Skip to main content

sdk.basecontract.getgasprice

Home > @openformat/sdk > BaseContract > getGasPrice

BaseContract.getGasPrice() method

getGasPrice function to fetch the appropriate gas parameters.

This function checks if the network supports EIP-1559 and returns the appropriate gas parameters for a transaction. If EIP-1559 is not supported, it uses the standard gas price.

Signature:

protected getGasPrice(): Promise<{
maxFeePerGas?: ethers.BigNumber;
maxPriorityFeePerGas?: ethers.BigNumber;
gasPrice?: ethers.BigNumber;
}>;

Returns:

Promise<{ maxFeePerGas?: ethers.BigNumber; maxPriorityFeePerGas?: ethers.BigNumber; gasPrice?: ethers.BigNumber; }>

{Promise<{ maxFeePerGas?: ethers.BigNumber, maxPriorityFeePerGas?: ethers.BigNumber, gasPrice?: ethers.BigNumber }>} An object containing the necessary gas parameters for a transaction.

Exceptions

Will throw an error if the network provider is not available or there's an issue with fetching gas data.