Skip to content

Commit c1e5c5e

Browse files
committed
Ensure correct network after connect again
Fixes mumbai/polygon ews not switching on connect WebGL
1 parent c85d3d7 commit c1e5c5e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Assets/Thirdweb/Core/Scripts/Wallet.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ public Wallet()
2929
/// <returns>A task representing the connection result.</returns>
3030
public async Task<string> Connect(WalletConnection walletConnection)
3131
{
32+
string address = null;
33+
3234
if (Utils.IsWebGLBuild())
3335
{
34-
return await Bridge.Connect(walletConnection);
36+
address = await Bridge.Connect(walletConnection);
3537
}
3638
else
3739
{
38-
string address = await ThirdwebManager.Instance.SDK.session.Connect(walletConnection);
40+
address = await ThirdwebManager.Instance.SDK.session.Connect(walletConnection);
3941
Utils.TrackWalletAnalytics(
4042
ThirdwebManager.Instance.SDK.session.Options.clientId,
4143
"connectWallet",
@@ -45,6 +47,17 @@ public async Task<string> Connect(WalletConnection walletConnection)
4547
);
4648
return address;
4749
}
50+
51+
try
52+
{
53+
await SwitchNetwork(walletConnection.chainId);
54+
}
55+
catch
56+
{
57+
// no-op
58+
}
59+
60+
return address;
4861
}
4962

5063
/// <summary>

0 commit comments

Comments
 (0)