Master the core concepts of DLMM including bins, bin steps, active bins, and how price discovery works in a discretized system.
Quick Example
Here's a taste of what you can do with the DLMM SDK:
import{FerraDlmmSDK,BinMath}from'@ferra-xyz/dlmm'// Initialize SDKconstsdk=newFerraDlmmSDK({network:'mainnet',fullNodeUrl:'https://...',senderAddress:'0x...'})// Get a pair and check priceconstpair=awaitsdk.Pair.getPair('0x...')constprice=BinMath.getPriceFromId(pair.parameters.active_id,Number(pair.binStep),9,// tokenX decimals6// tokenY decimals)console.log(`Current price: ${price} tokenY per tokenX`)
Prerequisites
Before you begin, ensure you have:
Node.js 16+ installed
Basic understanding of DeFi and liquidity provision