From 2e86c2a7389555aa4dd65fb77e391604777123dd Mon Sep 17 00:00:00 2001 From: alvrs Date: Mon, 14 Oct 2024 22:14:58 +0200 Subject: [PATCH 1/2] fix(common): allow overriding fees in writeContract and sendTransaction --- packages/common/src/sendTransaction.ts | 2 +- packages/common/src/writeContract.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); From e8cf238e56a1324acd76fb82d110755996f43c25 Mon Sep 17 00:00:00 2001 From: alvarius Date: Mon, 14 Oct 2024 22:43:24 +0100 Subject: [PATCH 2/2] Create spotty-crabs-prove.md --- .changeset/spotty-crabs-prove.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/spotty-crabs-prove.md 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.