chakra-sdk
v1.0.1
Published
Chakra SDK to access the Kriya derivatives suite
Downloads
160
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);