From 3926419fd19486ee8da79a92237b55e6241d13c1 Mon Sep 17 00:00:00 2001 From: AJ Webb Date: Wed, 1 Nov 2023 05:28:25 -1000 Subject: [PATCH] Addtional handling for unknown denoms --- .../Components/AccountTables/Components/AccountAssets.tsx | 4 +++- src/Pages/Assets/Components/AssetsList.js | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Pages/Accounts/Components/AccountTables/Components/AccountAssets.tsx b/src/Pages/Accounts/Components/AccountTables/Components/AccountAssets.tsx index a1954e4c..92794ae0 100644 --- a/src/Pages/Accounts/Components/AccountTables/Components/AccountAssets.tsx +++ b/src/Pages/Accounts/Components/AccountTables/Components/AccountAssets.tsx @@ -29,7 +29,9 @@ export const AccountAssets = () => { const tableData = accountAssets.map((a) => ({ ...a, displayDenom: assetMetadata.find((md) => md.base === a.denom)?.display, - exponent: assetMetadata.find((md) => md.base === a.denom)?.denomUnits?.[1].exponent, + exponent: + assetMetadata.find((md) => md.base === a.denom)?.denomUnits?.find((du) => !!du.exponent) + ?.exponent || 0, })); // Table header values in order diff --git a/src/Pages/Assets/Components/AssetsList.js b/src/Pages/Assets/Components/AssetsList.js index f44a92bf..77e1187c 100644 --- a/src/Pages/Assets/Components/AssetsList.js +++ b/src/Pages/Assets/Components/AssetsList.js @@ -14,10 +14,12 @@ const AssetsList = () => { getAssetsList: getTableData, } = useAssets(); - const tableData = assets.map(a => ({ + const tableData = assets.map((a) => ({ ...a, - displayDenom: assetMetadata.find(md => md.base === a.marker)?.display, - exponent: assetMetadata.find(md => md.base === a.marker)?.denomUnits[1].exponent, + displayDenom: assetMetadata.find((md) => md.base === a.marker)?.display, + exponent: + assetMetadata.find((md) => md.base === a.marker)?.denomUnits?.find((du) => !!du.exponent) + ?.exponent || 0, })); useEffect(() => {