message: Make address arg for getAddressByNetwork type safe
diff: @@ -19,18 +19,13 @@ consumeModule(SplitPrepaidCardHandlerABI);
  consumeModule(SpendABI);
  consumeModule(MerchantManagerABI);
  -const addresses: {
  - [network: string]: {
  - [contractName: string]: string | { [tokenName: string]: string };
  - };
  -} = Object.freeze({
  - kovan: {
  +const KOVAN = {
  cardToken: '0xd6E34821F508e4247Db359CFceE0cb5e8050972a',
  daiToken: '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa',
  foreignBridge: '0x366b4cc64D30849568af65522De3a68ea6CC78cE',
  foreignAMB: '0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560',
  - },
  - sokol: {
  +};
  +const SOKOL = {
  homeBridge: '0x16a80598DD2f143CFBf091638CE3fB02c9135528',
  homeAMB: '0xFe446bEF1DbF7AFE24E81e05BC8B271C1BA9a560',
  daiCpxd: '0xFeDc0c803390bbdA5C4C296776f4b574eC4F30D1',
  @@ -54,17 +49,28 @@ const addresses: {
  DAI: '0x74beF86c9d4a5b96B81D8d8e44157DFd35Eda5fB', // eslint-disable-line @typescript-eslint/naming-convention
  CARD: '0xb4Fcc975c2b6A57dd5B3d9a3B6b144499f707c7d', // eslint-disable-line @typescript-eslint/naming-convention
  },
  - },
  - mainnet: {
  +};
  +const MAINNET = {
  cardToken: '0x954b890704693af242613edEf1B603825afcD708',
  daiToken: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
  - },
  - xdai: {},
  +};
  +const XDAI = {};
  +const addresses: {
  + [network: string]: {
  + [contractName: string]: string | { [tokenName: string]: string };
  + };
  +} = Object.freeze({
  + kovan: KOVAN,
  + sokol: SOKOL,
  + mainnet: MAINNET,
  + xdai: XDAI,
  });
  +type AddressKeys = keyof typeof SOKOL | keyof typeof KOVAN | keyof typeof MAINNET | keyof typeof XDAI;
  +
  export default addresses;
  -export function getAddressByNetwork(contractName: string, network: string): string {
  +export function getAddressByNetwork(contractName: AddressKeys, network: string): string {
  let address = addresses[network][contractName];
  if (!address) {
  throw new Error(`Don't know about the address for '${contractName}' for network ${network}`);
  @@ -75,7 +81,7 @@ export function getAddressByNetwork(contractName: string, network: string): stri
  return address;
  }
  -export async function getAddress(contractName: string, web3: Web3): Promise<string> {
  +export async function getAddress(contractName: AddressKeys, web3: Web3): Promise<string> {
  let network = await networkName(web3);
  return getAddressByNetwork(contractName, network);
  }
  