Skip to content

Commit 4e27f94

Browse files
authored
fix: dependent calls break gas estimation (#44)
1 parent 1a151ef commit 4e27f94

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.changeset/smooth-rings-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"burner-connector": patch
3+
---
4+
5+
5792: Make calls sequentially to enable gas estimation for dependent calls

packages/burner-connector/src/burnerConnector/burner.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,25 +177,25 @@ export const burner = ({ useSessionStorage = false, rpcUrls = {} }: BurnerConfig
177177
}
178178

179179
// Execute calls sequentially for now
180-
const requests = [];
181-
let nonceIncrement = 0;
180+
const hashes: `0x${string}`[] = [];
182181
for (const call of sendCallsParams.calls) {
183182
const request = await client.prepareTransactionRequest({
184183
account: burnerAccount,
185184
data: call.data as `0x${string}`,
186185
to: call.to as `0x${string}`,
187186
value: call.value ? hexToBigInt(call.value as `0x${string}`) : undefined,
188187
});
189-
requests.push({
188+
const hash = await client.sendTransaction({
190189
...request,
191190
gas: (request.gas * GAS_MULTIPLIER) / 100n,
192-
nonce: request.nonce + nonceIncrement,
193191
});
194-
nonceIncrement++;
192+
hashes.push(hash);
193+
const receipt = await publicClient.waitForTransactionReceipt({ hash });
194+
if (receipt.status !== "success") {
195+
break;
196+
}
195197
}
196198

197-
const hashes = await Promise.all(requests.map((request) => client.sendTransaction(request)));
198-
199199
// Create a robust ID by concatenating transaction hashes, chain ID, and magic identifier
200200
const id = concat([
201201
...hashes,

0 commit comments

Comments
 (0)