Skip to content

Commit

Permalink
Merge pull request #34 from reown-com/fix/add-eth-chain-webgl
Browse files Browse the repository at this point in the history
fix: `wallet_addEthereumChain` rpc url issue on webgl
  • Loading branch information
skibitsky authored Dec 16, 2024
2 parents 48a8eeb + 99a4887 commit 08279c3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Reown.AppKit.Unity/Plugins/AppKit.jslib
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mergeInto(LibraryManager.library, {
const enableAnalytics = parameters.enableAnalytics;

// Load the scripts and initialize the configuration
import("https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.5.3/dist/appkit.js").then(AppKit => {
import("https://cdn.jsdelivr.net/npm/@reown/appkit-cdn@1.6.0/dist/appkit.js").then(AppKit => {
const WagmiCore = AppKit['WagmiCore'];
const WagmiAdapter = AppKit['WagmiAdapter'];
const Chains = AppKit['networks'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ protected virtual void OnChainChanged(ChainChangedEventArgs e)
{
if (e.PreviousChain?.ChainId == e.NewChain?.ChainId)
return;

if (e.NewChain == null)
return;

ChainChanged?.Invoke(this, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Reown.AppKit.Unity/Runtime/WebGL/Wagmi/WagmiInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static Task SwitchChainAsync(int chainId, AddEthereumChainParameter addEt
var switchChainParameter = new SwitchChainParameter
{
chainId = chainId,
parameter = addEthereumChainParameter
addEthereumChainParameter = addEthereumChainParameter
};

return SwitchChainAsync(switchChainParameter);
Expand Down
2 changes: 1 addition & 1 deletion src/Reown.AppKit.Unity/Runtime/WebGL/Wagmi/WagmiModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class GetAccountReturnType
public class SwitchChainParameter
{
public int chainId;
public AddEthereumChainParameter parameter;
public AddEthereumChainParameter addEthereumChainParameter;
}

[Serializable]
Expand Down

0 comments on commit 08279c3

Please sign in to comment.