Skip to content

Commit

Permalink
WalletConnect moving from required namespaces to optional namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed Mar 26, 2024
1 parent e1966e3 commit 0576a78
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions src/Nethereum.WalletConnect/NethereumWalletConnectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using WalletConnectSharp.Sign.Models;
using WalletConnectSharp.Sign.Models.Engine;
using Nethereum.RPC.HostWallet;
using System.Collections.Generic;

namespace Nethereum.WalletConnect
{
Expand Down Expand Up @@ -48,29 +49,46 @@ public static ConnectOptions GetDefaultConnectOptions(params long[] eip155chainI

public static ConnectOptions GetDefaultConnectOptions(string[] chainIds)
{
return new ConnectOptions()
var requiredNamespace = new ProposedNamespace()
{
RequiredNamespaces = new RequiredNamespaces()
{
{
"eip155", new ProposedNamespace()
{
Methods = new[]
Methods = new[]
{
ApiMethods.eth_sendTransaction.ToString(),
},
Chains = new[] { MAINNET } ,
Events = new[]
{
"chainChanged", "accountsChanged", "connect", "disconnect"
}
};

var optionalNamespace = new ProposedNamespace()
{
Methods = new[]
{
ApiMethods.eth_sign.ToString(),
ApiMethods.personal_sign.ToString(),
ApiMethods.eth_signTypedData_v4.ToString(),
ApiMethods.wallet_switchEthereumChain.ToString(),
ApiMethods.wallet_addEthereumChain.ToString()
},
Chains = chainIds,
Events = new[]
{
"chainChanged", "accountsChanged"
Chains = chainIds,
Events = new[]
{
"chainChanged", "accountsChanged", "connect", "disconnect"
}
}
}
};


return new ConnectOptions()
{
RequiredNamespaces =
{
{ "eip155", requiredNamespace }
},
OptionalNamespaces =
{
{ "eip155", optionalNamespace }
}
};
}
Expand Down

0 comments on commit 0576a78

Please sign in to comment.