uvd-x402-sdk 0.2.0__py3-none-any.whl → 0.2.2__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 CHANGED
@@ -2,7 +2,7 @@
2
2
  uvd-x402-sdk: Python SDK for x402 payments via Ultravioleta DAO facilitator.
3
3
 
4
4
  This SDK enables developers to easily integrate x402 cryptocurrency payments
5
- into their Python applications with support for 15 blockchain networks across
5
+ into their Python applications with support for 14 blockchain networks across
6
6
  4 network types (EVM, SVM, NEAR, Stellar).
7
7
 
8
8
  Supports both x402 v1 and v2 protocols:
@@ -29,15 +29,15 @@ Example usage:
29
29
  def protected_endpoint():
30
30
  return {"message": "Payment verified!"}
31
31
 
32
- Supported Networks (15 total, 14 enabled):
33
- - EVM (11): Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche, Celo,
34
- HyperEVM, Unichain, Monad, BSC (disabled)
32
+ Supported Networks (14 total):
33
+ - EVM (10): Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche, Celo,
34
+ HyperEVM, Unichain, Monad
35
35
  - SVM (2): Solana, Fogo
36
36
  - NEAR (1): NEAR Protocol
37
37
  - Stellar (1): Stellar
38
38
  """
39
39
 
40
- __version__ = "0.2.0"
40
+ __version__ = "0.2.2"
41
41
  __author__ = "Ultravioleta DAO"
42
42
 
43
43
  from uvd_x402_sdk.client import X402Client
uvd_x402_sdk/config.py CHANGED
@@ -84,17 +84,16 @@ class X402Config:
84
84
  verify_timeout: float = 30.0
85
85
  settle_timeout: float = 55.0 # Must be < Lambda timeout (60s)
86
86
 
87
- # Network configuration - All 15 networks (14 enabled by default)
87
+ # Network configuration - All 14 networks
88
88
  supported_networks: List[str] = field(default_factory=lambda: [
89
- # EVM chains (11 total, 10 enabled)
89
+ # EVM chains (10)
90
90
  "base", "ethereum", "polygon", "arbitrum", "optimism",
91
91
  "avalanche", "celo", "hyperevm", "unichain", "monad",
92
- # bsc disabled: Binance-Peg USDC doesn't support ERC-3009
93
- # SVM chains (2 total, 2 enabled)
92
+ # SVM chains (2)
94
93
  "solana", "fogo",
95
- # NEAR (1 total, 1 enabled)
94
+ # NEAR (1)
96
95
  "near",
97
- # Stellar (1 total, 1 enabled)
96
+ # Stellar (1)
98
97
  "stellar",
99
98
  ])
100
99
 
@@ -4,9 +4,9 @@ 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 15 mainnet networks out of the box:
8
- - 11 EVM chains: Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche,
9
- Celo, HyperEVM, Unichain, BSC (disabled), Monad
7
+ The SDK supports 14 mainnet networks out of the box:
8
+ - 10 EVM chains: Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche,
9
+ Celo, HyperEVM, Unichain, Monad
10
10
  - 2 SVM chains: Solana, Fogo
11
11
  - 1 NEAR: NEAR Protocol
12
12
  - 1 Stellar: Stellar
@@ -48,7 +48,7 @@ class NetworkConfig:
48
48
  network_type: Type of network (EVM, SOLANA, NEAR, STELLAR)
49
49
  chain_id: EVM chain ID (0 for non-EVM networks)
50
50
  usdc_address: USDC contract/token address
51
- usdc_decimals: Number of decimals for USDC (usually 6, BSC=18, Stellar=7)
51
+ usdc_decimals: Number of decimals for USDC (6 for EVM/SVM, 7 for Stellar)
52
52
  usdc_domain_name: EIP-712 domain name for USDC (EVM only)
53
53
  usdc_domain_version: EIP-712 domain version (EVM only)
54
54
  rpc_url: Default RPC endpoint
@@ -234,7 +234,6 @@ _NETWORK_TO_CAIP2 = {
234
234
  "hyperevm": "eip155:999",
235
235
  "unichain": "eip155:130",
236
236
  "monad": "eip155:143",
237
- "bsc": "eip155:56",
238
237
  # SVM chains (solana:genesisHash first 32 chars)
239
238
  "solana": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
240
239
  "fogo": "solana:fogo", # Placeholder - update when known
@@ -7,7 +7,6 @@ Each chain uses ERC-3009 TransferWithAuthorization for USDC transfers.
7
7
  Important EIP-712 domain considerations:
8
8
  - Most chains use 'USD Coin' as the domain name
9
9
  - Celo, HyperEVM, Unichain, Monad use 'USDC' as the domain name
10
- - BSC USDC uses 18 decimals (not standard 6)
11
10
  """
