Class: Assets
api/client/Assets.Assets
Handles all Asset related functionality
Methods
createAsset
▸ createAsset(args, opts?): Promise<GenericPolymeshTransaction<FungibleAsset, FungibleAsset>>
Create an Asset
Parameters
| Name | Type |
|---|---|
args | CreateAssetWithTickerParams |
opts? | ProcedureOpts |
Returns
Promise<GenericPolymeshTransaction<FungibleAsset, FungibleAsset>>
Note
if ticker is already reserved, then required role:
- Ticker Owner
Note
this method is of type ProcedureMethod, which means you can call createAsset.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
Defined in
createNftCollection
▸ createNftCollection(args, opts?): Promise<GenericPolymeshTransaction<NftCollection, NftCollection>>
Create an NftCollection
Parameters
| Name | Type |
|---|---|
args | CreateNftCollectionParams |
opts? | ProcedureOpts |
Returns
Promise<GenericPolymeshTransaction<NftCollection, NftCollection>>
Note
if ticker is already reserved, then required role:
- Ticker Owner
Note
this method is of type ProcedureMethod, which means you can call createNftCollection.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
Defined in
get
▸ get(paginationOpts?): Promise<ResultSet<Asset>>
Retrieve all the Assets on chain
Parameters
| Name | Type |
|---|---|
paginationOpts? | PaginationOptions |
Returns
Note
supports pagination
Defined in
getAsset
▸ getAsset(args): Promise<Asset>
Retrieve an Asset using its ticker.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | The registered ticker symbol of the Asset |
Returns
Promise<Asset>
A generic Asset instance. Use getFungibleAsset or getNftCollection for more specific types.
Remarks
This method will look up the assetId for the given ticker.
Defined in
▸ getAsset(args): Promise<Asset>
Retrieve an Asset using its assetId.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.assetId | string | The unique Asset ID on-chain |
Returns
Promise<Asset>
A generic Asset instance. Use getFungibleAsset or getNftCollection for more specific types.
Defined in
getAssets
▸ getAssets(args?): Promise<Asset[]>
Retrieve all Assets owned by a given Identity.
Parameters
| Name | Type | Description |
|---|---|---|
args? | Object | Optional configuration object |
args.owner | string | Identity | The owner of the assets, provided as an Identity instance or a string DID |
Returns
Promise<Asset[]>
A list of Asset instances owned by the specified Identity
Remarks
You may provide either an Identity instance or a string representing a DID.
Assets with invalid or unreadable ticker values will be excluded from the result.
Defined in
getFungibleAsset
▸ getFungibleAsset(args): Promise<FungibleAsset>
Retrieve a FungibleAsset using its asset ID.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.assetId | string | Unique ID of the Fungible Asset |
args.skipExistsCheck? | boolean | If true, skips existence validation before returning the asset |
Returns
Promise<FungibleAsset>
The FungibleAsset instance matching the provided assetId
Remarks
By default, the method checks whether the asset exists and throws if it does not.
Throws
If no matching FungibleAsset exists and skipExistsCheck is not set
Defined in
▸ getFungibleAsset(args): Promise<FungibleAsset>
Retrieve a FungibleAsset using its ticker.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | The ticker symbol of the Fungible Asset |
Returns
Promise<FungibleAsset>
The FungibleAsset instance matching the provided ticker
Remarks
The ticker must exist and be associated with a valid asset.
Throws
If no matching ticker exists or is not associated with a FungibleAsset
Defined in
getGlobalMetadataKeys
▸ getGlobalMetadataKeys(): Promise<GlobalMetadataKey[]>
Retrieve all global asset metadata keys registered on-chain.
Returns
Promise<GlobalMetadataKey[]>
A list of global Asset metadata keys
Remarks
Each metadata key includes its ID, name, and specification.
Defined in
getNextCustomAssetTypeId
▸ getNextCustomAssetTypeId(): Promise<BigNumber>
Gets the next custom Asset type Id
Returns
Promise<BigNumber>
Defined in
getNftCollection
▸ getNftCollection(args): Promise<NftCollection>
Retrieve an NftCollection using its ticker.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | The ticker symbol of the NftCollection |
Returns
Promise<NftCollection>
The NftCollection instance matching the provided ticker
Remarks
The ticker must exist and be associated with a valid collection.
Throws
If no matching ticker exists or is not associated with an NftCollection
Defined in
▸ getNftCollection(args): Promise<NftCollection>
Retrieve an NftCollection using its asset ID.
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.assetId | string | Unique ID of the NftCollection |
args.skipExistsCheck? | boolean | If true, skips existence validation before returning the collection |
Returns
Promise<NftCollection>
The NftCollection instance matching the provided assetId
Remarks
By default, the method checks whether the collection exists and throws if it does not.
Throws
If no matching NftCollection exists and skipExistsCheck is not set
Defined in
getTickerReservation
▸ getTickerReservation(args): TickerReservation
Retrieve a Ticker Reservation
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | Asset ticker |
Returns
Defined in
getTickerReservations
▸ getTickerReservations(args?): Promise<TickerReservation[]>
Retrieve all ticker reservations owned by a given Identity.
Parameters
| Name | Type | Description |
|---|---|---|
args? | Object | Method parameters |
args.owner | string | Identity | The Identity or string DID whose reservations to return. Defaults to the signing Identity if omitted. |
Returns
Promise<TickerReservation[]>
A list of active TickerReservation instances
Remarks
Only active reservations are returned. Assets that have already been created are excluded.
Note
Reservations with unreadable ticker characters are excluded.
Defined in
isTickerAvailable
▸ isTickerAvailable(args): Promise<boolean>
Check if a ticker hasn't been reserved
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | The ticker symbol to check |
Returns
Promise<boolean>
Note
can be subscribed to, if connected to node using a web socket
Defined in
▸ isTickerAvailable(args, callback): Promise<UnsubCallback>
Check if a ticker hasn't been reserved (with subscription)
Parameters
| Name | Type | Description |
|---|---|---|
args | Object | Configuration object |
args.ticker | string | The ticker symbol to check |
callback | SubCallback<boolean> | Callback function to receive updates |
Returns
Promise<UnsubCallback>
Note
can be subscribed to, if connected to node using a web socket
Defined in
registerCustomAssetType
▸ registerCustomAssetType(args, opts?): Promise<GenericPolymeshTransaction<BigNumber, BigNumber>>
Register a custom asset type
Parameters
| Name | Type |
|---|---|
args | RegisterCustomAssetTypeParams |
opts? | ProcedureOpts |
Returns
Promise<GenericPolymeshTransaction<BigNumber, BigNumber>>
Note
this method is of type ProcedureMethod, which means you can call registerCustomAssetType.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
Defined in
reserveTicker
▸ reserveTicker(args, opts?): Promise<GenericPolymeshTransaction<TickerReservation, TickerReservation>>
Reserve a ticker symbol under the ownership of the signing Identity to later use in the creation of an Asset. The ticker will expire after a set amount of time, after which other users can reserve it
Parameters
| Name | Type |
|---|---|
args | ReserveTickerParams |
opts? | ProcedureOpts |
Returns
Promise<GenericPolymeshTransaction<TickerReservation, TickerReservation>>
Note
this method is of type ProcedureMethod, which means you can call reserveTicker.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it