Skip to content

Commit

Permalink
fix chainId
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangndm3139 committed Jun 3, 2024
1 parent d6ab1ea commit b291505
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
28 changes: 4 additions & 24 deletions src/config/cache/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,4 +47,5 @@ export const emptyChainInfo: ChainInfo = {
gasPrice: [],
disabledWallets: [],
features: [],
indexerDb: ''
}
5 changes: 3 additions & 2 deletions src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export function getMChainsConfig(): Promise<MChainInfo[]> {
tokenImg: string
rest: string
coinConfig?: any[]
indexerDb: string
}) => {
return {
transactionService: null,
Expand Down Expand Up @@ -128,6 +129,7 @@ export function getMChainsConfig(): Promise<MChainInfo[]> {
// 'SPENDING_LIMIT',
],
coinConfig: e?.coinConfig || [],
indexerDb: e?.indexerDb
}
},
)
Expand Down Expand Up @@ -354,8 +356,7 @@ export async function getNumberOfDelegator(validatorId: any): Promise<IResponse<
const { chainInfo } = await getGatewayUrl()
return axios
.get(
`${
chainInfo.find((chain) => 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)
Expand Down

0 comments on commit b291505

Please sign in to comment.