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)

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.0.tar.gz (15.3 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.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: proof_of_intent-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 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.0.tar.gz
Algorithm Hash digest
SHA256 200587bba3d21af96de43a13d65578747dd65dac1cd9fa9e5beb5ea12b54e557
MD5 f2552130c3d2dcdee675e5f2e5f328b6
BLAKE2b-256 811fa7d0a36277469e0ed46462c53a9d18634a60d9ba9577d5479e70e17c572c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for proof_of_intent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc65bf3c893255029ff2195220311a14846f4c13257647f6708dfec458745c37
MD5 ad07b511af2848902a2e6383f08e33f0
BLAKE2b-256 80ff72904cb3b28b18c35af45844c20f76ba4c02a9a6ea050f98d747b6ec67e1

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