# Instruction

Represents a settlement Instruction to be executed on a certain Venue

## Hierarchy

* [Entity](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/entity)‹UniqueIdentifiers, string›

  ↳ **Instruction**

## Index

### Properties

* [context](#protected-context)
* [id](#id)
* [uuid](#uuid)

### Methods

* [affirm](#affirm)
* [details](#details)
* [exists](#exists)
* [getAffirmations](#getaffirmations)
* [getLegs](#getlegs)
* [getStatus](#getstatus)
* [getStatusV2](#getstatusv2)
* [isEqual](#isequal)
* [isExecuted](#isexecuted)
* [isPending](#ispending)
* [reject](#reject)
* [reschedule](#reschedule)
* [toHuman](#tohuman)
* [withdraw](#withdraw)
* [generateUuid](#static-generateuuid)
* [unserialize](#static-unserialize)

## Properties

### `Protected` context

• **context**: *Context*

*Inherited from* [*CheckpointSchedule*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/checkpointschedule)*.*[*context*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/checkpointschedule#protected-context)

*Defined in* [*src/api/entities/Entity.ts:48*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Entity.ts#L48)

***

### id

• **id**: *BigNumber*

*Defined in* [*src/api/entities/Instruction/index.ts:80*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L80)

Identifier number of the venue

***

### uuid

• **uuid**: *string*

*Inherited from* [*CheckpointSchedule*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/checkpointschedule)*.*[*uuid*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/checkpointschedule#uuid)

*Defined in* [*src/api/entities/Entity.ts:46*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Entity.ts#L46)

## Methods

### affirm

▸ **affirm**(`opts?`: [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md)): *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:448*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L448)

Affirm this instruction (authorize)

**`note`** this method is of type [NoArgsProcedureMethod](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md), which means you can call [affirm.checkAuthorization](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md#checkauthorization) on it to see whether the signing Account and Identity have the required roles and permissions to run it

**Parameters:**

| Name    | Type                                                                                                             |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| `opts?` | [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md) |

**Returns:** *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

***

### details

▸ **details**(): *Promise‹*[*InstructionDetails*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructiondetails)*›*

*Defined in* [*src/api/entities/Instruction/index.ts:201*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L201)

Retrieve information specific to this Instruction

**Returns:** *Promise‹*[*InstructionDetails*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructiondetails)*›*

***

### exists

▸ **exists**(): *Promise‹boolean›*

*Overrides* [*Entity*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/entity)*.*[*exists*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/entity#abstract-exists)

*Defined in* [*src/api/entities/Instruction/index.ts:183*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L183)

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

**Returns:** *Promise‹boolean›*

***

### getAffirmations

▸ **getAffirmations**(`paginationOpts?`: [PaginationOptions](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/paginationoptions.md)): *Promise‹*[*ResultSet*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/resultset.md)*‹*[*InstructionAffirmation*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/instructionaffirmation.md)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:260*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L260)

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

**`note`** supports pagination

**Parameters:**

| Name              | Type                                                                                                                     |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `paginationOpts?` | [PaginationOptions](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/paginationoptions.md) |

**Returns:** *Promise‹*[*ResultSet*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/resultset.md)*‹*[*InstructionAffirmation*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/instructionaffirmation.md)*››*

***

### getLegs

▸ **getLegs**(`paginationOpts?`: [PaginationOptions](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/paginationoptions.md)): *Promise‹*[*ResultSet*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/resultset.md)*‹*[*Leg*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/leg.md)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:306*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L306)

Retrieve all legs of this Instruction

**`note`** supports pagination

**Parameters:**

| Name              | Type                                                                                                                     |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `paginationOpts?` | [PaginationOptions](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/paginationoptions.md) |

**Returns:** *Promise‹*[*ResultSet*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/resultset.md)*‹*[*Leg*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/leg.md)*››*

***

### getStatus

▸ **getStatus**(): *Promise‹*[*InstructionStatusResult*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructionstatusresult)*›*

*Defined in* [*src/api/entities/Instruction/index.ts:357*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L357)

Retrieve current status of this Instruction

**`note`** uses the middleware

**Returns:** *Promise‹*[*InstructionStatusResult*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructionstatusresult)*›*

***

### getStatusV2

▸ **getStatusV2**(): *Promise‹*[*InstructionStatusResult*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructionstatusresult)*›*

*Defined in* [*src/api/entities/Instruction/index.ts:395*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L395)

Retrieve current status of this Instruction

**`note`** uses the middlewareV2

**Returns:** *Promise‹*[*InstructionStatusResult*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#instructionstatusresult)*›*

***

### isEqual

▸ **isEqual**(`entity`: [Entity](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/entity)‹unknown, unknown›): *boolean*

*Inherited from* [*CheckpointSchedule*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/checkpointschedule)*.*[*isEqual*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/checkpointschedule#isequal)

*Defined in* [*src/api/entities/Entity.ts:61*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Entity.ts#L61)

Determine whether this Entity is the same as another one

**Parameters:**

| Name     | Type                                                                                                                |
| -------- | ------------------------------------------------------------------------------------------------------------------- |
| `entity` | [Entity](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/entity)‹unknown, unknown› |

**Returns:** *boolean*

***

### isExecuted

▸ **isExecuted**(): *Promise‹boolean›*

*Defined in* [*src/api/entities/Instruction/index.ts:138*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L138)

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

**Returns:** *Promise‹boolean›*

***

### isPending

▸ **isPending**(): *Promise‹boolean›*

*Defined in* [*src/api/entities/Instruction/index.ts:162*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L162)

Retrieve whether the Instruction is still pending on chain

**Returns:** *Promise‹boolean›*

***

### reject

▸ **reject**(`opts?`: [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md)): *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:438*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L438)

Reject this instruction

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

**`note`** reject on `SettleOnBlock` behaves just like unauthorize

**`note`** this method is of type [NoArgsProcedureMethod](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md), which means you can call [reject.checkAuthorization](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md#checkauthorization) on it to see whether the signing Account and Identity have the required roles and permissions to run it

**Parameters:**

| Name    | Type                                                                                                             |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| `opts?` | [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md) |

**Returns:** *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

***

### reschedule

▸ **reschedule**(`opts?`: [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md)): *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:470*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L470)

Reschedules a failed Instruction to be tried again

**`throws`** if the Instruction status is not `InstructionStatus.Failed`

**`note`** this method is of type [NoArgsProcedureMethod](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md), which means you can call [reschedule.checkAuthorization](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md#checkauthorization) on it to see whether the signing Account and Identity have the required roles and permissions to run it

**Parameters:**

| Name    | Type                                                                                                             |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| `opts?` | [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md) |

**Returns:** *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

***

### toHuman

▸ **toHuman**(): *string*

*Overrides* [*Entity*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/entity)*.*[*toHuman*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/entity#abstract-tohuman)

*Defined in* [*src/api/entities/Instruction/index.ts:527*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L527)

Return the Instruction's ID

**Returns:** *string*

***

### withdraw

▸ **withdraw**(`opts?`: [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md)): *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

*Defined in* [*src/api/entities/Instruction/index.ts:458*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Instruction/index.ts#L458)

Withdraw affirmation from this instruction (unauthorize)

**`note`** this method is of type [NoArgsProcedureMethod](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md), which means you can call [withdraw.checkAuthorization](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/noargsproceduremethod.md#checkauthorization) on it to see whether the signing Account and Identity have the required roles and permissions to run it

**Parameters:**

| Name    | Type                                                                                                             |
| ------- | ---------------------------------------------------------------------------------------------------------------- |
| `opts?` | [ProcedureOpts](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/procedureopts.md) |

**Returns:** *Promise‹*[*TransactionQueue*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/transactionqueue)*‹*[*Instruction*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/instruction)*››*

***

### `Static` generateUuid

▸ **generateUuid**‹**Identifiers**›(`identifiers`: Identifiers): *string*

*Inherited from* [*CheckpointSchedule*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/checkpointschedule)*.*[*generateUuid*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/checkpointschedule#static-generateuuid)

*Defined in* [*src/api/entities/Entity.ts:14*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Entity.ts#L14)

Generate the Entity's UUID from its identifying properties

**Type parameters:**

▪ **Identifiers**

**Parameters:**

| Name          | Type        | Description |
| ------------- | ----------- | ----------- |
| `identifiers` | Identifiers |             |

**Returns:** *string*

***

### `Static` unserialize

▸ **unserialize**‹**Identifiers**›(`serialized`: string): *Identifiers*

*Inherited from* [*CheckpointSchedule*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/checkpointschedule)*.*[*unserialize*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/checkpointschedule#static-unserialize)

*Defined in* [*src/api/entities/Entity.ts:23*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/api/entities/Entity.ts#L23)

Unserialize a UUID into its Unique Identifiers

**Type parameters:**

▪ **Identifiers**

**Parameters:**

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| `serialized` | string | UUID to unserialize |

**Returns:** *Identifiers*
