Skip to main content

GasCostEstimator.gasCostOf() method

Estimates the cost of gas in native token of the current chain Pass in the same parameters as the contract's function.

Example

const costOfClaim = await nftDrop?.estimator.gasCostOf("claim", [
"0x...", // receiver
1, // quantity
"0x...", // currency
1, // price per token
[], // proofs
1, // proof max quantity per transaction
]);

Signature:

gasCostOf(fn: keyof TContract["functions"] | (string & {}), args: Parameters<TContract["functions"][typeof fn]> | any[]): Promise<string>;

Parameters

ParameterTypeDescription
fnkeyof TContract["functions"] | (string & {})
argsParameters<TContract["functions"][typeof fn]> | any[]

Returns:

Promise<string>

the estimated price in native currency (ETH, MATIC, etc) of calling this function

Remarks

Estimate the cost of gas in native token of the current chain