import createTransaction from "@ledgerhq/coin-cosmos/createTransaction";
const CAN_EDIT_FEES = true;
const areFeesProvided = tx => !!tx.fees;
const convertToLiveTransaction = ({ account, walletApiTransaction }) => {
    const liveTx = createTransaction(account);
    if (walletApiTransaction.amount) {
        liveTx.amount = walletApiTransaction.amount;
    }
    if (walletApiTransaction.recipient) {
        liveTx.recipient = walletApiTransaction.recipient;
    }
    if (walletApiTransaction.mode) {
        liveTx.mode = walletApiTransaction.mode;
    }
    if (walletApiTransaction.fees) {
        liveTx.fees = walletApiTransaction.fees;
    }
    if (walletApiTransaction.gas) {
        liveTx.gas = walletApiTransaction.gas;
    }
    if (walletApiTransaction.memo) {
        liveTx.memo = walletApiTransaction.memo;
    }
    if (walletApiTransaction.sourceValidator) {
        liveTx.sourceValidator = walletApiTransaction.sourceValidator;
    }
    if (walletApiTransaction.validators) {
        liveTx.validators = walletApiTransaction.validators;
    }
    return liveTx;
};
const getWalletAPITransactionSignFlowInfos = ({ walletApiTransaction, account }) => {
    return {
        canEditFees: CAN_EDIT_FEES,
        liveTx: convertToLiveTransaction({ walletApiTransaction, account }),
        hasFeesProvided: areFeesProvided(walletApiTransaction),
    };
};
export default { getWalletAPITransactionSignFlowInfos };
//# sourceMappingURL=walletApiAdapter.js.map