Function sui::client_commands::estimate_gas_budget
source · pub async fn estimate_gas_budget(
context: &mut WalletContext,
signer: SuiAddress,
kind: TransactionKind,
gas_price: u64,
gas_payment: Option<Vec<ObjectID>>,
sponsor: Option<SuiAddress>
) -> Result<u64, Error>
Expand description
Call a dry run with the transaction data to estimate the gas budget. The estimated gas budget is computed as following:
- the maximum between A and B, where: A = computation cost + GAS_SAFE_OVERHEAD * reference gas price B = computation cost + storage cost - storage rebate + GAS_SAFE_OVERHEAD * reference gas price overhead
This gas estimate is computed exactly as in the TypeScript SDK https://github.com/MystenLabs/sui/blob/3c4369270605f78a243842098b7029daf8d883d9/sdk/typescript/src/transactions/TransactionBlock.ts#L845-L858