diff --git a/packages/abstract-provider/src.ts/index.ts b/packages/abstract-provider/src.ts/index.ts index d2fdc7764e..cb8c6fb845 100644 --- a/packages/abstract-provider/src.ts/index.ts +++ b/packages/abstract-provider/src.ts/index.ts @@ -32,6 +32,8 @@ export type TransactionRequest = { maxPriorityFeePerGas?: BigNumberish; maxFeePerGas?: BigNumberish; + + customData?: Record; } export interface TransactionResponse extends Transaction { diff --git a/packages/abstract-signer/src.ts/index.ts b/packages/abstract-signer/src.ts/index.ts index 47c5988672..8ec850d899 100644 --- a/packages/abstract-signer/src.ts/index.ts +++ b/packages/abstract-signer/src.ts/index.ts @@ -10,7 +10,7 @@ import { version } from "./_version"; const logger = new Logger(version); const allowedTransactionKeys: Array = [ - "accessList", "chainId", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" + "accessList", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value" ]; const forwardErrors = [ diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index 072bbbb4e2..5a041f13c4 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -22,6 +22,7 @@ export interface Overrides { nonce?: BigNumberish | Promise; type?: number; accessList?: AccessListish; + customData?: Record; }; export interface PayableOverrides extends Overrides { @@ -55,6 +56,8 @@ export interface PopulatedTransaction { maxFeePerGas?: BigNumber; maxPriorityFeePerGas?: BigNumber; + + customData?: Record; }; export type EventFilter = { @@ -106,7 +109,8 @@ export interface ContractTransaction extends TransactionResponse { const allowedTransactionKeys: { [ key: string ]: boolean } = { chainId: true, data: true, from: true, gasLimit: true, gasPrice:true, nonce: true, to: true, value: true, type: true, accessList: true, - maxFeePerGas: true, maxPriorityFeePerGas: true + maxFeePerGas: true, maxPriorityFeePerGas: true, + customData: true } async function resolveName(resolver: Signer | Provider, nameOrPromise: string | Promise): Promise { @@ -257,6 +261,10 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen tx.value = roValue; } + if (ro.customData) { + tx.customData = shallowCopy(ro.customData); + } + // Remove the overrides delete overrides.nonce; delete overrides.gasLimit; @@ -270,6 +278,8 @@ async function populateTransaction(contract: Contract, fragment: FunctionFragmen delete overrides.maxFeePerGas; delete overrides.maxPriorityFeePerGas; + delete overrides.customData; + // Make sure there are no stray overrides, which may indicate a // typo or using an unsupported key. const leftovers = Object.keys(overrides).filter((key) => ((overrides)[key] != null));