File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ export type ChainOptions = {
2626 increaseZeroByteCount ?: boolean ;
2727 } ;
2828 faucets ?: Array < string > ;
29+ fees ?: {
30+ /**
31+ * Whether to force legacy transactions (pre EIP-1559) for this chain
32+ */
33+ forceLegacyTransactions ?: boolean ;
34+ } ;
2935} ;
3036
3137/**
Original file line number Diff line number Diff line change @@ -114,18 +114,21 @@ export async function getDefaultGasOverrides(
114114 client : ThirdwebClient ,
115115 chain : Chain ,
116116) {
117- // if chain is in the force gas price list, always use gas price
118- if ( ! FORCE_GAS_PRICE_CHAIN_IDS . includes ( chain . id ) ) {
119- const feeData = await getDynamicFeeData ( client , chain ) ;
120- if (
121- feeData . maxFeePerGas !== null &&
122- feeData . maxPriorityFeePerGas !== null
123- ) {
124- return {
125- maxFeePerGas : feeData . maxFeePerGas ,
126- maxPriorityFeePerGas : feeData . maxPriorityFeePerGas ,
127- } ;
128- }
117+ // if chain is configured to force legacy transactions or is in the legacy chain list
118+ if (
119+ chain . fees ?. forceLegacyTransactions ||
120+ FORCE_GAS_PRICE_CHAIN_IDS . includes ( chain . id )
121+ ) {
122+ return {
123+ gasPrice : await getGasPrice ( { client, chain, percentMultiplier : 10 } ) ,
124+ } ;
125+ }
126+ const feeData = await getDynamicFeeData ( client , chain ) ;
127+ if ( feeData . maxFeePerGas !== null && feeData . maxPriorityFeePerGas !== null ) {
128+ return {
129+ maxFeePerGas : feeData . maxFeePerGas ,
130+ maxPriorityFeePerGas : feeData . maxPriorityFeePerGas ,
131+ } ;
129132 }
130133 return {
131134 gasPrice : await getGasPrice ( { client, chain, percentMultiplier : 10 } ) ,
You can’t perform that action at this time.
0 commit comments