Skip to main content
Version: 23.0.x

Class: Portfolio

api/entities/Portfolio.Portfolio

Represents a base Portfolio for a specific Identity in the Polymesh blockchain

Hierarchy

Properties

owner

owner: Identity

Identity of the Portfolio's owner

Defined in

api/entities/Portfolio/index.ts:79


uuid

uuid: string

Inherited from

Entity.uuid

Defined in

api/entities/Entity.ts:46

Methods

exists

Abstract exists(): Promise<boolean>

Determine whether this Entity exists on chain

Returns

Promise<boolean>

Inherited from

Entity.exists


getAssetBalances

getAssetBalances(args?): Promise<PortfolioBalance[]>

Retrieve the balances of all fungible assets in this Portfolio

Parameters

NameTypeDescription
args?Object-
args.assets(string | FungibleAsset)[]array of FungibleAssets (or tickers) for which to fetch balances (optional, all balances are retrieved if not passed)

Returns

Promise<PortfolioBalance[]>


getCollections

getCollections(args?): Promise<PortfolioCollection[]>

Retrieve the NFTs held in this portfolio

Parameters

NameType
args?Object
args.collections(string | NftCollection)[]

Returns

Promise<PortfolioCollection[]>


getCustodian

getCustodian(): Promise<Identity>

Retrieve the custodian Identity of this Portfolio

Note

if no custodian is set, the owner Identity is returned

Returns

Promise<Identity>


getTransactionHistory

getTransactionHistory(filters?): Promise<HistoricSettlement[]>

Retrieve a list of transactions where this portfolio was involved. Can be filtered using parameters

Note

uses the middlewareV2

Parameters

NameTypeDescription
filtersObject-
filters.account?stringAccount involved in the settlement
filters.ticker?stringticker involved in the transaction

Returns

Promise<HistoricSettlement[]>


isCustodiedBy

isCustodiedBy(args?): Promise<boolean>

Return whether an Identity is the Portfolio custodian

Parameters

NameTypeDescription
args?Object-
args.identitystring | Identityoptional, defaults to the signing Identity

Returns

Promise<boolean>


isEqual

isEqual(entity): boolean

Determine whether this Entity is the same as another one

Parameters

NameType
entityEntity<unknown, unknown>

Returns

boolean

Inherited from

Entity.isEqual


isOwnedBy

isOwnedBy(args?): Promise<boolean>

Return whether an Identity is the Portfolio owner

Parameters

NameTypeDescription
args?Object-
args.identitystring | Identitydefaults to the signing Identity

Returns

Promise<boolean>


moveFunds

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

Moves funds from this Portfolio to another one owned by the same Identity

Note

required role:

  • Portfolio Custodian

Note

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

Parameters

NameType
argsMoveFundsParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>


quitCustody

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

Returns the custody of the portfolio to the portfolio owner unilaterally

Note

required role:

  • Portfolio Custodian

Note

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

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<void, void>>


setCustodian

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

Send an invitation to an Identity to assign it as custodian for this Portfolio

Note

this will create an Authorization Request which has to be accepted by the targetIdentity. An 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

required role:

  • Portfolio Custodian

Note

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

Parameters

NameType
argsSetCustodianParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>


toHuman

toHuman(): HumanReadable

Return the Portfolio ID and owner DID

Returns

HumanReadable

Overrides

Entity.toHuman


generateUuid

Static generateUuid<Identifiers>(identifiers): string

Generate the Entity's UUID from its identifying properties

Type parameters

Name
Identifiers

Parameters

NameType
identifiersIdentifiers

Returns

string

Inherited from

Entity.generateUuid


unserialize

Static unserialize<Identifiers>(serialized): Identifiers

Unserialize a UUID into its Unique Identifiers

Type parameters

Name
Identifiers

Parameters

NameTypeDescription
serializedstringUUID to unserialize

Returns

Identifiers

Inherited from

Entity.unserialize