Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
calintje committed Nov 15, 2024
1 parent b157b1c commit 153c1ec
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ts-sdk/client/src/gpa/whirlpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,25 @@ export function whirlpoolRewardVault3Filter(
} as WhirlpoolFilter;
}

/**
* Fetches all Whirlpool accounts with the specified filters.
*
* This function fetches all Whirlpool accounts from the blockchain that match the specified filters.
* It uses the Whirlpool discriminator to identify Whirlpool accounts and applies additional filters
* provided as arguments.
*
* @param {Rpc<GetProgramAccountsApi>} rpc - The Solana RPC client to fetch program accounts.
* @param {...WhirlpoolFilter[]} filters - The filters to apply when fetching Whirlpool accounts.
* @returns {Promise<Account<Whirlpool>[]>} A promise that resolves to an array of Whirlpool accounts.
*
* @example
* import { address, createSolanaRpc, devnet } from "@solana/web3.js";
* import { fetchAllWhirlpoolWithFilter, whirlpoolWhirlpoolConfigFilter } from "@orca-so/whirlpools-client";
*
* const rpcDevnet = createSolanaRpc(devnet("https://api.devnet.solana.com"));
* const WHIRLPOOLS_CONFIG_ADDRESS_DEVNET = address("FcrweFY1G9HJAHG5inkGB6pKg1HZ6x9UC2WioAfWrGkR");
* const whirlpools = await fetchAllWhirlpoolWithFilter(rpcDevnet, whirlpoolWhirlpoolConfigFilter(WHIRLPOOLS_CONFIG_ADDRESS_DEVNET));
*/
export async function fetchAllWhirlpoolWithFilter(
rpc: Rpc<GetProgramAccountsApi>,
...filters: WhirlpoolFilter[]
Expand Down

0 comments on commit 153c1ec

Please sign in to comment.