From fe959a1ed99214383f0f1cef4e5445d994d78444 Mon Sep 17 00:00:00 2001 From: Junaid <86780488+jdevcs@users.noreply.github.com> Date: Thu, 25 May 2023 10:18:35 +0200 Subject: [PATCH] Contract options fix (#6118) * added maxPriorityFeePerGas and maxFeePerGas in contract options * changelog update --- packages/web3-eth-contract/CHANGELOG.md | 1 + packages/web3-eth-contract/src/types.ts | 8 ++++++++ packages/web3-eth-contract/src/utils.ts | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/packages/web3-eth-contract/CHANGELOG.md b/packages/web3-eth-contract/CHANGELOG.md index 6b23870bec4..16ff2053da8 100644 --- a/packages/web3-eth-contract/CHANGELOG.md +++ b/packages/web3-eth-contract/CHANGELOG.md @@ -258,3 +258,4 @@ const transactionHash = receipt.transactionHash; ### Added - Added support for `getPastEvents` method to filter `allEvents` and specific event (#6010) +- Added `maxPriorityFeePerGas` and `maxFeePerGas` in `ContractOptions` type and updated function using it in utils (#6118) diff --git a/packages/web3-eth-contract/src/types.ts b/packages/web3-eth-contract/src/types.ts index dfa8c7da02b..43cc490efb7 100644 --- a/packages/web3-eth-contract/src/types.ts +++ b/packages/web3-eth-contract/src/types.ts @@ -135,6 +135,14 @@ export interface ContractOptions { * ``` */ address?: Address; // All transactions generated by web3.js from this contract will contain this address as the "to". + /** + * The max priority fee per gas to use for transactions. + */ + maxPriorityFeePerGas?: Uint; + /** + * The max fee per gas to use for transactions. + */ + maxFeePerGas?: Uint; } export interface NonPayableMethodObject { diff --git a/packages/web3-eth-contract/src/utils.ts b/packages/web3-eth-contract/src/utils.ts index 7a9b52fdf2a..bff0c1772ee 100644 --- a/packages/web3-eth-contract/src/utils.ts +++ b/packages/web3-eth-contract/src/utils.ts @@ -63,6 +63,8 @@ export const getSendTxParams = ({ gasPrice: contractOptions.gasPrice, from: contractOptions.from, input: contractOptions.input, + maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, + maxFeePerGas: contractOptions.maxFeePerGas, }, options as unknown as Record, ) as unknown as TransactionCall; @@ -99,6 +101,8 @@ export const getEthTxCallParams = ({ gasPrice: contractOptions.gasPrice, from: contractOptions.from, input: contractOptions.input, + maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, + maxFeePerGas: contractOptions.maxFeePerGas, }, options as unknown as Record, ) as unknown as TransactionCall; @@ -185,6 +189,8 @@ export const getCreateAccessListParams = ({ gasPrice: contractOptions.gasPrice, from: contractOptions.from, input: contractOptions.input, + maxPriorityFeePerGas: contractOptions.maxPriorityFeePerGas, + maxFeePerGas: contractOptions.maxFeePerGas, }, options as unknown as Record, ) as unknown as TransactionForAccessList;