Skip to content

Commit 63c6b5b

Browse files
fix: respect bundlerUrl in waitForUserReceipt
1 parent 322e449 commit 63c6b5b

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Respect bundlerUrl in waitForUserReceipt

packages/thirdweb/src/utils/any-evm/zksync/isZkSyncChain.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,20 @@ export async function isZkSyncChain(chain: Chain) {
1616
chain.id === 4654 ||
1717
chain.id === 333271 ||
1818
chain.id === 37111 ||
19-
chain.id === 978658
19+
chain.id === 978658 ||
20+
chain.id === 531050104 ||
21+
chain.id === 4457845
2022
) {
2123
return true;
2224
}
2325

24-
return false;
26+
// fallback to checking the stack on rpc
27+
try {
28+
const { getChainMetadata } = await import("../../../chains/utils.js");
29+
const chainMetadata = await getChainMetadata(chain);
30+
return chainMetadata.stackType === "zksync_stack";
31+
} catch {
32+
// If the network check fails, assume it's not a ZkSync chain
33+
return false;
34+
}
2535
}

packages/thirdweb/src/wallets/smart/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ async function _sendUserOp(args: {
624624
});
625625
// wait for tx receipt rather than return the userOp hash
626626
const receipt = await waitForUserOpReceipt({
627-
...options,
627+
...bundlerOptions,
628628
userOpHash,
629629
});
630630

packages/thirdweb/src/wallets/utils/getWalletBalance.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ANVIL_CHAIN } from "~test/chains.js";
33
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
44
import { TEST_CLIENT } from "~test/test-clients.js";
55
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
6-
import { defineChain } from "../../chains/utils.js";
76
import { getContract } from "../../contract/contract.js";
87
import { mintTo } from "../../extensions/erc20/write/mintTo.js";
98
import { deployERC20Contract } from "../../extensions/prebuilts/deploy-erc20.js";
@@ -57,12 +56,11 @@ describe.runIf(process.env.TW_SECRET_KEY)("getWalletBalance", () => {
5756
expect(result.displayValue).toBe(amount.toString());
5857
});
5958

60-
it("should work for un-named token", async () => {
59+
it("should work for native currency", async () => {
6160
const result = await getWalletBalance({
6261
address: TEST_ACCOUNT_A.address,
6362
client: TEST_CLIENT,
64-
chain: defineChain(97),
65-
tokenAddress: "0xd66c6B4F0be8CE5b39D52E0Fd1344c389929B378",
63+
chain: ANVIL_CHAIN,
6664
});
6765
expect(result).toBeDefined();
6866
expect(result.decimals).toBe(18);

0 commit comments

Comments
 (0)