UNPKG

@ledgerhq/coin-tezos

Version:
34 lines 1.5 kB
"use strict"; // SPDX-FileCopyrightText: © 2026 LEDGER SAS // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.estimateRevealLimits = estimateRevealLimits; const logs_1 = require("@ledgerhq/logs"); const taquito_1 = require("@taquito/taquito"); /** * Estimate the reveal-operation limits for an unrevealed manager account, clamped to * the configured minimums. Falls back to the SDK helpers when node estimation fails * (some addresses error with "inconsistent_hash"). */ async function estimateRevealLimits(tezosToolkit, address, feesConfig) { let revealEstimate; try { // eslint-disable-next-line @typescript-eslint/consistent-type-assertions revealEstimate = (await tezosToolkit.estimate.reveal()); } catch (error) { (0, logs_1.log)('estimate-error', 'error estimating reveal fees, trying to use getRevealGasLimit', { error, }); revealEstimate = { gasLimit: (0, taquito_1.getRevealGasLimit)(address), suggestedFeeMutez: (0, taquito_1.getRevealFee)(address), }; } return { fee: Math.max(feesConfig.minFees, revealEstimate?.suggestedFeeMutez ?? (0, taquito_1.getRevealFee)(address)), gasLimit: Math.max(feesConfig.minRevealGasLimit, revealEstimate?.gasLimit ?? 0), storageLimit: Math.max(feesConfig.minStorageLimit, revealEstimate?.storageLimit ?? 0), }; } //# sourceMappingURL=estimateRevealLimits.js.map