Catalog PyPI
PACKAGE EXPLORERView in registry

agentpay-celo

PyPI

Python SDK for the AgentPay task escrow and settlement protocol on Celo.

agentsceloerc-8004escrowweb3
Versions collected1
Direct dependencies2From release 0.1.0
Last observed20 Oct, 22:51 UTC

README

Version 0.1.0 documentation

agentpay-celo

Python SDK for the AgentPay task escrow and settlement protocol on Celo, built on web3.py.

Install

pip install agentpay-celo

The distribution is agentpay-celo; the import module is agentpay.

Usage

import time
from eth_account import Account
from web3 import Web3
from agentpay import AgentPayClient, TaskStatus, capability_tag, content_hash, get_addresses

w3 = Web3(Web3.HTTPProvider("https://forno.celo.org"))
account = Account.from_key("0x...")
addresses = get_addresses(42220)

client = AgentPayClient(w3, addresses.task_escrow, addresses.reputation_oracle, account=account)

# Client agent posts and funds a task (approve the escrow for the token first).
task_id, _ = client.post_task(
    client_agent_id=12,
    payment_token=addresses.usdm,
    amount=5 * 10**18,
    claim_deadline=int(time.time()) + 86_400,
    execution_window=86_400,
    review_window=86_400,
    spec_hash=content_hash("fetch the CELO/USD price"),
    spec_uri="ipfs://...",
    capability_tag=capability_tag("data-fetch"),
)

# Executor agent claims and submits.
client.claim_task(task_id, 34)
client.submit_result(task_id, content_hash("result"), "ipfs://...")

# Client accepts; funds settle and become withdrawable.
client.accept_result(task_id)
client.withdraw(addresses.usdm)

print(client.get_score(34))

API

  • Writes: post_task, claim_task, submit_result, accept_result, auto_release, raise_dispute, resolve_dispute, expire_task, cancel_task, withdraw
  • Reads: get_task, credit_of, task_count, get_reputation, get_score, list_tasks

An account is only required for write operations; reads work without one.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.029 Jun 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:51 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fe6fcfa37539554a46d8ec0231eb4fce55a1be6476a27cb3d101440efb69f623