reown-com/reown_flutter

Issue Adding Test Network

Closed this issue · 1 comments

I am trying to connect Amoy test net but its not getting connected i am using Metamask wallet to connect

I just have a little concern about the test network connection you have made this variable
`
static Map<String, List> test = {

'eip155': [
  ReownAppKitModalNetworkInfo(
    name: 'Sepolia',
    chainId: '11155111',
    currency: 'SEP',
    rpcUrl: 'https://ethereum-sepolia.publicnode.com',
    explorerUrl: 'https://sepolia.etherscan.io/',
    isTestNetwork: true,
  ),

  ReownAppKitModalNetworkInfo(
    name: 'Holesky',
    chainId: '17000',
    chainIcon: chainImagesId['17000'],
    currency: 'ETH',
    rpcUrl: 'https://rpc.holesky.test',
    explorerUrl: 'https://explorer.holesky.test',
    isTestNetwork: true,
  ),

  ReownAppKitModalNetworkInfo(
    name: 'Mumbai',
    chainId: '80001',
    currency: 'MATIC',
    rpcUrl: 'https://polygon-mumbai-bor-rpc.publicnode.com',
    extraRpcUrls: [
      'https://rpc.ankr.com/polygon_mumbai',
      'https://polygon-testnet.public.blastapi.io',
      'https://polygon-mumbai.blockpi.network/v1/rpc/public',
    ],
    explorerUrl: 'https://mumbai.polygonscan.com',
    isTestNetwork: true,
  ),

  ReownAppKitModalNetworkInfo(
    name: 'Amoy',
    chainId: '80002',
    currency: 'MATIC',
    rpcUrl: 'https://rpc-amoy.polygon.technology/',
    extraRpcUrls: [],
    explorerUrl: 'https://amoy.polygonscan.com',
    isTestNetwork: true,
  )
],

};
`

but you have not used it for getting the ReownAppKitModalNetworkInfo

in this method
static ReownAppKitModalNetworkInfo? getNetworkById( String namespace, String chainId, ) { return supported[namespace]?.firstWhere((e) => e.chainId == chainId); }

just using supported namespaces which does not include the test network

To Reproduce
Steps to reproduce the behavior:

  1. You can create an account in metamask and change the network to amoy test network
  2. You can try to connect the wallet it will throw an no element found for getnetworkid

one more thing is there any other way to connect the test network or we have to pass the value for this parameter (" List blockchains") in the "ReownAppKitModal" initialization to connect test network

did this before initializing appkitmodal and got it working

final testNetworks = ReownAppKitModalNetworks.test['eip155'] ?? []; ReownAppKitModalNetworks.addNetworks('eip155', testNetworks);