From cc6b034a4e658505bbb5613aa1324412be9a4e5a Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 27 Jun 2024 10:20:55 -0700 Subject: [PATCH] Add setAdditionalAddresses to enable dynamic addresses --- lib/addresses.ts | 16 +++++++++++++++- lib/types.ts | 4 +++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/addresses.ts b/lib/addresses.ts index 0d2127cc..9e2ddaa3 100644 --- a/lib/addresses.ts +++ b/lib/addresses.ts @@ -4,8 +4,22 @@ import mainnet from "../data/addresses.mainnet.json"; import testnet from "../data/addresses.testnet.json"; import { ParamChainName, ParamSymbol, ParamType } from "./types"; +interface Address { + address: string; + category: string; + chain_id: number; + chain_name: ParamChainName; + type: ParamType; +} + +let additionalAddresses: Address[] = []; + +export const setAdditionalAddresses = (addresses: Address[]) => { + additionalAddresses = addresses; +} + export const getAddress = (type: ParamType, network: ParamChainName, symbol?: ParamSymbol) => { - const networks = [...testnet, ...mainnet]; + const networks = [...testnet, ...mainnet, ...additionalAddresses]; let address; if (type !== "zrc20" && symbol) { throw new Error("Symbol is only supported when ParamType is zrc20"); diff --git a/lib/types.ts b/lib/types.ts index 28738b51..56e891db 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -19,10 +19,12 @@ export type ParamChainName = | "btc_mainnet" | "btc_testnet" | "eth_mainnet" + | "eth_developnet" | "mumbai_testnet" | "sepolia_testnet" | "zeta_mainnet" - | "zeta_testnet"; + | "zeta_testnet" + | "zeta_developnet"; export type ParamType = | "connector" | "erc20Custody"