🟧
JS SDK Cross-chain Zap
Symbiosis JS SDK Cross-chain Zap
Symbiosis owns liquidity pools with {stablecoin <> sToken} pairs to perform cross-chain swaps. To simplify adding liquidity to these pools across blockchains, we implemented cross-chain Zaps.
If you want to understand what happens under the hood during cross-chain zaps, refer to Symbiosis Routing Contracts.
JS SDK implements one method for cross-chain zaps:
Zapping.exactIn
. The method is identical to Swapping.exactIn
As a result of the operation, the user gets LP tokens of the liquidity pool to the address
to
const zapping = symbiosis.newZapping()
const { transactionRequest, fee, tokenAmountOut, route, priceImpact } = await zapping.exactIn(
tokenAmountIn,
poolAddress,
poolChainId,
from,
to,
revertableAddress,
slippage,
deadline,
use1Inch
)
// Send the transaction and get a receipt
const receipt = sendTransaction(transactionRequest)
// Wait for the transaction to be completed on the destination chain
const log = await zapping.waitForComplete(receipt)
Last modified 28d ago