-
Notifications
You must be signed in to change notification settings - Fork 108
feat: add useTokenAccountsByOwner hook for fetching token accounts by… #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
tobeycodes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request: this should be return accounts;
|
|
||
| return { | ||
| ...rest, | ||
| accounts: (data as TokenAccountsQueryResult<TAddress> | undefined)?.accounts || [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: