Metadata-Version: 2.4
Name: langchain-powersun
Version: 1.3.0
Summary: LangChain integration for PowerSun.vip — TRON Energy & Bandwidth marketplace and DEX swap aggregator with 27 MCP tools for AI agents
Author: PowerSun.vip
License: MIT
Project-URL: Homepage, https://powersun.vip
Project-URL: Repository, https://github.com/Hovsteder/powersun-tron-mcp
Project-URL: Documentation, https://powersun.vip/api-docs
Keywords: langchain,tron,tron-energy,tron-bandwidth,ai-agent,mcp,blockchain,powersun,sunswap,dex-swap,trc20-swap,token-swap
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: langchain-core>=0.2.0
Requires-Dist: httpx>=0.25.0

# langchain-powersun

LangChain integration for [PowerSun.vip](https://powersun.vip) — the TRON Energy & Bandwidth marketplace and DEX swap aggregator for AI agents.

## Install

```bash
pip install langchain-powersun
```

## Quick Start

```python
from langchain_powersun import PowerSunToolkit

# Public tools (market data, estimates)
tools = PowerSunToolkit().get_tools()

# With authentication (buy energy, check balance)
tools = PowerSunToolkit(api_key="ps_your_key").get_tools()

# Use with any LangChain agent
from langchain.agents import create_react_agent
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(llm, tools)
agent.invoke({"input": "What's the current price of TRON energy on PowerSun?"})
```

## Available Tools (12)

### Registration Tools (public, no auth required)

| Tool | Description |
|------|-------------|
| `powersun_register` | Start registration — get a challenge to sign with your TRON wallet |
| `powersun_verify_registration` | Submit wallet signature → get API key |

### Market Tools (public, no auth required)

| Tool | Description |
|------|-------------|
| `powersun_get_prices` | Energy & Bandwidth prices for all duration tiers |
| `powersun_estimate_cost` | Calculate exact cost for transactions |
| `powersun_get_available_resources` | Available Energy & Bandwidth |
| `powersun_get_market_overview` | Full market snapshot |

### Buyer Tools (auth recommended)

| Tool | Description |
|------|-------------|
| `powersun_buy_energy` | Purchase Energy delegation |
| `powersun_get_balance` | Account balance and deposit info |
| `powersun_get_order_status` | Order status with delegation progress |
| `powersun_broadcast_transaction` | Broadcast pre-signed tx with auto Energy (API key, x402, or 402) |

### Swap Tools (auth required)

| Tool | Description |
|------|-------------|
| `powersun_get_swap_quote` | Get swap quote for SunSwap DEX (TRX, USDT, USDC, SUN, BTT, WIN, JST, any TRC-20) |
| `powersun_execute_swap` | Execute signed swap TX with auto Energy (API key, x402, or 402) |

## Why PowerSun?

- **Only 10% commission** — lowest on the market
- **Save 20-50%** on TRON transaction fees
- **Instant delegation** — Energy arrives within seconds
- **AI-native** — built for autonomous agent workflows

## Links

- **Platform:** [powersun.vip](https://powersun.vip)
- **MCP Server:** [powersun.vip/mcp](https://powersun.vip/mcp)
- **API Docs:** [powersun.vip/api-docs](https://powersun.vip/api-docs)

## License

MIT
