feat: add useTokenAccountsByOwner hook for fetching token accounts by…#247
feat: add useTokenAccountsByOwner hook for fetching token accounts by…#247cxalem wants to merge 2 commits intogillsdk:masterfrom
Conversation
|
tobeycodes
left a comment
There was a problem hiding this comment.
Nice work! I did not check out the branch locally to test it but I left some of my thoughts for your review
… owner - Introduced a new hook `useTokenAccountsByOwner` to retrieve token accounts associated with a specific owner address, with optional filtering by token mint and zero balance inclusion. - Updated the hooks index to export the new hook. # Conflicts: # packages/react/src/hooks/index.ts
…type - Introduced a new utility type `ExistingAccount` to better represent on-chain accounts. - Updated the `account` property in `TokenAccountWithAddress` to use the new type. - Simplified the query function by removing unnecessary error handling and improving account processing logic.
| return { | ||
| accounts: allAccounts, | ||
| total: allAccounts.length, | ||
| }; |
There was a problem hiding this comment.
request: this should be return accounts;
|
|
||
| return { | ||
| ...rest, | ||
| accounts: (data as TokenAccountsQueryResult<TAddress> | undefined)?.accounts || [], |
There was a problem hiding this comment.
request: this should be accounts: data
… owner
useTokenAccountsByOwnerto retrieve token accounts associated with a specific owner address, with optional filtering by token mint and zero balance inclusion.Problem
Based on this issue #167
Summary of Changes
Commit Summary
Added
useTokenAccountsByOwnerReact HookFixes #
Usage examples: