WalletConnect / WalletConnectSharp

A C# implementation of the WalletConnect client
Apache License 2.0
139 stars 60 forks source link

Mobile Support #82

Open davidchavezgrant opened 1 year ago

davidchavezgrant commented 1 year ago

I've recently been experimenting with this on mobile platforms. Namely, MAUI and Avalonia on iOS. I've successfully been able to send a wallet connection request to a wallet, but very often, the connection will fail or the target wallet won't redirect back to my application. Trust Wallet also gives me an error like WalletConnect Session was disconnected. Go back to your browser and try WalletConnect again

For reference, I've written something like this in an AvaloniaUI app, and did something similar for MAUI:

    private async Task<SessionStruct?> OpenWallet(ConnectedData connection, bool useRainbow)
    {
        string schema = "https://";

        if (useRainbow)
        {
            schema += "rnbwapp.com";
        }
        else
        {
            schema += "link.trustwallet.com";
        }

        var urlString = schema + "/wc?uri=" + connection.Uri;
        var nsUrl     = new NSUrl(urlString);
        await UIApplication.SharedApplication.OpenUrlAsync(nsUrl, new UIApplicationOpenUrlOptions());
        return await connection.Approval;
    }

Interestingly, using the web3modal javascript package within a Blazor Web View does work as expected (most of the time). I'm trying to work toward a solution that doesn't rely on a webview, though.

Has anyone else done work on this or have any ideas?

gigajuwels commented 9 months ago

this is related to deep linking to a wallet which this library doesn't currently support, but we plan on adding support (unity already has this)