diff --git a/.changeset/spotty-crabs-prove.md b/.changeset/spotty-crabs-prove.md new file mode 100644 index 0000000000..6366c2191d --- /dev/null +++ b/.changeset/spotty-crabs-prove.md @@ -0,0 +1,7 @@ +--- +"@latticexyz/common": patch +--- + +The `transactionQueue` decorator internally keeps an updated reference for the recommended `baseFeePerGas` and `maxPriorityFeePerGas` from the connected chain to avoid having to fetch it right before sending a transaction. +However, due to the way the fee values were overridden, it wasn't possible for users to explicitly pass in custom fee values. +Now explicitly provided fee values have precedence over the internally estimated fee values. diff --git a/packages/common/src/sendTransaction.ts b/packages/common/src/sendTransaction.ts index abbeea30c8..86268bcb05 100644 --- a/packages/common/src/sendTransaction.ts +++ b/packages/common/src/sendTransaction.ts @@ -74,9 +74,9 @@ export async function sendTransaction< const params = { // viem_sendTransaction internally estimates gas, which we want to happen on the pending block blockTag: "pending", + ...feeRef.fees, ...request, nonce, - ...feeRef.fees, } as const satisfies SendTransactionParameters; debug("sending tx to", request.to, "with nonce", nonce); return await getAction(client, viem_sendTransaction, "sendTransaction")(params as never); diff --git a/packages/common/src/writeContract.ts b/packages/common/src/writeContract.ts index f772c4a1f2..6f6888d38a 100644 --- a/packages/common/src/writeContract.ts +++ b/packages/common/src/writeContract.ts @@ -78,9 +78,9 @@ export async function writeContract< const params = { // viem_writeContract internally estimates gas, which we want to happen on the pending block blockTag: "pending", + ...feeRef.fees, ...request, nonce, - ...feeRef.fees, } as const satisfies WriteContractParameters; debug("calling", params.functionName, "at", params.address, "with nonce", nonce); return await getAction(client, viem_writeContract, "writeContract")(params as never);