"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertToAtomicUnit = exports.convertToNonAtomicUnit = exports.getCustomFeesPerFamily = void 0;
const getCustomFeesPerFamily = transaction => {
    const { family, maxFeePerGas, maxPriorityFeePerGas, feePerByte, fees, utxoStrategy, gasPrice } = transaction;
    switch (family) {
        case "evm": {
            return {
                maxFeePerGas,
                maxPriorityFeePerGas,
                gasPrice,
            };
        }
        case "bitcoin": {
            return {
                feePerByte,
                utxoStrategy,
            };
        }
        default:
            return {
                fees,
            };
    }
};
exports.getCustomFeesPerFamily = getCustomFeesPerFamily;
const convertToNonAtomicUnit = ({ amount, account, }) => {
    const fromMagnitude = account.type === "TokenAccount"
        ? account.token.units[0].magnitude || 0
        : account.currency?.units[0].magnitude || 0;
    return amount?.shiftedBy(-fromMagnitude);
};
exports.convertToNonAtomicUnit = convertToNonAtomicUnit;
const convertToAtomicUnit = ({ amount, account, }) => {
    const fromMagnitude = account.type === "TokenAccount"
        ? account.token.units[0].magnitude || 0
        : account.currency?.units[0].magnitude || 0;
    return amount?.shiftedBy(fromMagnitude);
};
exports.convertToAtomicUnit = convertToAtomicUnit;
//# sourceMappingURL=utils.js.map