Skip to content

Commit

Permalink
External wallet improvements
Browse files Browse the repository at this point in the history
Do not double sign user ops during simulation / switch before falling back to add
  • Loading branch information
0xFirekeeper committed Sep 10, 2024
1 parent af37b3b commit c24a669
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Binary file modified Assets/Thirdweb/Runtime/NET/Thirdweb.dll
Binary file not shown.
15 changes: 11 additions & 4 deletions Assets/Thirdweb/Runtime/Unity/Wallets/Core/MetaMaskWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,19 @@ public static async Task EnsureCorrectNetwork(BigInteger chainId)
{
if (WebGLMetaMask.Instance.GetActiveChainId() != chainId)
{
await AddNetwork(chainId);
if (WebGLMetaMask.Instance.GetActiveChainId() == chainId)
try
{
return;
await SwitchNetwork(chainId);
}
catch
{
await AddNetwork(chainId);
if (WebGLMetaMask.Instance.GetActiveChainId() == chainId)
{
return;
}
await SwitchNetwork(chainId);
}
await SwitchNetwork(chainId);
}
}

Expand Down

0 comments on commit c24a669

Please sign in to comment.