Skip to content

Conversation

@luchobonatti
Copy link
Member

Add getPoolKeyFromPoolId utility and hook

Changes

  • Added getPoolKeyFromPoolId utility function to extract pool key data from a pool ID
  • Created useGetPoolKeyFromPoolId React Query hook for easy integration
  • Added comprehensive tests for both utility and hook
  • Added TSDoc documentation

Technical Details

  • Utility function decodes pool ID bytes to extract:
    • Token addresses
    • Fee tier
    • Tick spacing
    • Hook address
  • Hook provides automatic caching, loading states and error handling
  • Follows existing project patterns and conventions

Testing

  • Unit tests for utility function
  • Integration tests for React hook
  • Edge cases covered (invalid pool IDs, network errors)

Usage Example

const { data: poolKey, isLoading } = useGetPoolKeyFromPoolId({
  poolId: "0x1234...",
  chainId: 1
});

@luchobonatti luchobonatti self-assigned this May 26, 2025
@luchobonatti luchobonatti merged commit df36f55 into main May 26, 2025
1 check passed
@luchobonatti luchobonatti deleted the feat/getPoolKeyFromPoolId branch May 26, 2025 14:07
@github-actions
Copy link

🎉 This PR is included in version 1.0.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants