Get Pool by Address
Fetch and query a Fluxbeam pool info based on it's address.
Fetch parsed pool info
async function getPoolByAddress(poolAddress) {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
//get a fluxbeam Pool details using pool address
const operationsDoc = `
query MyQuery {
Fluxbeam_TokenSwap(
where: {pubkey: {_eq: ${JSON.stringify(poolAddress)}}}
) {
tokenPool
mintB
mintA
pubkey
curveType
}
}
`; //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 });
}
getPoolByAddress("GNezyhAbtximo2T63NBa96pYAnsfCXxW2dwcvziKfd9r");
//pool address for which you want the detailsLast updated