UNPKG

@ledgerhq/coin-mina

Version:
16 lines 704 B
import { updateTransaction } from "@ledgerhq/coin-framework/bridge/jsHelpers"; import estimateMaxSpendable from "./estimateMaxSpendable"; import getEstimatedFees from "./getEstimatedFees"; import { getNonce } from "../api"; export const prepareTransaction = async (a, t) => { const { fee, accountCreationFee } = await getEstimatedFees(t, a.freshAddress); const amount = t.useAllAmount ? await estimateMaxSpendable({ account: a, transaction: t, }) : t.amount; const nonce = await getNonce(t, a.freshAddress); return updateTransaction(t, { fees: { fee, accountCreationFee }, amount, nonce }); }; //# sourceMappingURL=prepareTransaction.js.map