Closed Rimantovas closed 7 months ago
Hello @Rimantovas, not sure I follow your concern 🤔 Could you elaborate a bit more?
The following method passes the session topic and request parameters to the handler. It would be nice to also get the chainId
@override
void registerRequestHandler({
required String chainId,
required String method,
dynamic Function(String, dynamic)? handler,
}) {
try {
return signEngine.registerRequestHandler(
chainId: chainId,
method: method,
handler: handler,
);
} catch (e) {
rethrow;
}
}
Ok but what do you mean by "having multiple EVM chains connected"? You can not have "multiple EVM chains connected". Your paired session between dapp/wallet always works on the current active chain.
Yes, you can only have one active chain at a time, but you can pass multiple chains as optional namespaces.
Created a pull request that solves this issue @quetool
Hello @Rimantovas! Here you can see the PR that would fix your issue! TL;DR: After this PR is merged you will have to handle your methods with onSessionRequest subscription (as it was supposed to be originally but was broken). method handlers registration will still work perfectly but if you want to access the current chainId then onSessionRequest subscription is your way to go https://github.com/WalletConnect/WalletConnectFlutterV2/pull/269
Is your feature request related to a problem? Please describe. When having multiple EVM chains connected, it is hard to determine which chain to interact with
Describe the solution you'd like Pass chainId parameter to registerRequestHandler handler function. Since we already have it in _onSessionRequest, it won't be hard to implement.