kriya-dex-sdk
v2.0.8
Published
Kriya SDK to access the Kriya DeFi protocols suite.
Downloads
3,725
Readme
Chakra SDK
Initialize SDK
import { Spot } from 'chakra-sdk';
const singer = new RawSigner(...);
const kriyaSpot = new Spot(signer);
Spot Data APIs
// List pools
kriyaSpot.listPools();
// Get price
kriyaSpot.getPrice(poolId);
// Get Lp tokens received on adding liquidity
kriyaSpot.getLpAmountIn(poolId, amount);
// Get tokens received on removing liquidity
kriyaSpot.getLpAmountsOut(poolId, amount);
Spot Action APIs
// Swap tokens
// Input inputTokenId, outputTokenId, amount, minReceived
await kriyaSpot.swap(inputTokenId, outputTokenId, amount, minReceived);
// Add liquidity
// Input tokenAId, tokenBId, amountA, amountB, minA, minB
await kriyaSpot.addLiquidity(tokenAId, tokenBId, amountA, amountB, minA, minB);
// Remove liquidity
// Input poolId, amount
await kriyaSpot.removeLiquidity(poolId, amount);