UNPKG

@ledgerhq/coin-canton

Version:
21 lines 782 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.estimateFees = estimateFees; const node_1 = require("../../network/node"); const errors_1 = require("../../types/errors"); async function estimateFees(serializedTransaction) { try { // We call the node to do a dry run and estimate fees return BigInt(await (0, node_1.simulate)(serializedTransaction)); } catch (e) { // default value is required in case of simulation error, else user will encounter an error in the flow if (e instanceof errors_1.SimulationError) { return BigInt(1000); } else { throw new Error("Unexpected error while estimating fees."); } } } //# sourceMappingURL=estimateFees.js.map