Skip to content

Commit

Permalink
fix: non fungible label (#160)
Browse files Browse the repository at this point in the history
* fix: non fungible label

* chore: removing amount if transfer is non fungible
  • Loading branch information
wainola authored Feb 22, 2024
1 parent e3d38e9 commit 2056a92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export type ExplorerContext = {

export const enum ResourceTypes {
FUNGIBLE = "fungible",
NON_FUNGIBLE = "nonFungible",
NON_FUNGIBLE = "nonfungible",
PERMISSIONED_GENERIC = "permissionedGeneric",
PERMISSIONLESS_GENERIC = "permissionlessGeneric",
}
Expand Down
21 changes: 13 additions & 8 deletions src/utils/Helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,18 @@ export const renderAmountValue = (
amount: string,
resourceID: string,
fromDomainInfo: SharedConfigDomain | undefined,
): string => {
if (type !== ResourceTypes.PERMISSIONLESS_GENERIC && resourceID !== "") {
): string | undefined => {
if (type === ResourceTypes.PERMISSIONLESS_GENERIC) {
return "Contract call"
}

if (type === ResourceTypes.FUNGIBLE && resourceID !== "") {
return `${amount} ${getResourceInfo(resourceID, fromDomainInfo!)}`
}

return "Contract call"
if (type === ResourceTypes.NON_FUNGIBLE && resourceID !== "") {
return `${getResourceInfo(resourceID, fromDomainInfo!)}`
}
}

export const renderFormatedConvertedAmount = (type: ResourceTypes, usdValue: number): string => {
Expand Down Expand Up @@ -317,16 +323,15 @@ export const accountLinks = (type: DomainTypes, accountId: string, domainExplore
}

export const filterTransfers = (transfers: Transfer[], sharedConfig: SharedConfigDomain[]) => {

return transfers.filter((transfer) => {
return transfers.filter(transfer => {
const { fromDomainId, toDomainId } = transfer

const fromDomainInfo = getDomainData(fromDomainId, sharedConfig)
const toDomainInfo = getDomainData(toDomainId, sharedConfig)
if(!fromDomainInfo || !toDomainInfo) {
if (!fromDomainInfo || !toDomainInfo) {
return
}

return transfer
})
}

0 comments on commit 2056a92

Please sign in to comment.