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-0.1.1.tar.gz (15.9 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-0.1.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: proof_of_intent-0.1.1.tar.gz
  • Upload date:
  • Size: 15.9 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-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a797a49bd768dd627ffdf057ec8ab3c93e87f5c58b61507425a1d1cb355e014f
MD5 234108e9ad732479843cc7d0bb36b452
BLAKE2b-256 9930f1558cb901da6c13918462d63cb66fc609a169e115e529995fbbba8e7b21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proof_of_intent-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9195cc35a9a155456d1cde24cd8592ffd7793e972f8b56ec8bbc34735f722989
MD5 33b21acd8f677bfb6dff1f9ad65a6fb7
BLAKE2b-256 626b4b252f53922b720d087a61307bb5843c33ec3f5fa6b0552c0aabe20f3b1a

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