For the complete documentation index, see llms.txt. This page is also available as Markdown.

Deposit

Deposit liquidity into vaults. Users can deposit coinA and coinB, and the associated LP Token will be minted to the user.

const input_amount = toDecimalsAmount(3, 9).toString()
const InputType = {
  Both: 'both',
  OneSide: 'oneSide',
}

// Calculate deposit amount
const result = await sdk.Vaults.calculateDepositAmount({
  vault_id,
  fix_amount_a: false,
  input_amount,
  slippage: 0.01,
  side: InputType.OneSide,
})
// Build and send transaction
const tx = new Transaction()
const params: DepositParams = {
  vault_id,
  slippage: 0.01,
  deposit_result: result,
  coin_object_b: VaultsUtils.buildCoinWithBalance(
    BigInt(input_amount),
    '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
    tx
  ),
  return_lp_token: true,
}
const lp_coin = await sdk.Vaults.deposit(params, tx)
if (lp_coin) {
  tx.transferObjects([lp_coin], '0x0..')
}

Last updated