> For the complete documentation index, see [llms.txt](https://developers.polymath.network/polymesh-sdk-api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.polymath.network/polymesh-sdk-api-reference/docs-v4/classes/middleware.md).

# Middleware

Handles all Middleware related functionality

## Hierarchy

* **Middleware**

## Index

### Methods

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

## Methods

### getEventByIndexedArgs

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

*Defined in* [*src/Middleware.ts:33*](https://github.com/PolymathNetwork/polymesh-sdk/blob/a0872cf4/src/Middleware.ts#L33)

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-v4/interfaces/eventidentifier.md) *| null›*

### getEventsByIndexedArgs

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

*Defined in* [*src/Middleware.ts:80*](https://github.com/PolymathNetwork/polymesh-sdk/blob/a0872cf4/src/Middleware.ts#L80)

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-v4/interfaces/eventidentifier.md)*\[] | null›*

### getTransactionByHash

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

*Defined in* [*src/Middleware.ts:129*](https://github.com/PolymathNetwork/polymesh-sdk/blob/a0872cf4/src/Middleware.ts#L129)

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-v4/interfaces/extrinsicdata.md) *| null›*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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-v4/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.
