Skip to content
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

feat: get all token balances #113

Merged
merged 11 commits into from
Jan 15, 2025

Conversation

michaelessiet
Copy link
Collaborator

@michaelessiet michaelessiet commented Jan 1, 2025

Pull Request Description

Related Issue

This doesn't fix any pre-existing issue, but is an attempt to claim the bring your own idea bounty.

Changes Made

This PR adds the following changes:

  • when token address is not supplied get_balance returns an object containing the amount of sol an address has but also the balance of each of it's non-TOKEN2022 token accounts

Implementation Details

  • While reading the Solana RPC docs I came across an endpoint that fetches all the token accounts owned by an address returns their balances along with that.
  • So with this data I thought why not just implement get_balance to be more comprehensive than just simple number values

Transaction executed by agent

Example transaction:
Screenshot 2025-01-11 at 18 10 20

Prompt Used

What's my balance

Additional Notes

Checklist

  • I have tested these changes locally
  • I have updated the documentation
  • I have added a transaction link
  • I have added the prompt used to test it

@michaelessiet
Copy link
Collaborator Author

The large number of changes is because of the lint command. Some prior commits weren't linted

@michaelessiet
Copy link
Collaborator Author

Screenshot 2025-01-02 at 13 44 21 More examples verifying that the change doesn't break anything related to the balance tool

@michaelessiet michaelessiet marked this pull request as ready for review January 2, 2025 12:46
@thearyanag
Copy link
Member

hey @michaelessiet - can we separate this into 2 tools?

  1. wallet balance
  2. token balance

given that some times, agent just want to knows it's SOL balance

@michaelessiet
Copy link
Collaborator Author

Sure. Will do

@michaelessiet
Copy link
Collaborator Author

Hey @thearyanag , I've updated the PR and separated it into 2 separate actions

@thearyanag
Copy link
Member

hey @michaelessiet - can you also pls update the final SS showcasing it

@michaelessiet
Copy link
Collaborator Author

Yup, on it

@michaelessiet
Copy link
Collaborator Author

the screenshot in the initial PR comment has been updated

@arihantbansal
Copy link
Member

LGTM!

@thearyanag thearyanag merged commit 3a33894 into sendaifun:main Jan 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants