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: integrate Solana GPT Wallet into examples #219

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

pegasus1134
Copy link

Related Issue

Fixes #126 (Example Request: Solana GPT Wallet).

Changes Made

This PR adds the following changes:

  • Added the Solana GPT Wallet to examples/solana-gpt-wallet/.
  • Integrated an AI-powered interface for interacting with Solana wallets.

Implemented the following features:

  • Token Swaps: Enabled via Jupiter API (Devnet) - Currently not fully functional.
  • Token Sends: Supports native SOL and SPL token transfers.
  • Transaction History: Tracks and displays recent transactions.
  • Automated Test SOL Airdrops: One-click 2 SOL airdrop for testing purposes.

Implementation Details

  • Built with Next.js, React, and TypeScript for a modern and scalable interface.
  • Blockchain interactions are powered by @solana/web3.js and @solana/spl-token:
  • Swaps: Uses the Jupiter API for token exchange.
  • Transfers: Implements SystemProgram.transfer for SOL and SPL token transactions.
  • Integrated OpenAI GPT-4o-mini for natural language processing.
  • Used Zustand for real-time state management.

Transaction Executed by Agent

Example transaction:

  • Type: Token transfer (SOL).
  • Transaction ID: View Transaction on Solscan.
  • From: HTBCtG3qRnsQeH2phvsmHnYMZcXgCgB3GE3WUDEJX8c.
  • To: B2pCag7JEgoaXuZ1WUCzfWrD9LhYQm3sN58ao1BzCETb.

Prompt Used

Transfer 3 SOL to wallet address B2pCag7JEgoaXuZ1WUCzfWrD9LhYQm3sN58ao1BzCETb

Additional Notes

Limitations:

  • Swap functionality depends on the Jupiter API, which has limited support on Devnet.
  • Currently supports GPT-4o-mini; future updates could integrate other AI models.

All features were tested locally on Solana Devnet.

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

@pegasus1134
Copy link
Author

Project deployed at https://solana-gpt-wallet.vercel.app for testing.

@michaelessiet
Copy link
Collaborator

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

@pegasus1134
Copy link
Author

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

Hey! On it now. Will give you an update in some time.

@pegasus1134
Copy link
Author

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

I have now deployed to mainnet by making a few changes. I might still take a little bit more time to come up with the final version, you can meanwhile connect your wallet and check it out. If there's anything I can fix do let me know...

@pegasus1134
Copy link
Author

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

Hey! I would like to work on this and close this today. Is there anything specific you would like me to do apart from the mainnet deployment and sharing transaction screenshots?

@michaelessiet
Copy link
Collaborator

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

Hey! I would like to work on this and close this today. Is there anything specific you would like me to do apart from the mainnet deployment and sharing transaction screenshots?

Yes, I noticed that you're not making use of the SolanaAgentKit in your gpt.service file. Please implement this app using the SolanaAgentKit as the primary way of interacting with the blockchain

@pegasus1134
Copy link
Author

Hey @pegasus1134, please can you launch this to mainnet so that we can test it properly. Also please attach screenshots showcasing the example performing on-chain actions

Hey! I would like to work on this and close this today. Is there anything specific you would like me to do apart from the mainnet deployment and sharing transaction screenshots?

Yes, I noticed that you're not making use of the SolanaAgentKit in your gpt.service file. Please implement this app using the SolanaAgentKit as the primary way of interacting with the blockchain

Thanks for letting me know. I will have this updated and ready to merge in a few hours

@pegasus1134
Copy link
Author

@michaelessiet Update: The SolanaAgentKit has now been fully integrated into the Solana GPT Wallet.

However, there is currently an issue with the agent initialization: Command processing error: Error: bad secret key size
at new GPTService (src/services/gpt.service.ts:77:21)
at handler (src/pages/api/process-command.ts:25:24)

This appears to be related to how the agent private key is being passed or initialized.
I'll be debugging this, but let me know if you have any insights on resolving this error.

- Successfully integrated SolanaAgentKit for SOL transactions
- Implemented user wallet authentication for mainnet
- Added GPT natural language processing
- Ready for mainnet SOL transactions
- Resolved agent initialization issues
@pegasus1134
Copy link
Author

I have added Solana Agent Kit into the project and it is now used in the gpt.service.ts file. Swaps are WIP currently. Send screenshots attached below. Hope we are ready to merge. Let me know if anything!
Uploading Screenshot 2025-02-04 at 7.30.22 PM.png…

@pegasus1134
Copy link
Author

Screenshot 2025-02-04 at 7 31 02 PM Screenshot 2025-02-04 at 7 31 17 PM @michaelessiet Thanks!

@pegasus1134
Copy link
Author

@michaelessiet I've currently spent way too much time on this project for me to ignore it now, so I'd like to get this merged at any cost. If there is anything at all you'd like me to do you can let me know.

@michaelessiet
Copy link
Collaborator

Screenshot 2025-02-05 at 14 09 06 Hey @pegasus1134, the app seems to be broken. No matter what I ask it it seems to return an error

@pegasus1134
Copy link
Author

Screenshot 2025-02-05 at 14 09 06 Hey @pegasus1134, the app seems to be broken. No matter what I ask it it seems to return an error

il definitely check this out and fix it. It works perfectly fine on the local system though. While I fix the deployed app you can maybe clone the repo and try running it locally and see if there are other issues with the code? It should be working there

@michaelessiet
Copy link
Collaborator

Sure, however, please know that we can not merge it unless a deployed version is fully functional

@pegasus1134
Copy link
Author

Sure, however, please know that we can not merge it unless a deployed version is fully functional

Absolutely, I understand. Working on fixing the deployed app right away.

I also wanted to know if you are looking for just a POC with Solana Token Send functionality in this PR, or it should be able to do everything like Creation, Swaps, etc before merging it?

@pegasus1134
Copy link
Author

@michaelessiet I've fixed the issue. It was due to vercel limiting the serverless functions, no changes to the code. So now I've deployed it on render. The server might be a bit slow but I just tested a send transaction and it worked. Please do check it out: https://solana-gpt-wallet.onrender.com/

@pegasus1134
Copy link
Author

@michaelessiet Can you please check and let me know if it’s good to go?

@pegasus1134
Copy link
Author

@thearyanag Could you please pitch in and let me know what I can do further to get this merged?

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.

Example Request: Solana GPT Wallet
2 participants