Skip to main content

polypad-agent (Python)

Thin typed client for the Polypad agent API (MCP) on Robinhood Chain. Version 2.0.0, matching the server. Not yet published to PyPI — install from the repo for now: pip install -e py/.

Install (once published)

pip install polypad-agent

Connect once

from polypad_agent import PolypadClient

client = PolypadClient()
# Show the user this URL: they connect their wallet, sign one message, and get a token.
print(client.connect_url(return_url="https://example.com/agent/done"))
# Store the token as POLYPAD_WALLET_TOKEN. The client reads it automatically.

Quickstart

from polypad_agent import PolypadClient

client = PolypadClient()  # reads POLYPAD_WALLET_TOKEN
print(client.list_tokens(sort="new", limit=5))
print(client.quote_trade(token="POLYDASH", side="buy", amountEth="0.01"))
mint = client.prepare_fund_mint(fund="0x7c1d31629ac68aebe83f230edbc7eacfc26285ef", quantity=1)
print(mint["signing"]["url"])  # the user opens this and signs

The loop

# Chat agent: prepare, show the link, wait for the hash, poll until confirmed.
done = client.prepare_sign_confirm(
    "polypad_prepare_fund_mint",
    {"fund": "0x7c1d31629ac68aebe83f230edbc7eacfc26285ef", "quantity": 1},
    on_signing_link=lambda url, summary: print(summary["headline"], url),
    get_tx_hash=read_hash_from_return_callback,
    return_url="https://example.com/agent/done",
)
print(done["status"], done["tx_hash"], done["result"])

# Script with its own wallet (the Forge path): prepare, sign, broadcast, confirm.
launched = client.prepare_sign_broadcast(
    "polypad_prepare_token_launch",
    {"name": "Agent Swarm", "symbol": "SWARM", "creatorFeeBps": 100, "devBuyEth": "0"},
    private_key=os.environ["LAUNCHER_PRIVATE_KEY"],
)
print(launched["status"], launched["tx_hash"])

Pay-per-call

from polypad_agent import pay_for_report

report = pay_for_report(
    "token-report",
    "address=0x3Da9244DDE38284017fD15e45d1Fdf66D3617B4B",
    private_key=os.environ["PAYER_PRIVATE_KEY"],
)

Recipes

  • examples/launch_token.py — launch a token from a script, then create its staking pool.
  • examples/run_fund.py — create a tokenized fund, then mint the manager's skin shares.
  • examples/smoke.py — read-only live smoke test (initialize, tools/list, stats).

More in the package

  • confirm / sign_and_send / sign_send_and_confirm — the standalone sign-loop helpers (confirm polls polypad_get_tx_status until the transaction confirms or fails).
  • sign_x402_payment / fetch_with_x402 / product_url / next_permit2_nonce — x402 building blocks for USDG (EIP-3009) and POLYDASH (Permit2) payments.
  • build_create_key_tx / build_deposit_tx / build_withdraw_tx / build_revoke_key_tx / get_key_status / get_vault_balance — SpendVault spending keys.
  • TOOL_NAMES / PREPARE_TOOLS / is_prepare_tool, RATE_LIMITS, ACTION_LIMITS, ERROR_MEANINGS — the 21 tools, the published limits, and the server's error meanings.

Tests

PYTHONPATH=src python -m unittest discover -s tests -v   # 44 tests (mocked transport, no network)

Per-call from still works: pass it explicitly and the client leaves the token out for that call. Contracts are unaudited.

Metadata

Release files for polypad-agent 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polypad-agent 2.0.0
File Size Uploaded Provenance Actions
polypad_agent-2.0.0.tar.gz 28.7 kB Without provenance Details for polypad_agent-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polypad-agent 2.0.0
File Interpreter ABI Platform Actions
polypad_agent-2.0.0-py3-none-any.whl Python 3 none any Details for polypad_agent-2.0.0-py3-none-any.whl

Total release size: 54.5 kB

Release files / polypad_agent-2.0.0.tar.gz

Download URL polypad_agent-2.0.0.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
283ff47044e4b6eb5aaf36b85ad0a797d44d6b79a4fc0f8184c4b638103e4ceb
BLAKE2b-256 checksum
How to use checksums
c0aa7bc055de9618ad3431905dcbeaa0f906da038afbcb0e3006337242a4a7a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / polypad_agent-2.0.0-py3-none-any.whl

Download URL polypad_agent-2.0.0-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31ef87f2b0c966116f53698b7e81ef716dbceaae74c9ec7071dcbfaf5ff98c38
BLAKE2b-256 checksum
How to use checksums
2084bb6b853f0c3388a7e8efbaf1247a2eb22b4756aea9f432ad79067b3f212f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for polypad-agent 2.0.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.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page