# Network

Handles all Network related functionality, including querying for historical events from middleware

## Hierarchy

* **Network**

## Index

### Methods

* [getEventByIndexedArgs](#geteventbyindexedargs)
* [getEventByIndexedArgsV2](#geteventbyindexedargsv2)
* [getEventsByIndexedArgs](#geteventsbyindexedargs)
* [getEventsByIndexedArgsV2](#geteventsbyindexedargsv2)
* [getLatestBlock](#getlatestblock)
* [getNetworkProperties](#getnetworkproperties)
* [getProtocolFees](#getprotocolfees)
* [getSs58Format](#getss58format)
* [getTransactionByHash](#gettransactionbyhash)
* [getTransactionByHashV2](#gettransactionbyhashv2)
* [getTreasuryAccount](#gettreasuryaccount)
* [getTreasuryBalance](#gettreasurybalance)
* [getVersion](#getversion)
* [transferPolyx](#transferpolyx)

## Methods

### getEventByIndexedArgs

▸ **getEventByIndexedArgs**(`opts`: object): *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md) *| null›*

*Defined in* [*src/Network.ts:167*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L167)

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*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md) *| null›*

***

### getEventByIndexedArgsV2

▸ **getEventByIndexedArgsV2**(`opts`: object): *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md) *| null›*

*Defined in* [*src/Network.ts:204*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L204)

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

**`note`** uses the middlewareV2

**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*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md) *| null›*

***

### getEventsByIndexedArgs

▸ **getEventsByIndexedArgs**(`opts`: object): *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md)*\[] | null›*

*Defined in* [*src/Network.ts:250*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L250)

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?`      | BigNumber           | page size                                        |
| `start?`     | BigNumber           | page offset                                      |

**Returns:** *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md)*\[] | null›*

***

### getEventsByIndexedArgsV2

▸ **getEventsByIndexedArgsV2**(`opts`: object): *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md)*\[] | null›*

*Defined in* [*src/Network.ts:300*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L300)

Retrieve a list of events. Can be filtered using parameters

**`note`** uses the middlewareV2

**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?`      | BigNumber           | page size                                        |
| `start?`     | BigNumber           | page offset                                      |

**Returns:** *Promise‹*[*EventIdentifier*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/eventidentifier.md)*\[] | null›*

***

### getLatestBlock

▸ **getLatestBlock**(): *Promise‹BigNumber›*

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

Retrieve the number of the latest block in the chain

**Returns:** *Promise‹BigNumber›*

***

### getNetworkProperties

▸ **getNetworkProperties**(): *Promise‹*[*NetworkProperties*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/networkproperties.md)*›*

*Defined in* [*src/Network.ts:82*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L82)

Retrieve information for the current network

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

***

### getProtocolFees

▸ **getProtocolFees**(`args`: object): *Promise‹*[*ProtocolFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/protocolfees.md)*\[]›*

*Defined in* [*src/Network.ts:106*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L106)

Retrieve the protocol fees associated with running specific transactions

**Parameters:**

▪ **args**: *object*

| Name   | Type     | Description                                                                                                                                |
| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `tags` | TxTag\[] | list of transaction tags (i.e. \[TxTags.asset.CreateAsset, TxTags.asset.RegisterTicker] or \["asset.createAsset", "asset.registerTicker"]) |

**Returns:** *Promise‹*[*ProtocolFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/protocolfees.md)*\[]›*

***

### getSs58Format

▸ **getSs58Format**(): *BigNumber*

*Defined in* [*src/Network.ts:75*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L75)

Retrieve the chain's SS58 format

**Returns:** *BigNumber*

***

### getTransactionByHash

▸ **getTransactionByHash**(`opts`: object): *Promise‹*[*ExtrinsicDataWithFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/extrinsicdatawithfees.md) *| null›*

*Defined in* [*src/Network.ts:348*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L348)

Retrieve a transaction by hash

**`note`** uses the middleware

**Parameters:**

▪ **opts**: *object*

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

**Returns:** *Promise‹*[*ExtrinsicDataWithFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/extrinsicdatawithfees.md) *| null›*

***

### getTransactionByHashV2

▸ **getTransactionByHashV2**(`opts`: object): *Promise‹*[*ExtrinsicDataWithFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/extrinsicdatawithfees.md) *| null›*

*Defined in* [*src/Network.ts:435*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L435)

Retrieve a transaction by hash

**`note`** uses the middlewareV2

**Parameters:**

▪ **opts**: *object*

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

**Returns:** *Promise‹*[*ExtrinsicDataWithFees*](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/extrinsicdatawithfees.md) *| null›*

***

### getTreasuryAccount

▸ **getTreasuryAccount**(): [*Account*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/account)

*Defined in* [*src/Network.ts:113*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L113)

Get the treasury wallet address

**Returns:** [*Account*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/classes/account)

***

### getTreasuryBalance

▸ **getTreasuryBalance**(): *Promise‹BigNumber›*

*Defined in* [*src/Network.ts:126*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L126)

Get the Treasury POLYX balance

**`note`** can be subscribed to

**Returns:** *Promise‹BigNumber›*

▸ **getTreasuryBalance**(`callback`: [SubCallback](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#subcallback)‹BigNumber›): *Promise‹*[*UnsubCallback*](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#unsubcallback)*›*

*Defined in* [*src/Network.ts:127*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L127)

**Parameters:**

| Name       | Type                                                                                                                   |
| ---------- | ---------------------------------------------------------------------------------------------------------------------- |
| `callback` | [SubCallback](https://developers.polymath.network/polymesh-sdk-api-reference/docs-beta/globals#subcallback)‹BigNumber› |

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

***

### getVersion

▸ **getVersion**(): *Promise‹string›*

*Defined in* [*src/Network.ts:68*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L68)

Fetch the current network version (i.e. 3.1.0)

**Returns:** *Promise‹string›*

***

### transferPolyx

▸ **transferPolyx**(`args`: [TransferPolyxParams](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/transferpolyxparams.md), `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)*‹void››*

*Defined in* [*src/Network.ts:152*](https://github.com/PolymathNetwork/polymesh-sdk/blob/31a16a34/src/Network.ts#L152)

Transfer an amount of POLYX to a specified Account

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

**Parameters:**

| Name    | Type                                                                                                                         |
| ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `args`  | [TransferPolyxParams](https://github.com/PolymathNetwork/polymesh-sdk/blob/docs/beta/docs/interfaces/transferpolyxparams.md) |
| `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)*‹void››*
