Identifying Whirlpool Tokens

If a service would like to see existing Whirlpool positions on a user's wallet, they can perform the following steps with utility functions from the Typescript SDK:

  1. Fetch all tokens in a user's wallet address

  2. For each token mint, derive the position PDA with getPositionPda.

  3. For each positionPda, use the fetcher's getPosition method to fetch the Position data. Filter out the empty ones.

  4. For each fetched position, filter out the ones where the position's does not match your list of supported Whirlpool address.

  5. If a list of addresses is not available, the service may want to filter the positions by their desired WhirlpoolsConfig instead. Given the position account doesn't host this data, the service will have to manually pull down each Whirlpool account and check it's whirlpoolsConfig key.

Last updated