OYL SDK Calls
The Oyl SDK provides utilities for interacting with the Alkanes metaprotocol and the Oyl AMM. This guide demonstrates common SDK operations.
Installation
Install the Oyl SDK using npm or yarn:
npm install @oyl/sdkCommon Operations
Query Pool Reserves
Get the current reserves of a trading pair:
const reserves = await sdk.getReserves(poolId);console.log('Reserve A:', reserves.reserve_a);console.log('Reserve B:', reserves.reserve_b);Calculate Swap Output
Calculate expected output for a swap:
const amountOut = await sdk.getAmountOut( amountIn, reserveIn, reserveOut );Execute a Swap
Perform a token swap:
const result = await sdk.swap({path: [tokenA, tokenB], amountIn: 1000000, amountOutMin: 900000, deadline: Date.now() + 300000});Additional Resources
- Full SDK documentation on GitHub
- Example projects and integration guides
- CLI tool for contract interactions
The Oyl SDK simplifies interaction with the protocol and provides helpful utilities for building applications on top of the Oyl AMM.