reown-com / reown-dotnet

Toolkits to build onchain UX
https://docs.reown.com/
Apache License 2.0
8 stars 1 forks source link

[bug] Editing supported chains and wallets not working on AppKit in WebGL build in Unity #4

Closed SantaDud closed 1 month ago

SantaDud commented 1 month ago

Link to minimal reproducible example

N/A

Summary

I'm currently trying to edit my supported chains and wallets on AppKit. The problem is that the changes work in the editor but not in the WebGL build.

Screenshot 2024-10-01 165730 Screenshot 2024-10-01 165754

Code

`public class AppkitManager : MonoBehaviour { private const string CHAIN_IMAGE_URL = "https://api.web3modal.com/public/getAssetImage";

    private async void Start()
    {
        await AppKit.InitializeAsync(new AppKitConfig(projectId: "07c7fe157897a85c6c8b4b70d5e7e9f5",
            new Metadata(name: "Landverse", description: "Landverse Telegram App", url: "https://dev.landverseminiapp.com/",
                iconUrl: "https://blog.sei.io/content/images/2022/08/Sei-logo-only-6.png"))
        {
            includedWalletIds = new []
            {
                "c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
            },

            supportedChains = new []
            {
                ChainConstants.Chains.Ethereum, 
                ChainConstants.Chains.Polygon, 
                ChainConstants.Chains.Ronin, 

                new Chain(ChainConstants.Namespaces.Evm,
                    "713715",
                    "Sei Devnet",
                    new Currency("Sei", "SEI", 18),
                    new BlockExplorer("Seitrace", "https://seitrace.com"),
                    "https://evm-rpc-arctic-1.sei-apis.com",
                    true,
                    $"{CHAIN_IMAGE_URL}/692ed6ba-e569-459a-556a-776476829e00"),

                new Chain(ChainConstants.Namespaces.Evm,
                    "1329",
                    "Sei Network",
                    new Currency("Sei", "SEI", 18),
                    new BlockExplorer("Seitrace", "https://seitrace.com"),
                    "https://evm-rpc.sei-apis.com/",
                    false,
                    $"{CHAIN_IMAGE_URL}/692ed6ba-e569-459a-556a-776476829e00"),
            }
        });
    }

    public void OpenAppKitModal()
    {
        if (!AppKit.IsInitialized)
        {
            return;
        }

        AppKit.OpenModal();
    }
}`

Additional Details

The version of Unity is 2023.2.7f1. Platform is WebGL. Managed stripping level set to Minimal.

skibitsky commented 1 month ago

Hello,

Thank you for opening the issue 🙏

I can confirm that some of the appkit configurations aren't properly propagated to the WebGL.

skibitsky commented 1 month ago

Custom chains in WebGL

To enable custom chains on WebGL, you need to provide an optional viemName property in the Chain object. This was missing from the documentation, and I will address this shortly 🙏

The correct chains configuration code in your case:

new Chain(ChainConstants.Namespaces.Evm,
    "713715",
    "Sei Devnet",
    new Currency("Sei", "SEI", 18),
    new BlockExplorer("Seitrace", "https://seitrace.com"),
    "https://evm-rpc-arctic-1.sei-apis.com",
    true,
    $"{CHAIN_IMAGE_URL}/692ed6ba-e569-459a-556a-776476829e00",
    "seiDevnet"), // add viemName

new Chain(ChainConstants.Namespaces.Evm,
    "1329",
    "Sei Network",
    new Currency("Sei", "SEI", 18),
    new BlockExplorer("Seitrace", "https://seitrace.com"),
    "https://evm-rpc.sei-apis.com/",
    false,
    $"{CHAIN_IMAGE_URL}/692ed6ba-e569-459a-556a-776476829e00",
    "seiTestnet"), // add viemName

Custom wallet list

The fix is in the works and will be included in the next release.

Telegram Mini App

I've noticed you mention Telegram App in the metadata. The current AppKit version isn't compatible with Telegram's Mini App browser. This issue has been resolved on the web side, but it will take some time to be implemented in the Unity package, likely a few weeks. I hope that doesn't block you.

skibitsky commented 1 month ago

Fixed in v1.0.1