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 {
				_lamports
				activationSlot
				activeId
				baseKey
				binStep
				feeOwner
				lastUpdatedAt
				maxSwappedAmount
				oracle
				pairType
				protocolFee
				reserveX
				reserveY
				status
				swapCapDeactivateSlot
				tokenXMint
				tokenYMint
				whitelistedWallet
				pubkey
			}
		}
		`; //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