Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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/thick-vans-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/wagmi-adapter": patch
---

Fix wagmi adapter usage with account factories
12 changes: 9 additions & 3 deletions packages/wagmi-adapter/src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ export function inAppWalletConnector(
const lastChainId = await config.storage?.getItem("tw.lastChainId");
if (params?.isReconnecting) {
const { autoConnect } = await import("thirdweb/wallets");
const chainId = lastChainId || args.smartAccount?.chain?.id || 1;
await autoConnect({
client,
chain: defineChain(lastChainId || 1),
chain: defineChain(chainId),
wallets: [wallet],
});

Expand All @@ -108,7 +109,7 @@ export function inAppWalletConnector(

return {
accounts: [getAddress(account.address)],
chainId: lastChainId || 1,
chainId: chainId,
};
}
const inAppOptions = params && "strategy" in params ? params : undefined;
Expand All @@ -117,7 +118,12 @@ export function inAppWalletConnector(
"Missing strategy prop, pass it to connect() when connecting to this connector",
);
}
const chain = defineChain(inAppOptions?.chainId || lastChainId || 1);
const chain = defineChain(
inAppOptions?.chainId ||
lastChainId ||
args.smartAccount?.chain?.id ||
1,
);
const decoratedOptions = {
...inAppOptions,
client,
Expand Down
Loading