# Instruction

Represents a settlement Instruction to be executed on a certain Venue

## Hierarchy

*   [Entity](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)
* [isEqual](#isequal)
* [isExecuted](#isexecuted)
* [isPending](#ispending)
* [reject](#reject)
* [reschedule](#reschedule)
* [toJson](#tojson)
* [withdraw](#withdraw)
* [generateUuid](#static-generateuuid)
* [unserialize](#static-unserialize)

## Properties

### `Protected` context

• **context**: [_Context_](context)

_Inherited from_ [_Entity_](entity)_._[_context_](../entity#protected-context)

_Defined in_ [_src/api/entities/Entity.ts:48_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Entity.ts#L48)

### id

• **id**: _BigNumber_

_Defined in_ [_src/api/entities/Instruction/index.ts:77_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L77)

Identifier number of the venue

### uuid

• **uuid**: _string_

_Inherited from_ [_Entity_](entity)_._[_uuid_](../entity#uuid)

_Defined in_ [_src/api/entities/Entity.ts:46_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Entity.ts#L46)

## Methods

### affirm

▸ **affirm**(`args`: void, `opts?`: [ProcedureOpts](../interfaces/procedureopts)): _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:402_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L402)

Affirm this instruction (authorize)

**`note`** this method is of type [ProcedureMethod](../interfaces/proceduremethod), which means you can call `affirm.checkAuthorization` on it to see whether the Current Account has the required permissions to run it

**Parameters:**

| Name    | Type                                         |
| ------- | -------------------------------------------- |
| `args`  | void                                         |
| `opts?` | [ProcedureOpts](../interfaces/procedureopts) |

**Returns:** _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

### details

▸ **details**(): _Promise‹_[_InstructionDetails_](../../globals#instructiondetails)_›_

_Defined in_ [_src/api/entities/Instruction/index.ts:194_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L194)

Retrieve information specific to this Instruction

**Returns:** _Promise‹_[_InstructionDetails_](../../globals#instructiondetails)_›_

### exists

▸ **exists**(): _Promise‹boolean›_

_Defined in_ [_src/api/entities/Instruction/index.ts:176_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L176)

Retrieve whether the Instruction exists on chain (or existed and was pruned)

**Returns:** _Promise‹boolean›_

### getAffirmations

▸ **getAffirmations**(`paginationOpts?`: [PaginationOptions](../interfaces/paginationoptions)): _Promise‹_[_ResultSet_](../interfaces/resultset)_‹_[_InstructionAffirmation_](../interfaces/instructionaffirmation)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:253_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L253)

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

**`note`** supports pagination

**Parameters:**

| Name              | Type                                                 |
| ----------------- | ---------------------------------------------------- |
| `paginationOpts?` | [PaginationOptions](../interfaces/paginationoptions) |

**Returns:** _Promise‹_[_ResultSet_](../interfaces/resultset)_‹_[_InstructionAffirmation_](../interfaces/instructionaffirmation)_››_

### getLegs

▸ **getLegs**(`paginationOpts?`: [PaginationOptions](../interfaces/paginationoptions)): _Promise‹_[_ResultSet_](../interfaces/resultset)_‹_[_Leg_](../interfaces/leg)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:299_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L299)

Retrieve all legs of this Instruction

**`note`** supports pagination

**Parameters:**

| Name              | Type                                                 |
| ----------------- | ---------------------------------------------------- |
| `paginationOpts?` | [PaginationOptions](../interfaces/paginationoptions) |

**Returns:** _Promise‹_[_ResultSet_](../interfaces/resultset)_‹_[_Leg_](../interfaces/leg)_››_

### getStatus

▸ **getStatus**(): _Promise‹_[_InstructionStatusResult_](../../globals#instructionstatusresult)_›_

_Defined in_ [_src/api/entities/Instruction/index.ts:350_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L350)

Retrieve current status of this Instruction

**`note`** uses the middleware

**Returns:** _Promise‹_[_InstructionStatusResult_](../../globals#instructionstatusresult)_›_

### isEqual

▸ **isEqual**(`entity`: [Entity](entity)‹unknown, unknown›): _boolean_

_Inherited from_ [_Entity_](entity)_._[_isEqual_](../entity#isequal)

_Defined in_ [_src/api/entities/Entity.ts:61_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Entity.ts#L61)

Whether this Entity is the same as another one

**Parameters:**

| Name     | Type                               |
| -------- | ---------------------------------- |
| `entity` | [Entity](entity)‹unknown, unknown› |

**Returns:** _boolean_

### isExecuted

▸ **isExecuted**(): _Promise‹boolean›_

_Defined in_ [_src/api/entities/Instruction/index.ts:131_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L131)

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:155_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L155)

Retrieve whether the Instruction is still pending on chain

**Returns:** _Promise‹boolean›_

### reject

▸ **reject**(`args`: void, `opts?`: [ProcedureOpts](../interfaces/procedureopts)): _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:392_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L392)

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 [ProcedureMethod](../interfaces/proceduremethod), which means you can call `reject.checkAuthorization` on it to see whether the Current Account has the required permissions to run it

**Parameters:**

| Name    | Type                                         |
| ------- | -------------------------------------------- |
| `args`  | void                                         |
| `opts?` | [ProcedureOpts](../interfaces/procedureopts) |

**Returns:** _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

### reschedule

▸ **reschedule**(`args`: void, `opts?`: [ProcedureOpts](../interfaces/procedureopts)): _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:422_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L422)

Schedule a failed Instructi oto rwaa

**`note`** this method is of type [ProcedureMethod](../interfaces/proceduremethod), which means you can call `reschedule.checkAuthorization` on it to see whether the Current Account has the required permissions to run it

**Parameters:**

| Name    | Type                                         |
| ------- | -------------------------------------------- |
| `args`  | void                                         |
| `opts?` | [ProcedureOpts](../interfaces/procedureopts) |

**Returns:** _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

### toJson

▸ **toJson**(): _string_

_Overrides_ [_Entity_](entity)_._[_toJson_](../entity#abstract-tojson)

_Defined in_ [_src/api/entities/Instruction/index.ts:451_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L451)

Return the Instruction's ID

**Returns:** _string_

### withdraw

▸ **withdraw**(`args`: void, `opts?`: [ProcedureOpts](../interfaces/procedureopts)): _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

_Defined in_ [_src/api/entities/Instruction/index.ts:412_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/src/api/entities/Instruction/index.ts#L412)

Withdraw affirmation from this instruction (unauthorize)

**`note`** this method is of type [ProcedureMethod](../interfaces/proceduremethod), which means you can call `withdraw.checkAuthorization` on it to see whether the Current Account has the required permissions to run it

**Parameters:**

| Name    | Type                                         |
| ------- | -------------------------------------------- |
| `args`  | void                                         |
| `opts?` | [ProcedureOpts](../interfaces/procedureopts) |

**Returns:** _Promise‹_[_TransactionQueue_](transactionqueue)_‹_[_Instruction_](instruction)_››_

### `Static` generateUuid

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

_Inherited from_ [_Entity_](entity)_._[_generateUuid_](../entity#static-generateuuid)

_Defined in_ [_src/api/entities/Entity.ts:14_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/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_ [_Entity_](entity)_._[_unserialize_](../entity#static-unserialize)

_Defined in_ [_src/api/entities/Entity.ts:23_](https://github.com/PolymathNetwork/polymesh-sdk/blob/bf2b7a12/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_
