sam-meteora-clmm-sdk
v0.3.6
Published
For now, see `playground.ts` for examples. Will add examples once stable.
Downloads
5
Readme
Example Usage
For now, see playground.ts for examples. Will add examples once stable.
Available functions
|Function|Description|Notes|
|---|---|--|
|getLbPairs|Get all available LB Pairs||
|getLbPair|Get a specific LB Pair||
|findLbPairs|Given a X and Y token mint, find corresponding LB Pair(s). Will also find inverse LB Pairs ie desiredTokenX as tokenY and desiredTokenY as tokenX||
|getBinsAroundActiveBin|Get current distribution based on a radius around the active bin. Returns price, bin id, x amount and y amount for each bin||
|getBinsBetweenMinAndMaxPrice|Get bins and corresponding distribution based on a min and max price. Returns price, bin id, x amount and y amount for each bin||
|getBinsBetweenLowerAndUpperBound|Get bins and corresponding distribution based on a min and max bin ID. Returns price, bin id, x amount and y amount for each bin||
|getCurrentPrice|Get current price for a LB pair||
|getPriceOfBinByLbPair|Get price of a bin by its bin id for a LB pair|Prefer getPriceOfBinByBinStep if already have information on bin step to reduce RPC calls|
|getPriceOfBinByBinStep|Get price of a bin by its bin id given a bin step|Use this when necessary but in general getBinsAroundActiveBin, getBinsBetweenMinAndMaxPrice and getBinsBetweenLowerAndUpperBound would already return the prices for each bin|
|getBinIdFromPrice|Returns the bin id given a price||
|getPositionsByUser|Get positions by user pubkey||
|getPositionsByUserAndLbPair|Get positions by user pubkey for a specific LB Pair||
|getPosition|Get detailed information for a specific position. information includes binId, price, positionXAmount, positionYAmount etc+||
|getEqualWeightageAmount|Returns an equal weightage amount of the opposing token based on ratio|This is useful when adding liquidity|
|initializePositionAndAddLiquidity|Returns a yet-to-be sent Transaction as well as position and positionMint. Use this to construct a transaction to add liquidity to a LB Pair|Note that X and Y distribution values are a percentage (in BPS) of totalX and totalY amount to be deposited. PositionMint will be remove in next iteration.|
|removeLiquidity|withdraw liquidity from a position||
|createLbPair|Create a new LB Pair or pool||
|swap|Works for swaps from X to Y or Y to X. Todo: Handle situation if bin array not yet initialized|If out token account does not exist, will create out token ATA. If out token is SOL, will receive WSOL. Does not handle for WSOL -> SOL|
