Get All LB Position Pairs

Fetch all LB Position pool info for Meteora DLMM

We can fetch all LB Pairs for the mainnet cluster for meteora DLMM using SHYFT's GraphQL APIs.

You can directly copy paste this code on replit and see it in action.

async function getAllLbPairs() {
	const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
	//get all Lb Pairs for meteora DLMM
	const operationsDoc = `
		query MyQuery {
		   meteora_dlmm_LbPair {
			activationPoint
                        activationType
                        activeId
                        baseKey
                        binStep
                        creator
                        creatorPoolOnOffControl
                        lastUpdatedAt
                        oracle
                        padding4
                        pairType
                        parameters
                        preActivationDuration
                        preActivationSwapAddress
                        protocolFee
                        requireBaseFactorSeed
                        reserveX
                        reserveY
                        status
                        tokenMintXProgramFlag
                        tokenMintYProgramFlag
                        tokenXMint
                        tokenYMint
		   }
		}
		`; //you can cherrypick the fields as per your requirement
	const result = await fetch(
	  `https://programs.shyft.to/v0/graphql/accounts?api_key=${SHYFT_API_KEY}&network=mainnet-beta`, //SHYFT's GQL endpoint
	  {
		method: "POST",
		body: JSON.stringify({
		  query: operationsDoc,
		  variables: {},
		  operationName: "MyQuery",
		}),
	  },
	);
  
	const { errors, data } = await result.json();
  
	console.dir(data, { depth: null });
  }
  
  getAllLbPairs();

Last updated

Was this helpful?