api.entities.Asset.Fungible - PolymeshAssociation/polymesh-sdk GitHub Wiki

@polymeshassociation/polymesh-sdk / api/entities/Asset/Fungible

api/entities/Asset/Fungible

Classes

FungibleAsset

Defined in: api/entities/Asset/Fungible/index.ts:65

Class used to manage all Fungible Asset functionality

Extends

Properties

assetHolders

assetHolders: AssetHolders

Defined in: api/entities/Asset/Fungible/index.ts:67

checkpoints

checkpoints: Checkpoints

Defined in: api/entities/Asset/Fungible/index.ts:71

compliance

compliance: Compliance

Defined in: api/entities/Asset/Base/BaseAsset.ts:73

Inherited from

BaseAsset.compliance

corporateActions

corporateActions: CorporateActions

Defined in: api/entities/Asset/Fungible/index.ts:72

documents

documents: Documents

Defined in: api/entities/Asset/Base/BaseAsset.ts:74

Inherited from

BaseAsset.documents

id

id: string

Defined in: api/entities/Asset/Base/BaseAsset.ts:81

Unique ID of the Asset in UUID format

Inherited from

BaseAsset.id

issuance

issuance: Issuance

Defined in: api/entities/Asset/Fungible/index.ts:68

metadata

metadata: Metadata

Defined in: api/entities/Asset/Base/BaseAsset.ts:75

Inherited from

BaseAsset.metadata

offerings

offerings: Offerings

Defined in: api/entities/Asset/Fungible/index.ts:70

permissions

permissions: Permissions

Defined in: api/entities/Asset/Base/BaseAsset.ts:76

Inherited from

BaseAsset.permissions

settlements

settlements: FungibleSettlements

Defined in: api/entities/Asset/Fungible/index.ts:66

transferRestrictions

transferRestrictions: TransferRestrictions

Defined in: api/entities/Asset/Fungible/index.ts:69

uuid

uuid: string

Defined in: api/entities/Entity.ts:46

Inherited from

BaseAsset.uuid

Accessors

evmAddress
Get Signature

get evmAddress(): string

Defined in: api/entities/Asset/Fungible/index.ts:174

The address of the fungible precompile through which EVM contracts and Ethereum tooling can call this Asset, i.e. 0x<Asset ID>00080000, EIP-55 checksummed

Note

every fungible Asset is exposed automatically, with nothing to deploy or register. Calls run the same checks as the equivalent extrinsic, so compliance, transfer restrictions and freezes still apply

Returns

string

rawId
Get Signature

get rawId(): string

Defined in: api/entities/Asset/Base/BaseAsset.ts:88

Unique ID of the Asset in hex format

Note

Although UUID format is the usual representation of asset IDs, generic polkadot/substrate tools usually expect it in hex format

Returns

string

Inherited from

BaseAsset.rawId

Methods

addRequiredMediators()

