@ledgerhq/coin-celo
Version:
23 lines • 1.16 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.estimateMaxSpendable = void 0;
const getTransactionStatus_1 = __importDefault(require("./getTransactionStatus"));
const prepareTransaction_1 = __importDefault(require("./prepareTransaction"));
const createTransaction_1 = __importDefault(require("./createTransaction"));
const helpers_1 = require("@ledgerhq/coin-framework/account/helpers");
const estimateMaxSpendable = async ({ account, parentAccount, transaction }) => {
const mainAccount = (0, helpers_1.getMainAccount)(account, parentAccount);
const t = await (0, prepareTransaction_1.default)(mainAccount, {
...(0, createTransaction_1.default)(account),
...transaction,
useAllAmount: true,
});
const { amount } = await (0, getTransactionStatus_1.default)(mainAccount, t);
return amount;
};
exports.estimateMaxSpendable = estimateMaxSpendable;
exports.default = exports.estimateMaxSpendable;
//# sourceMappingURL=estimateMaxSpendable.js.map