uvd-x402-sdk 0.5.4__tar.gz → 0.5.6__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.
Files changed (32) hide show
  1. {uvd_x402_sdk-0.5.4/src/uvd_x402_sdk.egg-info → uvd_x402_sdk-0.5.6}/PKG-INFO +1 -1
  2. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/pyproject.toml +1 -1
  3. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/__init__.py +3 -1
  4. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/models.py +51 -0
  5. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/__init__.py +7 -4
  6. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/sui.py +45 -1
  7. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6/src/uvd_x402_sdk.egg-info}/PKG-INFO +1 -1
  8. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/LICENSE +0 -0
  9. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/README.md +0 -0
  10. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/setup.cfg +0 -0
  11. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/client.py +0 -0
  12. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/config.py +0 -0
  13. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/decorators.py +0 -0
  14. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/exceptions.py +0 -0
  15. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/facilitator.py +0 -0
  16. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/integrations/__init__.py +0 -0
  17. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/integrations/django_integration.py +0 -0
  18. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/integrations/fastapi_integration.py +0 -0
  19. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/integrations/flask_integration.py +0 -0
  20. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/integrations/lambda_integration.py +0 -0
  21. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/algorand.py +0 -0
  22. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/base.py +0 -0
  23. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/evm.py +0 -0
  24. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/near.py +0 -0
  25. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/solana.py +0 -0
  26. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/networks/stellar.py +0 -0
  27. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk/response.py +0 -0
  28. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk.egg-info/SOURCES.txt +0 -0
  29. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk.egg-info/dependency_links.txt +0 -0
  30. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk.egg-info/requires.txt +0 -0
  31. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/src/uvd_x402_sdk.egg-info/top_level.txt +0 -0
  32. {uvd_x402_sdk-0.5.4 → uvd_x402_sdk-0.5.6}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uvd-x402-sdk
3
- Version: 0.5.4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "uvd-x402-sdk"
7
- version = "0.5.4"
7
+ version = "0.5.6"
8
8
  description = "Python SDK for x402 payments - gasless crypto payments across 18 blockchains with multi-stablecoin support (USDC, EURC, AUSD, PYUSD, USDT)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -42,7 +42,7 @@ Supported Networks (18 total):
42
42
  - Sui (2): Sui mainnet, Sui testnet
43
43
  """
44
44
 
45
- __version__ = "0.5.4"
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",
@@ -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 16 mainnet networks out of the box:
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
- - 2 Algorand: Algorand mainnet and testnet
13
+ - 1 Algorand: Algorand
14
+ - 1 Sui: Sui (sponsored transactions)
14
15
 
15
- Multi-token support (EVM chains only):
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()`.
@@ -7,6 +7,7 @@ This module supports Sui blockchain for x402 payments using sponsored transactio
7
7
 
8
8
  Supported Tokens:
9
9
  - USDC: Native Sui USDC
10
+ - AUSD: Agora USD (mainnet only)
10
11
 
11
12
  All Sui chains use the same payment flow:
12
13
  1. User creates a programmable transaction for token transfer
@@ -59,6 +60,9 @@ except ImportError:
59
60
  SUI_USDC_COIN_TYPE_MAINNET = "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
60
61
  SUI_USDC_COIN_TYPE_TESTNET = "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC"
61
62
 
63
+ # AUSD (Agora USD) coin types on Sui
64
+ SUI_AUSD_COIN_TYPE_MAINNET = "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD"
65
+
62
66
  # Sui Mainnet
63
67
  SUI = NetworkConfig(
64
68
  name="sui",
@@ -78,10 +82,18 @@ SUI = NetworkConfig(
78
82
  name="", # Not applicable for Sui
79
83
  version="",
80
84
  ),
85
+ "ausd": TokenConfig(
86
+ address=SUI_AUSD_COIN_TYPE_MAINNET,
87
+ decimals=6,
88
+ name="", # Not applicable for Sui
89
+ version="",
90
+ ),
81
91
  },
82
92
  extra_config={
83
93
  # Coin type for USDC (package::module::type format)
84
94
  "usdc_coin_type": SUI_USDC_COIN_TYPE_MAINNET,
95
+ # Coin type for AUSD (Agora USD)
96
+ "ausd_coin_type": SUI_AUSD_COIN_TYPE_MAINNET,
85
97
  # Fee payer (facilitator) address
86
98
  "fee_payer": SUI_FEE_PAYER_MAINNET,
87
99
  # Block explorer
@@ -247,6 +259,7 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
247
259
  - from: Sender address
248
260
  - to: Recipient address
249
261
  - amount: Transfer amount (string)
262
+ - coinObjectId: Sui coin object ID used for transfer (REQUIRED by facilitator)
250
263
 
251
264
  Args:
252
265
  payload: Payload dictionary from x402 payment
@@ -254,7 +267,8 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
254
267
  Returns:
255
268
  True if valid, raises ValueError if invalid
256
269
  """
257
- required_fields = ["transactionBytes", "senderSignature", "from", "to", "amount"]
270
+ # CRITICAL: coinObjectId is REQUIRED by the facilitator for deserialization
271
+ required_fields = ["transactionBytes", "senderSignature", "from", "to", "amount", "coinObjectId"]
258
272
  for field in required_fields:
259
273
  if field not in payload:
260
274
  raise ValueError(f"Sui payload missing '{field}' field")
@@ -291,6 +305,11 @@ def validate_sui_payload(payload: Dict[str, Any]) -> bool:
291
305
  except (ValueError, TypeError) as e:
292
306
  raise ValueError(f"Invalid amount: {e}")
293
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
+
294
313
  return True
295
314
 
296
315
 
@@ -345,6 +364,31 @@ def get_sui_usdc_coin_type(network_name: str = "sui") -> str:
345
364
  return SUI_USDC_COIN_TYPE_MAINNET
346
365
 
347
366
 
367
+ def get_sui_ausd_coin_type(network_name: str = "sui") -> Optional[str]:
368
+ """
369
+ Get the AUSD (Agora USD) coin type for a Sui network.
370
+
371
+ Note: AUSD is only available on Sui mainnet.
372
+
373
+ Args:
374
+ network_name: Network name ('sui', 'sui-mainnet', 'sui-testnet')
375
+
376
+ Returns:
377
+ AUSD coin type in package::module::type format, or None if not available
378
+
379
+ Example:
380
+ >>> get_sui_ausd_coin_type("sui")
381
+ '0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD'
382
+ >>> get_sui_ausd_coin_type("sui-testnet")
383
+ None
384
+ """
385
+ network_lower = network_name.lower()
386
+ # AUSD is only available on Sui mainnet
387
+ if "testnet" in network_lower:
388
+ return None
389
+ return SUI_AUSD_COIN_TYPE_MAINNET
390
+
391
+
348
392
  # =============================================================================
349
393
  # Sui Transaction Building Utilities (for reference)
350
394
  # =============================================================================
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uvd-x402-sdk
3
- Version: 0.5.4
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
File without changes
File without changes
File without changes