Skip to main content
Version: 30.0.x

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

ParameterType

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


createNftCollection()

createNftCollection(args: CreateNftCollectionParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<NftCollection, NftCollection>>

Defined in: src/api/client/Assets.ts:121

Create an NftCollection

Parameters

ParameterType

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


get()

get(paginationOpts?: PaginationOptions): Promise<ResultSet<Asset>>

Defined in: src/api/client/Assets.ts:410

Retrieve all the Assets on chain

Parameters

ParameterType

paginationOpts?

PaginationOptions

Returns

Promise<ResultSet<Asset>>

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
ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

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
ParameterTypeDescription

args

{ assetId: string; }

args.assetId

string

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

ParameterTypeDescription

args?

{ owner: string | Identity; }

args.owner?

string | Identity

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
ParameterTypeDescription

args

{ assetId: string; skipExistsCheck?: boolean; }

args.assetId

string

Unique identifier of the Fungible Asset

args.skipExistsCheck?

boolean

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
ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

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
ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

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
ParameterTypeDescription

args

{ assetId: string; skipExistsCheck?: boolean; }

args.assetId

string

Unique identifier of the NftCollection (for spec version 6.x, this is same as ticker)

args.skipExistsCheck?

boolean

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

ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

Asset ticker

Returns

TickerReservation


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

ParameterTypeDescription

args?

{ owner: string | Identity; }

args.owner?

string | Identity

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
ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

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
ParameterTypeDescription

args

{ ticker: string; }

args.ticker

string

Ticker symbol to check availability for

callback

SubCallback<boolean>

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

ParameterType

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


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

ParameterType

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


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

ParameterType

args

TransferFundsParams

opts?

ProcedureOpts

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