open-agentpay 0.2.3__tar.gz → 0.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/PKG-INFO +1 -1
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/pyproject.toml +1 -1
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/__init__.py +1 -1
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/models.py +5 -2
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/models.py +5 -4
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/.gitignore +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/README.md +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/budget/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/client.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/errors.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/interfaces.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/signer.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/client/transport.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/codecs.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/errors.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/interop.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/core/state.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/evm/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/evm/constants.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/evm/eip3009.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/evm/rpc.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/integrations/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/integrations/langchain/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/integrations/langchain/http.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/integrations/langchain/tool.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/config.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/db.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/errors.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/evaluator.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/interfaces.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/metered.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/policy/sqlite_engine.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/codecs.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/errors.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/interop.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/models.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/protocol/state.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/signer/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/state/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/state/buyer_coordinator.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/state/errors.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/state/guards.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/state/reconciliation.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/testing/__init__.py +0 -0
- {open_agentpay-0.2.3 → open_agentpay-0.2.4}/src/agentpay/testing/mock_seller.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: open-agentpay
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: The Open-Source Payment Infrastructure & Financial Firewall for Autonomous AI Agents
|
|
5
5
|
Project-URL: Homepage, https://github.com/open-agentpay/AgentPay
|
|
6
6
|
Project-URL: Documentation, https://open-agentpay.github.io/AgentPay/
|
|
@@ -46,6 +46,9 @@ _BYTES32_HEX_RE = re.compile(r"^(0x)?[0-9a-fA-F]{64}$")
|
|
|
46
46
|
# Maximum signed 64-bit integer for base units
|
|
47
47
|
SQLITE_MAX_INT = 9_223_372_036_854_775_807
|
|
48
48
|
|
|
49
|
+
# Supported fiat base currencies for AgentPay internal virtual wallet
|
|
50
|
+
WALLET_FIAT_CURRENCIES = frozenset({"CNY", "USD", "EUR"})
|
|
51
|
+
|
|
49
52
|
|
|
50
53
|
def _validate_evm_address(value: str, field_name: str) -> str:
|
|
51
54
|
"""Validate EVM address format and normalise to lowercase."""
|
|
@@ -228,7 +231,7 @@ class PaymentChallenge(BaseModel):
|
|
|
228
231
|
@field_validator("asset")
|
|
229
232
|
@classmethod
|
|
230
233
|
def _validate_asset(cls, v: str | None, info: Any) -> str | None:
|
|
231
|
-
if info.data.get("scheme") == "agentpay-wallet" and v
|
|
234
|
+
if info.data.get("scheme") == "agentpay-wallet" and v in WALLET_FIAT_CURRENCIES:
|
|
232
235
|
return v
|
|
233
236
|
if v is None:
|
|
234
237
|
raise X402ValidationError("asset is required", code=X402ErrorCode.MISSING_REQUIRED_FIELD)
|
|
@@ -331,7 +334,7 @@ class PaymentChallenge(BaseModel):
|
|
|
331
334
|
@model_validator(mode="after")
|
|
332
335
|
def _validate_scheme_fields(self) -> PaymentChallenge:
|
|
333
336
|
if self.scheme == "agentpay-wallet":
|
|
334
|
-
if self.network != "agentpay:internal-ledger" or self.asset
|
|
337
|
+
if self.network != "agentpay:internal-ledger" or self.asset not in WALLET_FIAT_CURRENCIES or not self.resource_uri:
|
|
335
338
|
raise X402ValidationError("invalid agentpay-wallet challenge fields", code=X402ErrorCode.INVALID_SCHEME)
|
|
336
339
|
if self.facilitator_url:
|
|
337
340
|
raise X402ValidationError("agentpay-wallet challenge must not name an EIP-3009 facilitator", code=X402ErrorCode.INVALID_SCHEME)
|
|
@@ -32,6 +32,7 @@ _CAIP2_RE = re.compile(r"^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$")
|
|
|
32
32
|
_EVM_ADDRESS_RE = re.compile(r"^0x[0-9a-fA-F]{40}$")
|
|
33
33
|
_AGENTPAY_ROUTE_RE = re.compile(r"^agentpay:route:[A-Za-z0-9_-]+$")
|
|
34
34
|
_AGENTPAY_INTERNAL_NETWORK = "agentpay:internal-ledger"
|
|
35
|
+
_WALLET_FIAT_CURRENCIES = frozenset({"CNY", "USD", "EUR"})
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
# ---------------------------------------------------------------------------
|
|
@@ -221,7 +222,7 @@ class PolicyConfig(BaseModel):
|
|
|
221
222
|
raise TypeError(f"whitelist_assets elements must be strings, got {type(addr).__name__}")
|
|
222
223
|
normalized: list[str] = []
|
|
223
224
|
for addr in v:
|
|
224
|
-
normalized.append(
|
|
225
|
+
normalized.append(addr if addr in _WALLET_FIAT_CURRENCIES else _validate_evm_address(addr, "whitelist_assets"))
|
|
225
226
|
return frozenset(normalized)
|
|
226
227
|
|
|
227
228
|
@field_validator("whitelist_networks", mode="before")
|
|
@@ -287,7 +288,7 @@ class PaymentRequest(BaseModel):
|
|
|
287
288
|
@field_validator("asset")
|
|
288
289
|
@classmethod
|
|
289
290
|
def _normalise_asset(cls, v: str) -> str:
|
|
290
|
-
if v
|
|
291
|
+
if v in _WALLET_FIAT_CURRENCIES:
|
|
291
292
|
return v
|
|
292
293
|
return _validate_evm_address(v, "asset")
|
|
293
294
|
|
|
@@ -302,11 +303,11 @@ class PaymentRequest(BaseModel):
|
|
|
302
303
|
def _validate_payment_identifiers(self) -> PaymentRequest:
|
|
303
304
|
wallet_fields = (
|
|
304
305
|
self.network == _AGENTPAY_INTERNAL_NETWORK,
|
|
305
|
-
self.asset
|
|
306
|
+
self.asset in _WALLET_FIAT_CURRENCIES,
|
|
306
307
|
bool(_AGENTPAY_ROUTE_RE.fullmatch(self.payee)),
|
|
307
308
|
)
|
|
308
309
|
if any(wallet_fields) and not all(wallet_fields):
|
|
309
|
-
raise ValueError("AgentPay wallet requests require internal-ledger, USD, and an agentpay:route payee")
|
|
310
|
+
raise ValueError("AgentPay wallet requests require internal-ledger, a supported fiat currency (CNY/USD/EUR), and an agentpay:route payee")
|
|
310
311
|
return self
|
|
311
312
|
|
|
312
313
|
@property
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|