This is documentation for Taquito 20.0.0, which is no longer actively maintained.
For up-to-date documentation, see the latest version (20.1.0).
Version: 20.0.0
Estimate Provider
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 tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY address. The configuration of the signer is to use a throw-away private key for demonstration purposes.
Signer
Wallet
Live Editor
// import { TezosToolkit } from '@taquito/taquito';
// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com');
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 '@taquito/taquito';
// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com');
Tezos.contract
.at('KT1BJadpDyLCACMH7Tt9xtpx4dQZVKw9cDF7')
.then((contract)=>{
return contract.methodsObject.increment(7);
})
.then((op)=>{
console.log(`Estimating the smart contract call: `);
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 '@taquito/taquito';
// const Tezos = new TezosToolkit('https://ghostnet.ecadinfra.com');
console.log(`Estimating the contract origination : `);