UNPKG

@ledgerhq/coin-algorand

Version:
23 lines 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.estimateFees = estimateFees; const network_1 = require("../network"); // Single signature size in bytes const SINGLE_SIGNATURE_SIZE = 71; // Average transaction size for fee estimation const AVERAGE_TX_SIZE = 250; /** * Estimate fees for an Algorand transaction * @param txSize - Optional transaction size in bytes (defaults to average) * @returns Fee estimation */ async function estimateFees(txSize) { const params = await (0, network_1.getTransactionParams)(); const size = txSize ?? AVERAGE_TX_SIZE; const suggestedFees = params.fee > 0 ? params.fee * (size + SINGLE_SIGNATURE_SIZE) : 0; const fees = Math.max(suggestedFees, params.minFee); return { value: BigInt(fees), }; } //# sourceMappingURL=estimateFees.js.map