Deposit Liquidity
Example: Depositing Assets into a Pool
1. Initialize SDK
import { TorchSDK, generateQueryId, DepositParams, toUnit } from '@torch-finance/sdk';
import { Asset } from '@torch-finance/core';
const sdk = new TorchSDK();2. Define Deposit Parameters
const queryId = await generateQueryId()
// Define assets
const TON_ASSET = Asset.ton();
const TSTON_ASSET = Asset.jetton("EQC98_qAmNEptUtPc7W6xdHh_ZHrBUFpw5Ft_IzNU20QAJav");
const STTON_ASSET = Asset.jetton("EQDNhy-nxYFgUqzfUzImBEP67JqsyMIcyk2S5_RwNNEYku0k");
const HTON_ASSET = Asset.jetton("EQDPdq8xjAhytYqfGSX8KcFWIReCufsB9Wdg0pLlYSO_h76w");
const LSDPoolAddress = "EQD_pool_address_example";
const MetaPoolAddress = "EQD_meta_pool_address_example";
// Define deposit parameters
const depositParams: DepositParams = {
queryId,
pool: BasePoolAddress,
depositAmounts: [
{
asset: TSTON_ASSET,
value: toUnit('0.0000001', 9), // 0.0000001 TSTON in TriTON pool
},
{
asset: STTON_ASSET,
value: toUnit('0.0000001', 9), // 0.0000001 STTON in TriTON pool
},
{
asset: TON_ASSET,
value: toUnit('0.0000001', 9), // 0.0000001 TON in TriTON pool
},
],
nextDeposit: {
pool: MetaPoolAddress,
depositAmounts: { asset: HTON_ASSET, value: toUnit('0.0000001', 9) }, // 0.0000001 HTON in Meta USD pool
},
slippageTolerance: 0.01, // 1%
};
3. Preview the Deposit
4. Execute the Deposit
4.1 Execute Swap with Simulation Result
4.2 Execute Swap Directly with Swap Params
Last updated