Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get connected account? #96

Closed
fudgebucket27 opened this issue Jun 12, 2023 · 2 comments
Closed

How to get connected account? #96

fudgebucket27 opened this issue Jun 12, 2023 · 2 comments

Comments

@fudgebucket27
Copy link

So I've got

 var sessionData = await connectData.Approval;

How do I get the account that approved?

@axenteoctavian
Copy link

This is my code but it might be different for you.
Change WALLETCONNECT_MULTIVERSX_NAMESPACE with your chainID then debug the code

            _walletConnectSession = await _walletConnect.Approval; 
  
             var selectedNamespace = _walletConnectSession.Namespaces[WALLETCONNECT_MULTIVERSX_NAMESPACE]; 
             if (selectedNamespace != null && selectedNamespace.Accounts.Length > 0) 
             { 
                 var currentSession = selectedNamespace.Accounts[0]; 
                 var parameters = currentSession.Split(':'); 
                 Address = parameters[2]; 
             }

@fudgebucket27
Copy link
Author

Thank you so much! I got it working with this for my namespace:

    var selectedNamespace = sessionData.Namespaces["eip155"];
            if (selectedNamespace != null && selectedNamespace.Accounts.Length > 0)
            {
                var currentSession = selectedNamespace.Accounts[0];
                var parameters = currentSession.Split(':');
                accountAddress = parameters[2];
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants