Skip to main content

Custom Networks

Custom Networks addition and selection

AppKit includes a predefined list of supported mainnets, (such as the Solana mainnet) and testnets ( also Solana testnet) within the ReownAppKitModalNetworks class. This means that if you intend to support both EVM chains and Solana, no further adjustments are necessary.

However, this class can be modified in order to achieve the following results, and more:

info

non-EVM blockchains are supported from version 1.2.0-beta01

// You can add more EVM networks
List<ReownAppKitModalNetworkInfo> extraChains = [...];
ReownAppKitModalNetworks.addSupportedNetworks('eip155', extraChains);

Note: If you are adding a test network, set isTestNetwork property of ReownAppKitModalNetworkInfo to true

// Remove Solana networks (supports only EVM networks):
ReownAppKitModalNetworks.removeSupportedNetworks('solana');
// Remove every test network
ReownAppKitModalNetworks.removeTestNetworks();
// Add more non-EVM networks, such as Polkadot
ReownAppKitModalNetworks.addSupportedNetworks('polkadot', [
ReownAppKitModalNetworkInfo(
name: 'Polkadot',
chainId: '91b171bb158e2d3848fa23a9f1c25182',
chainIcon: 'https://cryptologos.cc/logos/polkadot-new-dot-logo.png',
currency: 'DOT',
rpcUrl: 'https://rpc.polkadot.io',
explorerUrl: 'https://polkadot.subscan.io',
),
ReownAppKitModalNetworkInfo(
name: 'Westend',
chainId: 'e143f23803ac50e8f6f8e62695d1ce9e',
currency: 'DOT',
rpcUrl: 'https://westend-rpc.polkadot.io',
explorerUrl: 'https://westend.subscan.io',
isTestNetwork: true,
),
]);

As said before, if you plan to support just EVM and Solana networks you should already have everything in place, out of the box, inside AppKit configuration. However, if you are looking to support more non-EVM networks, such as Polkadot, then further configuration must be done:

Example: If you want to support EVM + Solana + Polkadot then, along with the networks list modification, you should also pass the the following optionalNamespaces: in AppKit instance:

optionalNamespaces: {
'eip155': RequiredNamespace.fromJson({
'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
namespace: 'eip155',
).map((chain) => 'eip155:${chain.chainId}').toList(),
'methods': NetworkUtils.defaultNetworkMethods['eip155']!.toList(),
'events': NetworkUtils.defaultNetworkEvents['eip155']!.toList(),
}),
'solana': RequiredNamespace.fromJson({
'chains': ReownAppKitModalNetworks.getAllSupportedNetworks(
namespace: 'solana',
).map((chain) => 'solana:${chain.chainId}').toList(),
'methods': NetworkUtils.defaultNetworkMethods['solana']!.toList(),
'events': [],
}),
'polkadot': RequiredNamespace.fromJson({
'chains': [
'polkadot:91b171bb158e2d3848fa23a9f1c25182',
'polkadot:e143f23803ac50e8f6f8e62695d1ce9e'
],
'methods': [
'polkadot_signMessage',
'polkadot_signTransaction',
],
'events': []
}),
},