api.entities.Instruction - PolymeshAssociation/polymesh-sdk GitHub Wiki
@polymeshassociation/polymesh-sdk / api/entities/Instruction
Defined in: api/entities/Instruction/index.ts:117
Represents a settlement Instruction to be executed on a certain Venue
-
Entity<UniqueIdentifiers,string>
id:
BigNumber
Defined in: api/entities/Instruction/index.ts:131
Unique identifier number of the instruction
uuid:
string
Defined in: api/entities/Entity.ts:46
affirm(
args?,opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:949
Affirm this instruction (authorize)
| Parameter | Type |
|---|---|
args? |
AffirmInstructionParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
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
affirmAsMediator(
args?,opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:963
Affirm this instruction as a mediator (authorize)
| Parameter | Type |
|---|---|
args? |
AffirmAsMediatorParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
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
details():
Promise<InstructionDetails>
Defined in: api/entities/Instruction/index.ts:589
Retrieve information specific to this Instruction
Promise<InstructionDetails>
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
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)
executeManually(
args?,opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:968
Executes an Instruction either of type SettleManual or a Failed instruction
| Parameter | Type |
|---|---|
args? |
ExecuteManualInstructionParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
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
exists():
Promise<boolean>
Defined in: api/entities/Instruction/index.ts:430
Determine whether this Instruction exists on chain (or existed and was pruned)
Promise<boolean>
generateOffChainAffirmationReceipt(
args):Promise<OffChainAffirmationReceipt>
Defined in: api/entities/Instruction/index.ts:1348
Generate an offchain affirmation receipt for a specific leg and UID
| Parameter | Type | Description |
|---|---|---|
args |
{ expiresAt: Date; legId: BigNumber; metadata?: string; signer?: string | Account; signerKeyRingType?: SignerKeyRingType; uid: BigNumber; } |
- |
args.expiresAt |
Date |
timestamp at which the receipt expires and can no longer be used to affirm |
args.legId |
BigNumber |
index 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.uid |
BigNumber |
UID of the receipt |
Promise<OffChainAffirmationReceipt>
getAffirmations(
paginationOpts?):Promise<ResultSet<InstructionAffirmation>>
Defined in: api/entities/Instruction/index.ts:625
Retrieve every authorization generated by this Instruction (status and authorizing Identity or Account)
| Parameter | Type |
|---|---|
paginationOpts? |
PaginationOptions | MiddlewarePaginationOptions
|
Promise<ResultSet<InstructionAffirmation>>
supports pagination.
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
if
- instruction does not exists
- instruction is executed/rejected and was pruned from chain (when querying from chain)
getInvolvedPortfolios(
args):Promise<(DefaultPortfolio|NumberedPortfolio)[]>
Defined in: api/entities/Instruction/index.ts:1041
Retrieve all the involved portfolios in this Instruction where the given identity is a custodian of
| Parameter | Type |
|---|---|
args |
{ did: string; } |
args.did |
string |
Promise<(DefaultPortfolio | NumberedPortfolio)[]>
Defined in: api/entities/Instruction/index.ts:828
Retrieve all legs of this Instruction
| Parameter | Type |
|---|---|
paginationOpts? |
PaginationOptions | MiddlewarePaginationOptions
|
supports pagination
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
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)
getLegStatus(
args):Promise<LegStatus>
Defined in: api/entities/Instruction/index.ts:1296
Returns the execution status of a specific leg in this Instruction
| Parameter | Type | Description |
|---|---|---|
args |
{ legId: BigNumber; } |
- |
args.legId |
BigNumber |
index of the leg whose status is to be fetched |
Promise<LegStatus>
getLockedInfo():
Promise<InstructionLockedInfo>
Defined in: api/entities/Instruction/index.ts:289
Retrieve whether the Instruction is locked for execution on chain
Promise<InstructionLockedInfo>
getMediators():
Promise<MediatorAffirmation[]>
Defined in: api/entities/Instruction/index.ts:1093
Returns the mediators for the Instruction, along with their affirmation status
Promise<MediatorAffirmation[]>
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
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)
getOffChainAffirmationForLeg(
args):Promise<AffirmationStatus>
Defined in: api/entities/Instruction/index.ts:1238
Returns affirmation status for a specific offchain leg in this Instruction
| Parameter | Type | Description |
|---|---|---|
args |
{ legId: BigNumber; } |
- |
args.legId |
BigNumber |
index of the leg whose affirmation status is to be fetched |
Promise<AffirmationStatus>
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
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)
getOffChainAffirmations():
Promise<OffChainAffirmation[]>
Defined in: api/entities/Instruction/index.ts:1173
Returns affirmation statuses for offchain legs in this Instruction
Promise<OffChainAffirmation[]>
uses middleware (if available) to retrieve information, otherwise directly queries from the chain
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)
getPendingAffirmationCount():
Promise<BigNumber>
Defined in: api/entities/Instruction/index.ts:247
Get the number of affirmations pending before instruction can be executed
Promise<BigNumber>
The count is returned as 0 for pruned instructions as well
getRelockStatus():
Promise<InstructionRelockStatus>
Defined in: api/entities/Instruction/index.ts:342
Retrieve the relock cooldown status of the Instruction
Promise<InstructionRelockStatus>
After a mediator unlocks an Instruction, they must wait for the relock cooldown period to
end before locking it again. maxRelockCount limits the total number of times an Instruction can be relocked.
getStatus():
Promise<InstructionStatusResult>
Defined in: api/entities/Instruction/index.ts:873
Retrieve current status of this Instruction
Promise<InstructionStatusResult>
uses the middlewareV2
isEqual(
entity):boolean
Defined in: api/entities/Entity.ts:61
Determine whether this Entity is the same as another one
| Parameter | Type |
|---|---|
entity |
Entity<unknown, unknown> |
boolean
isExecuted():
Promise<boolean>
Defined in: api/entities/Instruction/index.ts:216
Retrieve whether the Instruction has already been executed and pruned from the chain.
Promise<boolean>
isPending():
Promise<boolean>
Defined in: api/entities/Instruction/index.ts:268
Retrieve whether the Instruction is still pending on chain
Promise<boolean>
lockForExecution(
opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:985
Locks an Instruction of type SettleAfterLock for execution. Only a mediator of the instruction can lock the instruction.
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
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
- all assets' statistics are still valid
- there are no frozen assets
if any of the above conditions are not met
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
onStatusChange(
callback):Promise<UnsubCallback>
Defined in: api/entities/Instruction/index.ts:396
Retrieve current status of the Instruction. This can be subscribed to know if instruction fails
| Parameter | Type |
|---|---|
callback |
SubCallback<InstructionStatus> |
Promise<UnsubCallback>
can be subscribed to, if connected to node using a web socket
current status as Executed means that the Instruction has been executed/rejected and pruned from
the chain.
reject(
args?,opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:944
Reject this instruction
| Parameter | Type |
|---|---|
args? |
RejectInstructionParams |
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
reject on SettleOnAffirmation will execute the settlement and it will fail immediately.
reject on SettleOnBlock behaves just like unauthorize
reject on SettleManual behaves just like unauthorize
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
rejectAsMediator(
opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:958
Reject this instruction as a mediator
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
reject on SettleOnAffirmation will execute the settlement and it will fail immediately.
reject on SettleOnBlock behaves just like unauthorize
reject on SettleManual behaves just like unauthorize
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
toHuman():
string
Defined in: api/entities/Instruction/index.ts:1034
Return the Instruction's ID
string
unlockForExecution(
opts?):Promise<GenericPolymeshTransaction<Instruction,Instruction>>
Defined in: api/entities/Instruction/index.ts:992
Unlocks an Instruction that is currently LockedForExecution, moving it back to Pending. Only a mediator of the instruction can unlock it.
| Parameter | Type |
|---|---|
opts? |
ProcedureOpts |
Promise<GenericPolymeshTransaction<Instruction, Instruction>>
After unlocking, the mediator must wait for the relock cooldown period (see getRelockStatus) before locking the instruction again. This gives other parties time to reject the instruction if they wish to back out.
this method is of type NoArgsProcedureMethod, which means you can call unlockForExecution.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it
staticgenerateUuid<Identifiers>(identifiers):string
Defined in: api/entities/Entity.ts:14
Generate the Entity's UUID from its identifying properties
| Type Parameter |
|---|
Identifiers |
| Parameter | Type | Description |
|---|---|---|
identifiers |
Identifiers |
- |
string
staticunserialize<Identifiers>(serialized):Identifiers
Defined in: api/entities/Entity.ts:23
Unserialize a UUID into its Unique Identifiers
| Type Parameter |
|---|
Identifiers |
| Parameter | Type | Description |
|---|---|---|
serialized |
string |
UUID to unserialize |
Identifiers
Defined in: api/entities/Instruction/index.ts:107
id:
BigNumber
Defined in: api/entities/Instruction/index.ts:108