reference
This section contains sdk methods reference
Router
address
address
Address of the Router contract
gasConstants
gasConstants
Getters
getPoolAddress
getPoolAddress
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| The address of the router's wallet of first Jetton |
|
| 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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| The address of the first pool Jetton |
|
| The address of the second pool Jetton |
Result
Returns an address of a pool for a specified pair of assets.
getPool
getPool
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| The address of the first pool Jetton |
|
| The address of the second pool Jetton |
Result
Returns an instance of PoolV1
with specified Jetton token addresses.
getRouterData
getRouterData
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Result
Returns structure containing current state of the router.
Name | Type | Description |
---|---|---|
|
| true if |
|
| Address of contract's admin account |
|
| A structure describing state of contract's code & admin upgrade; zero values indicate that no upgrade is pending |
|
| Code of the router's liquidity pool contract |
|
| Code of lp wallet contract |
|
| Code of lp account contract |
Operations
createSwapBody
createSwapBody
Name | Type | Description |
---|---|---|
|
| User's address |
|
| Minimum amount of tokens received (in basic token units) |
|
| Jetton router's wallet address of tokens to be received |
|
| referral address |
getSwapJettonToJettonTxParams
getSwapJettonToJettonTxParams
Build all data required to execute a jetton to jetton swap
transaction
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| User's address |
|
| Jetton |
|
| Jetton |
|
| Amount of tokens to be swapped (in basic token units) |
|
| Minimum amount of tokens to be received (in basic token units) |
|
| Referral address |
|
| Transaction gas |
|
| Forward amount of gas for the next transaction (in nanoTons) |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendSwapJettonToJetton
sendSwapJettonToJetton
getSwapJettonToTonTxParams
getSwapJettonToTonTxParams
Build all data required to execute a jetton to ton swap
transaction
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| User's address |
|
| Jetton |
|
| instance of pTON contract |
|
| Amount of tokens to be swapped (in basic token units) |
|
| Minimum amount of tokens to be received (in basic token units) |
|
| Referral address |
|
| Transaction gas |
|
| Forward amount of gas for the next transaction (in nanoTons) |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendSwapJettonToTon
sendSwapJettonToTon
getSwapTonToJettonTxParams
getSwapTonToJettonTxParams
Build all data required to execute a ton to jetton swap
transaction
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| User's address |
|
| instance of pTON contract |
|
| Jetton |
|
| Amount of tokens to be swapped (in basic token units) |
|
| Minimum amount of tokens to be received (in basic token units) |
|
| Referral address |
|
| Forward amount of gas for the next transaction (in nanoTons) |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendSwapTonToJetton
sendSwapTonToJetton
createProvideLiquidityBody
createProvideLiquidityBody
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton token wallet |
|
| Minimum amount of created liquidity tokens (in basic token units) |
getProvideLiquidityJettonTxParams
getProvideLiquidityJettonTxParams
Collect all data required to execute a jetton provide_lp
transaction
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| User's address |
|
| Address of the first Jetton token or a proxy ton contract |
|
| Address of the second Jetton token |
|
| Amount of the first/second tokens deposited as liquidity (in basic token units) |
|
| Minimum amount of created liquidity tokens (in basic token units) |
|
| Transaction gas |
|
| Forward amount of gas for the next transaction (in nanoTons) |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendProvideLiquidityJetton
sendProvideLiquidityJetton
getProvideLiquidityTonTxParams
getProvideLiquidityTonTxParams
Collect all data required to execute a proxy ton provide_lp
transaction
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| User's address |
|
| instance of pTON contract |
|
| Address of the second Jetton token |
|
| Amount of the first/second tokens deposited as liquidity (in basic token units) |
|
| Minimum amount of created liquidity tokens (in basic token units) |
|
| Forward amount of gas for the next transaction (in nanoTons) |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendProvideLiquidityTon
sendProvideLiquidityTon
Pool
address
address
Address of the Pool contract
gasConstants
gasConstants
Getters
getPoolData
getPoolData
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Result
Returns structure containing current state of the pool.
Name | Type | Description |
---|---|---|
|
| Amount of the first token (in basic token units) |
|
| Amount of the second token (in basic token units) |
|
| Address of the first Jetton token |
|
| Address of the second Jetton token |
|
| Liquidity pool fee value |
|
| Protocol fee |
|
| Referral fee |
|
| Address for receiving protocol fees |
|
| Amount of collected protocol fees of the first token (in basic token units) |
|
| 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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Amount of tokens to swap (in basic token units) |
|
| 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
Name | Type | Description |
---|---|---|
|
| Amount of tokens received (in basic token units) |
|
| Amount tokens paid for protocol fees (in basic token units) |
|
| Amount tokens paid for referral fees (in basic token units) |
getExpectedTokens
getExpectedTokens
Estimate an expected amount of lp tokens minted when providing liquidity.
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Amount of tokens for the first Jetton (in basic token units) |
|
| 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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Amount of liquidity tokens (in basic token units) |
Result
Returns structure with expected freed liquidity
Name | Type | Description |
---|---|---|
|
| Amount of tokens for the first Jetton (in basic token units) |
|
| Amount of tokens for the second Jetton (in basic token units) |
getLpAccountAddress
getLpAccountAddress
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Address of a user |
Result
Function getLpAccountAddress
returns the lp account address of a user
getLpAccount
getLpAccount
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Address of a user |
Result
returns an instance of LpAccountV1
getJettonData
getJettonData
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Result
Returns a structure with Jetton data
Name | Type | Description |
---|---|---|
|
| Total token supply (in basic token units) |
|
| If mintable |
|
| Admin address |
|
| Offchain uri with Jetton data |
|
| Code of the lp Jetton wallet |
getWalletAddress
getWalletAddress
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
|
| Address of a user |
Result
returns a calculated lp wallet address of a user
getJettonWallet
getJettonWallet
Arguments
Name | Type | Description |
---|---|---|
|
| Address of a user |
Name | Type | Description |
---|---|---|
|
| 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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Transaction gas |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Lp tokens to burn |
|
| Excesses address |
|
| Transaction gas |
|
| Query id |
sendBurn
sendBurn
LpAccount
address
address
Address of the LpAccount contract
gasConstants
gasConstants
Getters
getLpAccountData
getLpAccountData
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Result
Returns structure containing current state of the lp account.
Name | Type | Description |
---|---|---|
|
| Owner's address |
|
| Pool's address |
|
| Balance of the first Jetton token (in basic token units) |
|
| 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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Transaction gas |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
sendRefund
sendRefund
createDirectAddLiquidityBody
createDirectAddLiquidityBody
getDirectAddLiquidityTxParams
getDirectAddLiquidityTxParams
Build all data required to execute a direct_add_liquidity
transaction.
Arguments
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Amount of the first Jetton tokens (in basic token units) |
|
| Amount of the second Jetton tokens (in basic token units) |
|
| Minimum amount of received liquidity tokens (in basic token units) |
|
| Transaction gas |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
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
Name | Type | Description |
---|---|---|
|
| Instance of |
Name | Type | Description |
---|---|---|
|
| Transaction gas |
|
| Query id |
Result
Name | Type | Description |
---|---|---|
|
| Address of the router's Jetton wallet for the swapped token |
|
| Recommended amount of TON (in nanoTons) sent as gas |
|
| Optional |
Notes:
params
is entirely optionalthe default value for
gasAmount
is equal to 0.3 TON
sendResetGas
sendResetGas
Last updated