diff --git a/src/server/schemas/transaction/index.ts b/src/server/schemas/transaction/index.ts index 0db9dae3..c9dd5500 100644 --- a/src/server/schemas/transaction/index.ts +++ b/src/server/schemas/transaction/index.ts @@ -266,7 +266,7 @@ export const toTransactionSchema = ( if (transaction.status === "sent") { return transaction.gasPrice?.toString() ?? null; } - return null; + return transaction.overrides?.gasPrice?.toString() ?? null; }; const resolveMaxFeePerGas = (): string | null => { diff --git a/src/server/schemas/txOverrides.ts b/src/server/schemas/txOverrides.ts index 04a59a91..cef4a157 100644 --- a/src/server/schemas/txOverrides.ts +++ b/src/server/schemas/txOverrides.ts @@ -10,8 +10,11 @@ export const txOverridesSchema = Type.Object({ description: "Gas limit for the transaction", }), - // Overriding `gasPrice` is currently not supported. - + gasPrice: Type.Optional({ + ...WeiAmountStringSchema, + description: + "Gas price for the transaction. Do not use this if maxFeePerGas is set or if you want to use EIP-1559 type transactions. Only use this if you want to use legacy transactions.", + }), maxFeePerGas: Type.Optional({ ...WeiAmountStringSchema, description: "Maximum fee per gas", diff --git a/src/server/utils/transactionOverrides.ts b/src/server/utils/transactionOverrides.ts index f97d784f..a048504e 100644 --- a/src/server/utils/transactionOverrides.ts +++ b/src/server/utils/transactionOverrides.ts @@ -18,6 +18,7 @@ export const parseTransactionOverrides = ( return { overrides: { gas: maybeBigInt(overrides.gas), + gasPrice: maybeBigInt(overrides.gasPrice), maxFeePerGas: maybeBigInt(overrides.maxFeePerGas), maxPriorityFeePerGas: maybeBigInt(overrides.maxPriorityFeePerGas), }, diff --git a/src/utils/transaction/types.ts b/src/utils/transaction/types.ts index c4591ce8..238c71bd 100644 --- a/src/utils/transaction/types.ts +++ b/src/utils/transaction/types.ts @@ -28,6 +28,7 @@ export type InsertedTransaction = { // User-provided overrides. overrides?: { gas?: bigint; + gasPrice?: bigint; maxFeePerGas?: bigint; maxPriorityFeePerGas?: bigint; }; diff --git a/src/worker/tasks/sendTransactionWorker.ts b/src/worker/tasks/sendTransactionWorker.ts index 803de187..c83b3736 100644 --- a/src/worker/tasks/sendTransactionWorker.ts +++ b/src/worker/tasks/sendTransactionWorker.ts @@ -320,6 +320,7 @@ const _sendTransaction = async ( // Apply gas setting overrides. // Do not set `maxFeePerGas` to estimate the onchain value. gas: overrides?.gas, + gasPrice: overrides?.gasPrice, maxPriorityFeePerGas: overrides?.maxPriorityFeePerGas, }, }); @@ -403,6 +404,7 @@ const _sendTransaction = async ( } await addSentNonce(chainId, from, nonce); + return { ...queuedTransaction, status: "sent",