protocol/packages/contract-wrappers/src/utils/contract_addresses.ts
F. Eugene Aumson f51c80adb2
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
2019-11-06 01:18:55 -05:00

16 lines
720 B
TypeScript

import { ChainId, ContractAddresses, getContractAddressesForChainOrThrow } from '@0x/contract-addresses';
import * as _ from 'lodash';
/**
* Returns the default contract addresses for the given chainId or throws with
* a context-specific error message if the chainId is not recognized.
*/
export function _getDefaultContractAddresses(chainId: number): ContractAddresses {
if (!(chainId in ChainId)) {
throw new Error(
`No default contract addresses found for the given chain id (${chainId}). If you want to use ContractWrappers on this chain, you must manually pass in the contract address(es) to the constructor.`,
);
}
return getContractAddressesForChainOrThrow(chainId);
}