diff --git a/packages/common/src/chain-infos/chain-info-reader.ts b/packages/common/src/chain-infos/chain-info-reader.ts index 55bd4ab..82ceb12 100644 --- a/packages/common/src/chain-infos/chain-info-reader.ts +++ b/packages/common/src/chain-infos/chain-info-reader.ts @@ -12,14 +12,16 @@ import { import path from "path"; export class ChainInfoReaderFromBackend implements ChainInfoReader { + constructor(private readonly baseUrl?: string, private readonly dex?: string) {} + async readChainInfos() { const chains = (await ( await fetchRetry( - CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_URL + + this.baseUrl ?? CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_URL + path.join( CHAIN_REGISTRY_BACKEND_ENDPOINTS.BASE_ENDPOINT, CHAIN_REGISTRY_BACKEND_ENDPOINTS.CHAIN_INFOS - ) + ) + "?dex=" + this.dex ) ).json()) as CustomChainInfo[]; return chains; diff --git a/packages/common/src/common.ts b/packages/common/src/common.ts index 2686d11..0e98662 100644 --- a/packages/common/src/common.ts +++ b/packages/common/src/common.ts @@ -29,8 +29,8 @@ export class OraiCommon { return OraiCommon.initializeFromCustomChainInfos(customChainInfos); } - static async initializeFromBackend() { - const reader = new ChainInfoReaderFromBackend(); + static async initializeFromBackend(baseUrl?: string, dex?: string) { + const reader = new ChainInfoReaderFromBackend(baseUrl, dex); return OraiCommon.initializeFromChainInfoReader(reader); }