@ledgerhq/coin-near
Version:
21 lines • 1 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepareTransaction = void 0;
const jsHelpers_1 = require("@ledgerhq/ledger-wallet-framework/bridge/jsHelpers");
const estimateMaxSpendable_1 = __importDefault(require("./estimateMaxSpendable"));
const getFeesForTransaction_1 = __importDefault(require("./getFeesForTransaction"));
const prepareTransaction = async (account, transaction) => {
const amount = transaction.useAllAmount
? await (0, estimateMaxSpendable_1.default)({
account,
transaction,
})
: transaction.amount;
const fees = await (0, getFeesForTransaction_1.default)(transaction);
return (0, jsHelpers_1.updateTransaction)(transaction, { fees, amount });
};
exports.prepareTransaction = prepareTransaction;
//# sourceMappingURL=prepareTransaction.js.map