2196 fold the ethereum custom chain structure (#2209)

* #2196 refactored the code to use networkMap for the custom chains
* code review fixes #2196
pull/2217/head
Michael Paschenko 3 years ago committed by GitHub
parent 4f079837f0
commit d57bf76d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/build.gradle
  2. 16
      app/src/main/java/com/alphawallet/app/entity/NetworkInfo.java
  3. 91
      app/src/main/java/com/alphawallet/app/repository/EthereumNetworkBase.java
  4. 14
      app/src/main/java/com/alphawallet/app/repository/EthereumNetworkRepositoryType.java
  5. 24
      app/src/main/java/com/alphawallet/app/ui/AddCustomRPCNetworkActivity.java
  6. 4
      app/src/main/java/com/alphawallet/app/ui/SelectNetworkFilterActivity.java
  7. 14
      app/src/main/java/com/alphawallet/app/viewmodel/CustomNetworkViewModel.java
  8. 4
      app/src/main/java/com/alphawallet/app/viewmodel/SelectNetworkFilterViewModel.java
  9. 56
      lib/src/main/java/com/alphawallet/ethereum/EthereumNetworkBase.java
  10. 5
      lib/src/main/java/com/alphawallet/ethereum/NetworkInfo.java

@ -186,7 +186,7 @@ dependencies {
implementation "com.google.dagger:dagger-android:2.22"
//Use Leak Canary for debug builds only
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
//debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
// Image Loader
implementation 'com.github.bumptech.glide:glide:4.12.0'

@ -17,6 +17,20 @@ public class NetworkInfo extends com.alphawallet.ethereum.NetworkInfo {
public String backupNodeUrl = null;
public String etherscanAPI = null; //This is used by the API call to fetch transactions
public NetworkInfo(
String name,
String symbol,
String rpcServerUrl,
String etherscanUrl,
long chainId,
String backupNodeUrl,
String etherscanAPI,
boolean isCustom) {
super(name, symbol, rpcServerUrl, etherscanUrl, chainId, isCustom);
this.backupNodeUrl = backupNodeUrl;
this.etherscanAPI = etherscanAPI;
}
public NetworkInfo(
String name,
String symbol,
@ -25,7 +39,7 @@ public class NetworkInfo extends com.alphawallet.ethereum.NetworkInfo {
long chainId,
String backupNodeUrl,
String etherscanAPI) {
super(name, symbol, rpcServerUrl, etherscanUrl, chainId);
super(name, symbol, rpcServerUrl, etherscanUrl, chainId, false);
this.backupNodeUrl = backupNodeUrl;
this.etherscanAPI = etherscanAPI;
}

@ -5,7 +5,6 @@ package com.alphawallet.app.repository;
import android.text.TextUtils;
import android.util.LongSparseArray;
import android.view.View;
import com.alphawallet.app.C;
import com.alphawallet.app.R;
@ -40,7 +39,6 @@ import io.reactivex.Single;
import static com.alphawallet.ethereum.EthereumNetworkBase.ARBITRUM_MAIN_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.ARBITRUM_TEST_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.ARBITRUM_TEST_RPC_URL;
import static com.alphawallet.ethereum.EthereumNetworkBase.ARTIS_SIGMA1_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.ARTIS_TAU1_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.AVALANCHE_ID;
@ -72,8 +70,6 @@ import static com.alphawallet.ethereum.EthereumNetworkBase.ROPSTEN_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.SOKOL_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.XDAI_ID;
import androidx.core.content.ContextCompat;
public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryType
{
public static final String COVALENT = "[COVALENT]";
@ -150,9 +146,9 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
//Note: This list also determines the order of display for main net chains in the wallet.
//If your wallet prioritises xDai for example, you may want to move the XDAI_ID to the front of this list,
//Then xDai would appear as the first token at the top of the wallet
private static final List<Long> hasValue = Arrays.asList(
private static final List<Long> hasValue = new ArrayList<>(Arrays.asList(
MAINNET_ID, CLASSIC_ID, XDAI_ID, POA_ID, ARTIS_SIGMA1_ID, BINANCE_MAIN_ID, HECO_ID, AVALANCHE_ID,
FANTOM_ID, MATIC_ID, OPTIMISTIC_MAIN_ID, ARBITRUM_MAIN_ID, PALM_ID);
FANTOM_ID, MATIC_ID, OPTIMISTIC_MAIN_ID, ARBITRUM_MAIN_ID, PALM_ID));
//List of network details. Note, the advantage of using LongSparseArray is efficiency and also
//the entries are automatically sorted into numerical order
@ -396,7 +392,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
static class CustomNetworks {
private ArrayList<NetworkInfo> list = new ArrayList<>();
transient private Map<Long, NetworkInfo> map = new HashMap<>();
private Map<Long, Boolean> mapToTestNet = new HashMap<>();
transient private PreferenceRepositoryType preferences;
@ -413,7 +408,10 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
this.mapToTestNet = cn.mapToTestNet;
for (NetworkInfo info : list) {
map.put(info.chainId, info);
networkMap.put(info.chainId, info);
if (mapToTestNet.containsKey(info.chainId) && !mapToTestNet.get(info.chainId)) {
hasValue.add(info.chainId);
}
}
}
}
@ -427,13 +425,17 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
break;
}
}
hasValue.remove(oldChainId);
mapToTestNet.remove(oldChainId);
map.remove(oldChainId);
networkMap.remove(oldChainId);
}
list.add(info);
if (!isTestnet) {
hasValue.add(info.chainId);
}
mapToTestNet.put(info.chainId, isTestnet);
map.put(info.chainId, info);
networkMap.put(info.chainId, info);
String networks = new Gson().toJson(this);
preferences.setCustomRPCNetworks(networks);
}
@ -445,16 +447,15 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
break;
}
}
hasValue.remove(chainId);
mapToTestNet.remove(chainId);
map.remove(chainId);
networkMap.remove(chainId);
String networks = new Gson().toJson(this);
preferences.setCustomRPCNetworks(networks);
}
}
private static CustomNetworks customNetworks;
EthereumNetworkBase(PreferenceRepositoryType preferenceRepository, NetworkInfo[] additionalNetworks, boolean useTestNets)
@ -463,7 +464,7 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
this.additionalNetworks = additionalNetworks;
this.useTestNets = useTestNets;
this.customNetworks = new CustomNetworks(this.preferences);
customNetworks = new CustomNetworks(this.preferences);
}
private void addNetworks(NetworkInfo[] networks, List<NetworkInfo> result, boolean withValue)
@ -505,11 +506,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
@Override
public String getNameById(long chainId)
{
NetworkInfo info = customNetworks.map.get(chainId);
if (info != null) {
return info.name;
}
if (networkMap.indexOfKey(chainId) >= 0) return networkMap.get(chainId).name;
else return "Unknown: " + chainId;
}
@ -518,21 +514,12 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public NetworkInfo getActiveBrowserNetwork()
{
long activeNetwork = preferences.getActiveBrowserNetwork();
NetworkInfo info = customNetworks.map.get(activeNetwork);
if (info != null) {
return info;
}
return networkMap.get(activeNetwork);
}
@Override
public NetworkInfo getNetworkByChain(long chainId)
{
NetworkInfo info = customNetworks.map.get(chainId);
if (info != null) {
return info;
}
return networkMap.get(chainId);
}
@ -627,10 +614,8 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
* of the additionalNetworks, the same token on DEFAULT_NETWORKS, and on a few
* test nets, they are displayed by that order.
*/
addNetworks(customNetworks.list.toArray(new NetworkInfo[0]), networks, true);
addNetworks(additionalNetworks, networks, false);
if (useTestNets) addNetworks(networks, false);
addNetworks(customNetworks.list.toArray(new NetworkInfo[0]), networks, false);
return networks.toArray(new NetworkInfo[0]);
}
@ -650,23 +635,12 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public static boolean hasRealValue(long chainId)
{
if (customNetworks.mapToTestNet.containsKey(chainId))
{
return !customNetworks.mapToTestNet.get(chainId);
}
else
{
return hasValue.contains(chainId);
}
return hasValue.contains(chainId);
}
public static String getSecondaryNodeURL(long networkId)
{
NetworkInfo info = networkMap.get(networkId);
if (info == null) {
info = customNetworks.map.get(networkId);
}
if (info != null) { return info.backupNodeUrl; }
else {
return "";
@ -700,9 +674,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public static String getNodeURLByNetworkId(long networkId)
{
NetworkInfo info = networkMap.get(networkId);
if (info == null) {
info = customNetworks.map.get(networkId);
}
if (info != null) { return info.rpcServerUrl; }
else { return MAINNET_RPC_URL; }
}
@ -714,9 +685,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
*/
public static String getDefaultNodeURL(long networkId) {
NetworkInfo info = networkMap.get(networkId);
if (info == null) {
info = customNetworks.map.get(networkId);
}
if (info != null) return info.rpcServerUrl;
else return "";
}
@ -724,10 +692,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public static String getEtherscanURLbyNetworkAndHash(long networkId, String txHash)
{
NetworkInfo info = networkMap.get(networkId);
if (info == null) {
info = customNetworks.map.get(networkId);
}
if (info != null)
{
return info.getEtherscanUri(txHash).toString();
@ -741,11 +705,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public static long getNetworkIdFromName(String name)
{
if (!TextUtils.isEmpty(name)) {
for (NetworkInfo NETWORK : customNetworks.map.values()) {
if (name.equals(NETWORK.name)) {
return NETWORK.chainId;
}
}
for (int i = 0; i < networkMap.size(); i++) {
if (name.equals(networkMap.valueAt(i).name)) {
return networkMap.valueAt(i).chainId;
@ -890,34 +849,21 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
}
public void addCustomRPCNetwork(String networkName, String rpcUrl, long chainId, String symbol, String blockExplorerUrl, String explorerApiUrl, boolean isTestnet, Long oldChainId) {
NetworkInfo info = new NetworkInfo(networkName, symbol, rpcUrl, blockExplorerUrl, chainId, null, explorerApiUrl);
NetworkInfo info = new NetworkInfo(networkName, symbol, rpcUrl, blockExplorerUrl, chainId, null, explorerApiUrl, true);
customNetworks.addCustomNetwork(info, isTestnet, oldChainId);
}
public NetworkInfoExt getNetworkInfoExt(long chainId) {
boolean isCustom = customNetworks.map.containsKey(chainId);
NetworkInfo info = getNetworkByChain(chainId);
boolean isTestNetwork = isCustom ? customNetworks.mapToTestNet.get(chainId) : !hasRealValue(chainId);
return new NetworkInfoExt(info, isTestNetwork, isCustom);
}
public void removeCustomRPCNetwork(long chainId) {
customNetworks.remove(chainId);
}
public static NetworkInfo getNetworkInfo(long chainId) {
NetworkInfo info = networkMap.get(chainId);
if (info == null) info = customNetworks.map.get(chainId);
return info;
return networkMap.get(chainId);
}
public static String getShortChainName(long chainId)
{
NetworkInfo info = networkMap.get(chainId);
if (info == null) info = customNetworks.map.get(chainId);
if (info != null)
{
String shortName = info.name;
@ -938,7 +884,6 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
public static String getChainSymbol(long chainId)
{
NetworkInfo info = networkMap.get(chainId);
if (info == null) info = customNetworks.map.get(chainId);
if (info != null)
{
return info.symbol;

@ -16,19 +16,6 @@ import io.reactivex.Single;
public interface EthereumNetworkRepositoryType {
class NetworkInfoExt {
public final NetworkInfo info;
public final boolean isTestNetwork;
public final boolean isCustomNetwork;
public NetworkInfoExt(NetworkInfo info, boolean isTestNetwork, boolean isCustomNetwork) {
this.info = info;
this.isTestNetwork = isTestNetwork;
this.isCustomNetwork = isCustomNetwork;
}
}
NetworkInfo getActiveBrowserNetwork();
void setActiveBrowserNetwork(NetworkInfo networkInfo);
@ -69,7 +56,6 @@ public interface EthereumNetworkRepositoryType {
void setActiveMainnet(boolean isMainNet);
void addCustomRPCNetwork(String networkName, String rpcUrl, long chainId, String symbol, String blockExplorerUrl, String explorerApiUrl, boolean isTestnet, Long oldChainId);
NetworkInfoExt getNetworkInfoExt(long chainId);
void removeCustomRPCNetwork(long chainId);
boolean isChainContract(long chainId, String address);

@ -88,17 +88,17 @@ public class AddCustomRPCNetworkActivity extends BaseActivity implements Standar
if (chainId >= 0) {
// get network info and fill ui
EthereumNetworkRepositoryType.NetworkInfoExt ext = viewModel.getNetworkInfo(chainId);
nameInputView.setText(ext.info.name);
rpcUrlInputView.setText(ext.info.rpcServerUrl.replaceAll("(/)([0-9a-fA-F]{32})","/********************************"));
chainIdInputView.setText(String.valueOf(ext.info.chainId));
symbolInputView.setText(ext.info.symbol);
blockExplorerUrlInputView.setText(ext.info.etherscanUrl);
blockExplorerApiUrl.setText(ext.info.etherscanAPI);
testNetSwitch.setChecked(ext.isTestNetwork);
NetworkInfo network = viewModel.getNetworkInfo(chainId);
nameInputView.setText(network.name);
rpcUrlInputView.setText(network.rpcServerUrl.replaceAll("(/)([0-9a-fA-F]{32})","/********************************"));
chainIdInputView.setText(String.valueOf(network.chainId));
symbolInputView.setText(network.symbol);
blockExplorerUrlInputView.setText(network.etherscanUrl);
blockExplorerApiUrl.setText(network.etherscanAPI);
testNetSwitch.setChecked(viewModel.isTestNetwork(network));
// disable editing for hardcoded networks
if (!ext.isCustomNetwork) {
if (!network.isCustom) {
nameInputView.getEditText().setEnabled(false);
rpcUrlInputView.getEditText().setEnabled(false);
chainIdInputView.getEditText().setEnabled(false);
@ -155,8 +155,8 @@ public class AddCustomRPCNetworkActivity extends BaseActivity implements Standar
long newChainId = Long.parseLong(chainIdInputView.getText().toString());
long chainId = getIntent().getLongExtra(CHAIN_ID, -1);
if (newChainId != chainId) {
EthereumNetworkRepositoryType.NetworkInfoExt networkInfo = viewModel.getNetworkInfo(newChainId);
if (networkInfo.info != null) {
NetworkInfo network = viewModel.getNetworkInfo(newChainId);
if (network != null) {
chainIdInputView.setError(getString(R.string.error_chainid_already_taken));
return false;
}

@ -123,8 +123,8 @@ public class SelectNetworkFilterActivity extends SelectNetworkBaseActivity imple
popupWindow.dismiss();
});
EthereumNetworkRepositoryType.NetworkInfoExt ext = viewModel.getNetworkInfoExt(chainId);
if (ext.isCustomNetwork) {
NetworkInfo network = viewModel.getNetworkByChain(chainId);
if (network.isCustom) {
popupView.findViewById(R.id.popup_delete).setOnClickListener(v -> {
// delete network
viewModel.removeCustomNetwork(chainId);

@ -1,12 +1,8 @@
package com.alphawallet.app.viewmodel;
import com.alphawallet.app.repository.EthereumNetworkRepository;
import com.alphawallet.app.repository.EthereumNetworkRepositoryType;
import com.alphawallet.app.repository.EthereumNetworkBase;
import com.alphawallet.ethereum.NetworkInfo;
import com.alphawallet.app.entity.NetworkInfo;
public class CustomNetworkViewModel extends BaseViewModel
{
@ -22,7 +18,11 @@ public class CustomNetworkViewModel extends BaseViewModel
this.ethereumNetworkRepository.addCustomRPCNetwork(name, rpcUrl, chainId, symbol, blockExplorerUrl, explorerApiUrl, isTestnet, oldChainId);
}
public EthereumNetworkRepositoryType.NetworkInfoExt getNetworkInfo(long chainId) {
return this.ethereumNetworkRepository.getNetworkInfoExt(chainId);
public NetworkInfo getNetworkInfo(long chainId) {
return this.ethereumNetworkRepository.getNetworkByChain(chainId);
}
public boolean isTestNetwork(NetworkInfo network) {
return !EthereumNetworkRepository.hasRealValue(network.chainId);
}
}

@ -72,10 +72,6 @@ public class SelectNetworkFilterViewModel extends BaseViewModel {
return networkRepository.getNetworkByChain(chainId);
}
public EthereumNetworkRepositoryType.NetworkInfoExt getNetworkInfoExt(long chainId) {
return this.networkRepository.getNetworkInfoExt(chainId);
}
public boolean mainNetActive()
{
return preferenceRepository.isActiveMainnet();

@ -70,65 +70,65 @@ public abstract class EthereumNetworkBase { // implements EthereumNetworkReposit
static Map<Long, NetworkInfo> networkMap = new LinkedHashMap<Long, NetworkInfo>() {
{
put(MAINNET_ID, new NetworkInfo("Ethereum", "ETH", MAINNET_RPC_URL, "https://etherscan.io/tx/",
MAINNET_ID));
MAINNET_ID, false));
put(CLASSIC_ID, new NetworkInfo("Ethereum Classic", "ETC", CLASSIC_RPC_URL, "https://blockscout.com/etc/mainnet/tx/",
CLASSIC_ID));
CLASSIC_ID, false));
put(XDAI_ID, new NetworkInfo("xDAI", "xDAI", XDAI_RPC_URL, "https://blockscout.com/xdai/mainnet/tx/",
XDAI_ID));
XDAI_ID, false));
put(POA_ID, new NetworkInfo("POA", "POA", POA_RPC_URL, "https://blockscout.com/poa/core/tx/",
POA_ID));
POA_ID, false));
put(ARTIS_SIGMA1_ID, new NetworkInfo("ARTIS sigma1", "ATS", ARTIS_SIGMA1_RPC_URL, "https://explorer.sigma1.artis.network/tx/",
ARTIS_SIGMA1_ID));
ARTIS_SIGMA1_ID, false));
put(KOVAN_ID, new NetworkInfo("Kovan (Test)", "ETH", KOVAN_RPC_URL, "https://kovan.etherscan.io/tx/",
KOVAN_ID));
KOVAN_ID, false));
put(ROPSTEN_ID, new NetworkInfo("Ropsten (Test)", "ETH", ROPSTEN_RPC_URL, "https://ropsten.etherscan.io/tx/",
ROPSTEN_ID));
ROPSTEN_ID, false));
put(SOKOL_ID, new NetworkInfo("Sokol (Test)", "POA", SOKOL_RPC_URL, "https://blockscout.com/poa/sokol/tx/",
SOKOL_ID));
SOKOL_ID, false));
put(RINKEBY_ID, new NetworkInfo("Rinkeby (Test)", "ETH", RINKEBY_RPC_URL, "https://rinkeby.etherscan.io/tx/",
RINKEBY_ID));
RINKEBY_ID, false));
put(GOERLI_ID, new NetworkInfo("Görli (Test)", "GÖETH", GOERLI_RPC_URL, "https://goerli.etherscan.io/tx/",
GOERLI_ID));
GOERLI_ID, false));
put(ARTIS_TAU1_ID, new NetworkInfo("ARTIS tau1 (Test)", "ATS", ARTIS_TAU1_RPC_URL, "https://explorer.tau1.artis.network/tx/",
ARTIS_TAU1_ID));
ARTIS_TAU1_ID, false));
put(BINANCE_TEST_ID, new NetworkInfo("BSC TestNet (Test)", "T-BSC", BINANCE_TEST_RPC_URL, "https://explorer.binance.org/smart-testnet/tx/",
BINANCE_MAIN_ID));
BINANCE_MAIN_ID, false));
put(BINANCE_MAIN_ID, new NetworkInfo("Binance (BSC)", "BSC", BINANCE_MAIN_RPC_URL, "https://explorer.binance.org/smart/tx/",
BINANCE_TEST_ID));
BINANCE_TEST_ID, false));
put(HECO_ID, new NetworkInfo("Heco", "HT", HECO_RPC_URL, "https://hecoinfo.com/tx/",
HECO_ID));
HECO_ID, false));
put(HECO_TEST_ID, new NetworkInfo("Heco (Test)", "HT", HECO_TEST_RPC_URL, "https://testnet.hecoinfo.com/tx/",
HECO_TEST_ID));
HECO_TEST_ID, false));
put(AVALANCHE_ID, new NetworkInfo("Avalanche Mainnet C-Chain", "AVAX", AVALANCHE_RPC_URL, "https://cchain.explorer.avax.network/tx/",
AVALANCHE_ID));
AVALANCHE_ID, false));
put(FUJI_TEST_ID, new NetworkInfo("Avalanche FUJI C-Chain (Test)", "AVAX", FUJI_TEST_RPC_URL, "https://cchain.explorer.avax-test.network/tx/",
FUJI_TEST_ID));
FUJI_TEST_ID, false));
put(FANTOM_ID, new NetworkInfo("Fantom Opera", "FTM", FANTOM_RPC_URL, "https://ftmscan.com/tx/",
FANTOM_ID));
FANTOM_ID, false));
put(FANTOM_TEST_ID, new NetworkInfo("Fantom (Test)", "FTM", FANTOM_TEST_RPC_URL, "https://explorer.testnet.fantom.network/tx/",
FANTOM_TEST_ID));
FANTOM_TEST_ID, false));
put(MATIC_ID, new NetworkInfo("Polygon", "POLY", MATIC_RPC_URL, "https://polygonscan.com/tx/",
MATIC_ID));
MATIC_ID, false));
put(MATIC_TEST_ID, new NetworkInfo("Mumbai (Test)", "POLY", MUMBAI_TEST_RPC_URL, "https://mumbai.polygonscan.com/tx/",
MATIC_TEST_ID));
MATIC_TEST_ID, false));
put(OPTIMISTIC_MAIN_ID, new NetworkInfo("Optimistic","ETH", OPTIMISTIC_MAIN_URL, "https://optimistic.etherscan.io/tx/",
OPTIMISTIC_MAIN_ID));
OPTIMISTIC_MAIN_ID, false));
put(OPTIMISTIC_TEST_ID, new NetworkInfo("Optimistic (Test)", "ETH", OPTIMISTIC_TEST_URL, "https://kovan-optimistic.etherscan.io/tx/",
OPTIMISTIC_TEST_ID));
put(CRONOS_TEST_ID, new NetworkInfo("Cronos (Test)", "tCRO", CRONOS_TEST_URL, "https://cronos-explorer.crypto.org/tx/",CRONOS_TEST_ID));
OPTIMISTIC_TEST_ID, false));
put(CRONOS_TEST_ID, new NetworkInfo("Cronos (Test)", "tCRO", CRONOS_TEST_URL, "https://cronos-explorer.crypto.org/tx/",CRONOS_TEST_ID, false));
put(ARBITRUM_MAIN_ID, new NetworkInfo("Arbitrum One","AETH", ARBITRUM_RPC_URL, "https://arbiscan.io/tx/",
ARBITRUM_MAIN_ID));
ARBITRUM_MAIN_ID, false));
put(ARBITRUM_TEST_ID, new NetworkInfo("Arbitrum Test", "ARETH", ARBITRUM_TEST_RPC_URL, "https://rinkeby-explorer.arbitrum.io/tx/",
ARBITRUM_TEST_ID));
ARBITRUM_TEST_ID, false));
put(PALM_ID, new NetworkInfo("PALM","PALM", PALM_RPC_URL, "https://explorer.palm.io/tx/",
PALM_ID));
PALM_ID, false));
put(PALM_TEST_ID, new NetworkInfo("PALM (Test)", "PALM", PALM_TEST_RPC_URL, "https://explorer.palm-uat.xyz/tx/",
PALM_TEST_ID));
PALM_TEST_ID, false));
}
};

@ -11,18 +11,21 @@ public class NetworkInfo {
public final String rpcServerUrl;
public final String etherscanUrl; // This is used by the Transaction Detail page for the user to visit a website with detailed transaction information
public final long chainId;
public final boolean isCustom;
public NetworkInfo(
String name,
String symbol,
String rpcServerUrl,
String etherscanUrl,
long chainId) {
long chainId,
boolean isCustom) {
this.name = name;
this.symbol = symbol;
this.rpcServerUrl = rpcServerUrl;
this.etherscanUrl = etherscanUrl;
this.chainId = chainId;
this.isCustom = isCustom;
}
}

Loading…
Cancel
Save