Change all instances of networkId to chainId (#2313)
* abi-gen/test: recompile contract fixtures for 3.0 It seems this hadn't been done since the merge with the 3.0 branch. * Sync `monorepo$ yarn test` exclusions to CI config * sra-spec: correct typo * contract-wrappers: TODO after coord.-server update * utils: fix typo in comment * Refactor networkId to chainId everywhere * Update CHANGELOGs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"version": "3.4.0-beta.0",
|
||||
"version": "4.0.0-beta.0",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Remove `readOnlyProxy` from addresses interface",
|
||||
@@ -13,6 +13,10 @@
|
||||
{
|
||||
"note": "Update `exchange`, `staking`, `stakingProxy`, `zeroExGovernor`, `assetProxyOwner`, and `erc20BridgeProxy` addresses for each tesnet",
|
||||
"pr": 2296
|
||||
},
|
||||
{
|
||||
"note": "Contract addresses are no longer indexed by network ID. Now they're indexed by chain ID.",
|
||||
"pr": 2313
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
"stakingProxy": "0xbab9145f1d57cd4bb0c9aa2d1ece0a5b6e734d34",
|
||||
"erc20BridgeProxy": "0xfb2dd2a1366de37f7241c83d47da58fd503e2c64"
|
||||
},
|
||||
"50": {
|
||||
"1337": {
|
||||
"erc20Proxy": "0x1dc4c1cefef38a777b15aa20260a54e584b16c48",
|
||||
"erc721Proxy": "0x1d7022f5b17d2f8b695918fb48fa1089c9f85401",
|
||||
"erc1155Proxy": "0x6a4a62e5a7ed13c361b176a5f62c2ee620ac0df8",
|
||||
|
||||
@@ -26,27 +26,27 @@ export interface ContractAddresses {
|
||||
erc20BridgeProxy: string;
|
||||
}
|
||||
|
||||
export enum NetworkId {
|
||||
export enum ChainId {
|
||||
Mainnet = 1,
|
||||
Ropsten = 3,
|
||||
Rinkeby = 4,
|
||||
Kovan = 42,
|
||||
Ganache = 50,
|
||||
Ganache = 1337,
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get addresses of contracts that have been deployed to either the
|
||||
* Ethereum mainnet or a supported testnet. Throws if there are no known
|
||||
* contracts deployed on the corresponding network.
|
||||
* @param networkId The desired networkId.
|
||||
* contracts deployed on the corresponding chain.
|
||||
* @param chainId The desired chainId.
|
||||
* @returns The set of addresses for contracts which have been deployed on the
|
||||
* given networkId.
|
||||
* given chainId.
|
||||
*/
|
||||
export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): ContractAddresses {
|
||||
const networkToAddresses: { [networkId: number]: ContractAddresses } = addresses;
|
||||
export function getContractAddressesForChainOrThrow(chainId: ChainId): ContractAddresses {
|
||||
const chainToAddresses: { [chainId: number]: ContractAddresses } = addresses;
|
||||
|
||||
if (networkToAddresses[networkId] === undefined) {
|
||||
throw new Error(`Unknown network id (${networkId}). No known 0x contracts have been deployed on this network.`);
|
||||
if (chainToAddresses[chainId] === undefined) {
|
||||
throw new Error(`Unknown chain id (${chainId}). No known 0x contracts have been deployed on this chain.`);
|
||||
}
|
||||
return networkToAddresses[networkId];
|
||||
return chainToAddresses[chainId];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user