Class: Assets
Defined in: src/api/client/Assets.ts:54
Handles all Asset related functionality
Methods
createAsset()
createAsset(
args:CreateAssetWithTickerParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<FungibleAsset,FungibleAsset>>
Defined in: src/api/client/Assets.ts:104
Create an Asset
Parameters
| Parameter | Type |
|---|---|
| |
|
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
createNftCollection()
createNftCollection(
args:CreateNftCollectionParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<NftCollection,NftCollection>>
Defined in: src/api/client/Assets.ts:112
Create an NftCollection
Parameters
| Parameter | Type |
|---|---|
| |
|
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
get()
get(
paginationOpts?:PaginationOptions):Promise<ResultSet<Asset>>
Defined in: src/api/client/Assets.ts:401
Retrieve all the Assets on chain
Parameters
| Parameter | Type |
|---|---|
|
Returns
Note
supports pagination
getAsset()
Call Signature
getAsset(
args:object):Promise<Asset>
Defined in: src/api/client/Assets.ts:224
Retrieve a FungibleAsset or NftCollection by ticker
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique ticker of the Asset |
Returns
Promise<Asset>
Note
getFungibleAsset and getNftCollection are similar to this method, but return a more specific type
Call Signature
getAsset(
args:object):Promise<Asset>
Defined in: src/api/client/Assets.ts:233
Retrieve a FungibleAsset or NftCollection by Asset ID
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique identifier of the Asset |
Returns
Promise<Asset>
Note
getFungibleAsset and getNftCollection are similar to this method, but return a more specific type
getAssets()
getAssets(
args?:object):Promise<Asset[]>
Defined in: src/api/client/Assets.ts:254
Retrieve all of the Assets owned by an Identity
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Identity representation or Identity ID as stored in the blockchain |
Returns
Promise<Asset[]>
Note
Assets with unreadable characters in their tickers will be left out
getFungibleAsset()
Call Signature
getFungibleAsset(
args:object):Promise<FungibleAsset>
Defined in: src/api/client/Assets.ts:302
Retrieve a FungibleAsset by Asset ID
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique identifier of the Fungible Asset |
|
| When true, method will not check if Asset exists before returning instance. Defaults to false |
Returns
Promise<FungibleAsset>
Call Signature
getFungibleAsset(
args:object):Promise<FungibleAsset>
Defined in: src/api/client/Assets.ts:314
Retrieve a FungibleAsset by ticker
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique ticker of the Fungible Asset |
Returns
Promise<FungibleAsset>
Note
The Asset must exist on chain to be retrieved by ticker
getGlobalMetadataKeys()
getGlobalMetadataKeys():
Promise<GlobalMetadataKey[]>
Defined in: src/api/client/Assets.ts:442
Retrieve all the Asset Global Metadata on chain. This includes metadata id, name and specs
Returns
Promise<GlobalMetadataKey[]>
getNextCustomAssetTypeId()
getNextCustomAssetTypeId():
Promise<BigNumber>
Defined in: src/api/client/Assets.ts:495
Gets the next custom Asset type Id
Returns
Promise<BigNumber>
getNftCollection()
Call Signature
getNftCollection(
args:object):Promise<NftCollection>
Defined in: src/api/client/Assets.ts:353
Retrieve an NftCollection by ticker
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique ticker of the NftCollection |
Returns
Promise<NftCollection>
Note
The NftCollection must exist on chain to be retrieved by ticker
Call Signature
getNftCollection(
args:object):Promise<NftCollection>
Defined in: src/api/client/Assets.ts:361
Retrieve an NftCollection by Asset ID
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Unique identifier of the NftCollection (for spec version 6.x, this is same as ticker) |
|
| When true, method will not check if the NftCollection exists before returning instance. Defaults to false |
Returns
Promise<NftCollection>
getTickerReservation()
getTickerReservation(
args:object):TickerReservation
Defined in: src/api/client/Assets.ts:210
Retrieve a Ticker Reservation
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Asset ticker |
Returns
getTickerReservations()
getTickerReservations(
args?:object):Promise<TickerReservation[]>
Defined in: src/api/client/Assets.ts:169
Retrieve all the ticker reservations currently owned by an Identity. This doesn't include tickers already associated with an Asset
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| The identity whose reservations to return. Defaults to the signing Identity if omitted. |
Returns
Promise<TickerReservation[]>
A list of active TickerReservation instances
Note
Reservations with unreadable ticker characters are excluded.
isTickerAvailable()
Call Signature
isTickerAvailable(
args:object):Promise<boolean>
Defined in: src/api/client/Assets.ts:121
Check if a ticker hasn't been reserved
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Ticker symbol to check availability for |
Returns
Promise<boolean>
Promise that resolves to true if ticker is available, false otherwise
Call Signature
isTickerAvailable(
args:object,callback:SubCallback<boolean>):Promise<UnsubCallback>
Defined in: src/api/client/Assets.ts:133
Check if a ticker hasn't been reserved (with subscription support)
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Ticker symbol to check availability for |
|
| Callback function that receives availability status updates |
Returns
Promise<UnsubCallback>
Promise that resolves to an unsubscribe function
Note
can be subscribed to, if connected to node using a web socket
registerCustomAssetType()
registerCustomAssetType(
args:RegisterCustomAssetTypeParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<BigNumber,BigNumber>>
Defined in: src/api/client/Assets.ts:490
Register a custom asset type
Parameters
| Parameter | Type |
|---|---|
| |
|
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
reserveTicker()
reserveTicker(
args:ReserveTickerParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<TickerReservation,TickerReservation>>
Defined in: src/api/client/Assets.ts:96
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
| Parameter | Type |
|---|---|
| |
|
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