jumbo-exchange-sdk
v1.0.0
Published
npm Package - jumbo-exchange-sdk
Readme
jumbo-exchange-sdk
SDK for interacting with the Jumbo Exchange on NEAR Protocol.
Installation
npm install jumbo-exchange-sdk
Usage
Get Configuration
import { getConfig } from 'jumbo-exchange-sdk';
const config = getConfig({ networkId: 'mainnet' });
Get Pool Info
import { getPool } from 'jumbo-exchange-sdk';
const pool = await getPool(42); // with config override const pool = await getPool(42, { networkId: 'testnet' });
Get Token Balance
import { getTokenBalance } from 'jumbo-exchange-sdk';
const balance = await getTokenBalance( 'token.near', 'myaccount.near' );
Swap Tokens
import { swap } from 'jumbo-exchange-sdk';
const result = await swap({ tokenIn: 'token-a.near', tokenOut: 'token-b.near', amountIn: '1000000', minAmountOut: '990000', });
Add Liquidity
import { addLiquidity } from 'jumbo-exchange-sdk';
const result = await addLiquidity( 42, ['1000000', '2000000'], account );
API
| Function | Description |
|---|---|
| getConfig(overrides?) | Returns full resolved config |
| getPool(poolId, config?) | Fetches pool info by ID |
| getTokenBalance(tokenId, accountId, config?) | Fetches token balance for an account |
| swap(params, config?) | Executes a token swap |
| addLiquidity(poolId, amounts, account, config?) | Adds liquidity to a pool |
License
MIT