12
11
 
13
12
  from uvd_x402_sdk.networks.base import (
@@ -164,22 +163,6 @@ MONAD = NetworkConfig(
164
163
  enabled=True,
165
164
  )
166
165
 
167
- # BNB Smart Chain (BSC)
168
- # NOTE: BSC USDC uses 18 decimals (not 6 like other chains)
169
- # NOTE: Binance-Peg USDC doesn't support ERC-3009 - DISABLED
170
- BSC = NetworkConfig(
171
- name="bsc",
172
- display_name="BNB Smart Chain",
173
- network_type=NetworkType.EVM,
174
- chain_id=56,
175
- usdc_address="0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
176
- usdc_decimals=18, # Different from other chains!
177
- usdc_domain_name="USD Coin",
178
- usdc_domain_version="2",
179
- rpc_url="https://binance.llamarpc.com",
180
- enabled=False, # Disabled: Binance-Peg USDC doesn't support ERC-3009
181
- )
182
-
183
166
  # =============================================================================
184
167
  # Register all EVM networks
185
168
  # =============================================================================
@@ -195,7 +178,6 @@ _EVM_NETWORKS = [
195
178
  HYPEREVM,
196
179
  UNICHAIN,
197
180
  MONAD,
198
- BSC,
199
181
  ]
200
182
 
201
183
  for network in _EVM_NETWORKS:
@@ -228,8 +210,6 @@ def get_token_decimals(network_name: str) -> int:
228
210
  network_name: Network identifier
229
211
 
230
212
  Returns:
231
- Number of decimals (6 for most chains, 18 for BSC)
213
+ Number of decimals (6 for all supported chains)
232
214
  """
233
- if network_name.lower() == "bsc":
234
- return 18
235
215
  return 6
@@ -11,12 +11,17 @@ All SVM chains use the same payment flow:
11
11
  3. Facilitator is fee payer (user pays ZERO SOL/tokens)
12
12
  4. Facilitator co-signs and submits transaction
13
13
 
14
- Transaction Structure (REQUIRED by facilitator):
15
- - Instruction 0: SetComputeUnitLimit (units: 20,000)
16
- - Instruction 1: SetComputeUnitPrice (microLamports: 1)
17
- - Instruction 2: TransferChecked (USDC transfer)
18
-
19
- The facilitator validates this exact structure in src/chain/solana.rs.
14
+ Transaction Structure (flexible, facilitator v1.9.4+):
15
+ - SetComputeUnitLimit instruction (recommended: 20,000 units)
16
+ - SetComputeUnitPrice instruction (recommended: 100,000 microLamports)
17
+ - TransferChecked (USDC transfer)
18
+ - Optional: CreateAssociatedTokenAccount (if recipient ATA doesn't exist)
19
+ - Additional instructions may be added by wallets (e.g., Phantom memo)
20
+
21
+ The facilitator scans for the transfer instruction rather than requiring
22
+ fixed positions, allowing wallets like Phantom to add extra instructions.
23
+ The full signed transaction is sent to the facilitator, which uses it
24
+ exactly as signed (no reconstruction).
20
25
  """
21
26
 
22
27
  import base64
@@ -52,8 +57,8 @@ SOLANA = NetworkConfig(
52
57
  "ata_program_id": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
53
58
  # Default compute units for transfer
54
59
  "compute_units": 20000,
55
- # Default priority fee in microLamports
56
- "priority_fee_microlamports": 1,
60
+ # Priority fee in microLamports (100k for fast landing on mainnet)
61
+ "priority_fee_microlamports": 100_000,
57
62
  # Block explorer
58
63
  "explorer_url": "https://solscan.io",
59
64
  # Genesis hash (first 32 chars for CAIP-2)
@@ -82,8 +87,8 @@ FOGO = NetworkConfig(
82
87
  "ata_program_id": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
83
88
  # Default compute units for transfer
84
89
  "compute_units": 20000,
85
- # Default priority fee in microLamports
86
- "priority_fee_microlamports": 1,
90
+ # Priority fee in microLamports (100k for fast landing)
91
+ "priority_fee_microlamports": 100_000,
87
92
  # Block explorer (placeholder - update when available)
88
93
  "explorer_url": "https://explorer.fogo.nightly.app",
89
94
  # Network type identifier
@@ -165,11 +170,17 @@ def validate_svm_transaction_structure(transaction_base64: str) -> bool:
165
170
  """
166
171
  Validate that an SVM transaction has the correct structure for x402.
167
172
 
168
- The facilitator expects:
169
- - VersionedTransaction with exactly 3 instructions
170
- - Instruction 0: SetComputeUnitLimit
171
- - Instruction 1: SetComputeUnitPrice
172
- - Instruction 2: TransferChecked (SPL token)
173
+ The facilitator expects (flexible order, Dec 2024+):
174
+ - VersionedTransaction with at least 3 instructions
175
+ - SetComputeUnitLimit instruction (any position)
176
+ - SetComputeUnitPrice instruction (any position)
177
+ - TransferChecked instruction (SPL token)
178
+ - Optional: CreateAssociatedTokenAccount instruction
179
+ - Optional: Additional instructions from wallet (e.g., Phantom memo)
180
+
181
+ Note: Wallets like Phantom may add extra instructions during signing.
182
+ The facilitator v1.9.4+ handles this by scanning for the transfer
183
+ instruction rather than requiring fixed positions.
173
184
 
174
185
  Args:
175
186
  transaction_base64: Base64-encoded serialized transaction
@@ -266,4 +277,6 @@ SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3
266
277
 
267
278
  # Default values for x402 transactions
268
279
  DEFAULT_COMPUTE_UNITS = 20000
269
- DEFAULT_PRIORITY_FEE_MICROLAMPORTS = 1
280
+ # Use 100k microlamports/CU for fast landing on mainnet
281
+ # Lower values (like 1) cause transactions to be deprioritized and time out
282
+ DEFAULT_PRIORITY_FEE_MICROLAMPORTS = 100_000
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uvd-x402-sdk
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for integrating x402 payments via the Ultravioleta DAO facilitator
5
5
  Author-email: Ultravioleta DAO <dev@ultravioletadao.xyz>
6
6
  Project-URL: Homepage, https://github.com/UltravioletaDAO/uvd-x402-sdk-python
@@ -51,11 +51,11 @@ Requires-Dist: eth-account>=0.10.0; extra == "web3"
51
51
 
52
52
  Python SDK for integrating **x402 cryptocurrency payments** via the Ultravioleta DAO facilitator.
53
53
 
54
- Accept USDC payments across **15 blockchain networks** with a single integration. The SDK handles signature verification, on-chain settlement, and all the complexity of multi-chain payments.
54
+ Accept USDC payments across **14 blockchain networks** with a single integration. The SDK handles signature verification, on-chain settlement, and all the complexity of multi-chain payments.
55
55
 
56
56
  ## Features
57
57
 
58
- - **15 Networks**: EVM chains (Base, Ethereum, Polygon, etc.), SVM chains (Solana, Fogo), NEAR, and Stellar
58
+ - **14 Networks**: EVM chains (Base, Ethereum, Polygon, etc.), SVM chains (Solana, Fogo), NEAR, and Stellar
59
59
  - **x402 v1 & v2**: Full support for both protocol versions with auto-detection
60
60
  - **Framework Integrations**: Flask, FastAPI, Django, AWS Lambda
61
61
  - **Gasless Payments**: Users sign authorizations, facilitator pays all network fees
@@ -88,14 +88,11 @@ print(f"Paid by {result.payer_address}, tx: {result.transaction_hash}")
88
88
  | HyperEVM | EVM | 999 | `eip155:999` | Active |
89
89
  | Unichain | EVM | 130 | `eip155:130` | Active |
90
90
  | Monad | EVM | 143 | `eip155:143` | Active |
91
- | BSC | EVM | 56 | `eip155:56` | Disabled* |
92
91
  | Solana | SVM | - | `solana:5eykt...` | Active |
93
92
  | Fogo | SVM | - | `solana:fogo` | Active |
94
93
  | NEAR | NEAR | - | `near:mainnet` | Active |
95
94
  | Stellar | Stellar | - | `stellar:pubnet` | Active |
96
95
 
97
- *BSC's USDC doesn't support ERC-3009 TransferWithAuthorization
98
-
99
96
  ## Installation
100
97
 
101
98
  ```bash
@@ -689,7 +686,7 @@ The facilitator (https://facilitator.ultravioletadao.xyz) handles all on-chain i
689
686
 
690
687
  **"Unsupported network"**
691
688
  - Check that the network is in `supported_networks`
692
- - Verify the network is enabled (BSC is disabled by default)
689
+ - Verify the network is enabled
693
690
  - For v2, ensure CAIP-2 format is correct
694
691
 
695
692
  **"Payment verification failed"**
@@ -756,6 +753,12 @@ MIT License - see LICENSE file.
756
753
 
757
754
  ## Changelog
758
755
 
756
+ ### v0.2.1 (2025-12-16)
757
+
758
+ - Removed BSC network (doesn't support ERC-3009)
759
+ - Added GitHub Actions workflow for PyPI publishing
760
+ - Updated to 14 supported networks
761
+
759
762
  ### v0.2.0 (2025-12-15)
760
763
 
761
764
  - Added **NEAR Protocol** support with NEP-366 meta-transactions
@@ -766,11 +769,10 @@ MIT License - see LICENSE file.
766
769
  - Added CAIP-2 parsing utilities (`parse_caip2_network`, `to_caip2_network`)
767
770
  - Added `MultiPaymentConfig` for multi-network recipient configuration
768
771
  - Added `Payment402BuilderV2` for v2 response construction
769
- - Updated to 15 supported networks (14 enabled)
770
772
 
771
773
  ### v0.1.0 (2025-12-01)
772
774
 
773
775
  - Initial release
774
- - 14 network support (EVM, Solana, Stellar)
776
+ - EVM, Solana, Stellar network support
775
777
  - Flask, FastAPI, Django, Lambda integrations
776
778
  - Full Pydantic models
@@ -1,6 +1,6 @@
1
- uvd_x402_sdk/__init__.py,sha256=b-k8ngOXA6hEeHKzf7O5Mhb2Y8DZJhoYuaWKk1whKeo,4690
1
+ uvd_x402_sdk/__init__.py,sha256=Z_q46CqoCRpvkm_czDHeGHSkJKczlGfaS0JYjfvYzeM,4662
2
2
  uvd_x402_sdk/client.py,sha256=oWPnm7uKeIrIx4hD_NCopDDDaKU0dP8E8SGHvzwByew,18916
3
- uvd_x402_sdk/config.py,sha256=oTVhJw1G0D0JHBzu6iw6rBzBtICvWhptPuvX6SzM5KI,9052
3
+ uvd_x402_sdk/config.py,sha256=UEQC9Cnk2Q7MLPebqjog7ucTyMJkGw8-OhL7v8JEJww,8892
4
4
  uvd_x402_sdk/decorators.py,sha256=dojuSHXdJ029aMC3IVTqQtZAy_Z9FJlY-Lm23qtlJUw,10092
5
5
  uvd_x402_sdk/exceptions.py,sha256=LltNzpnwV0FLCYPb-gQgvlZTueudiFRE2x8i5sv8cFk,6781
6
6
  uvd_x402_sdk/models.py,sha256=LBQErb5Po27BOYyWgyzQhPzx_1TKA3zCwbjuB3MevIE,14679
@@ -10,14 +10,14 @@ uvd_x402_sdk/integrations/django_integration.py,sha256=0NwUncWuTF9ejeeZEP54lgfZY
10
10
  uvd_x402_sdk/integrations/fastapi_integration.py,sha256=TfXFjtDSJ9nTCKElLJj7joxAAhduiauvl97lEhFH2tw,10535
11
11
  uvd_x402_sdk/integrations/flask_integration.py,sha256=8bV8DpiXNJyhS8_yrweaPCqxBke2Tkbybb_dGPiC94M,9084
12
12
  uvd_x402_sdk/integrations/lambda_integration.py,sha256=B6dFvxpdhgviiaZf7qFK--LMa8Fh7ITgEhLRp6iwyqE,10504
13
- uvd_x402_sdk/networks/__init__.py,sha256=0TMPws5C8jLChFYxW5TVH8vjTc1S-TcZZ9HR4AnlQ1U,1478
14
- uvd_x402_sdk/networks/base.py,sha256=4sIepZTqKzxnNW0oGi1ENkUL8IdEi9vdvqoc5OMifNk,10289
15
- uvd_x402_sdk/networks/evm.py,sha256=vWFuJBNMYrA4gJWA6xfkInfR3QhVwLL5Lpi7yS1HNwA,6568
13
+ uvd_x402_sdk/networks/__init__.py,sha256=mBspQT3gtN6qRCmk-2Qa1I70d9BURk6po2OCCJE3LsA,1462
14
+ uvd_x402_sdk/networks/base.py,sha256=HU5ca8Lp6x5QHEZxtHUkp1qM7F1t84kgxCAROyEOMaI,10264
15
+ uvd_x402_sdk/networks/evm.py,sha256=hSAkQAu537lQWWZn2iO_o33N5Qmqe7ZtzbghjP42N7Y,5866
16
16
  uvd_x402_sdk/networks/near.py,sha256=R88fxEDE0W6buUrs_Hlc1LyJ4OSXTZlmCf393-CxjAg,12005
17
- uvd_x402_sdk/networks/solana.py,sha256=sY3gkYGvmC3NSj3bjl2fCWvbl_0wVIIlte4BvdRkWKE,8702
17
+ uvd_x402_sdk/networks/solana.py,sha256=pWdwUe3N08bCu75CUn_8UzjMFfygMPeNhB1Hf0J2vac,9633
18
18
  uvd_x402_sdk/networks/stellar.py,sha256=luXKdqUwJHRa8N0hfOoMEpny3u1PS7nNtU6c8VGqpIY,3663
19
- uvd_x402_sdk-0.2.0.dist-info/LICENSE,sha256=_FxTbuGgcgrco5ZjC_8o-NhyoPGYuF8B86m02LavkCA,1094
20
- uvd_x402_sdk-0.2.0.dist-info/METADATA,sha256=zn8s_lM8-sjf36hR_UI1r-9PULelXn3TC-ihZkenoUI,22706
21
- uvd_x402_sdk-0.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
22
- uvd_x402_sdk-0.2.0.dist-info/top_level.txt,sha256=Exyjj_Kl7CDAGFMi72lT9oFPOYiRNZb3l8tr906mMmc,13
23
- uvd_x402_sdk-0.2.0.dist-info/RECORD,,
19
+ uvd_x402_sdk-0.2.2.dist-info/LICENSE,sha256=_FxTbuGgcgrco5ZjC_8o-NhyoPGYuF8B86m02LavkCA,1094
20
+ uvd_x402_sdk-0.2.2.dist-info/METADATA,sha256=tofqPIOfpHE-ZWOvayGvD1fXJsqFJKLPtlEUTYwbAr0,22679
21
+ uvd_x402_sdk-0.2.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
22
+ uvd_x402_sdk-0.2.2.dist-info/top_level.txt,sha256=Exyjj_Kl7CDAGFMi72lT9oFPOYiRNZb3l8tr906mMmc,13
23
+ uvd_x402_sdk-0.2.2.dist-info/RECORD,,