Skip to content

Commit

Permalink
Added arbitrum and optimism to networks and providers (#2335).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Nov 30, 2021
1 parent caa1983 commit 0844de4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/networks/src.ts/index.ts
Expand Up @@ -122,6 +122,7 @@ const classicMordor: Network = {
_defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor")
};

// See: https://chainlist.org
const networks: { [name: string]: Network } = {
unspecified: { chainId: 0, name: "unspecified" },

Expand Down Expand Up @@ -177,6 +178,13 @@ const networks: { [name: string]: Network } = {
matic: { chainId: 137, name: "matic" },
maticmum: { chainId: 80001, name: "maticmum" },

optimism: { chainId: 10, name: "optimism" },
"optimism-kovan": { chainId: 69, name: "optimism-kovan" },
"optimism-goerli": { chainId: 420, name: "optimism-goerli" },

arbitrum: { chainId: 42161, name: "arbitrum" },
"arbitrum-rinkeby": { chainId: 421611, name: "arbitrum-rinkeby" },

bnb: { chainId: 56, name: "bnb" },
bnbt: { chainId: 97, name: "bnbt" },
}
Expand Down
12 changes: 12 additions & 0 deletions packages/providers/src.ts/alchemy-provider.ts
Expand Up @@ -76,6 +76,18 @@ export class AlchemyProvider extends UrlJsonRpcProvider {
case "maticmum":
host = "polygon-mumbai.g.alchemy.com/v2/";
break;
case "arbitrum":
host = "arb-mainnet.g.alchemy.com/v2/";
break;
case "arbitrum-rinkeby":
host = "arb-rinkeby.g.alchemy.com/v2/";
break;
case "optimism":
host = "opt-mainnet.g.alchemy.com/v2/";
break;
case "optimism-kovan":
host = "opt-kovan.g.alchemy.com/v2/";
break;
default:
logger.throwArgumentError("unsupported network", "network", arguments[0]);
}
Expand Down
12 changes: 12 additions & 0 deletions packages/providers/src.ts/infura-provider.ts
Expand Up @@ -105,6 +105,18 @@ export class InfuraProvider extends UrlJsonRpcProvider {
case "maticmum":
host = "polygon-mumbai.infura.io";
break;
case "optimism":
host = "optimism-mainnet.infura.io";
break;
case "optimism-kovan":
host = "optimism-kovan.infura.io";
break;
case "arbitrum":
host = "arbitrum-mainnet.infura.io";
break;
case "arbitrum-rinkeby":
host = "arbitrum-rinkeby.infura.io";
break;
default:
logger.throwError("unsupported network", Logger.errors.INVALID_ARGUMENT, {
argument: "network",
Expand Down

0 comments on commit 0844de4

Please sign in to comment.