Skip to main content

Python SDK for the Proof-of-Intent Protocol — intent signing, delegation, and execution on EVM chains

Project description

proof-of-intent Python SDK

Python SDK for the Proof-of-Intent Protocol — on-chain intent registration, cryptographic delegation, and scope-enforced execution on Ethereum Sepolia.

Install

pip install proof-of-intent

Environment variables

# Required: your wallet private key (Sepolia testnet only)
PRIVATE_KEY=0x...

# Optional: only needed if you call compile_intent()
CLAUDE_API_KEY=sk-ant-...

Five-line quickstart

import os
from proof_of_intent import ContractClient, usdc, in_hours, UNISWAP_V3

# Instantiate — all contract addresses default to deployed Sepolia contracts
client = ContractClient(private_key=os.environ["PRIVATE_KEY"])

# Register an intent (build + EIP-712 sign + on-chain register in one call)
intent_id = client.create_intent(
    token_in="0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",  # Sepolia USDC
    max_amount_in=usdc(100),      # 100 USDC
    min_amount_out=1,
    allowed_protocols=["Uniswap-V3"],
    deadline=in_hours(1),
)
print("intent registered:", intent_id)

# Delegate execution rights to an agent address
delegation_id = client.delegate_from_root(
    intent_id,
    child_scope={
        "maxAmountIn":      usdc(100),
        "minAmountOut":     1,
        "allowedProtocols": [UNISWAP_V3.hex()],
        "deadline":         in_hours(1),
    },
    delegate_to=client.account.address,   # delegate to self for demo
)
print("delegation created:", delegation_id)

Helpers

from proof_of_intent import usdc, weth, in_minutes, in_hours, UNISWAP_V3, CURVE

usdc(500)          # → 500_000_000   (500 USDC in raw units)
weth(0.15)         # → 150_000_000_000_000_000
in_minutes(60)     # → Unix timestamp 60 minutes from now
in_hours(1)        # → Unix timestamp 1 hour from now
UNISWAP_V3.hex()   # → "0x1cc..."  (bytes32 protocol ID)

Error handling

from proof_of_intent.errors import ScopeViolationError, DeadlineExpiredError, POIPError

try:
    client.delegate_from_delegation(parent_id, child_scope, agent)
except ScopeViolationError:
    print("child scope exceeds parent — blocked by the contract")
except DeadlineExpiredError:
    print("deadline has passed")
except POIPError as e:
    print("other protocol error:", e)

Natural-language intent compilation (optional)

pip install "proof-of-intent[ai]"
from proof_of_intent import compile_intent, ContractClient

params  = compile_intent("swap 200 USDC for ETH using Uniswap within 2 hours")
client  = ContractClient(private_key=os.environ["PRIVATE_KEY"])
intent_id = client.create_intent(**params)

Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proof_of_intent-2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proof_of_intent-2-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file proof_of_intent-2.tar.gz.

File metadata

  • Download URL: proof_of_intent-2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for proof_of_intent-2.tar.gz
Algorithm Hash digest
SHA256 96033fbbdb9e15a3ba3db57171cb08c16cdefdad051fa7714293ae8206bc5719
MD5 db8d8adcd14ee2276a82eb5fe5a20d3b
BLAKE2b-256 1b2f165918a2f4f423ce3071ddd1033c0606bc2092eeeb834208563492939398

See more details on using hashes here.

File details

Details for the file proof_of_intent-2-py3-none-any.whl.

File metadata

  • Download URL: proof_of_intent-2-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for proof_of_intent-2-py3-none-any.whl
Algorithm Hash digest
SHA256 36a8fe8b79eeb5772f3b8ee52fb979e026c8efec56b983c5ae48234c17db06c5
MD5 f1fdac5c5fe76f8aa50455e5b2511125
BLAKE2b-256 a3684212e7b14f31c7ef67cc8caa3480b05356a0d63f0a253d8c6bcd8dfc5590

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page