Skip to content

Commit

Permalink
fix(address): fix the nrc721 not displayed in the assets list
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl-L committed Apr 12, 2024
1 parent 334cf05 commit 65c2cf6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pages/Address/AddressAssetComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const AddressNRC721Comp = ({ account, isRGBPP }: { account: NRC721; isRGB
<AddressAssetComp
isRGBPP={isRGBPP ?? false}
href={`/nft-collections/${collection?.typeHash}`}
property={!symbol ? '?' : `#${amount}`}
property={!symbol ? '?' : `#${sliceNftName(amount, 20)}`}
name={!symbol ? '?' : sliceNftName(symbol)}
isUnverified={!symbol}
udtLabel="NRC 721"
Expand Down
3 changes: 3 additions & 0 deletions src/pages/Address/AddressComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import {
AddressSporeComp,
AddressSudtComp,
AddressXudtComp,
AddressNRC721Comp,
} from './AddressAssetComp'

enum AssetInfo {
Expand Down Expand Up @@ -267,6 +268,8 @@ export const AddressOverviewCard: FC<{ address: Address }> = ({ address }) => {

case 'm_nft_token':
return <AddressMNFTComp account={udt} key={udt.symbol + udt.udtType + udt.amount} />
case 'nrc_721_token':
return <AddressNRC721Comp account={udt} key={udt.symbol + udt.udtType + udt.amount} />
default:
return null
}
Expand Down
3 changes: 2 additions & 1 deletion src/utils/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,5 @@ export const handleBigNumberFloor = (value: BigNumber | string | number, decimal
return `${parseFloorDecimal(bigValue, decimal)}`
}

export const sliceNftName = (name?: string) => (name && name.length > 32 ? `${name.slice(0, 32)}...` : name)
export const sliceNftName = (name?: string, maxLength = 32) =>
name && name.length > maxLength ? `${name.slice(0, maxLength)}...` : name

0 comments on commit 65c2cf6

Please sign in to comment.