Skip to content

Commit

Permalink
change to chain registry util function
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaaawscodepipelinedeploy committed Apr 22, 2024
1 parent dd37354 commit e9cee19
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/asset-list/hooks/queries/useAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@chain-registry/utils'
import { useGeckoPrices } from './useGeckoPrices';
import BigNumber from "bignumber.js";
import { PrettyAsset } from "@/components";

import { assets, chains } from '@/utils/local-chain-registry'

Expand Down Expand Up @@ -67,7 +68,33 @@ export const useAssets = (chainName: string) => {

}, [chainName, allBalances, priceMap])

<<<<<<< HEAD
const isLoading = [isAllBalanceLoading, isGeckoPricesLading].some(isLoading => isLoading === true)
=======
let displayAmount = '0'
if (assetBySymbol) {
displayAmount = convertBaseUnitToDisplayUnit(assets, symbol, amount)
}

const prettyChainName = getChainNameByDenom(assets, denom) || ''

return {
...asset,
symbol,
logoUrl: asset?.logo_URIs?.png || asset?.logo_URIs?.svg,
prettyChainName,
displayAmount,
dollarValue,
amount,
denom,
};
}).sort((a, b) => BigNumber(a.displayAmount).lte(b.displayAmount) ? 1 : -1)
}
return []
}, [topTokens, chainName, allBalances, priceMap])

const isLoading = [isAllBalanceLoading, isTopTokensLoading, isGeckoPricesLading].some(isLoading => isLoading === true)
>>>>>>> 2e6b1810 (change to chain registry util function)

return { data, isLoading, refetch: refetchAllBalances }
}

0 comments on commit e9cee19

Please sign in to comment.