Class GasCostEstimator<TContract>

Estimates the gas cost of Contract calls

Type Parameters

  • TContract extends BaseContract

Hierarchy

  • GasCostEstimator

Constructors

Properties

contractWrapper: ContractWrapper<TContract>

Methods

  • Returns the current gas price in gwei

    Returns Promise<string>

    the current gas price in gwei

    Remarks

    Get the current gas price in gwei

    Example

    const gasCostInGwei = await contract.estimator.currentGasPriceInGwei();
    
  • Estimates the cost of gas in native token of the current chain Pass in the same parameters as the contract's function.

    Parameters

    • fn: string & {} | keyof TContract["functions"]
    • args: any[] | Parameters<TContract["functions"][string & {} | keyof TContract["functions"]]>

    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

    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
    ]);
  • Estimates the gas limit of a transaction Pass in the same parameters as the contract's function.

    Parameters

    • fn: string & {} | keyof TContract["functions"]
    • args: any[] | Parameters<TContract["functions"][string & {} | keyof TContract["functions"]]>

    Returns Promise<BigNumber>

    the estimated gas limit of the transaction

    Remarks

    Estimates the gas limit of a transaction

    Example

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

Generated using TypeDoc