uvd-x402-sdk 0.5.5__py3-none-any.whl → 0.5.6__py3-none-any.whl
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/__init__.py +3 -1
- uvd_x402_sdk/models.py +51 -0
- uvd_x402_sdk/networks/__init__.py +7 -4
- uvd_x402_sdk/networks/sui.py +8 -1
- {uvd_x402_sdk-0.5.5.dist-info → uvd_x402_sdk-0.5.6.dist-info}/METADATA +1 -1
- {uvd_x402_sdk-0.5.5.dist-info → uvd_x402_sdk-0.5.6.dist-info}/RECORD +9 -9
- {uvd_x402_sdk-0.5.5.dist-info → uvd_x402_sdk-0.5.6.dist-info}/LICENSE +0 -0
- {uvd_x402_sdk-0.5.5.dist-info → uvd_x402_sdk-0.5.6.dist-info}/WHEEL +0 -0
- {uvd_x402_sdk-0.5.5.dist-info → uvd_x402_sdk-0.5.6.dist-info}/top_level.txt +0 -0
uvd_x402_sdk/__init__.py
CHANGED
|
@@ -42,7 +42,7 @@ Supported Networks (18 total):
|
|
|
42
42
|
- Sui (2): Sui mainnet, Sui testnet
|
|
43
43
|
"""
|
|
44
44
|
|
|
45
|
-
__version__ = "0.5.
|
|
45
|
+
__version__ = "0.5.6"
|
|
46
46
|
__author__ = "Ultravioleta DAO"
|
|
47
47
|
|
|
48
48
|
from uvd_x402_sdk.client import X402Client
|
|
@@ -67,6 +67,7 @@ from uvd_x402_sdk.models import (
|
|
|
67
67
|
SolanaPayloadContent, # Alias for backward compatibility
|
|
68
68
|
NEARPayloadContent,
|
|
69
69
|
StellarPayloadContent,
|
|
70
|
+
SuiPayloadContent,
|
|
70
71
|
# Requirements models (v1)
|
|
71
72
|
PaymentRequirements,
|
|
72
73
|
# Requirements models (v2)
|
|
@@ -172,6 +173,7 @@ __all__ = [
|
|
|
172
173
|
"SolanaPayloadContent",
|
|
173
174
|
"NEARPayloadContent",
|
|
174
175
|
"StellarPayloadContent",
|
|
176
|
+
"SuiPayloadContent",
|
|
175
177
|
# Requirements models
|
|
176
178
|
"PaymentRequirements",
|
|
177
179
|
"PaymentOption",
|
uvd_x402_sdk/models.py
CHANGED
|
@@ -114,12 +114,59 @@ class StellarPayloadContent(BaseModel):
|
|
|
114
114
|
populate_by_name = True
|
|
115
115
|
|
|
116
116
|
|
|
117
|
+
class SuiPayloadContent(BaseModel):
|
|
118
|
+
"""
|
|
119
|
+
Sui payment payload using sponsored transactions.
|
|
120
|
+
|
|
121
|
+
Contains a user-signed programmable transaction that the facilitator sponsors.
|
|
122
|
+
The facilitator pays gas (in SUI), user pays ZERO SUI.
|
|
123
|
+
|
|
124
|
+
Transaction Flow:
|
|
125
|
+
1. User creates a programmable transaction for token transfer
|
|
126
|
+
2. User signs the transaction (setSender + setGasOwner for sponsorship)
|
|
127
|
+
3. Transaction is sent to facilitator with sender signature
|
|
128
|
+
4. Facilitator adds sponsor signature and pays gas
|
|
129
|
+
5. Facilitator submits to Sui network
|
|
130
|
+
|
|
131
|
+
Required Fields (all mandatory for facilitator deserialization):
|
|
132
|
+
- transactionBytes: BCS-encoded TransactionData
|
|
133
|
+
- senderSignature: User's Ed25519 or Secp256k1 signature
|
|
134
|
+
- from: Sender Sui address (0x + 64 hex)
|
|
135
|
+
- to: Recipient Sui address (0x + 64 hex)
|
|
136
|
+
- amount: Transfer amount in base units
|
|
137
|
+
- coinObjectId: The Sui coin object ID used for the transfer (CRITICAL!)
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
transactionBytes: str = Field(
|
|
141
|
+
..., description="Base64-encoded BCS serialized TransactionData"
|
|
142
|
+
)
|
|
143
|
+
senderSignature: str = Field(
|
|
144
|
+
..., description="Base64-encoded user signature (Ed25519 or Secp256k1)"
|
|
145
|
+
)
|
|
146
|
+
from_address: str = Field(
|
|
147
|
+
..., alias="from", description="Sender Sui address (0x + 64 hex chars)"
|
|
148
|
+
)
|
|
149
|
+
to: str = Field(
|
|
150
|
+
..., description="Recipient Sui address (0x + 64 hex chars)"
|
|
151
|
+
)
|
|
152
|
+
amount: str = Field(
|
|
153
|
+
..., description="Amount in token base units (e.g., '1000000' for 1 USDC)"
|
|
154
|
+
)
|
|
155
|
+
coinObjectId: str = Field(
|
|
156
|
+
..., description="Sui coin object ID used for the transfer (REQUIRED by facilitator)"
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
class Config:
|
|
160
|
+
populate_by_name = True
|
|
161
|
+
|
|
162
|
+
|
|
117
163
|
# Union type for all payload contents
|
|
118
164
|
PayloadContent = Union[
|
|
119
165
|
EVMPayloadContent,
|
|
120
166
|
SVMPayloadContent,
|
|
121
167
|
NEARPayloadContent,
|
|
122
168
|
StellarPayloadContent,
|
|
169
|
+
SuiPayloadContent,
|
|
123
170
|
]
|
|
124
171
|
|
|
125
172
|
|
|
@@ -196,6 +243,10 @@ class PaymentPayload(BaseModel):
|
|
|
196
243
|
"""Parse payload as Stellar format."""
|
|
197
244
|
return StellarPayloadContent(**self.payload)
|
|
198
245
|
|
|
246
|
+
def get_sui_payload(self) -> SuiPayloadContent:
|
|
247
|
+
"""Parse payload as Sui format (sponsored transaction)."""
|
|
248
|
+
return SuiPayloadContent(**self.payload)
|
|
249
|
+
|
|
199
250
|
|
|
200
251
|
class PaymentRequirements(BaseModel):
|
|
201
252
|
"""
|
|
@@ -4,18 +4,21 @@ Network configurations for x402 payments.
|
|
|
4
4
|
This module provides configuration for all supported blockchain networks,
|
|
5
5
|
including USDC contract addresses, RPC URLs, and network-specific parameters.
|
|
6
6
|
|
|
7
|
-
The SDK supports
|
|
7
|
+
The SDK supports 17 mainnet networks across 6 blockchain families:
|
|
8
8
|
- 10 EVM chains: Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche,
|
|
9
9
|
Celo, HyperEVM, Unichain, Monad
|
|
10
10
|
- 2 SVM chains: Solana, Fogo
|
|
11
11
|
- 1 NEAR: NEAR Protocol
|
|
12
12
|
- 1 Stellar: Stellar
|
|
13
|
-
-
|
|
13
|
+
- 1 Algorand: Algorand
|
|
14
|
+
- 1 Sui: Sui (sponsored transactions)
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
+ 15 testnets for development and testing.
|
|
17
|
+
|
|
18
|
+
Multi-token support:
|
|
16
19
|
- USDC: All chains
|
|
17
20
|
- EURC: Ethereum, Base, Avalanche
|
|
18
|
-
- AUSD: Ethereum, Arbitrum, Avalanche, Polygon, Monad
|
|
21
|
+
- AUSD: Ethereum, Arbitrum, Avalanche, Polygon, Monad, Sui
|
|
19
22
|
- PYUSD: Ethereum
|
|
20
23
|
|
|
21
24
|
You can register custom networks using `register_network()`.
|
uvd_x402_sdk/networks/sui.py
CHANGED
|
@@ -259,6 +259,7 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
|
|
|
259
259
|
- from: Sender address
|
|
260
260
|
- to: Recipient address
|
|
261
261
|
- amount: Transfer amount (string)
|
|
262
|
+
- coinObjectId: Sui coin object ID used for transfer (REQUIRED by facilitator)
|
|
262
263
|
|
|
263
264
|
Args:
|
|
264
265
|
payload: Payload dictionary from x402 payment
|
|
@@ -266,7 +267,8 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
|
|
|
266
267
|
Returns:
|
|
267
268
|
True if valid, raises ValueError if invalid
|
|
268
269
|
"""
|
|
269
|
-
|
|
270
|
+
# CRITICAL: coinObjectId is REQUIRED by the facilitator for deserialization
|
|
271
|
+
required_fields = ["transactionBytes", "senderSignature", "from", "to", "amount", "coinObjectId"]
|
|
270
272
|
for field in required_fields:
|
|
271
273
|
if field not in payload:
|
|
272
274
|
raise ValueError(f"Sui payload missing '{field}' field")
|
|
@@ -303,6 +305,11 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
|
|
|
303
305
|
except (ValueError, TypeError) as e:
|
|
304
306
|
raise ValueError(f"Invalid amount: {e}")
|
|
305
307
|
|
|
308
|
+
# Validate coinObjectId is a valid Sui object ID (66 chars: 0x + 64 hex)
|
|
309
|
+
coin_object_id = payload["coinObjectId"]
|
|
310
|
+
if not is_valid_sui_address(coin_object_id):
|
|
311
|
+
raise ValueError(f"Invalid coinObjectId: {coin_object_id} (expected 0x + 64 hex chars)")
|
|
312
|
+
|
|
306
313
|
return True
|
|
307
314
|
|
|
308
315
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: uvd-x402-sdk
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.6
|
|
4
4
|
Summary: Python SDK for x402 payments - gasless crypto payments across 18 blockchains with multi-stablecoin support (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
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
uvd_x402_sdk/__init__.py,sha256=
|
|
1
|
+
uvd_x402_sdk/__init__.py,sha256=sloZp8MsMuj1ocHAUcbw-xGoaOLU0Ns29HXwnBIJ6oQ,6625
|
|
2
2
|
uvd_x402_sdk/client.py,sha256=QbK22DtC3HmvvCezphQ-UsYX468vKrIN-M_wF4pv9cM,18389
|
|
3
3
|
uvd_x402_sdk/config.py,sha256=BNGnX2RwZ_ELIcSKU7RkwTUcln4LMFZdCwG1ptASKN8,8644
|
|
4
4
|
uvd_x402_sdk/decorators.py,sha256=XJ7V4554hsa-AVDrizF1oKmeTysg5zlkQRcaeGBI73E,9767
|
|
5
5
|
uvd_x402_sdk/exceptions.py,sha256=kzYNHFn41dSOZ5HaBDrbf4tdwJYQs1YcU9YybTrGZxo,6527
|
|
6
6
|
uvd_x402_sdk/facilitator.py,sha256=OgmB-4GDu9HvG-C6DprMd4h-3neSwsxVuC5-NffVwVI,12776
|
|
7
|
-
uvd_x402_sdk/models.py,sha256=
|
|
7
|
+
uvd_x402_sdk/models.py,sha256=J5qL8CFCrc2UOpnKILi3FXJLNFLDOO0pclrDK4BaLEA,16190
|
|
8
8
|
uvd_x402_sdk/response.py,sha256=4wxH4kWg1F8pokKEbN1kDvDF55cQxmQUN88HTxXht8g,13608
|
|
9
9
|
uvd_x402_sdk/integrations/__init__.py,sha256=Hq1Y0YIMYWBAtmbOLXDC40KQuCrbSpQVjAqEsbjH56s,1912
|
|
10
10
|
uvd_x402_sdk/integrations/django_integration.py,sha256=e3xaV1Yz3HHI7zZBNcyTmV0JsHImkiIEv6PxDvqv0ok,8234
|
|
11
11
|
uvd_x402_sdk/integrations/fastapi_integration.py,sha256=j5h1IJwFLBBoWov7ANLCFaxeCa8pugn-XU9ibrzIL0Y,10205
|
|
12
12
|
uvd_x402_sdk/integrations/flask_integration.py,sha256=0iQKO5-WRxE76Pv-1jEl4lYhjCLmq_R-jxR5g9xIcKw,8825
|
|
13
13
|
uvd_x402_sdk/integrations/lambda_integration.py,sha256=nRf4o3nS6Syx-d5P0kEhz66y7jb_S4w-mwaIazgiA9c,10184
|
|
14
|
-
uvd_x402_sdk/networks/__init__.py,sha256=
|
|
14
|
+
uvd_x402_sdk/networks/__init__.py,sha256=Ky_PZvBMgpuP6Z5JgIM8LevfxYp4r9JK5dnQ4Xo5KuM,2160
|
|
15
15
|
uvd_x402_sdk/networks/algorand.py,sha256=kyet3mu8Uf454QAM6PHQ1FWuQetpPQ7D0jtj7dfojsc,19433
|
|
16
16
|
uvd_x402_sdk/networks/base.py,sha256=P-wTw3LnLZnd_Gv2NPsdcCZZMQb_yDY_NdEMvnstRhY,15421
|
|
17
17
|
uvd_x402_sdk/networks/evm.py,sha256=4IbeaMH2I1c9DYCijghys0qYNeL2Nl92IMKLwq-b0Zg,10065
|
|
18
18
|
uvd_x402_sdk/networks/near.py,sha256=HMMWJr-Jckj3YQTbSXkavlJWZB7ZV8OQX0bq8DuVxIg,12990
|
|
19
19
|
uvd_x402_sdk/networks/solana.py,sha256=GVUeh0O2W6f8Vbgoom2UQSGI8joZV68Pnpzhh87Bnqg,13640
|
|
20
20
|
uvd_x402_sdk/networks/stellar.py,sha256=ZuF-crx41N9MxSsgf2kAy88fsM-xvDyXY_D2ND6M71Y,5142
|
|
21
|
-
uvd_x402_sdk/networks/sui.py,sha256=
|
|
22
|
-
uvd_x402_sdk-0.5.
|
|
23
|
-
uvd_x402_sdk-0.5.
|
|
24
|
-
uvd_x402_sdk-0.5.
|
|
25
|
-
uvd_x402_sdk-0.5.
|
|
26
|
-
uvd_x402_sdk-0.5.
|
|
21
|
+
uvd_x402_sdk/networks/sui.py,sha256=PNKTLIY9q3Ku_s5ZIePLA9rhhZkMwwIgToUQ4Wzb8bw,13026
|
|
22
|
+
uvd_x402_sdk-0.5.6.dist-info/LICENSE,sha256=OcLzB_iSgMbvk7b0dlyvleY_IbL2WUaPxvn1CHw2uAc,1073
|
|
23
|
+
uvd_x402_sdk-0.5.6.dist-info/METADATA,sha256=3PwYHg6CeD7f1bJl-6_s7AjCAM78g57ihHU7ta3zLKw,36537
|
|
24
|
+
uvd_x402_sdk-0.5.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
25
|
+
uvd_x402_sdk-0.5.6.dist-info/top_level.txt,sha256=Exyjj_Kl7CDAGFMi72lT9oFPOYiRNZb3l8tr906mMmc,13
|
|
26
|
+
uvd_x402_sdk-0.5.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|