Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smooth-rings-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"burner-connector": patch
---

5792: Make calls sequentially to enable gas estimation for dependent calls
11 changes: 7 additions & 4 deletions packages/burner-connector/src/burnerConnector/burner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export const burner = ({ useSessionStorage = false, rpcUrls = {} }: BurnerConfig
}

// Execute calls sequentially for now
const requests = [];
const hashes: `0x${string}`[] = [];
let nonceIncrement = 0;
for (const call of sendCallsParams.calls) {
const request = await client.prepareTransactionRequest({
Expand All @@ -186,16 +186,19 @@ export const burner = ({ useSessionStorage = false, rpcUrls = {} }: BurnerConfig
to: call.to as `0x${string}`,
value: call.value ? hexToBigInt(call.value as `0x${string}`) : undefined,
});
requests.push({
const hash = await client.sendTransaction({
...request,
gas: (request.gas * GAS_MULTIPLIER) / 100n,
nonce: request.nonce + nonceIncrement,
});
hashes.push(hash);
const receipt = await publicClient.getTransactionReceipt({ hash });
if (receipt.status !== "success") {
break;
}
nonceIncrement++;
}

const hashes = await Promise.all(requests.map((request) => client.sendTransaction(request)));

// Create a robust ID by concatenating transaction hashes, chain ID, and magic identifier
const id = concat([
...hashes,
Expand Down