-
Notifications
You must be signed in to change notification settings - Fork 11
api.entities.Asset.NonFungible.Nft.Nft
api/entities/Asset/NonFungible/Nft.Nft
Class used to manage Nft functionality. Each NFT belongs to an NftCollection, which specifies the expected metadata values for each NFT
-
Entity
<NftUniqueIdentifiers
,HumanReadable
>↳
Nft
- exists
- getImageUri
- getMetadata
- getOwner
- getTokenUri
- isEqual
- isLocked
- redeem
- generateUuid
- unserialize
• collection: NftCollection
The NftCollection this NFT belongs to
api/entities/Asset/NonFungible/Nft.ts:50
• id: BigNumber
api/entities/Asset/NonFungible/Nft.ts:45
• uuid: string
▸ exists(): Promise
<boolean
>
Determine if the NFT exists on chain
Promise
<boolean
>
api/entities/Asset/NonFungible/Nft.ts:130
▸ getImageUri(): Promise
<null
| string
>
Get the conventional image URI for the NFT
This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
When creating a collection an issuer can either require per token images by specifying global metadata key imageUri
as a collection key or by
setting a collection base image URL by setting a value on the collection corresponding to the global metadata key baseImageUri
.
This method will return null
if the NFT issuer did not configure the collection according to the convention.
Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
The URI values can include {tokenId}
that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
-
https://example.com/nfts/{tokenId}/image.png
becomeshttps://example.com/nfts/1/image.png
-
https://example.com/nfts
becomeshttps://example.com/nfts/1
if used a base value, but remain unchanged as a local value
Promise
<null
| string
>
api/entities/Asset/NonFungible/Nft.ts:152
▸ getMetadata(): Promise
<NftMetadata
[]>
Get metadata associated with this token
Promise
<NftMetadata
[]>
api/entities/Asset/NonFungible/Nft.ts:98
▸ getOwner(): Promise
<null
| NumberedPortfolio
| DefaultPortfolio
>
Get owner of the NFT
Promise
<null
| NumberedPortfolio
| DefaultPortfolio
>
Note
This method returns null
if there is no existing holder for the token. This may happen even if the token has been redeemed/burned
api/entities/Asset/NonFungible/Nft.ts:213
▸ getTokenUri(): Promise
<null
| string
>
Get the conventional token URI for the NFT
This function will check for a token level value and a collection level value. Token level values take precedence over base values in case of a conflict.
When creating a collection an issuer can either require per token URL by specifying global metadata key tokenURI
as a collection key or by
setting a collection base URL by setting a value on the collection corresponding to the global metadata key baseTokenUri
on the collection.
This method will return null
if the NFT issuer did not configure the collection according to the convention.
Per token URIs provide the most flexibility, but require more chain space to store, increasing the POLYX fee to issue each token.
The URI values can include {tokenId}
that will be replaced with the NFTs ID. If a base URI does not specify this the ID will be appended onto the URL. Examples:
-
https://example.com/nfts/{tokenId}/info.json
becomeshttps://example.com/nfts/1/info.json
-
https://example.com/nfts
becomeshttps://example.com/nfts/1
if used a base value, but remain unchanged as a local value
Promise
<null
| string
>
api/entities/Asset/NonFungible/Nft.ts:188
▸ isEqual(entity
): boolean
Determine whether this Entity is the same as another one
Name | Type |
---|---|
entity |
Entity <unknown , unknown > |
boolean
▸ isLocked(): Promise
<boolean
>
Check if the NFT is locked in any settlement instruction
Promise
<boolean
>
Throws
if NFT has no owner (has been redeemed)
api/entities/Asset/NonFungible/Nft.ts:245
▸ redeem(args?
, opts?
): Promise
<GenericPolymeshTransaction
<void
, void
>>
Redeem (or "burns") the NFT, removing it from circulation
Name | Type |
---|---|
args? |
RedeemNftParams |
opts? |
ProcedureOpts |
Promise
<GenericPolymeshTransaction
<void
, void
>>
Note
this method is of type OptionalArgsProcedureMethod, which means you can call redeem.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
api/entities/Asset/NonFungible/Nft.ts:58
▸ Static
generateUuid<Identifiers
>(identifiers
): string
Generate the Entity's UUID from its identifying properties
Name |
---|
Identifiers |
Name | Type |
---|---|
identifiers |
Identifiers |
string
▸ Static
unserialize<Identifiers
>(serialized
): Identifiers
Unserialize a UUID into its Unique Identifiers
Name |
---|
Identifiers |
Name | Type | Description |
---|---|---|
serialized |
string |
UUID to unserialize |
Identifiers
Entities
- Account
- Asset
- Authorization Request
- Checkpoint
- Checkpoint Schedule
- Corporate Action
- Corporate Action Base
- Custom Permission Group
- Default Portfolio
- Default Trusted Claim Issuer
- Dividend Distribution
- Entity
- Identity
- Instruction
- Known Permission Group
- Metadata Entry
- Multi Sig Proposal
- Numbered Portfolio
- Offering
- Permission Group
- Portfolio
- Subsidies
- Subsidy
- Ticker Reservation
- Venue
- Authorizations
- Types