@ledgerhq/coin-tezos
Version:
39 lines • 1.6 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getEstimatedFees;
const bignumber_js_1 = __importDefault(require("bignumber.js"));
const logic_1 = require("../logic");
/**
* Fetch the transaction fees for a transaction
*
* @param {Account} a
* @param {Transaction} t
*/
async function getEstimatedFees({ account, transaction, }) {
const estimate = await (0, logic_1.estimateFees)({
account: {
xpub: account.xpub,
address: account.freshAddress,
balance: BigInt(account.balance.toString()),
revealed: account.tezosResources.revealed,
},
transaction: {
mode: transaction.mode,
recipient: transaction.recipient,
amount: BigInt(transaction.amount.toString()),
useAllAmount: transaction.useAllAmount,
},
});
return {
fees: (0, bignumber_js_1.default)(estimate.fees.toString()),
gasLimit: (0, bignumber_js_1.default)(estimate.gasLimit.toString()),
storageLimit: (0, bignumber_js_1.default)(estimate.storageLimit.toString()),
estimatedFees: (0, bignumber_js_1.default)(estimate.estimatedFees.toString()),
amount: estimate.amount !== undefined ? (0, bignumber_js_1.default)(estimate.amount.toString()) : (0, bignumber_js_1.default)(0),
taquitoError: estimate.taquitoError,
};
}
//# sourceMappingURL=getFeesForTransaction.js.map