Taquito's estimate method can be used to estimate fees, gas, and storage associated with an operation.
note
Our estimation of fee, gasLimit and storageLimit is based on the RPC call response to simulate_operation plus a small buffer. The context and volume at the time of simulate_operation might differ from preapply/operations and injection/operation, potentially causing errors like fees_too_low, storage_exhausted.operation and gas_exhausted.operation.
The following example shows an estimate of the fees associated with transferring 2ṁ to mv1UrqbBFBXnEdHnvSrMpt2BQnZzFMA9HQnc address. The configuration of the signer is to use a throw-away private key for demonstration purposes.
Signer
Wallet
Live Editor
// import { TezosToolkit } from '@mavrykdynamics/taquito';
// const Tezos = new TezosToolkit('https://rpc.mavryk,network/basenet');
This example will demonstrate how to estimate the fees related to calling a smart contract.
Signer
Wallet
We have updated the estimate provider to have a contractCall() method.
The contractCall() member method can now be used to estimate contract calls as such:
Live Editor
// import { TezosToolkit } from '@mavrykdynamics/taquito';
// const Tezos = new TezosToolkit('https://rpc.mavryk,network/basenet');
In this example, we will use the estimate method of Taquito on a contract origination. The genericMultisigJSONfile variable contains a Michelson Smart Contract.
Signer
Wallet
Live Editor
// import { TezosToolkit } from '@mavrykdynamics/taquito';
// const Tezos = new TezosToolkit('https://rpc.mavryk,network/basenet');
println(`Estimating the contract origination : `);