# Middleware

Handles all Middleware related functionality

## Hierarchy

* **Middleware**

## Index

### Methods

* [getEventByIndexedArgs](/polymesh-sdk-api-reference/docs-v8/classes/middleware.md#geteventbyindexedargs)
* [getEventsByIndexedArgs](/polymesh-sdk-api-reference/docs-v8/classes/middleware.md#geteventsbyindexedargs)
* [getTransactionByHash](/polymesh-sdk-api-reference/docs-v8/classes/middleware.md#gettransactionbyhash)

## Methods

### getEventByIndexedArgs

▸ **getEventByIndexedArgs**(`opts`: object): *Promise‹*[*EventIdentifier*](/polymesh-sdk-api-reference/docs-v8/interfaces/eventidentifier.md) *| null›*

*Defined in* [*src/Middleware.ts:34*](https://github.com/PolymathNetwork/polymesh-sdk/blob/7362b318/src/Middleware.ts#L34)

Retrieve a single event by any of its indexed arguments. Can be filtered using parameters

**`note`** uses the middleware

**Parameters:**

▪ **opts**: *object*

| Name         | Type                | Description                                      |
| ------------ | ------------------- | ------------------------------------------------ |
| `eventArg0?` | undefined \| string | event parameter value to filter by in position 0 |
| `eventArg1?` | undefined \| string | event parameter value to filter by in position 1 |
| `eventArg2?` | undefined \| string | event parameter value to filter by in position 2 |
| `eventId`    | EventId             | type of the event to fetch                       |
| `moduleId`   | ModuleId            | type of the module to fetch                      |

**Returns:** *Promise‹*[*EventIdentifier*](/polymesh-sdk-api-reference/docs-v8/interfaces/eventidentifier.md) *| null›*

### getEventsByIndexedArgs

▸ **getEventsByIndexedArgs**(`opts`: object): *Promise‹*[*EventIdentifier*](/polymesh-sdk-api-reference/docs-v8/interfaces/eventidentifier.md)*\[] | null›*

*Defined in* [*src/Middleware.ts:73*](https://github.com/PolymathNetwork/polymesh-sdk/blob/7362b318/src/Middleware.ts#L73)

Retrieve a list of events. Can be filtered using parameters

**`note`** uses the middleware

**Parameters:**

▪ **opts**: *object*

| Name         | Type                | Description                                      |
| ------------ | ------------------- | ------------------------------------------------ |
| `eventArg0?` | undefined \| string | event parameter value to filter by in position 0 |
| `eventArg1?` | undefined \| string | event parameter value to filter by in position 1 |
| `eventArg2?` | undefined \| string | event parameter value to filter by in position 2 |
| `eventId`    | EventId             | type of the event to fetch                       |
| `moduleId`   | ModuleId            | type of the module to fetch                      |
| `size?`      | undefined \| number | page size                                        |
| `start?`     | undefined \| number | page offset                                      |

**Returns:** *Promise‹*[*EventIdentifier*](/polymesh-sdk-api-reference/docs-v8/interfaces/eventidentifier.md)*\[] | null›*

### getTransactionByHash

▸ **getTransactionByHash**(`opts`: object): *Promise‹*[*ExtrinsicData*](/polymesh-sdk-api-reference/docs-v8/interfaces/extrinsicdata.md) *| null›*

*Defined in* [*src/Middleware.ts:117*](https://github.com/PolymathNetwork/polymesh-sdk/blob/7362b318/src/Middleware.ts#L117)

Retrieve a transaction by hash

**`note`** uses the middleware

**Parameters:**

▪ **opts**: *object*

| Name     | Type   | Description             |
| -------- | ------ | ----------------------- |
| `txHash` | string | hash of the transaction |

**Returns:** *Promise‹*[*ExtrinsicData*](/polymesh-sdk-api-reference/docs-v8/interfaces/extrinsicdata.md) *| null›*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.polymath.network/polymesh-sdk-api-reference/docs-v8/classes/middleware.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
