Class: Assets
api/client/Assets.Assets
Handles all Asset related functionality
Methods
createAsset
▸ createAsset(args
, opts?
): Promise
<GenericPolymeshTransaction
<FungibleAsset
, FungibleAsset
>>
Create an Asset
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
Parameters
Name | Type |
---|---|
args | CreateAssetWithTickerParams |
opts? | ProcedureOpts |
Returns
Promise
<GenericPolymeshTransaction
<FungibleAsset
, FungibleAsset
>>
createNftCollection
▸ createNftCollection(args
, opts?
): Promise
<GenericPolymeshTransaction
<NftCollection
, NftCollection
>>
Create an 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
Parameters
Name | Type |
---|---|
args | CreateNftCollectionParams |
opts? | ProcedureOpts |
Returns
Promise
<GenericPolymeshTransaction
<NftCollection
, NftCollection
>>
get
▸ get(paginationOpts?
): Promise
<ResultSet
<FungibleAsset
| NftCollection
>>
Retrieve all the Assets on chain
Note
supports pagination
Parameters
Name | Type |
---|---|
paginationOpts? | PaginationOptions |
Returns
Promise
<ResultSet
<FungibleAsset
| NftCollection
>>
getAsset
▸ getAsset(args
): Promise
<Asset
>
Retrieve a FungibleAsset or NftCollection
Note
getFungibleAsset
and getNftCollection
are similar to this method, but return a more specific type
Parameters
Name | Type |
---|---|
args | Object |
args.ticker | string |
Returns
Promise
<Asset
>
getAssets
▸ getAssets(args?
): Promise
<Asset
[]>
Retrieve all of the Assets owned by an Identity
Note
Assets with unreadable characters in their tickers will be left out
Parameters
Name | Type | Description |
---|---|---|
args? | Object | - |
args.owner | string | Identity | Identity representation or Identity ID as stored in the blockchain |
Returns
Promise
<Asset
[]>
getFungibleAsset
▸ getFungibleAsset(args
): Promise
<FungibleAsset
>
Retrieve a FungibleAsset
Parameters
Name | Type | Description |
---|---|---|
args | Object | - |
args.ticker | string | Asset ticker |
Returns
Promise
<FungibleAsset
>
getGlobalMetadataKeys
▸ getGlobalMetadataKeys(): Promise
<GlobalMetadataKey
[]>
Retrieve all the Asset Global Metadata on chain. This includes metadata id, name and specs
Returns
Promise
<GlobalMetadataKey
[]>
getNftCollection
▸ getNftCollection(args
): Promise
<NftCollection
>
Retrieve an NftCollection
Parameters
Name | Type | Description |
---|---|---|
args | Object | - |
args.ticker | string | NftCollection ticker |
Returns
Promise
<NftCollection
>
getTickerReservation
▸ getTickerReservation(args
): TickerReservation
Retrieve a Ticker Reservation
Parameters
Name | Type | Description |
---|---|---|
args | Object | - |
args.ticker | string | Asset ticker |
Returns
getTickerReservations
▸ getTickerReservations(args?
): Promise
<TickerReservation
[]>
Retrieve all the ticker reservations currently owned by an Identity. This doesn't include Assets that have already been launched
Note
reservations with unreadable characters in their tickers will be left out
Parameters
Name | Type | Description |
---|---|---|
args? | Object | - |
args.owner | string | Identity | defaults to the signing Identity |
Returns
Promise
<TickerReservation
[]>
isTickerAvailable
▸ isTickerAvailable(args
): Promise
<boolean
>
Check if a ticker hasn't been reserved
Note
can be subscribed to
Parameters
Name | Type |
---|---|
args | Object |
args.ticker | string |
Returns
Promise
<boolean
>
▸ isTickerAvailable(args
, callback
): Promise
<UnsubCallback
>
Parameters
Name | Type |
---|---|
args | Object |
args.ticker | string |
callback | SubCallback <boolean > |
Returns
Promise
<UnsubCallback
>
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
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
Parameters
Name | Type |
---|---|
args | ReserveTickerParams |
opts? | ProcedureOpts |
Returns
Promise
<GenericPolymeshTransaction
<TickerReservation
, TickerReservation
>>