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-walletnpm 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.
Metadata
Release files for agentWallet-python 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentwallet_python-0.1.0.tar.gz | 5.6 kB | Without provenance | Details for agentwallet_python-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentWallet_python-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for agentWallet_python-0.1.0-py3-none-any.whl |
Total release size: 12.1 kB
Release files / agentwallet_python-0.1.0.tar.gz
| Download URL | agentwallet_python-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b69a6cf39ed821c4cc3fe1b0e3a2d21dab33384b5060fae43e061e48513612eb
|
|
BLAKE2b-256 checksum How to use checksums |
9d1e2d69902f36c3a6a48243b18ea42b75b01fab7555365c640e688527140402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Release files / agentWallet_python-0.1.0-py3-none-any.whl
| Download URL | agentWallet_python-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f5697f3b06c97e76068f1d89d2822d57be1ee12f30360a847bc9915f4e894a1
|
|
BLAKE2b-256 checksum How to use checksums |
3c798a922b25dc6ba5fb14377b7a3ae707079e4d45fb7f29549c7e3d84d7ce3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Security for agentWallet-python 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.