uvd-x402-sdk 0.5.5__tar.gz → 0.7.0__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.
- {uvd_x402_sdk-0.5.5/src/uvd_x402_sdk.egg-info → uvd_x402_sdk-0.7.0}/PKG-INFO +313 -9
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/README.md +310 -6
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/pyproject.toml +116 -110
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/__init__.py +348 -239
- uvd_x402_sdk-0.7.0/src/uvd_x402_sdk/advanced_escrow.py +633 -0
- uvd_x402_sdk-0.7.0/src/uvd_x402_sdk/erc8004.py +663 -0
- uvd_x402_sdk-0.7.0/src/uvd_x402_sdk/escrow.py +637 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/models.py +51 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/__init__.py +12 -9
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/base.py +3 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/evm.py +71 -1
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/sui.py +8 -1
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0/src/uvd_x402_sdk.egg-info}/PKG-INFO +313 -9
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk.egg-info/SOURCES.txt +3 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/LICENSE +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/setup.cfg +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/client.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/config.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/decorators.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/exceptions.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/facilitator.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/integrations/__init__.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/integrations/django_integration.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/integrations/fastapi_integration.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/integrations/flask_integration.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/integrations/lambda_integration.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/algorand.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/near.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/solana.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/networks/stellar.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk/response.py +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk.egg-info/dependency_links.txt +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk.egg-info/requires.txt +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/src/uvd_x402_sdk.egg-info/top_level.txt +0 -0
- {uvd_x402_sdk-0.5.5 → uvd_x402_sdk-0.7.0}/tests/test_client.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: uvd-x402-sdk
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python SDK for x402 payments - gasless crypto payments across
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: Python SDK for x402 payments - gasless crypto payments across 21 blockchains (including Scroll, SKALE). Features: ERC-8004 Trustless Agents, Escrow/Refunds, multi-stablecoin (USDC, EURC, AUSD, PYUSD, USDT)
|
|
5
5
|
Author-email: Ultravioleta DAO <dev@ultravioletadao.xyz>
|
|
6
6
|
Project-URL: Homepage, https://github.com/UltravioletaDAO/uvd-x402-sdk-python
|
|
7
7
|
Project-URL: Documentation, https://docs.ultravioletadao.xyz/x402-sdk
|
|
8
8
|
Project-URL: Repository, https://github.com/UltravioletaDAO/uvd-x402-sdk-python
|
|
9
9
|
Project-URL: Issues, https://github.com/UltravioletaDAO/uvd-x402-sdk-python/issues
|
|
10
|
-
Keywords: x402,payments,crypto,usdc,eurc,stablecoin,web3,evm,solana,near,stellar,algorand,sui,facilitator,gasless,eip-712,eip-3009
|
|
10
|
+
Keywords: x402,payments,crypto,usdc,eurc,stablecoin,web3,evm,solana,near,stellar,algorand,sui,scroll,skale,facilitator,gasless,eip-712,eip-3009,erc-8004,trustless-agents,escrow,refund
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -53,13 +53,13 @@ Requires-Dist: httpx>=0.24.0; extra == "dev"
|
|
|
53
53
|
|
|
54
54
|
Python SDK for integrating **x402 cryptocurrency payments** via the Ultravioleta DAO facilitator.
|
|
55
55
|
|
|
56
|
-
Accept **gasless stablecoin payments** across **
|
|
56
|
+
Accept **gasless stablecoin payments** across **21 blockchain networks** with a single integration. The SDK handles signature verification, on-chain settlement, and all the complexity of multi-chain payments.
|
|
57
57
|
|
|
58
|
-
**New in v0.
|
|
58
|
+
**New in v0.6.0**: ERC-8004 Trustless Agents (on-chain reputation), Escrow & Refund support, Scroll and SKALE networks!
|
|
59
59
|
|
|
60
60
|
## Features
|
|
61
61
|
|
|
62
|
-
- **
|
|
62
|
+
- **21 Networks**: EVM chains (13 including Scroll, SKALE), SVM chains (Solana, Fogo), NEAR, Stellar, Algorand, and Sui
|
|
63
63
|
- **5 Stablecoins**: USDC, EURC, AUSD, PYUSD, USDT (EVM chains)
|
|
64
64
|
- **x402 v1 & v2**: Full support for both protocol versions with auto-detection
|
|
65
65
|
- **Framework Integrations**: Flask, FastAPI, Django, AWS Lambda
|
|
@@ -67,6 +67,8 @@ Accept **gasless stablecoin payments** across **16 blockchain networks** with a
|
|
|
67
67
|
- **Simple API**: Decorators and middleware for quick integration
|
|
68
68
|
- **Type Safety**: Full Pydantic models and type hints
|
|
69
69
|
- **Extensible**: Register custom networks and tokens easily
|
|
70
|
+
- **ERC-8004 Trustless Agents**: On-chain reputation and identity for AI agents
|
|
71
|
+
- **Escrow & Refunds**: Hold payments in escrow with dispute resolution
|
|
70
72
|
|
|
71
73
|
## Quick Start (5 Lines)
|
|
72
74
|
|
|
@@ -79,6 +81,124 @@ result = client.process_payment(request.headers["X-PAYMENT"], Decimal("10.00"))
|
|
|
79
81
|
print(f"Paid by {result.payer_address}, tx: {result.transaction_hash}")
|
|
80
82
|
```
|
|
81
83
|
|
|
84
|
+
## Complete Usage Example
|
|
85
|
+
|
|
86
|
+
Here's a complete example showing the full x402 payment flow - returning a 402 response when no payment is provided, and processing the payment when it arrives:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from decimal import Decimal
|
|
90
|
+
from uvd_x402_sdk import (
|
|
91
|
+
X402Client,
|
|
92
|
+
X402Config,
|
|
93
|
+
create_402_response,
|
|
94
|
+
PaymentRequiredError,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# 1. Configure the client with your recipient addresses
|
|
98
|
+
config = X402Config(
|
|
99
|
+
recipient_evm="0xYourEVMWallet...", # For Base, Ethereum, etc.
|
|
100
|
+
recipient_solana="YourSolanaAddress...", # For Solana, Fogo
|
|
101
|
+
recipient_near="your-account.near", # For NEAR
|
|
102
|
+
recipient_stellar="G...YourStellarAddress", # For Stellar
|
|
103
|
+
recipient_algorand="YOUR_ALGO_ADDRESS...", # For Algorand
|
|
104
|
+
recipient_sui="0xYourSuiAddress...", # For Sui
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
client = X402Client(config=config)
|
|
108
|
+
|
|
109
|
+
def handle_api_request(request):
|
|
110
|
+
"""
|
|
111
|
+
Handle an API request that requires payment.
|
|
112
|
+
"""
|
|
113
|
+
price = Decimal("1.00") # $1.00 USD
|
|
114
|
+
|
|
115
|
+
# Check if payment header exists
|
|
116
|
+
x_payment = request.headers.get("X-PAYMENT")
|
|
117
|
+
|
|
118
|
+
if not x_payment:
|
|
119
|
+
# No payment provided - return 402 Payment Required
|
|
120
|
+
return {
|
|
121
|
+
"status": 402,
|
|
122
|
+
"headers": {
|
|
123
|
+
"Content-Type": "application/json",
|
|
124
|
+
},
|
|
125
|
+
"body": create_402_response(
|
|
126
|
+
amount_usd=price,
|
|
127
|
+
config=config,
|
|
128
|
+
resource="/api/premium",
|
|
129
|
+
description="Premium API access",
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# Payment provided - verify and settle
|
|
134
|
+
try:
|
|
135
|
+
result = client.process_payment(x_payment, price)
|
|
136
|
+
|
|
137
|
+
# Payment successful!
|
|
138
|
+
return {
|
|
139
|
+
"status": 200,
|
|
140
|
+
"body": {
|
|
141
|
+
"success": True,
|
|
142
|
+
"message": "Payment verified and settled!",
|
|
143
|
+
"payer": result.payer_address,
|
|
144
|
+
"network": result.network,
|
|
145
|
+
"transaction_hash": result.transaction_hash,
|
|
146
|
+
"amount_paid": str(result.amount),
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
except PaymentRequiredError as e:
|
|
151
|
+
# Payment verification failed
|
|
152
|
+
return {
|
|
153
|
+
"status": 402,
|
|
154
|
+
"body": {"error": str(e)}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
# The 402 response includes payment options for all configured networks:
|
|
158
|
+
# {
|
|
159
|
+
# "x402Version": 1,
|
|
160
|
+
# "accepts": [
|
|
161
|
+
# {"network": "base", "asset": "0x833589fCD...", "amount": "1000000", "payTo": "0xYour..."},
|
|
162
|
+
# {"network": "solana", "asset": "EPjFWdd5...", "amount": "1000000", "payTo": "Your..."},
|
|
163
|
+
# {"network": "near", "asset": "17208628...", "amount": "1000000", "payTo": "your.near"},
|
|
164
|
+
# {"network": "stellar", "asset": "CCW67Q...", "amount": "10000000", "payTo": "G..."},
|
|
165
|
+
# {"network": "algorand", "asset": "31566704", "amount": "1000000", "payTo": "YOUR..."},
|
|
166
|
+
# {"network": "sui", "asset": "0xdba346...", "amount": "1000000", "payTo": "0xYour..."},
|
|
167
|
+
# ],
|
|
168
|
+
# "payTo": "0xYour...",
|
|
169
|
+
# "maxAmountRequired": "1000000",
|
|
170
|
+
# "resource": "/api/premium",
|
|
171
|
+
# "description": "Premium API access"
|
|
172
|
+
# }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Using the Decorator (Simpler)
|
|
176
|
+
|
|
177
|
+
For even simpler integration, use the `@require_payment` decorator:
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
from decimal import Decimal
|
|
181
|
+
from uvd_x402_sdk import require_payment, configure_x402
|
|
182
|
+
|
|
183
|
+
# Configure once at startup
|
|
184
|
+
configure_x402(
|
|
185
|
+
recipient_address="0xYourEVMWallet...",
|
|
186
|
+
recipient_solana="YourSolanaAddress...",
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
@require_payment(amount_usd=Decimal("1.00"))
|
|
190
|
+
def premium_endpoint(payment_result):
|
|
191
|
+
"""
|
|
192
|
+
This function only runs if payment is verified.
|
|
193
|
+
Returns 402 automatically if no valid payment.
|
|
194
|
+
"""
|
|
195
|
+
return {
|
|
196
|
+
"data": "Premium content here!",
|
|
197
|
+
"paid_by": payment_result.payer_address,
|
|
198
|
+
"tx": payment_result.transaction_hash,
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
82
202
|
## Supported Networks
|
|
83
203
|
|
|
84
204
|
| Network | Type | Chain ID | CAIP-2 | Status |
|
|
@@ -93,20 +213,25 @@ print(f"Paid by {result.payer_address}, tx: {result.transaction_hash}")
|
|
|
93
213
|
| HyperEVM | EVM | 999 | `eip155:999` | Active |
|
|
94
214
|
| Unichain | EVM | 130 | `eip155:130` | Active |
|
|
95
215
|
| Monad | EVM | 143 | `eip155:143` | Active |
|
|
216
|
+
| Scroll | EVM | 534352 | `eip155:534352` | Active |
|
|
217
|
+
| SKALE | EVM | 1187947933 | `eip155:1187947933` | Active |
|
|
218
|
+
| SKALE Testnet | EVM | 324705682 | `eip155:324705682` | Active |
|
|
96
219
|
| Solana | SVM | - | `solana:5eykt...` | Active |
|
|
97
220
|
| Fogo | SVM | - | `solana:fogo` | Active |
|
|
98
221
|
| NEAR | NEAR | - | `near:mainnet` | Active |
|
|
99
222
|
| Stellar | Stellar | - | `stellar:pubnet` | Active |
|
|
100
223
|
| Algorand | Algorand | - | `algorand:mainnet` | Active |
|
|
101
224
|
| Algorand Testnet | Algorand | - | `algorand:testnet` | Active |
|
|
225
|
+
| Sui | Sui | - | `sui:mainnet` | Active |
|
|
226
|
+
| Sui Testnet | Sui | - | `sui:testnet` | Active |
|
|
102
227
|
|
|
103
|
-
### Supported Tokens
|
|
228
|
+
### Supported Tokens
|
|
104
229
|
|
|
105
230
|
| Token | Networks | Decimals |
|
|
106
231
|
|-------|----------|----------|
|
|
107
|
-
| USDC | All
|
|
232
|
+
| USDC | All networks | 6 |
|
|
108
233
|
| EURC | Ethereum, Base, Avalanche | 6 |
|
|
109
|
-
| AUSD | Ethereum, Arbitrum, Avalanche, Polygon, Monad | 6 |
|
|
234
|
+
| AUSD | Ethereum, Arbitrum, Avalanche, Polygon, Monad, Sui | 6 |
|
|
110
235
|
| PYUSD | Ethereum | 6 |
|
|
111
236
|
| USDT | Ethereum, Arbitrum, Optimism, Avalanche, Polygon | 6 |
|
|
112
237
|
|
|
@@ -439,6 +564,72 @@ payload = build_atomic_group(
|
|
|
439
564
|
request = build_x402_payment_request(payload, network="algorand")
|
|
440
565
|
```
|
|
441
566
|
|
|
567
|
+
### Sui
|
|
568
|
+
|
|
569
|
+
Sui uses sponsored transactions with Move-based programmable transaction blocks.
|
|
570
|
+
|
|
571
|
+
```python
|
|
572
|
+
from uvd_x402_sdk import X402Client, X402Config
|
|
573
|
+
|
|
574
|
+
config = X402Config(
|
|
575
|
+
recipient_sui="0xYourSuiAddress...",
|
|
576
|
+
supported_networks=["sui"],
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
client = X402Client(config=config)
|
|
580
|
+
result = client.process_payment(x_payment_header, Decimal("1.00"))
|
|
581
|
+
|
|
582
|
+
# Sui payload contains a user-signed PTB that the facilitator sponsors
|
|
583
|
+
payload = client.extract_payload(x_payment_header)
|
|
584
|
+
sui_data = payload.get_sui_payload()
|
|
585
|
+
print(f"From: {sui_data.from_address}")
|
|
586
|
+
print(f"To: {sui_data.to}")
|
|
587
|
+
print(f"Amount: {sui_data.amount}")
|
|
588
|
+
print(f"Coin Object ID: {sui_data.coinObjectId}")
|
|
589
|
+
print(f"Transaction Bytes: {sui_data.transactionBytes[:50]}...")
|
|
590
|
+
|
|
591
|
+
# Sui uses sponsored transactions (user pays ZERO SUI for gas)
|
|
592
|
+
# Facilitator adds sponsor signature and pays gas fees
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
#### Sui-Specific Utilities
|
|
596
|
+
|
|
597
|
+
```python
|
|
598
|
+
from uvd_x402_sdk.networks.sui import (
|
|
599
|
+
validate_sui_payload,
|
|
600
|
+
is_valid_sui_address,
|
|
601
|
+
is_valid_sui_coin_type,
|
|
602
|
+
get_sui_fee_payer,
|
|
603
|
+
get_sui_usdc_coin_type,
|
|
604
|
+
get_sui_ausd_coin_type,
|
|
605
|
+
SUI_FEE_PAYER_MAINNET,
|
|
606
|
+
SUI_USDC_COIN_TYPE_MAINNET,
|
|
607
|
+
SUI_AUSD_COIN_TYPE_MAINNET,
|
|
608
|
+
)
|
|
609
|
+
|
|
610
|
+
# Validate Sui addresses (0x + 64 hex chars)
|
|
611
|
+
assert is_valid_sui_address("0xe7bbf2b13f7d72714760aa16e024fa1b35a978793f9893d0568a4fbf356a764a")
|
|
612
|
+
|
|
613
|
+
# Validate coin types (package::module::type format)
|
|
614
|
+
assert is_valid_sui_coin_type(SUI_USDC_COIN_TYPE_MAINNET)
|
|
615
|
+
|
|
616
|
+
# Get fee payer (sponsor) address
|
|
617
|
+
fee_payer = get_sui_fee_payer("sui") # Returns mainnet sponsor
|
|
618
|
+
print(f"Sui sponsor: {fee_payer}")
|
|
619
|
+
|
|
620
|
+
# Get USDC coin type
|
|
621
|
+
usdc_type = get_sui_usdc_coin_type("sui")
|
|
622
|
+
# '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC'
|
|
623
|
+
|
|
624
|
+
# Get AUSD coin type (mainnet only)
|
|
625
|
+
ausd_type = get_sui_ausd_coin_type("sui")
|
|
626
|
+
# '0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD'
|
|
627
|
+
|
|
628
|
+
# Validate Sui payment payload
|
|
629
|
+
payload = client.extract_payload(x_payment_header)
|
|
630
|
+
validate_sui_payload(payload.payload) # Raises ValueError if invalid
|
|
631
|
+
```
|
|
632
|
+
|
|
442
633
|
---
|
|
443
634
|
|
|
444
635
|
## x402 v1 vs v2
|
|
@@ -687,6 +878,10 @@ from uvd_x402_sdk import (
|
|
|
687
878
|
STELLAR_FEE_PAYER_MAINNET, # GCHPGXJT2WFFRFCA5TV4G4E3PMMXLNIDUH27PKDYA4QJ2XGYZWGFZNHB
|
|
688
879
|
STELLAR_FEE_PAYER_TESTNET, # GBBFZMLUJEZVI32EN4XA2KPP445XIBTMTRBLYWFIL556RDTHS2OWFQ2Z
|
|
689
880
|
|
|
881
|
+
# Sui
|
|
882
|
+
SUI_FEE_PAYER_MAINNET, # 0xe7bbf2b13f7d72714760aa16e024fa1b35a978793f9893d0568a4fbf356a764a
|
|
883
|
+
SUI_FEE_PAYER_TESTNET, # 0xabbd16a2fab2a502c9cfe835195a6fc7d70bfc27cffb40b8b286b52a97006e67
|
|
884
|
+
|
|
690
885
|
# Helper function
|
|
691
886
|
get_fee_payer, # Get fee payer for any network
|
|
692
887
|
)
|
|
@@ -694,6 +889,7 @@ from uvd_x402_sdk import (
|
|
|
694
889
|
# Get fee payer for any network
|
|
695
890
|
fee_payer = get_fee_payer("algorand") # Returns KIMS5H6Q...
|
|
696
891
|
fee_payer = get_fee_payer("solana") # Returns F742C4VfF...
|
|
892
|
+
fee_payer = get_fee_payer("sui") # Returns 0xe7bbf2b...
|
|
697
893
|
fee_payer = get_fee_payer("base") # Returns None (EVM doesn't need fee payer)
|
|
698
894
|
```
|
|
699
895
|
|
|
@@ -951,6 +1147,69 @@ except X402Error as e:
|
|
|
951
1147
|
|
|
952
1148
|
---
|
|
953
1149
|
|
|
1150
|
+
## ERC-8004 Trustless Agents
|
|
1151
|
+
|
|
1152
|
+
Build verifiable on-chain reputation for AI agents and services.
|
|
1153
|
+
|
|
1154
|
+
```python
|
|
1155
|
+
from uvd_x402_sdk import Erc8004Client
|
|
1156
|
+
|
|
1157
|
+
async with Erc8004Client() as client:
|
|
1158
|
+
# Get agent identity
|
|
1159
|
+
identity = await client.get_identity("ethereum", 42)
|
|
1160
|
+
print(f"Agent URI: {identity.agent_uri}")
|
|
1161
|
+
|
|
1162
|
+
# Get agent reputation
|
|
1163
|
+
reputation = await client.get_reputation("ethereum", 42)
|
|
1164
|
+
print(f"Score: {reputation.summary.summary_value}")
|
|
1165
|
+
|
|
1166
|
+
# Submit feedback after payment
|
|
1167
|
+
result = await client.submit_feedback(
|
|
1168
|
+
network="ethereum",
|
|
1169
|
+
agent_id=42,
|
|
1170
|
+
value=95,
|
|
1171
|
+
tag1="quality",
|
|
1172
|
+
proof=settle_response.proof_of_payment,
|
|
1173
|
+
)
|
|
1174
|
+
|
|
1175
|
+
# Respond to feedback (agents only)
|
|
1176
|
+
await client.append_response(
|
|
1177
|
+
network="ethereum",
|
|
1178
|
+
agent_id=42,
|
|
1179
|
+
feedback_index=1,
|
|
1180
|
+
response_text="Thank you for your feedback!",
|
|
1181
|
+
)
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
---
|
|
1185
|
+
|
|
1186
|
+
## Escrow & Refunds
|
|
1187
|
+
|
|
1188
|
+
Hold payments in escrow with dispute resolution.
|
|
1189
|
+
|
|
1190
|
+
```python
|
|
1191
|
+
from uvd_x402_sdk import EscrowClient
|
|
1192
|
+
|
|
1193
|
+
async with EscrowClient() as client:
|
|
1194
|
+
# Create escrow payment
|
|
1195
|
+
escrow = await client.create_escrow(
|
|
1196
|
+
payment_header=request.headers["X-PAYMENT"],
|
|
1197
|
+
requirements=payment_requirements,
|
|
1198
|
+
escrow_duration=86400, # 24 hours
|
|
1199
|
+
)
|
|
1200
|
+
|
|
1201
|
+
# Release after service delivery
|
|
1202
|
+
await client.release(escrow.id)
|
|
1203
|
+
|
|
1204
|
+
# Or request refund if service failed
|
|
1205
|
+
await client.request_refund(
|
|
1206
|
+
escrow_id=escrow.id,
|
|
1207
|
+
reason="Service not delivered",
|
|
1208
|
+
)
|
|
1209
|
+
```
|
|
1210
|
+
|
|
1211
|
+
---
|
|
1212
|
+
|
|
954
1213
|
## How x402 Works
|
|
955
1214
|
|
|
956
1215
|
The x402 protocol enables gasless stablecoin payments (USDC, EURC, AUSD, PYUSD):
|
|
@@ -976,6 +1235,7 @@ The facilitator (https://facilitator.ultravioletadao.xyz) handles all on-chain i
|
|
|
976
1235
|
| NEAR | DelegateAction (Borsh) | Wraps in `Action::Delegate` |
|
|
977
1236
|
| Stellar | Auth entry (XDR) | Wraps in fee-bump transaction |
|
|
978
1237
|
| Algorand | ASA transfer tx | Signs fee tx + submits atomic group |
|
|
1238
|
+
| Sui | Programmable tx block | Sponsors gas + submits transaction |
|
|
979
1239
|
|
|
980
1240
|
---
|
|
981
1241
|
|
|
@@ -1001,6 +1261,7 @@ The facilitator (https://facilitator.ultravioletadao.xyz) handles all on-chain i
|
|
|
1001
1261
|
- **Solana/Fogo**: Users sign partial transactions (facilitator co-signs and submits)
|
|
1002
1262
|
- **Stellar**: Users sign Soroban authorization entries only
|
|
1003
1263
|
- **NEAR**: Users sign NEP-366 meta-transactions (DelegateAction)
|
|
1264
|
+
- **Sui**: Users sign programmable transaction blocks (facilitator sponsors gas)
|
|
1004
1265
|
- The facilitator submits and pays for all on-chain transactions
|
|
1005
1266
|
- All signatures include expiration timestamps (`validBefore`) for replay protection
|
|
1006
1267
|
- Nonces prevent double-spending of authorizations
|
|
@@ -1082,6 +1343,49 @@ MIT License - see LICENSE file.
|
|
|
1082
1343
|
|
|
1083
1344
|
## Changelog
|
|
1084
1345
|
|
|
1346
|
+
### v0.6.0 (2026-01-30)
|
|
1347
|
+
|
|
1348
|
+
- **ERC-8004 Trustless Agents**: Full client for on-chain reputation system
|
|
1349
|
+
- `Erc8004Client` class with identity, reputation, and feedback methods
|
|
1350
|
+
- `append_response()` method for agents to respond to feedback
|
|
1351
|
+
- `ProofOfPayment` model for reputation submission authorization
|
|
1352
|
+
- `build_erc8004_payment_requirements()` helper
|
|
1353
|
+
- **Escrow & Refund Support**: Complete escrow payment flow
|
|
1354
|
+
- `EscrowClient` class with create, release, refund, dispute methods
|
|
1355
|
+
- `EscrowPayment`, `RefundRequest`, `Dispute` models
|
|
1356
|
+
- Helper functions: `can_release_escrow()`, `can_refund_escrow()`, etc.
|
|
1357
|
+
- **New Networks**: Scroll (534352) and SKALE (1187947933, testnet: 324705682)
|
|
1358
|
+
- SKALE is gasless L3 with sFUEL
|
|
1359
|
+
- Scroll is zkEVM Layer 2
|
|
1360
|
+
- SDK now supports 21 blockchain networks
|
|
1361
|
+
|
|
1362
|
+
### v0.5.6 (2025-12-31)
|
|
1363
|
+
|
|
1364
|
+
- Added `SuiPayloadContent` Pydantic model for Sui sponsored transactions
|
|
1365
|
+
- Added `coinObjectId` as required field (CRITICAL for facilitator deserialization)
|
|
1366
|
+
- Added `get_sui_payload()` method to `PaymentPayload`
|
|
1367
|
+
- Updated `validate_sui_payload()` to require `coinObjectId`
|
|
1368
|
+
|
|
1369
|
+
### v0.5.5 (2025-12-30)
|
|
1370
|
+
|
|
1371
|
+
- Added AUSD (Agora USD) support for Sui mainnet
|
|
1372
|
+
- Added `SUI_AUSD_COIN_TYPE_MAINNET` constant
|
|
1373
|
+
- Added `get_sui_ausd_coin_type()` helper function
|
|
1374
|
+
|
|
1375
|
+
### v0.5.4 (2025-12-30)
|
|
1376
|
+
|
|
1377
|
+
- **Sui Blockchain Support**: Added Sui mainnet and testnet networks
|
|
1378
|
+
- Added `NetworkType.SUI` for Sui Move VM chains
|
|
1379
|
+
- Added `SUI_FEE_PAYER_MAINNET` and `SUI_FEE_PAYER_TESTNET` sponsor addresses
|
|
1380
|
+
- Added CAIP-2 support for `sui:mainnet` and `sui:testnet`
|
|
1381
|
+
- Added Sui-specific utilities: `validate_sui_payload()`, `is_valid_sui_address()`, `is_valid_sui_coin_type()`
|
|
1382
|
+
- SDK now supports 18 blockchain networks
|
|
1383
|
+
|
|
1384
|
+
### v0.5.3 (2025-12-27)
|
|
1385
|
+
|
|
1386
|
+
- Documentation updates for Algorand support
|
|
1387
|
+
- Updated README with facilitator addresses and changelog
|
|
1388
|
+
|
|
1085
1389
|
### v0.5.2 (2025-12-26)
|
|
1086
1390
|
|
|
1087
1391
|
- Added EVM facilitator addresses for reference
|