# Class: WardenPayloadCompressor

### Constructors

#### constructor

• **new WardenPayloadCompressor**(`networkName`, `provider`, `multicallOptions?`)

Create new instance of WardenPayloadCompressor

**Parameters**

| Name                | Type                                                                                    | Description                          |
| ------------------- | --------------------------------------------------------------------------------------- | ------------------------------------ |
| `networkName`       | `"bsc"` \| `"arbitrum"` \| `"polygon"` \| `"ethereum"` \| `"avalanche"` \| `"optimism"` | Chain name (supported by WardenSwap) |
| `provider`          | `Provider`                                                                              | ethersjs' Provider                   |
| `multicallOptions?` | `MulticallBatchOption`                                                                  | Multicall options                    |

### Methods

#### compress

▸ **compress**(`src`, `dest`, `amountIn`, `minDestAmount`, `partnerId`, `metaData`, `swapAddress`, `receiver`, `paths`, `volumes`): `Promise`<`string`>

Compress calldata for L2 chains

**Parameters**

| Name            | Type                            | Description                                             |
| --------------- | ------------------------------- | ------------------------------------------------------- |
| `src`           | `string`                        | Source Token                                            |
| `dest`          | `string`                        | Destination Token                                       |
| `amountIn`      | `BigNumberish`                  | Amount of source token                                  |
| `minDestAmount` | `BigNumberish`                  | Minimum amount of destination token required            |
| `partnerId`     | `BigNumberish`                  | Warden's partner ID                                     |
| `metaData`      | `BigNumberish`                  | MetaWarden data                                         |
| `swapAddress`   | `string`                        | Warden swap contract                                    |
| `receiver`      | `string`                        | Receiver wallet                                         |
| `paths`         | `PathResult` \| `PathResult`\[] | Path result(s) gathered from `getQuote`                 |
| `volumes`       | `number`\[]                     | Splitting ratio of source token amount range from 1-100 |

**Returns**

`Promise`<`string`>

Serialized data to be used with swap functions with compression feature

***

#### encodeSwapData

▸ **encodeSwapData**(`paths`): `string`

Encode swap data for L1 chains

**Parameters**

| Name    | Type                            | Description                             |
| ------- | ------------------------------- | --------------------------------------- |
| `paths` | `PathResult` \| `PathResult`\[] | Path result(s) gathered from `getQuote` |

**Returns**

`string`

A hexadecimal string representing encoded swap data

***

#### encodeSwapDataL2

▸ **encodeSwapDataL2**(`paths`, `volumes`, `addressIdxMap?`): `Promise`<`string`>

Compress swap data for L2 chains

**Parameters**

| Name             | Type                            | Description                                              |
| ---------------- | ------------------------------- | -------------------------------------------------------- |
| `paths`          | `PathResult` \| `PathResult`\[] | Path result(s) gathered from `getQuote`                  |
| `volumes`        | `number`\[]                     | Splitting ratio of source token amount range from 1-100  |
| `addressIdxMap?` | `Object`                        | Address-index map gathered from ArbAddressTable contract |

**Returns**

`Promise`<`string`>

A hexadecimal string representing compressed swap data


---

# 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://docs.wardenswap.finance/warden/wardenswap-sdk/references/class-wardenpayloadcompressor.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.
