Skip to content

Commit

Permalink
feat: special logic for native type of transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
wainola committed Sep 13, 2024
1 parent 040c9c3 commit 4d56ef0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/ExplorerTable/ExplorerTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ExplorerTable = {

const ExplorerTable: React.FC<ExplorerTable> = ({ state, sharedConfig }: ExplorerTable) => {
const { classes } = useStyles()
const NATIVE_RESOURCE_ID = "0x1000000000000000000000000000000000000000000000000000000000000000"

const renderTransferList = (transferData: Transfer[]): JSX.Element[] => {
return transferData.map((transfer: Transfer) => {
Expand Down Expand Up @@ -97,7 +98,9 @@ const ExplorerTable: React.FC<ExplorerTable> = ({ state, sharedConfig }: Explore
</TableCell>
<TableCell className={clsx(classes.row, classes.dataRow)}>
<span className={classes.amountInfo}>
<span>{type !== undefined ? formatTransferType(type as ResourceTypes) : "-"}</span>
<span>
{type !== undefined ? formatTransferType(resourceID !== NATIVE_RESOURCE_ID ? (type as ResourceTypes) : ResourceTypes.NATIVE) : "-"}
</span>
</span>
</TableCell>
<TableCell className={clsx(classes.row, classes.dataRow)}>
Expand Down
1 change: 1 addition & 0 deletions src/types/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export const enum ResourceTypes {
PERMISSIONED_GENERIC = "permissionedGeneric",
PERMISSIONLESS_GENERIC = "permissionlessGeneric",
SEMI_FUNGIBLE = "semifungible",
NATIVE = "native",
}

export type SharedConfig = {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/Helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ export const formatTransferType = (transferType: ResourceTypes): string => {
return "Generic"
case ResourceTypes.SEMI_FUNGIBLE:
return "Semifungible"
case ResourceTypes.NATIVE:
return "Native"
default:
return "Fungible"
}
Expand Down

0 comments on commit 4d56ef0

Please sign in to comment.