Open muhammad-hassan-shakeel opened 9 months ago
Hello @muhammad-hassan-shakeel! I didn't understand your concern but for session proposals these are the models: https://github.com/WalletConnect/WalletConnectFlutterV2/blob/master/lib/apis/sign_api/models/proposal_models.dart
Docs: https://docs.walletconnect.com/web3wallet/wallet-usage#session-approval
approveSession method takes namespaces argument of Namespace type. Namespace type has three attributes accounts, events and methods.
On unity end, namespace object looks like this:
public class Namespace
{
[JsonProperty("accounts")]
public string[] Accounts;
[JsonProperty("methods")]
public string[] Methods;
[JsonProperty("events")]
public string[] Events;
[JsonProperty("chains")]
public string[] Chains;
the unity guys are looking for "chains" list from flutter side.
how can I send them the chains list?
An account is just the union of the chainId and the address, so for instance, eip155:1:0xsa087dfs96gd85f6sd7a0a9fs68dg5
. Furthermore, you have a handy method inside NamespaceUtils
called getChainsFromAccounts
.
So, if I get you correctly this is what you are looking for:
void _onSessionProposal(SessionProposalEvent? args) async {
final accounts = args?.params.generatedNamespaces?['eip155']?.accounts;
final allChains = NamespaceUtils.getChainsFromAccounts(accounts ?? []);
debugPrint('All eip155 chains requested: $allChains');
}
is there a way for me to add "chains" key in the map? with information related to chains only? excluding the address part
Hi @quetool
I am facing with the same issue with Wagmi V2, they use the chains
returned from session namespace to validate chain and then request method wallet_addEthereumChain
. Because there is no chains in session name space, that method is always called event it's unnecessary.
The code is here: https://github.com/wevm/wagmi/blob/c403563be5dd3ab36d8582e69071ce87294468c2/packages/connectors/src/walletConnect.ts#L261
Hello @hoangbtmrk , you should open your issue under web repository https://github.com/WalletConnect/web3modal, this is the Flutter one.
This is the Namespace class, we are developing some application where I need to connect with the Unity app of ours via WalletConnect. Unity team is looking for chains list in Namespace but unfortunately it doesn't have it. Can you please tell me what can I do on flutter end to send that to them at the time of Session approval?