Class: WardenPayloadCompressor
A class for calldata compression to be used with WardenSwap on L2 chains
Constructors
constructor
• new WardenPayloadCompressor(networkName
, provider
, multicallOptions?
)
Create new instance of WardenPayloadCompressor
Parameters
Name | Type | Description |
---|---|---|
|
| Chain name (supported by WardenSwap) |
|
| ethersjs' Provider |
|
| 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 |
---|---|---|
|
| Source Token |
|
| Destination Token |
|
| Amount of source token |
|
| Minimum amount of destination token required |
|
| Warden's partner ID |
|
| MetaWarden data |
|
| Warden swap contract |
|
| Receiver wallet |
|
| Path result(s) gathered from |
|
| 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 |
---|---|---|
|
| Path result(s) gathered from |
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 |
---|---|---|
|
| Path result(s) gathered from |
|
| Splitting ratio of source token amount range from 1-100 |
|
| Address-index map gathered from ArbAddressTable contract |
Returns
Promise
<string
>
A hexadecimal string representing compressed swap data
Last updated