Skip to content

Commit 5456c35

Browse files
committed
Added EIP-1559 overrides to contracts (#1610).
1 parent 7a12216 commit 5456c35

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/contracts/src.ts/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const logger = new Logger(version);
1717
export interface Overrides {
1818
gasLimit?: BigNumberish | Promise<BigNumberish>;
1919
gasPrice?: BigNumberish | Promise<BigNumberish>;
20+
maxFeePerGas?: BigNumberish | Promise<BigNumberish>;
21+
maxPriorityFeePerGas?: BigNumberish | Promise<BigNumberish>;
2022
nonce?: BigNumberish | Promise<BigNumberish>;
2123
type?: number;
2224
accessList?: AccessListish;
@@ -50,6 +52,9 @@ export interface PopulatedTransaction {
5052

5153
type?: number;
5254
accessList?: AccessList;
55+
56+
maxFeePerGas?: BigNumber;
57+
maxPriorityFeePerGas?: BigNumber;
5358
};
5459

5560
export type EventFilter = {
@@ -101,6 +106,7 @@ export interface ContractTransaction extends TransactionResponse {
101106
const allowedTransactionKeys: { [ key: string ]: boolean } = {
102107
chainId: true, data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true,
103108
type: true, accessList: true,
109+
maxFeePerGas: true, maxPriorityFeePerGas: true
104110
}
105111

106112
async function resolveName(resolver: Signer | Provider, nameOrPromise: string | Promise<string>): Promise<string> {
@@ -216,6 +222,8 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen
216222
if (ro.nonce != null) { tx.nonce = BigNumber.from(ro.nonce).toNumber(); }
217223
if (ro.gasLimit != null) { tx.gasLimit = BigNumber.from(ro.gasLimit); }
218224
if (ro.gasPrice != null) { tx.gasPrice = BigNumber.from(ro.gasPrice); }
225+
if (ro.maxFeePerGas != null) { tx.maxFeePerGas = BigNumber.from(ro.maxFeePerGas); }
226+
if (ro.maxPriorityFeePerGas != null) { tx.maxPriorityFeePerGas = BigNumber.from(ro.maxPriorityFeePerGas); }
219227
if (ro.from != null) { tx.from = ro.from; }
220228

221229
if (ro.type != null) { tx.type = ro.type; }
@@ -259,6 +267,9 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen
259267
delete overrides.type;
260268
delete overrides.accessList;
261269

270+
delete overrides.maxFeePerGas;
271+
delete overrides.maxPriorityFeePerGas;
272+
262273
// Make sure there are no stray overrides, which may indicate a
263274
// typo or using an unsupported key.
264275
const leftovers = Object.keys(overrides).filter((key) => ((<any>overrides)[key] != null));
@@ -693,7 +704,7 @@ export class BaseContract {
693704
// Check that the signature is unique; if not the ABI generation has
694705
// not been cleaned or may be incorrectly generated
695706
if (uniqueSignatures[signature]) {
696-
logger.warn(`Duplicate ABI entry for ${ JSON.stringify(name) }`);
707+
logger.warn(`Duplicate ABI entry for ${ JSON.stringify(signature) }`);
697708
return;
698709
}
699710
uniqueSignatures[signature] = true;

0 commit comments

Comments
 (0)