Skip to content

Commit bfdfc23

Browse files
authored
Better error message on failed predictAddress (#2882)
1 parent 48e6427 commit bfdfc23

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.changeset/flat-turkeys-promise.md

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+
Better error message for failed smart wallet connections

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ export async function connectSmartWallet(
6363
const accountAddress = await predictAddress(factoryContract, {
6464
personalAccountAddress: personalAccount.address,
6565
...options,
66-
});
66+
})
67+
.then((address) => address)
68+
.catch(() => {
69+
throw new Error(
70+
`Failed to get account address with factory contract ${factoryContract.address} on chain ID ${chain.id}. Are you on the right chain?`,
71+
);
72+
});
6773

6874
const accountContract = getContract({
6975
client,

0 commit comments

Comments
 (0)