From b291505cc0ca2f3eac524ea706d8d59576f4f829 Mon Sep 17 00:00:00 2001 From: HoangNDM6 Date: Mon, 3 Jun 2024 15:21:33 +0700 Subject: [PATCH] fix chainId --- src/config/cache/chains.ts | 28 ++++------------------------ src/services/index.ts | 5 +++-- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/config/cache/chains.ts b/src/config/cache/chains.ts index e39e41cd36..af3dffef5a 100644 --- a/src/config/cache/chains.ts +++ b/src/config/cache/chains.ts @@ -9,31 +9,10 @@ export const getChains = (): ChainInfo[] => chains export const loadChains = async () => { const networkList: ChainInfo[] = await getMChainsConfig() chains = networkList.map((chain) => { - if (chain.chainId.includes('euphoria')) { - return { - ...chain, - environment: 'euphoria', - } + return { + ...chain, + environment: chain.indexerDb, } - if (chain.chainId.includes('serenity')) { - return { - ...chain, - environment: 'serenity', - } - } - if (chain.chainId.includes('auradev')) { - return { - ...chain, - environment: 'auratestnet', - } - } - if (chain.chainId.includes('xstaxy')) { - return { - ...chain, - environment: 'xstaxy', - } - } - return chain }) // const { results = [] } = await getChainsConfig(GATEWAY_URL, { limit: 100 }) // chains = results @@ -68,4 +47,5 @@ export const emptyChainInfo: ChainInfo = { gasPrice: [], disabledWallets: [], features: [], + indexerDb: '' } diff --git a/src/services/index.ts b/src/services/index.ts index ddddf8efed..703c57d6a6 100644 --- a/src/services/index.ts +++ b/src/services/index.ts @@ -75,6 +75,7 @@ export function getMChainsConfig(): Promise { tokenImg: string rest: string coinConfig?: any[] + indexerDb: string }) => { return { transactionService: null, @@ -128,6 +129,7 @@ export function getMChainsConfig(): Promise { // 'SPENDING_LIMIT', ], coinConfig: e?.coinConfig || [], + indexerDb: e?.indexerDb } }, ) @@ -354,8 +356,7 @@ export async function getNumberOfDelegator(validatorId: any): Promise chain.chainId == currentChainInfo.chainId)?.rest + `${chainInfo.find((chain) => chain.chainId == currentChainInfo.chainId)?.rest }/cosmos/staking/v1beta1/validators/${validatorId}/delegations?pagination.count_total=true`, ) .then((res) => res.data)