diff --git a/src/components/ExplorerTable/ExplorerTable.tsx b/src/components/ExplorerTable/ExplorerTable.tsx index c4043a0..48c788a 100644 --- a/src/components/ExplorerTable/ExplorerTable.tsx +++ b/src/components/ExplorerTable/ExplorerTable.tsx @@ -43,7 +43,7 @@ const ExplorerTable: React.FC = ({ state, sharedConfig }: Explore const fromDomainInfo = getDomainData(fromDomainId, sharedConfig) const toDomainInfo = getDomainData(toDomainId, sharedConfig) - const formatedFee = getFormatedFee(fee, fromDomainInfo!) + const formatedFee = getFormatedFee(fee, resourceID, fromDomainInfo!) const fromDomainType = fromDomainInfo?.type diff --git a/src/utils/Helpers.tsx b/src/utils/Helpers.tsx index 7e235d8..3420b81 100644 --- a/src/utils/Helpers.tsx +++ b/src/utils/Helpers.tsx @@ -176,17 +176,21 @@ export const formatDistanceDate = (timestamp: string): string => { } } -export const getFormatedFee = (fee: Transfer["fee"] | string, domain: SharedConfigDomain): string => { +export const getFormatedFee = (fee: Transfer["fee"] | string, resourceID: string, domain: SharedConfigDomain): string => { let formatedFee = "No fee" - const { type } = domain + const { type, resources } = domain if (type === DomainTypes.SUBSTRATE) { formatedFee = "50 PHA" } - if (typeof fee !== "string" && domain) { - const { nativeTokenDecimals, nativeTokenSymbol } = domain - formatedFee = `${ethers.formatUnits(fee.amount, nativeTokenDecimals).toString()} ${nativeTokenSymbol.toUpperCase()}` + const resource = resources.find(resource => { + return resource.resourceId === resourceID + }) + + if (typeof fee !== "string" && domain && resource) { + const { decimals, symbol } = resource + formatedFee = `${ethers.formatUnits(fee.amount, decimals).toString()} ${symbol.toUpperCase()}` } return formatedFee