Skip to content

api.client.Assets.Assets

prashantasdeveloper edited this page May 1, 2025 · 55 revisions

Class: Assets

api/client/Assets.Assets

Handles all Asset related functionality

Table of contents

Methods

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

api/client/Assets.ts:113


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

api/client/Assets.ts:126


get

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

Retrieve all the Assets on chain

Parameters

Name Type
paginationOpts? PaginationOptions

Returns

Promise<ResultSet<Asset>>

Note

supports pagination

Defined in

api/client/Assets.ts:386


getAsset

getAsset(args): Promise<Asset>

Retrieve a FungibleAsset or NftCollection

Parameters

Name Type
args Object
args.ticker string

Returns

Promise<Asset>

Note

getFungibleAsset and getNftCollection are similar to this method, but return a more specific type

Defined in

api/client/Assets.ts:221

getAsset(args): Promise<Asset>

Parameters

Name Type
args Object
args.assetId string

Returns

Promise<Asset>

Defined in

api/client/Assets.ts:222


getAssets

getAssets(args?): Promise<Asset[]>

Retrieve all of the Assets owned by an Identity

Parameters

Name Type Description
args? Object -
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

Defined in

api/client/Assets.ts:243


getFungibleAsset

getFungibleAsset(args): Promise<FungibleAsset>

Retrieve a FungibleAsset

Parameters

Name Type Description
args Object -
args.assetId string Unique Id of the Fungible Asset (for spec version 6.x, this is same as ticker)
args.skipExistsCheck? boolean when true, method will not check if the Asset exists

Returns

Promise<FungibleAsset>

Defined in

api/client/Assets.ts:292

getFungibleAsset(args): Promise<FungibleAsset>

Parameters

Name Type
args Object
args.skipExistsCheck? boolean
args.ticker string

Returns

Promise<FungibleAsset>

Defined in

api/client/Assets.ts:298


getGlobalMetadataKeys

getGlobalMetadataKeys(): Promise<GlobalMetadataKey[]>

Retrieve all the Asset Global Metadata on chain. This includes metadata id, name and specs

Returns

Promise<GlobalMetadataKey[]>

Defined in

api/client/Assets.ts:427


getNextCustomAssetTypeId

getNextCustomAssetTypeId(): Promise<BigNumber>

Gets the next custom Asset type Id

Returns

Promise<BigNumber>

Defined in

api/client/Assets.ts:485


getNftCollection

getNftCollection(args): Promise<NftCollection>

Retrieve an NftCollection

Parameters

Name Type Description
args Object -
args.skipExistsCheck? boolean when true, method will not check if the NftCollection exists
args.ticker string NftCollection ticker

Returns

Promise<NftCollection>

Defined in

api/client/Assets.ts:340

getNftCollection(args): Promise<NftCollection>

Parameters

Name Type
args Object
args.assetId string
args.skipExistsCheck? boolean

Returns

Promise<NftCollection>

Defined in

api/client/Assets.ts:346


getTickerReservation

getTickerReservation(args): TickerReservation

Retrieve a Ticker Reservation

Parameters

Name Type Description
args Object -
args.ticker string Asset ticker

Returns

TickerReservation

Defined in

api/client/Assets.ts:209


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

Parameters

Name Type Description
args? Object -
args.owner string | Identity defaults to the signing Identity

Returns

Promise<TickerReservation[]>

Note

reservations with unreadable characters in their tickers will be left out

Defined in

api/client/Assets.ts:170


isTickerAvailable

isTickerAvailable(args): Promise<boolean>

Check if a ticker hasn't been reserved

Parameters

Name Type
args Object
args.ticker string

Returns

Promise<boolean>

Note

can be subscribed to, if connected to node using a web socket

Defined in

api/client/Assets.ts:135

isTickerAvailable(args, callback): Promise<UnsubCallback>

Parameters

Name Type
args Object
args.ticker string
callback SubCallback<boolean>

Returns

Promise<UnsubCallback>

Defined in

api/client/Assets.ts:136


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

api/client/Assets.ts:478


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

Defined in

api/client/Assets.ts:100

Clone this wiki locally