Skip to main content
Version: v28.0.x

Class: Instruction

api/entities/Instruction.Instruction

Represents a settlement Instruction to be executed on a certain Venue

Hierarchy

Properties

id

id: BigNumber

Unique identifier number of the instruction

Defined in

api/entities/Instruction/index.ts:127


uuid

uuid: string

Inherited from

Entity.uuid

Defined in

api/entities/Entity.ts:46

Methods

affirm

affirm(args?, opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Affirm this instruction (authorize)

Parameters

NameType
args?AffirmInstructionParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

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

Defined in

api/entities/Instruction/index.ts:900


affirmAsMediator

affirmAsMediator(args?, opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Affirm this instruction as a mediator (authorize)

Parameters

NameType
args?AffirmAsMediatorParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

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

Defined in

api/entities/Instruction/index.ts:934


details

details(): Promise<InstructionDetails>

Retrieve information specific to this Instruction

Returns

Promise<InstructionDetails>

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • instruction is not yet processed by the middleware (when querying from middleware)
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:546


executeManually

executeManually(args?, opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Executes an Instruction either of type SettleManual or a Failed instruction

Parameters

NameType
args?ExecuteManualInstructionParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

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

Defined in

api/entities/Instruction/index.ts:954


exists

exists(): Promise<boolean>

Determine whether this Instruction exists on chain (or existed and was pruned)

Returns

Promise<boolean>

Overrides

Entity.exists

Defined in

api/entities/Instruction/index.ts:387


generateOffChainAffirmationReceipt

generateOffChainAffirmationReceipt(args): Promise<OffChainAffirmationReceipt>

Generate an offchain affirmation receipt for a specific leg and UID

Parameters

NameTypeDescription
argsObject-
args.legIdBigNumberindex of the offchain leg in this instruction
args.metadata?string(optional) metadata to be associated with the receipt
args.signer?string | Account(optional) Signer to be used to generate receipt signature. Defaults to signing Account associated with the SDK
args.signerKeyRingType?SignerKeyRingType(optional) keyring type of the signer. Defaults to 'Sr25519'
args.uidBigNumberUID of the receipt

Returns

Promise<OffChainAffirmationReceipt>

Defined in

api/entities/Instruction/index.ts:1309


getAffirmations

getAffirmations(paginationOpts?): Promise<ResultSet<InstructionAffirmation>>

Retrieve every authorization generated by this Instruction (status and authorizing Identity)

Parameters

NameType
paginationOpts?PaginationOptions | MiddlewarePaginationOptions

Returns

Promise<ResultSet<InstructionAffirmation>>

Note

supports pagination.

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:582


getInvolvedPortfolios

getInvolvedPortfolios(args): Promise<(DefaultPortfolio | NumberedPortfolio)[]>

Retrieve all the involved portfolios in this Instruction where the given identity is a custodian of

Parameters

NameType
argsObject
args.didstring

Returns

Promise<(DefaultPortfolio | NumberedPortfolio)[]>

Defined in

api/entities/Instruction/index.ts:1028


getLegs

getLegs(paginationOpts?): Promise<ResultSet<Leg>>

Retrieve all legs of this Instruction

Parameters

NameType
paginationOpts?PaginationOptions | MiddlewarePaginationOptions

Returns

Promise<ResultSet<Leg>>

Note

supports pagination

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • instruction is not yet processed by the middleware (when querying from middleware)
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:771


getLockedInfo

getLockedInfo(): Promise<InstructionLockedInfo>

Retrieve whether the Instruction is locked for execution on chain

Returns

Promise<InstructionLockedInfo>

Defined in

api/entities/Instruction/index.ts:299


getMediators

getMediators(): Promise<MediatorAffirmation[]>

Returns the mediators for the Instruction, along with their affirmation status

Returns

Promise<MediatorAffirmation[]>

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • instruction is not yet processed by the middleware (when querying from middleware)
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:1082


getOffChainAffirmationForLeg

getOffChainAffirmationForLeg(args): Promise<AffirmationStatus>

Returns affirmation status for a specific offchain leg in this Instruction

Parameters

NameTypeDescription
argsObject-
args.legIdBigNumberindex of the leg whose affirmation status is to be fetched

Returns

Promise<AffirmationStatus>

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • legId provided is not an off-chain leg
  • instruction is not yet processed by the middleware (when querying from middleware)
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:1227


getOffChainAffirmations

getOffChainAffirmations(): Promise<OffChainAffirmation[]>

Returns affirmation statuses for offchain legs in this Instruction

Returns

Promise<OffChainAffirmation[]>

Note

uses middleware (if available) to retrieve information, otherwise directly queries from the chain

Throws

if

  • instruction does not exists
  • instruction is not yet processed by the middleware (when querying from middleware)
  • instruction is executed/rejected and was pruned from chain (when querying from chain)

Defined in

api/entities/Instruction/index.ts:1162


getPendingAffirmationCount

getPendingAffirmationCount(): Promise<BigNumber>

Get the number of affirmations pending before instruction can be executed

Returns

Promise<BigNumber>

Note

The count is returned as 0 for pruned instructions as well

Defined in

api/entities/Instruction/index.ts:257


getStatus

getStatus(): Promise<InstructionStatusResult>

Retrieve current status of this Instruction

Returns

Promise<InstructionStatusResult>

Note

uses the middlewareV2

Defined in

api/entities/Instruction/index.ts:816


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

Defined in

api/entities/Entity.ts:61


isExecuted

isExecuted(): Promise<boolean>

Retrieve whether the Instruction has already been executed and pruned from the chain.

Returns

Promise<boolean>

Defined in

api/entities/Instruction/index.ts:226


isPending

isPending(): Promise<boolean>

Retrieve whether the Instruction is still pending on chain

Returns

Promise<boolean>

Defined in

api/entities/Instruction/index.ts:278


lockForExecution

lockForExecution(opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Locks an Instruction of type SettleAfterLock for execution. Only a mediator of the instruction can lock the instruction.

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

An Instruction can only be locked if

  • it has been affirmed by all parties
  • it is pending or has failed at least one time
  • all mediator affirmations are valid
  • all assets are in allowed venue list
  • all senders have the right amount of assets being transferred
  • all senders and receivers are compliant and have valid CDD claims
  • all assets' statistics are still valid
  • there are no frozen assets

Throws

if any of the above conditions are not met

Note

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

Defined in

api/entities/Instruction/index.ts:976


onStatusChange

onStatusChange(callback): Promise<UnsubCallback>

Retrieve current status of the Instruction. This can be subscribed to know if instruction fails

Parameters

NameType
callbackSubCallback<InstructionStatus>

Returns

Promise<UnsubCallback>

Note

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

Note

current status as Executed means that the Instruction has been executed/rejected and pruned from the chain.

Defined in

api/entities/Instruction/index.ts:353


reject

reject(args?, opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Reject this instruction

Parameters

NameType
args?RejectInstructionParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

reject on SettleOnAffirmation will execute the settlement and it will fail immediately.

Note

reject on SettleOnBlock behaves just like unauthorize

Note

reject on SettleManual behaves just like unauthorize

Note

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

Defined in

api/entities/Instruction/index.ts:890


rejectAsMediator

rejectAsMediator(opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Reject this instruction as a mediator

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

reject on SettleOnAffirmation will execute the settlement and it will fail immediately.

Note

reject on SettleOnBlock behaves just like unauthorize

Note

reject on SettleManual behaves just like unauthorize

Note

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

Defined in

api/entities/Instruction/index.ts:924


toHuman

toHuman(): string

Return the Instruction's ID

Returns

string

Overrides

Entity.toHuman

Defined in

api/entities/Instruction/index.ts:1021


withdraw

withdraw(args?, opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Withdraw affirmation from this instruction (unauthorize)

Parameters

NameType
args?WithdrawInstructionParams
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

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

Defined in

api/entities/Instruction/index.ts:910


withdrawAsMediator

withdrawAsMediator(opts?): Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Withdraw affirmation from this instruction as a mediator (unauthorize)

Parameters

NameType
opts?ProcedureOpts

Returns

Promise<GenericPolymeshTransaction<Instruction, Instruction>>

Note

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

Defined in

api/entities/Instruction/index.ts:944


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

Defined in

api/entities/Entity.ts:14


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

Defined in

api/entities/Entity.ts:23