import { MempoolFilterResponse } from '@taquito/rpc'; export interface FeeParams { minimalFeeMutez: number; feePerGasMutez: number; feePerByteMutez: number; } export declare const DEFAULT_FEE_PARAMS: FeeParams; export declare const feeParamsFromMempoolFilter: (response?: Pick) => FeeParams; export interface EstimateProperties { milligasLimit: number; storageLimit: number; opSize: number; minimalFeePerStorageByteMutez: number; baseFeeMutez?: number; feeParams?: FeeParams; } /** * Examples of use : * * Estimate a transfer operation : * ``` * // Assuming that provider and signer are already configured... * * const amount = 2; * const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY'; * * // Estimate gasLimit, storageLimit and fees for a transfer operation * const est = await Tezos.estimate.transfer({ to: address, amount: amount }) * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit, * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez) * * ``` * * Estimate a contract origination : * ``` * // generic.json is referring to a Michelson Smart Contract * * const genericMultisigJSON = require('./generic.json') * const est = await Tezos.estimate.originate({ * code: genericMultisigJSON, * storage: { * stored_counter: 0, * threshold: 1, * keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'] * } * }) * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit, * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez) * * ``` * * Fee estimation keeps the same overall formula shape on Tezos L1 and on Tezos X / Tezlink: * a fixed minimal fee plus byte and gas-price components. The important difference is that on * Tezos X the byte fee and gas-price terms exposed by `mempool/filter` are material and may * change over time, while on L1 they have historically been close to Taquito's long-standing * defaults. `Estimate` therefore accepts fee parameters computed by the estimator instead of * assuming L1 values internally. */ export declare class Estimate { private readonly _milligasLimit; private readonly _storageLimit; readonly opSize: number | string; private readonly minimalFeePerStorageByteMutez; /** * Base fee in mutez (1 mutez = 1e10−6 tez) */ private readonly baseFeeMutez; private readonly feeParams; constructor(_milligasLimit: number | string, _storageLimit: number | string, opSize: number | string, minimalFeePerStorageByteMutez: number | string, /** * Base fee in mutez (1 mutez = 1e10−6 tez) */ baseFeeMutez?: number | string, feeParams?: FeeParams); /** * The number of Mutez that will be burned for the storage of the [operation](https://tezos.gitlab.io/user/glossary.html#operations). (Storage + Allocation fees) */ get burnFeeMutez(): number; /** * The limit on the amount of storage an [operation](https://tezos.gitlab.io/user/glossary.html#operations) can use with 20 buffer. */ get storageLimit(): number; /** * The limit on the amount of [gas](https://tezos.gitlab.io/user/glossary.html#gas) a given operation can consume with 100 buffer depends on the operation. */ get gasLimit(): number; private get operationFeeMutez(); private roundUp; /** * Minimum fees for the [operation](https://tezos.gitlab.io/user/glossary.html#operations) according to [baker](https://tezos.gitlab.io/user/glossary.html#baker) defaults. */ get minimalFeeMutez(): number; /** * The suggested fee for the operation which includes minimal fees and a small buffer. */ get suggestedFeeMutez(): number; /** * Fees according to your specified base fee will ensure that at least minimum fees are used. */ get usingBaseFeeMutez(): number; /** * The sum of `minimalFeeMutez` + `burnFeeMutez`. */ get totalCost(): number; /** * Since Delphinet, consumed gas is provided in milligas for more precision. * This function returns an estimation of the gas that operation will consume in milligas. */ get consumedMilligas(): number; static createEstimateInstanceFromProperties(estimateProperties: EstimateProperties[]): Estimate; static createArrayEstimateInstancesFromProperties(estimateProperties: EstimateProperties[]): Estimate[]; }