Skip to content

Commit

Permalink
Merge pull request #82 from dappforce/fix/hydradx
Browse files Browse the repository at this point in the history
Fix fetching of tokens balances for hydra dx
  • Loading branch information
olehmell authored Mar 21, 2024
2 parents e5c99e3 + 90d73cb commit 9983b95
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/services/assetRegistry/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const log = newLogger('AssetRegistry')
export const commonAssetRegistries = {
'assets.metadata': generateCommonAssetRegistry(['assets', 'metadata']),
'assetRegistry.metadataMap': generateCommonAssetRegistry(['assetRegistry', 'assetMetadataMap']),
'assetRegistry.assets': generateCommonAssetRegistry(['assetRegistry', 'assets']),
'ormlAssetRegistry.metadata': generateCommonAssetRegistry(['ormlAssetRegistry', 'metadata']),
'currencies.listenAssetsInfo': generateCommonAssetRegistry(
['currencies', 'listenAssetsInfo'],
Expand Down
4 changes: 2 additions & 2 deletions src/services/balances/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const customOrmlTokenGetter = asTypesGenerator<
},
'ormlTokens.accounts': async (api, { account, token }) => {
const [balances, locks] = await api.queryMulti([
[api.query.tokens.accounts, [account, token]],
[api.query.tokens.locks, [account, token]]
[api.query.ormlTokens.accounts, [account, token]],
[api.query.ormlTokens.locks, [account, token]]
])
return { balances: balances as any, locks: locks as any }
},
Expand Down
7 changes: 5 additions & 2 deletions src/services/prices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { FIVE_MINUTES } from '../constant/index'
import Cache from '../cache'

const cacheKey = 'prices'
const coingeckoUrl = 'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&price_change_percentage=24h'
const coingeckoUrl =
'https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&price_change_percentage=24h'

const pricesCache = new Cache<any>('prices', FIVE_MINUTES)

Expand All @@ -17,7 +18,9 @@ const fetchPrices = async (ids: string) => {
loading: true
})

const newPrices = await axiosGetRequest(`${coingeckoUrl}&ids=${ids}`, { timeout: 5000 })
const newPrices = ids
? await axiosGetRequest(`${coingeckoUrl}&ids=${ids}`, { timeout: 5000 })
: undefined

const newData = newPrices
? {
Expand Down
4 changes: 2 additions & 2 deletions src/services/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export async function getCachedChainProperties(chain: string): Promise<ChainProp
const customFetchAssetsRegistryByNetwork = {
interlay: getKintsugiAssetRegistry,
kintsugi: getKintsugiAssetRegistry,
basilisk: commonAssetRegistries['assetRegistry.metadataMap'],
hydradx: commonAssetRegistries['assetRegistry.metadataMap'],
basilisk: commonAssetRegistries['assetRegistry.assets'],
hydradx: commonAssetRegistries['assetRegistry.assets'],
astar: commonAssetRegistries['assets.metadata'],
shiden: commonAssetRegistries['assets.metadata'],
statemine: commonAssetRegistries['assets.metadata'],
Expand Down

0 comments on commit 9983b95

Please sign in to comment.