Creates a new Dex instance
The TON client instance
The address of the Dex contract
Returns the address of this Dex contract instance
The TON address of the Dex contract
Fetches the latest state of the Dex contract from the blockchain
Contract state including parsed contract data, balance and last transaction
Simulates a swap using the current state of this Dex instance
Amount of input token to swap
Direction flag: true for token0 to token1 swap, false for token1 to token0 swap
Simulation result
StaticbuildBuilds a message body for adding Jetton liquidity to a pool
Options for the liquidity addition
Cell containing the message body for the Jetton transfer with add liquidity payload
StaticbuildBuilds a message body for adding TON (native currency) liquidity to a pool
Options for the TON liquidity addition
Cell containing the message body for the TON liquidity addition
StaticbuildBuilds a payload for swapping Jetton tokens
Minimum amount of output tokens to receive
Destination address for output tokens
OptionalforwardTonAmount: bigint = 0nTON to forward with output tokens
OptionalforwardPayload: SliceOptional payload to forward
Slice containing the payload for the Jetton swap
StaticbuildBuilds a message body for swapping TON to tokens
Minimum amount of tokens to receive
Destination address for output tokens
Amount of TON to swap
OptionalforwardTonAmount: bigint = 0nTON to forward with output tokens
OptionalforwardPayload: SliceOptional payload to forward
OptionalqueryId: bigint = 1nQuery ID for the operation
Cell containing the message body for the TON swap
StaticgetStatic method to fetch the latest state of a Dex contract without instantiating the class
The TON client instance
The address of the Dex contract
Contract state including parsed contract data, balance and last transaction
StaticsimulateStatic method to simulate adding liquidity to calculate the required paired amount
Simulation result with paired amount and new reserves
StaticsimulateStatic method to simulate a swap without instantiating the class
Parameters for the swap simulation
Simulation result
Dex class for interacting with decentralized exchange contracts on TON Provides functionality for liquidity operations, swaps, and simulation
See
LiquidityPool