Warden
Search…
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
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
Copy link
Outline
Constructors
Methods