🟧
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, check out this document: Cross-chain Zaps
JS SDK implements one method for cross-chain zaps: Zapping.exactIn. The method is almost identical to Swapping.exactIn except two properties for input:
Property
Description
poolAddress
The liquidity pool's address to add liquidity to.
poolChainId
The network's chainid where the liquidity pool is located.
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)
Copy link