api.entities.Portfolio - PolymeshAssociation/polymesh-sdk GitHub Wiki

@polymeshassociation/polymesh-sdk / api/entities/Portfolio

api/entities/Portfolio

Classes

abstract Portfolio

Defined in: api/entities/Portfolio/index.ts:76

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

Extends

Extended by

Properties

owner

owner: Identity

Defined in: api/entities/Portfolio/index.ts:90

Identity of the Portfolio's owner

uuid

uuid: string

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

Inherited from

Entity.uuid

Methods

exists()

abstract exists(): Promise<boolean>

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

Determine whether this Entity exists on chain

Returns

Promise<boolean>

Inherited from

Entity.exists

getAssetBalances()

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

Defined in: api/entities/Portfolio/index.ts:231

Retrieve the balances of all fungible assets in this Portfolio

Parameters
Parameter Type Description
args? { assets: (string | FungibleAsset)[]; } -
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[]>

Defined in: api/entities/Portfolio/index.ts:310

Retrieve the NFTs held in this portfolio

Parameters
Parameter Type Description
args? { collections: (string | NftCollection)[]; } -
args.collections? (string | NftCollection)[] array of NftCollection (or tickers) for which to fetch holdings (optional, all holdings are retrieved if not passed)
Returns

Promise<PortfolioCollection[]>

getCustodian()

getCustodian(): Promise<Identity>

Defined in: api/entities/Portfolio/index.ts:427

Retrieve the custodian Identity of this Portfolio

Returns

Promise<Identity>

Note

if no custodian is set, the owner Identity is returned

getTransactionHistory()

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

Defined in: api/entities/Portfolio/index.ts:469

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

Parameters
Parameter Type Description
filters { account?: string; assetId?: string; ticker?: string; } -
filters.account? string Account involved in the settlement
filters.assetId? string -
filters.ticker? string ticker involved in the transaction
Returns

Promise<HistoricSettlement[]>

Note

uses the middlewareV2

isAssetPreApproved()

isAssetPreApproved(asset): Promise<boolean>

Defined in: api/entities/Portfolio/index.ts:168

Returns whether or not this Portfolio has pre-approved a particular asset

Parameters
Parameter Type
asset string | BaseAsset
Returns

Promise<boolean>

isCustodiedBy()

isCustodiedBy(args?): Promise<boolean>

Defined in: api/entities/Portfolio/index.ts:154

Return whether an Identity is the Portfolio custodian

Parameters
Parameter Type Description
args? { identity: string | Identity; } -
args.identity? string | Identity optional, defaults to the signing Identity
Returns

Promise<boolean>

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

Entity.isEqual

isOwnedBy()

isOwnedBy(args?): Promise<boolean>

Defined in: api/entities/Portfolio/index.ts:141

Return whether an Identity is the Portfolio owner

Parameters
Parameter Type Description
args? { identity: string | Identity; } -
args.identity? string | Identity defaults to the signing Identity
Returns

Promise<boolean>

moveFunds()

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

Defined in: api/entities/Portfolio/index.ts:402

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

Parameters
Parameter Type
args MoveFundsParams
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

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

preApproveAsset()

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

Defined in: api/entities/Portfolio/index.ts:415

Pre-approves receiving an asset for this Portfolio. Receiving this asset in a settlement will not require manual affirmation

Parameters
Parameter Type
args { asset: string | BaseAsset; }
args.asset string | BaseAsset
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

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

preApprovedAssets()

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

Defined in: api/entities/Portfolio/index.ts:193

Returns a list of all assets this Portfolio has pre-approved. These assets will not require affirmation when being received in settlements

Parameters
Parameter Type
paginationOpts? PaginationOptions
Returns

Promise<ResultSet<Asset>>

quitCustody()

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

Defined in: api/entities/Portfolio/index.ts:410

Returns the custody of the portfolio to the portfolio owner unilaterally

Parameters
Parameter Type
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

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

removeAssetPreApproval()

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

Defined in: api/entities/Portfolio/index.ts:420

Removes pre-approval of an asset for this Portfolio

Parameters
Parameter Type
args { asset: string | BaseAsset; }
args.asset string | BaseAsset
opts? ProcedureOpts
Returns

Promise<GenericPolymeshTransaction<void, void>>

Note

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

toHuman()

toHuman(): HumanReadable

Defined in: api/entities/Portfolio/index.ts:544

Return the Portfolio ID and owner DID

Returns

HumanReadable

Overrides

Entity.toHuman

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

Entity.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

Entity.unserialize

Interfaces

HumanReadable

Defined in: api/entities/Portfolio/index.ts:66

Properties

did

did: string

Defined in: api/entities/Portfolio/index.ts:67

id?

optional id?: string

Defined in: api/entities/Portfolio/index.ts:68


UniqueIdentifiers

Defined in: api/entities/Portfolio/index.ts:61

Properties

did

did: string

Defined in: api/entities/Portfolio/index.ts:62

id?

optional id?: BigNumber

Defined in: api/entities/Portfolio/index.ts:63

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