Skip to content

Commit

Permalink
Merge pull request #394 from aura-nw/euphoria
Browse files Browse the repository at this point in the history
Euphoria
  • Loading branch information
harisato authored Jun 3, 2024
2 parents 3fd94cd + f6dd675 commit 8bffb2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
31 changes: 5 additions & 26 deletions src/config/cache/chains.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,18 @@
import { ChainInfo, RPC_AUTHENTICATION } from '@gnosis.pm/safe-react-gateway-sdk'
import { getMChainsConfig } from '../../services'
import { MChainInfo, getMChainsConfig } from '../../services'

// Cache is required as loading Redux store directly is an anit-pattern
let chains: ChainInfo[] = []

export const getChains = (): ChainInfo[] => chains

export const loadChains = async () => {
const networkList: ChainInfo[] = await getMChainsConfig()
const networkList: MChainInfo[] = 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('aura')) {
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
6 changes: 4 additions & 2 deletions src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type _ChainInfo = {
explorer: string
defaultGasPrice: string
defaultGas: GasPriceDefault[]
indexerDb: string
}

type GasPriceDefault = {
Expand Down Expand Up @@ -75,6 +76,7 @@ export function getMChainsConfig(): Promise<MChainInfo[]> {
tokenImg: string
rest: string
coinConfig?: any[]
indexerDb: string
}) => {
return {
transactionService: null,
Expand Down Expand Up @@ -128,6 +130,7 @@ export function getMChainsConfig(): Promise<MChainInfo[]> {
// 'SPENDING_LIMIT',
],
coinConfig: e?.coinConfig || [],
indexerDb: e?.indexerDb
}
},
)
Expand Down Expand Up @@ -354,8 +357,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 8bffb2c

Please sign in to comment.