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

adding Para pregenerated wallet #303

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

Conversation

uratmangun
Copy link

@uratmangun uratmangun commented Feb 28, 2025

Pull Request Description

This PR adds integrate Para SDK to create, retrieve, update and use para pregenerated wallet with solana agent kit

Related Issue

Fixes # (issue number)

Changes Made

  • Added Para SDK integration for enhanced wallet management
  • Created functionality to create, retrieve, update, and use, pre-generated wallets
  • Added necessary environment variables (PARA_API_KEY)
  • Updated package dependencies to include Para SDKs (@getpara/server-sdk) and para solana signer sdk (@getpara/solana-web3.js-v1-integration)

Implementation Details

  • Created specific functions (createParaPregenWallet, getParaPregenWallets, updateParaPregenWallet, useParaPregenWallet, switchParaToMainWallet) to interact with Para wallet services

Transaction executed by agent

Example transaction:
The prompt:

create para pregen wallet for [email protected]
use para pregen wallet with userShare sdfsdfsdfsd
send 0.1 sol to <wallet address>

https://explorer.solana.com/tx/vpajh3Swtb9qPhEVq7mnu6hUFoFTZuhVbPi25RADTmkMW2ZvYgxnkdGgvHvDZpjrHLPTcPhU8XN79cKjvTcqBsS?cluster=devnet

Prompt Used

Create a Para wallet for [email protected]
Use Para wallet with userShare sdfsdfsdfsd
Get para wallets with email [email protected]
Update Para wallet with id 123 for [email protected]
Switch from Para wallet to main wallet

Additional Notes

This integration requires the PARA_API_KEY environment variable to be properly configured. The functionality allows for creating, retrieving, updating, and using Para pre-generated wallets, enhancing the wallet management capabilities of the application. The github repo for the demo: https://github.com/uratmangun/agent-stdio

You can see the demo with client MCP server here:
Watch the video

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

Added Para SDK integration with the following features:
- Create pre-generated wallets
- Get pre-generated wallets
- Update pre-generated wallets
- Added necessary environment variables
- Updated package dependencies
@uratmangun uratmangun changed the title Para adding Para pregenerated wallet Feb 28, 2025
@uratmangun uratmangun marked this pull request as draft March 1, 2025 13:45
Changes:
- Added useParaPregenWallet action and tool
- Modified Para integration files
- Updated package dependencies
Changes:
- Added deactivateParaPregenWallet and claimParaPregenWallet actions
- Updated agent methods to support new Para wallet management features
- Modified import and export statements in relevant files
- Updated action and tool implementations for new wallet operations
@uratmangun uratmangun marked this pull request as ready for review March 2, 2025 02:48
Changes:
- Refactored createParaPregenWallet to remove agent-specific userShare mapping
- Updated useParaPregenWallet to accept userShare instead of email
- Modified action and tool schemas to use userShare
- Removed unnecessary agent method modifications
- Updated input handling in Para-related tools and actions
Removes previously added claimParaPregenWallet action, tool, and related methods across multiple files. This appears to be a cleanup of an unused or deprecated feature in the Para wallet management integration.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the lint command so that files can be properly formatted

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,48 @@
import { Para as ParaServer, Environment, WalletType } from "@getpara/server-sdk";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please verify that the server sdk works in the browser as well as some people might want to use the Solana Agent kit in React, Solidjs or vanilla JS in the browser

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
yeah i test it just now and it works great im using the nextjs langchain example

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will end up not being compatible with V2. Is there a more modular way to do this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i saw the v2 and its actually what im looking for, i actually overriding the sendTransaction method of solanaAgentKit.connection.sendTransaction and i think its too hacky and now that you make sendTransaction modular it is much more better i will check em out and see what i can do, but it actually pretty compatible i can make it modular

Removes deactivateParaPregenWallet functionality and replaces it with switchParaToMainWallet across multiple files. This refactoring simplifies the Para wallet management flow and provides a more semantically clear method for transitioning wallet contexts.
@uratmangun uratmangun requested a review from michaelessiet March 3, 2025 02:17
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.

2 participants