reference
This section contains sdk methods reference
Router
address
address
Address of the Router contract
gasConstants
gasConstants
Getters
getPoolAddress
getPoolAddress
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
token0
Address | string
The address of the router's wallet of first Jetton
token1
Address | string
The address of the router's wallet of second Jetton
Result
Returns an address of a pool for a specified pair of assets.
getPoolAddressByJettonMinters
getPoolAddressByJettonMinters
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
token0
Address | string
The address of the first pool Jetton Minter
wallet
token1
Address | string
The address of the second pool Jetton Minter
wallet
Result
Returns an address of a pool for a specified pair of assets.
getPool
getPool
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
token0
Address | string
The address of the first pool Jetton Minter
wallet
token1
Address | string
The address of the second pool Jetton Minter
wallet
Result
Returns an instance of PoolV1
with specified Jetton token addresses.
getRouterData
getRouterData
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
Result
Returns structure containing current state of the router.
isLocked
boolean
true if transfer_notification
operations are locked (swap
, provide_lp
)
adminAddress
Address
Address of contract's admin account
tempUpgrade
Cell
A structure describing state of contract's code & admin upgrade; zero values indicate that no upgrade is pending
poolCode
Cell
Code of the router's liquidity pool contract
jettonLpWalletCode
Cell
Code of lp wallet contract
lpAccountCode
Cell
Code of lp account contract
Operations
createSwapBody
createSwapBody
userWalletAddress
Address | string
User's address
minAskAmount
bigint | number | string
Minimum amount of tokens received (in basic token units)
askJettonWalletAddress
Address | string
Jetton router's wallet address of tokens to be received
referralAddress
Address | string | undefined
referral address
getSwapJettonToJettonTxParams
getSwapJettonToJettonTxParams
Build all data required to execute a jetton to jetton swap
transaction
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
userWalletAddress
Address | string
User's address
offerJettonAddress
Address | string
Jetton Minter
address of a token to be swapped
askJettonAddress
Address | string
Jetton Minter
address of a token to be received
offerAmount
bigint | number | string
Amount of tokens to be swapped (in basic token units)
minAskAmount
bigint | number | string
Minimum amount of tokens to be received (in basic token units)
referralAddress
Address | string | undefined
Referral address
gasAmount
bigint | number | string | undefined
Transaction gas
forwardGasAmount
bigint | number | string | undefined
Forward amount of gas for the next transaction (in nanoTons)
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendSwapJettonToJetton
sendSwapJettonToJetton
getSwapJettonToTonTxParams
getSwapJettonToTonTxParams
Build all data required to execute a jetton to ton swap
transaction
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
userWalletAddress
Address | string
User's address
offerJettonAddress
Address | string
Jetton Minter
address of a token to be swapped
proxyTon
PtonV1
instance of pTON contract
offerAmount
bigint | number | string
Amount of tokens to be swapped (in basic token units)
minAskAmount
bigint | number | string
Minimum amount of tokens to be received (in basic token units)
referralAddress
Address | string | undefined
Referral address
gasAmount
bigint | number | string | undefined
Transaction gas
forwardGasAmount
bigint | number | string | undefined
Forward amount of gas for the next transaction (in nanoTons)
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendSwapJettonToTon
sendSwapJettonToTon
getSwapTonToJettonTxParams
getSwapTonToJettonTxParams
Build all data required to execute a ton to jetton swap
transaction
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
userWalletAddress
Address | string
User's address
proxyTon
PtonV1
instance of pTON contract
askJettonAddress
Address | string
Jetton Minter
address of a token to be received
offerAmount
bigint | number | string
Amount of tokens to be swapped (in basic token units)
minAskAmount
bigint | number | string
Minimum amount of tokens to be received (in basic token units)
referralAddress
Address | string | undefined
Referral address
forwardGasAmount
bigint | number | string | undefined
Forward amount of gas for the next transaction (in nanoTons)
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendSwapTonToJetton
sendSwapTonToJetton
createProvideLiquidityBody
createProvideLiquidityBody
routerWalletAddress
Address | string
Address of the router's Jetton token wallet
minLpOut
bigint | number | string
Minimum amount of created liquidity tokens (in basic token units)
getProvideLiquidityJettonTxParams
getProvideLiquidityJettonTxParams
Collect all data required to execute a jetton provide_lp
transaction
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
userWalletAddress
Address | string
User's address
sendTokenAddress
Address | string
Address of the first Jetton token or a proxy ton contract
otherTokenAddress
Address | string
Address of the second Jetton token
sendAmount
bigint | number | string
Amount of the first/second tokens deposited as liquidity (in basic token units)
minLpOut
bigint | number | string
Minimum amount of created liquidity tokens (in basic token units)
gasAmount
bigint | number | string | undefined
Transaction gas
forwardGasAmount
bigint | number | string | undefined
Forward amount of gas for the next transaction (in nanoTons)
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendProvideLiquidityJetton
sendProvideLiquidityJetton
getProvideLiquidityTonTxParams
getProvideLiquidityTonTxParams
Collect all data required to execute a proxy ton provide_lp
transaction
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
userWalletAddress
Address | string
User's address
proxyTon
PtonV1
instance of pTON contract
otherTokenAddress
Address | string
Address of the second Jetton token
sendAmount
bigint | number | string
Amount of the first/second tokens deposited as liquidity (in basic token units)
minLpOut
bigint | number | string
Minimum amount of created liquidity tokens (in basic token units)
forwardGasAmount
bigint | number | string | undefined
Forward amount of gas for the next transaction (in nanoTons)
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendProvideLiquidityTon
sendProvideLiquidityTon
Pool
address
address
Address of the Pool contract
gasConstants
gasConstants
Getters
getPoolData
getPoolData
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
Result
Returns structure containing current state of the pool.
reserve0
bigint
Amount of the first token (in basic token units)
reserve1
bigint
Amount of the second token (in basic token units)
token0WalletAddress
Address
Address of the first Jetton token
token1WalletAddress
Address
Address of the second Jetton token
lpFee
bigint
Liquidity pool fee value
protocolFee
bigint
Protocol fee
refFee
bigint
Referral fee
protocolFeeAddress
Address
Address for receiving protocol fees
collectedToken0ProtocolFee
bigint
Amount of collected protocol fees of the first token (in basic token units)
collectedToken1ProtocolFee
bigint
Amount of collected protocol fees of the second token (in basic token units)
Notes:
fee ratio is the value of fee divided by
FEE_DIVIDER
(10000); so a fee of 1% has a value of 100
getExpectedOutputs
getExpectedOutputs
Estimate expected result of the amount of jettonWallet tokens swapped to the other type of tokens of the pool
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
amount
bigint | number | string
Amount of tokens to swap (in basic token units)
jettonWallet
Address | string
Token Jetton address (must be equal to one of the Jetton addresses of the pool)
Result
Returns structure with expected result of a token swap
jettonToReceive
bigint
Amount of tokens received (in basic token units)
protocolFeePaid
bigint
Amount tokens paid for protocol fees (in basic token units)
refFeePaid
bigint
Amount tokens paid for referral fees (in basic token units)
getExpectedTokens
getExpectedTokens
Estimate an expected amount of lp tokens minted when providing liquidity.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
amount0
bigint | number | string
Amount of tokens for the first Jetton (in basic token units)
amount1
bigint | number | string
Amount of tokens for the second Jetton (in basic token units)
Result
Returns an estimated amount of liquidity tokens to be minted
getExpectedLiquidity
getExpectedLiquidity
Estimate expected liquidity freed upon burning liquidity tokens.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
jettonAmount
bigint | number | string
Amount of liquidity tokens (in basic token units)
Result
Returns structure with expected freed liquidity
amount0
bigint
Amount of tokens for the first Jetton (in basic token units)
amount1
bigint
Amount of tokens for the second Jetton (in basic token units)
getLpAccountAddress
getLpAccountAddress
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
ownerAddress
Address | string
Address of a user
Result
Function getLpAccountAddress
returns the lp account address of a user
getLpAccount
getLpAccount
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
ownerAddress
Address | string
Address of a user
Result
returns an instance of LpAccountV1
getJettonData
getJettonData
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
Result
Returns a structure with Jetton data
totalSupply
bigint
Total token supply (in basic token units)
isMintable
boolean
If mintable
adminAddress
Address
Admin address
jettonContentUri
string
Offchain uri with Jetton data
jettonWalletCode
Cell
Code of the lp Jetton wallet
getWalletAddress
getWalletAddress
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
ownerAddress
Address | string
Address of a user
Result
returns a calculated lp wallet address of a user
getJettonWallet
getJettonWallet
Arguments
ownerAddress
Address | string
Address of a user
ownerAddress
Address | string
Address of a user
Result
Function getJettonWallet
returns a JettonWallet
instance for an address returned by getWalletAddress
Operations
createCollectFeesBody
createCollectFeesBody
getCollectFeeTxParams
getCollectFeeTxParams
Build all data required to execute a collect_fees
transaction.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
gasAmount
bigint | number | string | undefined
Transaction gas
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
Notes:
param
is entirely optionalthe default value for
gasAmount
is equal to 1.1 TON
sendCollectFees
sendCollectFees
createBurnBody
createBurnBody
getBurnTxParams
getBurnTxParams
Build all data required to execute a burn
transaction.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
amount
bigint | number | string
Lp tokens to burn
responseAddress
Address | string
Excesses address
gasAmount
bigint | number | string | undefined
Transaction gas
queryId
bigint | number | undefined
Query id
sendBurn
sendBurn
LpAccount
address
address
Address of the LpAccount contract
gasConstants
gasConstants
Getters
getLpAccountData
getLpAccountData
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
Result
Returns structure containing current state of the lp account.
userAddress
Address
Owner's address
poolAddress
Address
Pool's address
amount0
bigint
Balance of the first Jetton token (in basic token units)
amount1
bigint
Balance of the second Jetton token (in basic token units)
Operations
createRefundBody
createRefundBody
getRefundTxParams
getRefundTxParams
Build all data required to execute a refund_me
transaction.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
gasAmount
bigint | number | string | undefined
Transaction gas
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
sendRefund
sendRefund
createDirectAddLiquidityBody
createDirectAddLiquidityBody
getDirectAddLiquidityTxParams
getDirectAddLiquidityTxParams
Build all data required to execute a direct_add_liquidity
transaction.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
amount0
bigint | number | string
Amount of the first Jetton tokens (in basic token units)
amount1
bigint | number | string
Amount of the second Jetton tokens (in basic token units)
minimumLpToMint
bigint | number | string | undefined
Minimum amount of received liquidity tokens (in basic token units)
gasAmount
bigint | number | string | undefined
Transaction gas
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
Notes:
addition of liquidity will fail if a user should receive less than
minimumLpToMint
of lp tokens as a resultthe default value for
gasAmount
is equal to 0.3 TON
sendDirectAddLiquidity
sendDirectAddLiquidity
createResetGasBody
createResetGasBody
getResetGasTxParams
getResetGasTxParams
Build all data required to execute a reset_gas
transaction.
Arguments
provider
ContractProvider
Instance of @ton/core
contract provider
gasAmount
bigint | number | string | undefined
Transaction gas
queryId
bigint | number | undefined
Query id
Result
to
Address
Address of the router's Jetton wallet for the swapped token
value
bigint
Recommended amount of TON (in nanoTons) sent as gas
body
Cell | null | undefined
Optional Cell
with data to be send
Notes:
params
is entirely optionalthe default value for
gasAmount
is equal to 0.3 TON
sendResetGas
sendResetGas
Last updated