# Get Pool by Address

We can apply filters on any field of a Orca account. If we want to fetch a pool by its address (public key), then we need to apply where filter on its <mark style="color:yellow;">pubKey</mark>.

You can directly copy paste this code on <mark style="color:yellow;">replit</mark> and see it in action.

#### Fetch parsed pool info

{% tabs %}
{% tab title="Code " %}
{% code overflow="wrap" %}

```typescript
import { Connection, PublicKey } from "@solana/web3.js";
import { gql, GraphQLClient } from "graphql-request";

const SHYFT_API_KEY = 'YOUR-KEY';

const graphQLEndpoint = `https://programs.shyft.to/v0/graphql/?api_key=${SHYFT_API_KEY}`;

const graphQLClient = new GraphQLClient(graphQLEndpoint, {
  method: `POST`,
  jsonSerializer: {
    parse: JSON.parse,
    stringify: JSON.stringify,
  },
});

async function queryOrcaPool(address:string) {
  // We only fetch fields necessary for us
  const query = gql`
query MyQuery {
  ORCA_WHIRLPOOLS_whirlpool(
    where: {pubkey: {_eq: ${JSON.stringify(address)}}}
  ) {
    feeGrowthGlobalA
    feeGrowthGlobalB
    feeRate
    liquidity
    protocolFeeOwedA
    protocolFeeOwedB
    protocolFeeRate
    rewardLastUpdatedTimestamp
    sqrtPrice
    tickCurrentIndex
    tickSpacing
    tokenMintA
    tokenMintB
    tokenVaultA
    tokenVaultB
    whirlpoolsConfig
    rewardInfos
    tickSpacingSeed
    whirlpoolBump
    pubkey
  }
}`;

  return await graphQLClient.request(query);
}

//This is WEN-USDC pool addres
const poolInfo = await queryOrcaPool('5y2jFFA3A8GNjRnVMg8LfTHbBg7y2vivopiK8LmGRP2B');
console.log(poolInfo)
```

{% endcode %}
{% endtab %}

{% tab title="Response" %}
{% code overflow="wrap" %}

```json
{
  "data": {
    "ORCA_WHIRLPOOLS_whirlpool": [
      {
        "_lamports": 6835882,
        "feeGrowthGlobalA": 231258459758921020000,
        "feeGrowthGlobalB": 323593608381790200,
        "feeRate": 1600,
        "liquidity": 25737860849531,
        "protocolFeeOwedA": 456759997,
        "protocolFeeOwedB": 1960049,
        "protocolFeeRate": 1,
        "rewardLastUpdatedTimestamp": 1711629638,
        "sqrtPrice": 1162262018220541200,
        "tickCurrentIndex": -55294,
        "tickSpacing": 16,
        "tokenMintA": "WENWENvqqNya429ubCdR81ZmD69brwQaaBYY6p3LCpk",
        "tokenMintB": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "tokenVaultA": "FLVWmkfEcacdRW3xw6ZsW2couNwyiXKXP7nyTc1zJMov",
        "tokenVaultB": "A7CSkqoDemkyLnBCN8zhdpscFDntEqsv3jw4LDHEHs9T",
        "whirlpoolsConfig": "2LecshUwdy9xi7meFgHtFJQNSKk4KdTrcpvaB56dP2NQ",
        "rewardInfos": [
          {
            "mint": "11111111111111111111111111111111",
            "vault": "11111111111111111111111111111111",
            "authority": "DjDsi34mSB66p2nhBL6YvhbcLtZbkGfNybFeLDjJqxJW",
            "growthGlobalX64": "0",
            "emissionsPerSecondX64": "0"
          },
          {
            "mint": "11111111111111111111111111111111",
            "vault": "11111111111111111111111111111111",
            "authority": "DjDsi34mSB66p2nhBL6YvhbcLtZbkGfNybFeLDjJqxJW",
            "growthGlobalX64": "0",
            "emissionsPerSecondX64": "0"
          },
          {
            "mint": "11111111111111111111111111111111",
            "vault": "11111111111111111111111111111111",
            "authority": "DjDsi34mSB66p2nhBL6YvhbcLtZbkGfNybFeLDjJqxJW",
            "growthGlobalX64": "0",
            "emissionsPerSecondX64": "0"
          }
        ],
        "tickSpacingSeed": [
          16,
          0
        ],
        "whirlpoolBump": [
          255
        ],
        "pubkey": "5y2jFFA3A8GNjRnVMg8LfTHbBg7y2vivopiK8LmGRP2B"
      }
    ]
  }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

Once you have the pool info, you need to make sense of the data as well. For example, how much liquidity is present in the pool. You can do it by following this case study.

{% content-ref url="/pages/5Sten7Ss7JVt8SzOz3RF" %}
[Get Liquidity Details of a Pool](/solana-indexers/case-studies/orca-whirlpool/get-liquidity-details-of-a-pool.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shyft.to/solana-indexers/case-studies/orca-whirlpool/get-pool-by-address.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
