A Python package for Lit agentWallet
Project description
Lit Protocol Agent Wallet Python SDK
A Python SDK for interacting with Lit Protocol's Agent Wallet and executing ERC20 transfers. This SDK provides a wrapper around Lit Protocol's tools and Agent Wallet functionality.
Prerequisites
- Python 3.7+
- Node.js and npm
@lit-protocol/agent-wallet
npm package- Required Python packages (install via pip):
- web3
- eth-utils
- eth-typing
- python-dotenv
- lit-python-sdk
Installation
- First, install the required Node.js package:
npm install @lit-protocol/agent-wallet
Install the Python dependencies:
pip install web3 eth-utils eth-typing python-dotenv lit-python-sdk
Set up your environment variables: Create a .env file in your project root and add:
LIT_PRIVATE_KEY=your_lit_private_key_here
Features
ERC20 token transfers using Lit Protocol Tool management (listing, searching, and retrieving tool information) Session signature management Address validation Network-specific tool queries
Usage Examples Basic Tool Management pythonCopyfrom agent_wallet_python.client import AgentWalletClient
Initialize the client
client = AgentWalletClient()
List available tools
tool_names = client.get_available_tool_names()
print(f"Available tools: {', '.join(tool_names)}")
Get specific tool
tool = client.get_tool_by_name("ERC20Transfer", network="datil-dev")
ERC20 Token Transfer
pythonCopyfrom lit_erc20_transfer import LitERC20Transfer
Initialize transfer client
transfer_client = LitERC20Transfer(network="datil-dev")
transfer_client.connect()
Execute transfer
result = transfer_client.execute_transfer( pkp_eth_address="0xYourPKPAddress", token_address="0xTokenAddress", recipient_address="0xRecipientAddress", amount="1.0", rpc_url="https://your-rpc-url", chain_id=84532 ) API Reference LitERC20Transfer Methods
connect(): Initialize and connect to Lit Protocol execute_transfer(pkp_eth_address, token_address, recipient_address, amount, rpc_url, chain_id, decimals=18): Execute an ERC20 token transfer get_session_signatures(): Get session signatures for Lit Protocol validate_address(address): Validate Ethereum addresses validate_amount(amount): Validate transfer amounts
AgentWalletClient Methods
list_all_tools(): Get all available tools across networks list_tools_by_network(network): Get tools filtered by network get_tool_by_ipfs_cid(cid): Get a tool by its IPFS CID get_tool_by_name(name, network=None): Get a tool by its name get_available_tool_names(): Get a list of all available tool names
Error Handling The SDK includes comprehensive error handling for:
Invalid addresses Invalid amounts Network connection issues Tool retrieval failures Session signature errors
Network Support The SDK supports multiple networks:
datil datil-dev datil-test
Security Considerations
Always keep your LIT_PRIVATE_KEY secure and never commit it to version control Validate all addresses and amounts before executing transfers Use appropriate session expiration times Implement proper error handling in production environments
Contributing Contributions are welcome! Please submit pull requests with any improvements or bug fixes. License [MIT] Copy You can now copy this entire code block and use it as your README.md file. The formatting will be preserved exactly as shown.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file agentwallet_python-0.1.0.tar.gz
.
File metadata
- Download URL: agentwallet_python-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b69a6cf39ed821c4cc3fe1b0e3a2d21dab33384b5060fae43e061e48513612eb
|
|
MD5 |
bc8321aa0edb42829ffbaf1649db0107
|
|
BLAKE2b-256 |
9d1e2d69902f36c3a6a48243b18ea42b75b01fab7555365c640e688527140402
|
File details
Details for the file agentWallet_python-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: agentWallet_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7f5697f3b06c97e76068f1d89d2822d57be1ee12f30360a847bc9915f4e894a1
|
|
MD5 |
4068750014dbd6fbd18ba4e01478faae
|
|
BLAKE2b-256 |
3c798a922b25dc6ba5fb14377b7a3ae707079e4d45fb7f29549c7e3d84d7ce3d
|