addRequiredMediators(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:253

Add required mediators. Mediators must approve any trades involving the asset

Parameters
Parameter Type
args AssetMediatorParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call addRequiredMediators.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.addRequiredMediators

approveAllowance()

approveAllowance(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:398

Approve spender account allowance for transferring this Asset

Parameters
Parameter Type
args ApproveAllowanceParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

Replaces any existing allowance for this if an allowance already exists for spender account for this Asset. Setting amount to 0 revokes the allowance.

On every spend transaction, the spender account's allowance will be decremented by the amount transferred.

Note

this method is of type ProcedureMethod, which means you can call approveAllowance.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

controllerTransfer()

controllerTransfer(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:245

Force a transfer from a given Portfolio or Account, by default to the caller's default Portfolio

Parameters
Parameter Type
args ControllerTransferParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

from Polymesh 8.1.1 destination can be any Account or Portfolio, such as the rightful owner of seized tokens. Before 8.1.1 it must be the signing Account or one of the signing Identity's Portfolios

Note

a destination the caller does not control must not require receiver affirmation for the Asset, since a forced transfer cannot affirm on its behalf

Note

the transfer ignores holder freezes, so it can seize tokens an agent has frozen

Note

this method is of type ProcedureMethod, which means you can call controllerTransfer.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

createdAt()

createdAt(): Promise<EventIdentifier | null>

Defined in: api/entities/Asset/Fungible/index.ts:184

Retrieve the identifier data (block number, date and event index) of the event that was emitted when the token was created

Returns

Promise<EventIdentifier | null>

Note

uses the middlewareV2

Note

there is a possibility that the data is not ready by the time it is requested. In that case, null is returned

currentFundingRound()
Call Signature

currentFundingRound(): Promise<string | null>

Defined in: api/entities/Asset/Base/BaseAsset.ts:540

Retrieve the Asset's funding round

Returns

Promise<string | null>

Promise that resolves to the current funding round name or null if not set

Inherited from

BaseAsset.currentFundingRound

Call Signature

currentFundingRound(callback): Promise<UnsubCallback>

Defined in: api/entities/Asset/Base/BaseAsset.ts:550

Retrieve the Asset's funding round

Parameters
Parameter Type Description
callback SubCallback<string | null> Callback function that receives funding round updates
Returns

Promise<UnsubCallback>

Promise that resolves to an unsubscribe function

Note

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

Inherited from

BaseAsset.currentFundingRound

details()
Call Signature

details(): Promise<AssetDetails>

Defined in: api/entities/Asset/Base/BaseAsset.ts:373

Retrieve the Asset's data

Returns

Promise<AssetDetails>

Promise that resolves to the Asset details

Inherited from

BaseAsset.details

Call Signature

details(callback): Promise<UnsubCallback>

Defined in: api/entities/Asset/Base/BaseAsset.ts:383

Retrieve the Asset's data

Parameters
Parameter Type Description
callback SubCallback<AssetDetails> Callback function that receives Asset details updates
Returns

Promise<UnsubCallback>

Promise that resolves to an unsubscribe function

Note

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

Inherited from

BaseAsset.details

exists()

exists(): Promise<boolean>

Defined in: api/entities/Asset/Fungible/index.ts:371

Determine whether this FungibleAsset exists on chain

Returns

Promise<boolean>

Overrides

BaseAsset.exists

freeze()

freeze(opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:222

Freeze transfers of the Asset

Parameters
Parameter Type
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type NoArgsProcedureMethod, which means you can call freeze.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.freeze

freezeHolder()

freezeHolder(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:239

Freeze one holder of the Asset, an Account or a Portfolio, so that it cannot send any of it. Unlike freeze, every other holder can still transfer

Parameters
Parameter Type
args FreezeHolderParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

freezing applies to the holder given, not to its Identity. To stop an investor moving the Asset, freeze each Account and Portfolio that holds it

Note

the holder can still receive the Asset, and a controller transfer can still take it from the holder, which is how an agent seizes from a frozen holder

Note

requires Polymesh 8.1.1 or later, and throws NotSupported on an older chain

Note

this method is of type ProcedureMethod, which means you can call freezeHolder.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.freezeHolder

freezeTokens()

freezeTokens(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:155

Freeze more of a holder's tokens, on top of whatever is already frozen. The holder cannot send frozen tokens

Parameters
Parameter Type
args FrozenTokensParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

relative: freezing 100 twice leaves 200 frozen

Throws

if the frozen amount would exceed the holder's balance

Note

requires Polymesh 8.1.1 or later, and throws NotSupported on an older chain

Note

this method is of type ProcedureMethod, which means you can call freezeTokens.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

getAllowance()

getAllowance(args): Promise<BigNumber>

Defined in: api/entities/Asset/Fungible/index.ts:440

Retrieve the amount of allowance for a spender account as approved by owner

Parameters
Parameter Type
args { owner: AccountLike; spender: AccountLike; }
args.owner AccountLike
args.spender AccountLike
Returns

Promise<BigNumber>

getAllowances()

getAllowances(args): Promise<AssetAllowance[]>

Defined in: api/entities/Asset/Fungible/index.ts:410

Retrieve every allowance an Account has approved for this Asset — each spender and what it may transfer

Parameters
Parameter Type Description
args { owner: AccountLike; } -
args.owner AccountLike the Account whose approvals to read
Returns

Promise<AssetAllowance[]>

Note

not paginated: allowances are keyed by owner, spender and Asset in that order, so the Asset can only be filtered after reading. Bounded by how many approvals the owner has made across all Assets

getIdentifiers()
Call Signature

getIdentifiers(): Promise<SecurityIdentifier[]>

Defined in: api/entities/Asset/Base/BaseAsset.ts:282

Retrieve the Asset's identifiers list

Returns

Promise<SecurityIdentifier[]>

Promise that resolves to the list of security identifiers

Inherited from

BaseAsset.getIdentifiers

Call Signature

getIdentifiers(callback?): Promise<UnsubCallback>

Defined in: api/entities/Asset/Base/BaseAsset.ts:292

Retrieve the Asset's identifiers list

Parameters
Parameter Type Description
callback? SubCallback<SecurityIdentifier[]> Callback function that receives identifier updates
Returns

Promise<UnsubCallback>

Promise that resolves to an unsubscribe function

Note

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

Inherited from

BaseAsset.getIdentifiers

getIssuedInFundingRound()

getIssuedInFundingRound(fundingRound): Promise<BigNumber>

Defined in: api/entities/Asset/Base/BaseAsset.ts:586

Retrieve the total amount of the Asset issued in the given funding round

Parameters
Parameter Type Description
fundingRound string name of the funding round to query
Returns

Promise<BigNumber>

Inherited from

BaseAsset.getIssuedInFundingRound

getOperationHistory()

getOperationHistory(): Promise<HistoricAgentOperation[]>

Defined in: api/entities/Asset/Fungible/index.ts:254

Retrieve this Asset's Operation History

Returns

Promise<HistoricAgentOperation[]>

Note

Operations are grouped by the agent Identity who performed them

Note

uses the middlewareV2

getRequiredMediators()

getRequiredMediators(): Promise<Identity[]>

Defined in: api/entities/Asset/Base/BaseAsset.ts:485

Get required Asset mediators. These Identities must approve any Instruction involving the asset

Returns

Promise<Identity[]>

Inherited from

BaseAsset.getRequiredMediators

getTransactionHistory()

getTransactionHistory(opts): Promise<ResultSet<HistoricAssetTransaction>>

Defined in: api/entities/Asset/Fungible/index.ts:289

Retrieve this Asset's transaction History

Parameters
Parameter Type
opts MiddlewarePaginationOptions & object
Returns

Promise<ResultSet<HistoricAssetTransaction>>

Note

uses the middlewareV2

getVenueFilteringDetails()

getVenueFilteringDetails(): Promise<VenueFilteringDetails>

Defined in: api/entities/Asset/Base/BaseAsset.ts:505

Get venue filtering details

Returns

Promise<VenueFilteringDetails>

Inherited from

BaseAsset.getVenueFilteringDetails

investorCount()

investorCount(): Promise<BigNumber>

Defined in: api/entities/Asset/Fungible/index.ts:212

Retrieve the amount of unique investors that hold this Asset

Returns

Promise<BigNumber>

isEqual()

isEqual(entity): boolean

Defined in: api/entities/Entity.ts:61

Determine whether this Entity is the same as another one

Parameters
Parameter Type
entity Entity<unknown, unknown>
Returns

boolean

Inherited from

BaseAsset.isEqual

isFrozen()
Call Signature

isFrozen(): Promise<boolean>

Defined in: api/entities/Asset/Base/BaseAsset.ts:330

Check whether transfers are frozen for the Asset

Returns

Promise<boolean>

Promise that resolves to true if transfers are frozen, false otherwise

Inherited from

BaseAsset.isFrozen

Call Signature

isFrozen(callback): Promise<UnsubCallback>

Defined in: api/entities/Asset/Base/BaseAsset.ts:340

Check whether transfers are frozen for the Asset

Parameters
Parameter Type Description
callback SubCallback<boolean> Callback function that receives frozen 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

Inherited from

BaseAsset.isFrozen

linkTicker()

linkTicker(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:266

Link ticker to the asset

Parameters
Parameter Type
args LinkTickerToAssetParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

if ticker is already reserved, then required role:

  • Ticker Owner
Note

this method is of type ProcedureMethod, which means you can call linkTicker.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.linkTicker

modify()

modify(args, opts?): Promise<GenericPolymeshTransaction<Asset, Asset>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:129

Modify some properties of the Asset

Parameters
Parameter Type
args ModifyAssetParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<Asset, Asset>>

Throws

if the passed values result in no changes being made to the Asset

Throws

if the passed assetType is not a known asset type or a custom type that has not been created on the chain

Throws

if trying to modify an NftCollection's assetType

Note

this method is of type ProcedureMethod, which means you can call modify.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.modify

redeem()

redeem(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:207

Redeem (burn) an amount of this Asset's tokens

Parameters
Parameter Type
args RedeemTokensParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call redeem.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

removeRequiredMediators()

removeRequiredMediators(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:258

Remove required mediators

Parameters
Parameter Type
args AssetMediatorParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call removeRequiredMediators.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.removeRequiredMediators

setFrozenTokens()

setFrozenTokens(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:145

Set how many of a holder's tokens are frozen, replacing whatever amount was frozen before. The holder cannot send frozen tokens

Parameters
Parameter Type
args FrozenTokensParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

absolute: setting 100 twice leaves 100 frozen. Use freezeTokens and unfreezeTokens to adjust the amount instead. Passing 0 unfreezes every token

Note

the chain does not check this against the holder's balance, so more can be frozen than the holder holds, leaving nothing it can send

Note

freezing applies to the holder given, not to its Identity

Note

a controller transfer can still take frozen tokens

Note

requires Polymesh 8.1.1 or later, and throws NotSupported on an older chain

Note

this method is of type ProcedureMethod, which means you can call setFrozenTokens.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

setVenueFiltering()

setVenueFiltering(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:110

Enable/disable venue filtering for this Asset and/or set allowed/disallowed venues

Parameters
Parameter Type
args SetVenueFilteringParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type ProcedureMethod, which means you can call setVenueFiltering.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.setVenueFiltering

toHuman()

toHuman(): string

Defined in: api/entities/Asset/Base/BaseAsset.ts:629

Return the BaseAsset's ID

Returns

string

Inherited from

BaseAsset.toHuman

transferOwnership()

transferOwnership(args, opts?): Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:105

Transfer ownership of the Asset to another Identity. This generates an authorization request that must be accepted by the recipient

Parameters
Parameter Type
args TransferAssetOwnershipParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Note

the signing Identity must be an agent of this Asset holding asset.acceptAssetOwnershipTransfer permission — granted by TxGroup.AdvancedAssetManagement or PermissionGroupType.Full. The chain checks this when the target accepts, against the Identity that created the Authorization Request, so an offer sent without it can never be accepted

Note

this will create Authorization Request which has to be accepted by the target Identity. An api/entities/Account!Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Note

this method is of type ProcedureMethod, which means you can call transferOwnership.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.transferOwnership

unfreeze()

unfreeze(opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:227

Unfreeze transfers of the Asset

Parameters
Parameter Type
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

this method is of type NoArgsProcedureMethod, which means you can call unfreeze.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.unfreeze

unfreezeHolder()

unfreezeHolder(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:248

Unfreeze a holder of the Asset that was frozen with freezeHolder

Parameters
Parameter Type
args FreezeHolderParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

leaves any frozen part of the holder's balance frozen. See unfreezeTokens

Note

requires Polymesh 8.1.1 or later, and throws NotSupported on an older chain

Note

this method is of type ProcedureMethod, which means you can call unfreezeHolder.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.unfreezeHolder

unfreezeTokens()

unfreezeTokens(args, opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Fungible/index.ts:164

Release some of a holder's frozen tokens

Parameters
Parameter Type
args FrozenTokensParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

relative: this reduces the frozen amount by amount

Throws

if amount exceeds what is frozen

Note

requires Polymesh 8.1.1 or later, and throws NotSupported on an older chain

Note

this method is of type ProcedureMethod, which means you can call unfreezeTokens.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

unlinkTicker()

unlinkTicker(opts?): Promise<GenericPolymeshTransaction<void, void>>

Defined in: api/entities/Asset/Base/BaseAsset.ts:275

Unlink ticker from the Asset

Parameters
Parameter Type
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

Only the ticker owner is allowed to unlink the Asset

Throws

if there is no ticker to unlink

Note

this method is of type NoArgsProcedureMethod, which means you can call unlinkTicker.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it

Inherited from

BaseAsset.unlinkTicker

generateUuid()

static generateUuid<Identifiers>(identifiers): string

Defined in: api/entities/Entity.ts:14

Generate the Entity's UUID from its identifying properties

Type Parameters
Type Parameter
Identifiers
Parameters
Parameter Type Description
identifiers Identifiers -
Returns

string

Inherited from

BaseAsset.generateUuid

unserialize()

static unserialize<Identifiers>(serialized): Identifiers

Defined in: api/entities/Entity.ts:23

Unserialize a UUID into its Unique Identifiers

Type Parameters
Type Parameter
Identifiers
Parameters
Parameter Type Description
serialized string UUID to unserialize
Returns

Identifiers

Inherited from

BaseAsset.unserialize

⚠️ **GitHub.com Fallback** ⚠️