Class: Assets
Defined in: src/api/client/Assets.ts:56
Handles all Asset related functionality
Methods
createAsset()
createAsset(
args:CreateAssetWithTickerParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<FungibleAsset,FungibleAsset>>
Defined in: src/api/client/Assets.ts:113
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:121
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:410
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:233
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:242
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:263
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:311
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:323
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:451
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:504
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:362
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:370
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:219
Retrieve a Ticker Reservation
Parameters
| Parameter | Type | Description |
|---|---|---|
| { | ‐ |
|
| Asset ticker |
Returns
getTickerReservations()
getTickerReservations(
args?:object):Promise<TickerReservation[]>
Defined in: src/api/client/Assets.ts:178
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:130
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:142
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:499
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:105
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
transferFunds()
transferFunds(
args:TransferFundsParams,opts?:ProcedureOpts):Promise<GenericPolymeshTransaction<void,void>>
Defined in: src/api/client/Assets.ts:527
Transfer funds between two asset holders (Account or Portfolio) owned by same identity.
Parameters
| Parameter | Type |
|---|---|
| |
|
Returns
Promise<GenericPolymeshTransaction<void, void>>
Note
When from account is of type account and the caller is the subsidizer of from account, there should be allowance available for transfer and for each transfer said amount is decremented.
Note
To transfer between asset holders owned by separate DID use settlement instructions
Note
this method is of type ProcedureMethod, which means you can call transferFunds.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it