diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 05:22:48 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 05:22:48 +0800 |
commit | 38b146c395429f860f57fa1865e01175eee39e62 (patch) | |
tree | 19fea9dc74f5fb0b1b8212a65f3274b94df31d0a /packages/contract-addresses/src/index.ts | |
parent | e3af06ab107f98d4ca4a195da05d808370b56bb4 (diff) | |
download | dexon-0x-contracts-38b146c395429f860f57fa1865e01175eee39e62.tar.gz dexon-0x-contracts-38b146c395429f860f57fa1865e01175eee39e62.tar.zst dexon-0x-contracts-38b146c395429f860f57fa1865e01175eee39e62.zip |
Add OrThrow suffix to getContractAddressesForNetwork
Diffstat (limited to 'packages/contract-addresses/src/index.ts')
-rw-r--r-- | packages/contract-addresses/src/index.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 80e88c8f9..1ea8c61dd 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -52,12 +52,13 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { /** * Used to get addresses of contracts that have been deployed to either the - * Ethereum mainnet or a supported testnet. + * Ethereum mainnet or a supported testnet. Throws if there are no known + * contracts deployed on the corresponding network. * @param networkId The desired networkId. * @returns The set of addresses for contracts which have been deployed on the * given networkId. */ -export function getContractAddressesForNetwork(networkId: NetworkId): ContractAddresses { +export function getContractAddressesForNetworkOrThrow(networkId: NetworkId): ContractAddresses { if (_.isUndefined(networkToAddresses[networkId])) { throw new Error(`Unknown network id (${networkId}). No known 0x contracts have been deployed on this network.`); } |