|
@@ -37,16 +37,26 @@ const chainIds = {
|
|
rinkeby: 4,
|
|
rinkeby: 4,
|
|
};
|
|
};
|
|
|
|
|
|
-function getChainConfig(network: keyof typeof chainIds): NetworkUserConfig {
|
|
|
|
- const url: string = "https://" + network + ".infura.io/v3/" + infuraApiKey;
|
|
|
|
|
|
+function getChainConfig(chain: keyof typeof chainIds): NetworkUserConfig {
|
|
|
|
+ let jsonRpcUrl: string;
|
|
|
|
+ switch (chain) {
|
|
|
|
+ case "avalanche":
|
|
|
|
+ jsonRpcUrl = "https://api.avax.network/ext/bc/C/rpc";
|
|
|
|
+ break;
|
|
|
|
+ case "bsc":
|
|
|
|
+ jsonRpcUrl = "https://bsc-dataseed1.binance.org";
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ jsonRpcUrl = "https://" + chain + ".infura.io/v3/" + infuraApiKey;
|
|
|
|
+ }
|
|
return {
|
|
return {
|
|
accounts: {
|
|
accounts: {
|
|
count: 10,
|
|
count: 10,
|
|
mnemonic,
|
|
mnemonic,
|
|
path: "m/44'/60'/0'/0",
|
|
path: "m/44'/60'/0'/0",
|
|
},
|
|
},
|
|
- chainId: chainIds[network],
|
|
|
|
- url,
|
|
|
|
|
|
+ chainId: chainIds[chain],
|
|
|
|
+ url: jsonRpcUrl,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|