Skip to main content
Version: 23.0.x

Class: NftCollection

api/entities/Asset/NonFungible/NftCollection.NftCollection

Class used to manage NFT functionality

Hierarchy

Properties

compliance

compliance: Compliance

Inherited from

BaseAsset.compliance

Defined in

api/entities/Asset/Base/BaseAsset.ts:54


did

did: string

Identity ID of the Asset (used for Claims)

Inherited from

BaseAsset.did

Defined in

api/entities/Asset/Base/BaseAsset.ts:62


documents

documents: Documents

Inherited from

BaseAsset.documents

Defined in

api/entities/Asset/Base/BaseAsset.ts:55


metadata

metadata: Metadata

Inherited from

BaseAsset.metadata

Defined in

api/entities/Asset/Base/BaseAsset.ts:56


permissions

permissions: Permissions

Inherited from

BaseAsset.permissions

Defined in

api/entities/Asset/Base/BaseAsset.ts:57


settlements

settlements: NonFungibleSettlements

Defined in

api/entities/Asset/NonFungible/NftCollection.ts:50


ticker

ticker: string

ticker of the Asset

Inherited from

BaseAsset.ticker

Defined in

api/entities/Asset/Base/BaseAsset.ts:67


uuid

uuid: string

Inherited from

BaseAsset.uuid

Defined in

api/entities/Entity.ts:46

Methods

collectionKeys

collectionKeys(): Promise<CollectionKey[]>

Retrieve the metadata that defines the NFT collection. Every issue call for this collection must provide a value for each element returned

Note

Each NFT must have an entry for each value, it should comply with the spec. In other words, the SDK only validates the presence of metadata keys, additional validation should be used when issuing

Returns

Promise<CollectionKey[]>


createdAt

createdAt(): Promise<null | EventIdentifier>

Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created

Note

uses the middlewareV2

Note

there is a possibility that the data is not ready by the time it is requested. In that case, null is returned

Returns

Promise<null | EventIdentifier>


details

details(): Promise<AssetDetails>

Retrieve the NftCollection's data

Note

can be subscribed to

Returns

Promise<AssetDetails>

Overrides

BaseAsset.details

details(callback): Promise<UnsubCallback>

Parameters

NameType
callbackSubCallback<AssetDetails>

Returns

Promise<UnsubCallback>

Overrides

BaseAsset.details


exists

exists(): Promise<boolean>

Determine whether this NftCollection exists on chain

Returns

Promise<boolean>

Overrides

BaseAsset.exists


freeze

freeze(opts?): Promise<GenericPolymeshTransaction<void, void>>

Freeze transfers of the Asset

Note

this method is of type NoArgsProcedureMethod, which means you can call freeze.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Inherited from

BaseAsset.freeze


getCollectionId

getCollectionId(): Promise<BigNumber>

Returns the collection's on chain numeric ID. Used primarily to access NFT specific storage values

Returns

Promise<BigNumber>


getIdentifiers

getIdentifiers(): Promise<SecurityIdentifier[]>

Retrieve the Asset's identifiers list

Note

can be subscribed to

Returns

Promise<SecurityIdentifier[]>

Inherited from

BaseAsset.getIdentifiers

getIdentifiers(callback?): Promise<UnsubCallback>

Parameters

NameType
callback?SubCallback<SecurityIdentifier[]>

Returns

Promise<UnsubCallback>

Inherited from

BaseAsset.getIdentifiers


getNft

getNft(args): Promise<Nft>

Get an NFT belonging to this collection

Throws

if the given NFT does not exist

Parameters

NameType
argsObject
args.idBigNumber

Returns

Promise<Nft>


investorCount

investorCount(): Promise<BigNumber>

Retrieve the amount of unique investors that hold this Nft

Returns

Promise<BigNumber>


isEqual

isEqual(entity): boolean

Determine whether this Entity is the same as another one

Parameters

NameType
entityEntity<unknown, unknown>

Returns

boolean

Inherited from

BaseAsset.isEqual


isFrozen

isFrozen(): Promise<boolean>

Check whether transfers are frozen for the Asset

Note

can be subscribed to

Returns

Promise<boolean>

Inherited from

BaseAsset.isFrozen

isFrozen(callback): Promise<UnsubCallback>

Parameters

NameType
callbackSubCallback<boolean>

Returns

Promise<UnsubCallback>

Inherited from

BaseAsset.isFrozen


issue

issue(args, opts?): Promise<GenericPolymeshTransaction<Nft, Nft>>

Issues a new NFT for the collection

Note

Each NFT requires metadata for each value returned by collectionKeys. The SDK and chain only validate the presence of these fields. Additional validation may be needed to ensure each value complies with the specification.

Note

this method is of type ProcedureMethod, which means you can call issue.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Parameters

NameType
argsIssueNftParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Nft, Nft>>


toHuman

toHuman(): string

Return the NftCollection's ticker

Returns

string

Inherited from

BaseAsset.toHuman


transferOwnership

transferOwnership(args, opts?): Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Transfer ownership of the Asset to another Identity. This generates an authorization request that must be accepted by the recipient

Note

this will create Authorization Request which has to be accepted by the target Identity. An Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Note

this method is of type ProcedureMethod, which means you can call transferOwnership.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Parameters

NameType
argsTransferAssetOwnershipParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Inherited from

BaseAsset.transferOwnership


unfreeze

unfreeze(opts?): Promise<GenericPolymeshTransaction<void, void>>

Unfreeze transfers of the Asset

Note

this method is of type NoArgsProcedureMethod, which means you can call unfreeze.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>

Inherited from

BaseAsset.unfreeze


generateUuid

Static generateUuid<Identifiers>(identifiers): string

Generate the Entity's UUID from its identifying properties

Type parameters

Name
Identifiers

Parameters

NameType
identifiersIdentifiers

Returns

string

Inherited from

BaseAsset.generateUuid


unserialize

Static unserialize<Identifiers>(serialized): Identifiers

Unserialize a UUID into its Unique Identifiers

Type parameters

Name
Identifiers

Parameters

NameTypeDescription
serializedstringUUID to unserialize

Returns

Identifiers

Inherited from

BaseAsset.unserialize