Gas estimate information for transaction cost prediction.
Remarks
Provides detailed gas pricing estimates to help users understand transaction
costs before execution. Supports both legacy (gasPrice) and EIP-1559
(maxFeePerGas) pricing models. The estimatedCost is calculated based on
current network conditions and may vary by the time of actual execution.
Example
// Get gas estimate before transaction constestimate: GasEstimate = awaitvana.permissions.estimateGas({ grantee:'0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36', dataId:123 });
// Convert to human-readable format constcostInEth = Number(estimate.estimatedCost) / 1e18; console.log(`Estimated cost: ${costInEth.toFixed(6)} ETH`);
// Check if user has sufficient balance constbalance = awaitvana.protocol.getBalance(userAddress); if (balance < estimate.estimatedCost) { thrownewError(`Insufficient balance. Need ${costInEth} ETH`); }
// Use estimate for transaction with buffer awaitvana.permissions.grant(params, { gasLimit:estimate.gasLimit * 110n / 100n, // 10% buffer maxFeePerGas:estimate.maxFeePerGas, maxPriorityFeePerGas:estimate.maxPriorityFeePerGas });
Gas estimate information for transaction cost prediction.
Remarks
Provides detailed gas pricing estimates to help users understand transaction costs before execution. Supports both legacy (gasPrice) and EIP-1559 (maxFeePerGas) pricing models. The estimatedCost is calculated based on current network conditions and may vary by the time of actual execution.
Example