uvd-x402-sdk 0.2.3__py3-none-any.whl → 0.3.0__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 +17 -1
- uvd_x402_sdk/networks/__init__.py +26 -0
- uvd_x402_sdk/networks/base.py +152 -1
- uvd_x402_sdk/networks/evm.py +147 -6
- {uvd_x402_sdk-0.2.3.dist-info → uvd_x402_sdk-0.3.0.dist-info}/METADATA +121 -8
- {uvd_x402_sdk-0.2.3.dist-info → uvd_x402_sdk-0.3.0.dist-info}/RECORD +9 -9
- {uvd_x402_sdk-0.2.3.dist-info → uvd_x402_sdk-0.3.0.dist-info}/LICENSE +0 -0
- {uvd_x402_sdk-0.2.3.dist-info → uvd_x402_sdk-0.3.0.dist-info}/WHEEL +0 -0
- {uvd_x402_sdk-0.2.3.dist-info → uvd_x402_sdk-0.3.0.dist-info}/top_level.txt +0 -0
uvd_x402_sdk/__init__.py
CHANGED
|
@@ -37,7 +37,7 @@ Supported Networks (14 total):
|
|
|
37
37
|
- Stellar (1): Stellar
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
|
-
__version__ = "0.
|
|
40
|
+
__version__ = "0.3.0"
|
|
41
41
|
__author__ = "Ultravioleta DAO"
|
|
42
42
|
|
|
43
43
|
from uvd_x402_sdk.client import X402Client
|
|
@@ -83,6 +83,14 @@ from uvd_x402_sdk.networks import (
|
|
|
83
83
|
get_supported_chain_ids,
|
|
84
84
|
get_supported_network_names,
|
|
85
85
|
NetworkType,
|
|
86
|
+
# Token types (multi-stablecoin support)
|
|
87
|
+
TokenType,
|
|
88
|
+
TokenConfig,
|
|
89
|
+
ALL_TOKEN_TYPES,
|
|
90
|
+
get_token_config,
|
|
91
|
+
get_supported_tokens,
|
|
92
|
+
is_token_supported,
|
|
93
|
+
get_networks_by_token,
|
|
86
94
|
# CAIP-2 utilities (v2 support)
|
|
87
95
|
parse_caip2_network,
|
|
88
96
|
to_caip2_network,
|
|
@@ -151,6 +159,14 @@ __all__ = [
|
|
|
151
159
|
"get_supported_chain_ids",
|
|
152
160
|
"get_supported_network_names",
|
|
153
161
|
"NetworkType",
|
|
162
|
+
# Token types (multi-stablecoin support)
|
|
163
|
+
"TokenType",
|
|
164
|
+
"TokenConfig",
|
|
165
|
+
"ALL_TOKEN_TYPES",
|
|
166
|
+
"get_token_config",
|
|
167
|
+
"get_supported_tokens",
|
|
168
|
+
"is_token_supported",
|
|
169
|
+
"get_networks_by_token",
|
|
154
170
|
# CAIP-2 utilities
|
|
155
171
|
"parse_caip2_network",
|
|
156
172
|
"to_caip2_network",
|
|
@@ -11,12 +11,24 @@ The SDK supports 14 mainnet networks out of the box:
|
|
|
11
11
|
- 1 NEAR: NEAR Protocol
|
|
12
12
|
- 1 Stellar: Stellar
|
|
13
13
|
|
|
14
|
+
Multi-token support (EVM chains only):
|
|
15
|
+
- USDC: All chains
|
|
16
|
+
- EURC: Ethereum, Base, Avalanche
|
|
17
|
+
- AUSD: Ethereum, Arbitrum, Avalanche, Polygon, Monad
|
|
18
|
+
- PYUSD: Ethereum
|
|
19
|
+
- GHO: Ethereum, Base, Arbitrum
|
|
20
|
+
- crvUSD: Ethereum, Arbitrum
|
|
21
|
+
|
|
14
22
|
You can register custom networks using `register_network()`.
|
|
15
23
|
"""
|
|
16
24
|
|
|
17
25
|
from uvd_x402_sdk.networks.base import (
|
|
18
26
|
NetworkConfig,
|
|
19
27
|
NetworkType,
|
|
28
|
+
# Token types (multi-stablecoin support)
|
|
29
|
+
TokenType,
|
|
30
|
+
TokenConfig,
|
|
31
|
+
ALL_TOKEN_TYPES,
|
|
20
32
|
get_network,
|
|
21
33
|
get_network_by_chain_id,
|
|
22
34
|
register_network,
|
|
@@ -24,6 +36,11 @@ from uvd_x402_sdk.networks.base import (
|
|
|
24
36
|
get_supported_chain_ids,
|
|
25
37
|
get_supported_network_names,
|
|
26
38
|
SUPPORTED_NETWORKS,
|
|
39
|
+
# Token helper functions
|
|
40
|
+
get_token_config,
|
|
41
|
+
get_supported_tokens,
|
|
42
|
+
is_token_supported,
|
|
43
|
+
get_networks_by_token,
|
|
27
44
|
# CAIP-2 utilities (x402 v2)
|
|
28
45
|
parse_caip2_network,
|
|
29
46
|
to_caip2_network,
|
|
@@ -38,6 +55,10 @@ __all__ = [
|
|
|
38
55
|
# Core
|
|
39
56
|
"NetworkConfig",
|
|
40
57
|
"NetworkType",
|
|
58
|
+
# Token types (multi-stablecoin support)
|
|
59
|
+
"TokenType",
|
|
60
|
+
"TokenConfig",
|
|
61
|
+
"ALL_TOKEN_TYPES",
|
|
41
62
|
# Registry functions
|
|
42
63
|
"get_network",
|
|
43
64
|
"get_network_by_chain_id",
|
|
@@ -46,6 +67,11 @@ __all__ = [
|
|
|
46
67
|
"get_supported_chain_ids",
|
|
47
68
|
"get_supported_network_names",
|
|
48
69
|
"SUPPORTED_NETWORKS",
|
|
70
|
+
# Token helper functions
|
|
71
|
+
"get_token_config",
|
|
72
|
+
"get_supported_tokens",
|
|
73
|
+
"is_token_supported",
|
|
74
|
+
"get_networks_by_token",
|
|
49
75
|
# CAIP-2 utilities (x402 v2)
|
|
50
76
|
"parse_caip2_network",
|
|
51
77
|
"to_caip2_network",
|
uvd_x402_sdk/networks/base.py
CHANGED
|
@@ -4,12 +4,48 @@ Base network configuration and registry.
|
|
|
4
4
|
This module provides the foundation for network configuration, including:
|
|
5
5
|
- NetworkConfig dataclass for defining network parameters
|
|
6
6
|
- NetworkType enum for categorizing networks
|
|
7
|
+
- TokenType for multi-stablecoin support
|
|
7
8
|
- Global registry for storing and retrieving network configurations
|
|
8
9
|
"""
|
|
9
10
|
|
|
10
11
|
from dataclasses import dataclass, field
|
|
11
12
|
from enum import Enum
|
|
12
|
-
from typing import Dict, List, Optional, Any
|
|
13
|
+
from typing import Dict, List, Literal, Optional, Any
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# Token Type Definitions (Multi-Stablecoin Support)
|
|
18
|
+
# =============================================================================
|
|
19
|
+
|
|
20
|
+
# Supported stablecoin token types
|
|
21
|
+
# - usdc: USD Coin (Circle) - 6 decimals
|
|
22
|
+
# - eurc: Euro Coin (Circle) - 6 decimals
|
|
23
|
+
# - ausd: Agora USD (Agora Finance) - 6 decimals
|
|
24
|
+
# - pyusd: PayPal USD (PayPal/Paxos) - 6 decimals
|
|
25
|
+
# - gho: GHO Stablecoin (Aave) - 18 decimals
|
|
26
|
+
# - crvusd: Curve USD (Curve Finance) - 18 decimals
|
|
27
|
+
TokenType = Literal["usdc", "eurc", "ausd", "pyusd", "gho", "crvusd"]
|
|
28
|
+
|
|
29
|
+
# All supported token types
|
|
30
|
+
ALL_TOKEN_TYPES: List[TokenType] = ["usdc", "eurc", "ausd", "pyusd", "gho", "crvusd"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class TokenConfig:
|
|
35
|
+
"""
|
|
36
|
+
Configuration for a stablecoin token on a specific network.
|
|
37
|
+
|
|
38
|
+
Attributes:
|
|
39
|
+
address: Contract address of the token
|
|
40
|
+
decimals: Number of decimals (6 for most stablecoins, 18 for GHO/crvUSD)
|
|
41
|
+
name: Token name for EIP-712 domain (e.g., "USD Coin" or "USDC")
|
|
42
|
+
version: Token version for EIP-712 domain
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
address: str
|
|
46
|
+
decimals: int
|
|
47
|
+
name: str
|
|
48
|
+
version: str
|
|
13
49
|
|
|
14
50
|
|
|
15
51
|
class NetworkType(Enum):
|
|
@@ -53,6 +89,7 @@ class NetworkConfig:
|
|
|
53
89
|
usdc_domain_version: EIP-712 domain version (EVM only)
|
|
54
90
|
rpc_url: Default RPC endpoint
|
|
55
91
|
enabled: Whether network is currently enabled
|
|
92
|
+
tokens: Multi-token configurations (EVM chains only, maps token type to config)
|
|
56
93
|
extra_config: Additional network-specific configuration
|
|
57
94
|
"""
|
|
58
95
|
|
|
@@ -66,6 +103,7 @@ class NetworkConfig:
|
|
|
66
103
|
usdc_domain_version: str = "2"
|
|
67
104
|
rpc_url: str = ""
|
|
68
105
|
enabled: bool = True
|
|
106
|
+
tokens: Dict[TokenType, TokenConfig] = field(default_factory=dict)
|
|
69
107
|
extra_config: Dict[str, Any] = field(default_factory=dict)
|
|
70
108
|
|
|
71
109
|
def __post_init__(self) -> None:
|
|
@@ -209,6 +247,119 @@ def get_supported_network_names() -> List[str]:
|
|
|
209
247
|
SUPPORTED_NETWORKS = _NETWORK_REGISTRY
|
|
210
248
|
|
|
211
249
|
|
|
250
|
+
# =============================================================================
|
|
251
|
+
# Token Helper Functions (Multi-Stablecoin Support)
|
|
252
|
+
# =============================================================================
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def get_token_config(network_name: str, token_type: TokenType = "usdc") -> Optional[TokenConfig]:
|
|
256
|
+
"""
|
|
257
|
+
Get token configuration for a specific network and token type.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
network_name: Network identifier (e.g., 'base', 'ethereum')
|
|
261
|
+
token_type: Token type (defaults to 'usdc')
|
|
262
|
+
|
|
263
|
+
Returns:
|
|
264
|
+
TokenConfig if the token is supported on this network, None otherwise
|
|
265
|
+
|
|
266
|
+
Example:
|
|
267
|
+
>>> config = get_token_config('ethereum', 'eurc')
|
|
268
|
+
>>> if config:
|
|
269
|
+
... print(f"EURC address: {config.address}")
|
|
270
|
+
"""
|
|
271
|
+
network = get_network(network_name)
|
|
272
|
+
if not network:
|
|
273
|
+
return None
|
|
274
|
+
|
|
275
|
+
# Check tokens dict first (multi-token support)
|
|
276
|
+
if token_type in network.tokens:
|
|
277
|
+
return network.tokens[token_type]
|
|
278
|
+
|
|
279
|
+
# Fall back to USDC config for backward compatibility
|
|
280
|
+
if token_type == "usdc":
|
|
281
|
+
return TokenConfig(
|
|
282
|
+
address=network.usdc_address,
|
|
283
|
+
decimals=network.usdc_decimals,
|
|
284
|
+
name=network.usdc_domain_name,
|
|
285
|
+
version=network.usdc_domain_version,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
return None
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def get_supported_tokens(network_name: str) -> List[TokenType]:
|
|
292
|
+
"""
|
|
293
|
+
Get list of supported token types for a network.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
network_name: Network identifier
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
List of supported TokenType values
|
|
300
|
+
|
|
301
|
+
Example:
|
|
302
|
+
>>> tokens = get_supported_tokens('ethereum')
|
|
303
|
+
>>> print(tokens) # ['usdc', 'eurc', 'ausd', 'pyusd', 'gho', 'crvusd']
|
|
304
|
+
"""
|
|
305
|
+
network = get_network(network_name)
|
|
306
|
+
if not network:
|
|
307
|
+
return []
|
|
308
|
+
|
|
309
|
+
# Get tokens from the tokens dict
|
|
310
|
+
tokens: List[TokenType] = list(network.tokens.keys())
|
|
311
|
+
|
|
312
|
+
# Always include 'usdc' if the network has USDC configured
|
|
313
|
+
if "usdc" not in tokens and network.usdc_address:
|
|
314
|
+
tokens.insert(0, "usdc")
|
|
315
|
+
|
|
316
|
+
return tokens
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def is_token_supported(network_name: str, token_type: TokenType) -> bool:
|
|
320
|
+
"""
|
|
321
|
+
Check if a specific token is supported on a network.
|
|
322
|
+
|
|
323
|
+
Args:
|
|
324
|
+
network_name: Network identifier
|
|
325
|
+
token_type: Token type to check
|
|
326
|
+
|
|
327
|
+
Returns:
|
|
328
|
+
True if token is supported, False otherwise
|
|
329
|
+
|
|
330
|
+
Example:
|
|
331
|
+
>>> is_token_supported('ethereum', 'eurc')
|
|
332
|
+
True
|
|
333
|
+
>>> is_token_supported('celo', 'eurc')
|
|
334
|
+
False
|
|
335
|
+
"""
|
|
336
|
+
return get_token_config(network_name, token_type) is not None
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def get_networks_by_token(token_type: TokenType) -> List[NetworkConfig]:
|
|
340
|
+
"""
|
|
341
|
+
Get all networks that support a specific token type.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
token_type: Token type to search for
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
List of NetworkConfig instances that support the token
|
|
348
|
+
|
|
349
|
+
Example:
|
|
350
|
+
>>> networks = get_networks_by_token('eurc')
|
|
351
|
+
>>> for n in networks:
|
|
352
|
+
... print(n.name) # ethereum, base, avalanche
|
|
353
|
+
"""
|
|
354
|
+
result = []
|
|
355
|
+
for network in _NETWORK_REGISTRY.values():
|
|
356
|
+
if not network.enabled:
|
|
357
|
+
continue
|
|
358
|
+
if is_token_supported(network.name, token_type):
|
|
359
|
+
result.append(network)
|
|
360
|
+
return result
|
|
361
|
+
|
|
362
|
+
|
|
212
363
|
# =============================================================================
|
|
213
364
|
# CAIP-2 Utilities (x402 v2 support)
|
|
214
365
|
# =============================================================================
|
uvd_x402_sdk/networks/evm.py
CHANGED
|
@@ -7,11 +7,20 @@ 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
|
+
|
|
11
|
+
Multi-token support:
|
|
12
|
+
- USDC: All chains (6 decimals)
|
|
13
|
+
- EURC: Ethereum, Base, Avalanche (6 decimals)
|
|
14
|
+
- AUSD: Ethereum, Arbitrum, Avalanche, Polygon, Monad (6 decimals)
|
|
15
|
+
- PYUSD: Ethereum (6 decimals)
|
|
16
|
+
- GHO: Ethereum, Base, Arbitrum (18 decimals)
|
|
17
|
+
- crvUSD: Ethereum, Arbitrum (18 decimals)
|
|
10
18
|
"""
|
|
11
19
|
|
|
12
20
|
from uvd_x402_sdk.networks.base import (
|
|
13
21
|
NetworkConfig,
|
|
14
22
|
NetworkType,
|
|
23
|
+
TokenConfig,
|
|
15
24
|
register_network,
|
|
16
25
|
)
|
|
17
26
|
|
|
@@ -19,7 +28,7 @@ from uvd_x402_sdk.networks.base import (
|
|
|
19
28
|
# EVM Networks Configuration
|
|
20
29
|
# =============================================================================
|
|
21
30
|
|
|
22
|
-
# Base (Layer 2)
|
|
31
|
+
# Base (Layer 2) - supports USDC, EURC, GHO
|
|
23
32
|
BASE = NetworkConfig(
|
|
24
33
|
name="base",
|
|
25
34
|
display_name="Base",
|
|
@@ -31,9 +40,29 @@ BASE = NetworkConfig(
|
|
|
31
40
|
usdc_domain_version="2",
|
|
32
41
|
rpc_url="https://mainnet.base.org",
|
|
33
42
|
enabled=True,
|
|
43
|
+
tokens={
|
|
44
|
+
"usdc": TokenConfig(
|
|
45
|
+
address="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
46
|
+
decimals=6,
|
|
47
|
+
name="USD Coin",
|
|
48
|
+
version="2",
|
|
49
|
+
),
|
|
50
|
+
"eurc": TokenConfig(
|
|
51
|
+
address="0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
52
|
+
decimals=6,
|
|
53
|
+
name="EURC",
|
|
54
|
+
version="2",
|
|
55
|
+
),
|
|
56
|
+
"gho": TokenConfig(
|
|
57
|
+
address="0x6Bb7a212910682DCFdbd5BCBb3e28FB4E8da10Ee",
|
|
58
|
+
decimals=18,
|
|
59
|
+
name="Gho Token",
|
|
60
|
+
version="1",
|
|
61
|
+
),
|
|
62
|
+
},
|
|
34
63
|
)
|
|
35
64
|
|
|
36
|
-
# Ethereum Mainnet
|
|
65
|
+
# Ethereum Mainnet (supports all 6 stablecoins)
|
|
37
66
|
ETHEREUM = NetworkConfig(
|
|
38
67
|
name="ethereum",
|
|
39
68
|
display_name="Ethereum",
|
|
@@ -45,9 +74,47 @@ ETHEREUM = NetworkConfig(
|
|
|
45
74
|
usdc_domain_version="2",
|
|
46
75
|
rpc_url="https://eth.llamarpc.com",
|
|
47
76
|
enabled=True,
|
|
77
|
+
tokens={
|
|
78
|
+
"usdc": TokenConfig(
|
|
79
|
+
address="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
80
|
+
decimals=6,
|
|
81
|
+
name="USD Coin",
|
|
82
|
+
version="2",
|
|
83
|
+
),
|
|
84
|
+
"eurc": TokenConfig(
|
|
85
|
+
address="0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",
|
|
86
|
+
decimals=6,
|
|
87
|
+
name="EURC",
|
|
88
|
+
version="2",
|
|
89
|
+
),
|
|
90
|
+
"ausd": TokenConfig(
|
|
91
|
+
address="0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
|
|
92
|
+
decimals=6,
|
|
93
|
+
name="Agora USD",
|
|
94
|
+
version="1",
|
|
95
|
+
),
|
|
96
|
+
"pyusd": TokenConfig(
|
|
97
|
+
address="0x6c3ea9036406852006290770BEdFcAbA0e23A0e8",
|
|
98
|
+
decimals=6,
|
|
99
|
+
name="PayPal USD",
|
|
100
|
+
version="1",
|
|
101
|
+
),
|
|
102
|
+
"gho": TokenConfig(
|
|
103
|
+
address="0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",
|
|
104
|
+
decimals=18,
|
|
105
|
+
name="Gho Token",
|
|
106
|
+
version="1",
|
|
107
|
+
),
|
|
108
|
+
"crvusd": TokenConfig(
|
|
109
|
+
address="0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E",
|
|
110
|
+
decimals=18,
|
|
111
|
+
name="Curve.Fi USD Stablecoin",
|
|
112
|
+
version="1",
|
|
113
|
+
),
|
|
114
|
+
},
|
|
48
115
|
)
|
|
49
116
|
|
|
50
|
-
# Polygon (PoS)
|
|
117
|
+
# Polygon (PoS) - supports USDC, AUSD
|
|
51
118
|
POLYGON = NetworkConfig(
|
|
52
119
|
name="polygon",
|
|
53
120
|
display_name="Polygon",
|
|
@@ -59,9 +126,23 @@ POLYGON = NetworkConfig(
|
|
|
59
126
|
usdc_domain_version="2",
|
|
60
127
|
rpc_url="https://polygon-rpc.com",
|
|
61
128
|
enabled=True,
|
|
129
|
+
tokens={
|
|
130
|
+
"usdc": TokenConfig(
|
|
131
|
+
address="0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
132
|
+
decimals=6,
|
|
133
|
+
name="USD Coin",
|
|
134
|
+
version="2",
|
|
135
|
+
),
|
|
136
|
+
"ausd": TokenConfig(
|
|
137
|
+
address="0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
|
|
138
|
+
decimals=6,
|
|
139
|
+
name="Agora USD",
|
|
140
|
+
version="1",
|
|
141
|
+
),
|
|
142
|
+
},
|
|
62
143
|
)
|
|
63
144
|
|
|
64
|
-
# Arbitrum One
|
|
145
|
+
# Arbitrum One - supports USDC, AUSD, GHO, crvUSD
|
|
65
146
|
ARBITRUM = NetworkConfig(
|
|
66
147
|
name="arbitrum",
|
|
67
148
|
display_name="Arbitrum One",
|
|
@@ -73,6 +154,32 @@ ARBITRUM = NetworkConfig(
|
|
|
73
154
|
usdc_domain_version="2",
|
|
74
155
|
rpc_url="https://arb1.arbitrum.io/rpc",
|
|
75
156
|
enabled=True,
|
|
157
|
+
tokens={
|
|
158
|
+
"usdc": TokenConfig(
|
|
159
|
+
address="0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
160
|
+
decimals=6,
|
|
161
|
+
name="USD Coin",
|
|
162
|
+
version="2",
|
|
163
|
+
),
|
|
164
|
+
"ausd": TokenConfig(
|
|
165
|
+
address="0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
|
|
166
|
+
decimals=6,
|
|
167
|
+
name="Agora USD",
|
|
168
|
+
version="1",
|
|
169
|
+
),
|
|
170
|
+
"gho": TokenConfig(
|
|
171
|
+
address="0x7dfF72693f6A4149b17e7C6314655f6A9F7c8B33",
|
|
172
|
+
decimals=18,
|
|
173
|
+
name="Gho Token",
|
|
174
|
+
version="1",
|
|
175
|
+
),
|
|
176
|
+
"crvusd": TokenConfig(
|
|
177
|
+
address="0x498Bf2B1e120FeD3ad3D42EA2165E9b73f99C1e5",
|
|
178
|
+
decimals=18,
|
|
179
|
+
name="Curve.Fi USD Stablecoin",
|
|
180
|
+
version="1",
|
|
181
|
+
),
|
|
182
|
+
},
|
|
76
183
|
)
|
|
77
184
|
|
|
78
185
|
# Optimism
|
|
@@ -89,7 +196,7 @@ OPTIMISM = NetworkConfig(
|
|
|
89
196
|
enabled=True,
|
|
90
197
|
)
|
|
91
198
|
|
|
92
|
-
# Avalanche C-Chain
|
|
199
|
+
# Avalanche C-Chain - supports USDC, EURC, AUSD
|
|
93
200
|
AVALANCHE = NetworkConfig(
|
|
94
201
|
name="avalanche",
|
|
95
202
|
display_name="Avalanche C-Chain",
|
|
@@ -101,6 +208,26 @@ AVALANCHE = NetworkConfig(
|
|
|
101
208
|
usdc_domain_version="2",
|
|
102
209
|
rpc_url="https://avalanche-c-chain-rpc.publicnode.com",
|
|
103
210
|
enabled=True,
|
|
211
|
+
tokens={
|
|
212
|
+
"usdc": TokenConfig(
|
|
213
|
+
address="0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
214
|
+
decimals=6,
|
|
215
|
+
name="USD Coin",
|
|
216
|
+
version="2",
|
|
217
|
+
),
|
|
218
|
+
"eurc": TokenConfig(
|
|
219
|
+
address="0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",
|
|
220
|
+
decimals=6,
|
|
221
|
+
name="EURC",
|
|
222
|
+
version="2",
|
|
223
|
+
),
|
|
224
|
+
"ausd": TokenConfig(
|
|
225
|
+
address="0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
|
|
226
|
+
decimals=6,
|
|
227
|
+
name="Agora USD",
|
|
228
|
+
version="1",
|
|
229
|
+
),
|
|
230
|
+
},
|
|
104
231
|
)
|
|
105
232
|
|
|
106
233
|
# Celo
|
|
@@ -148,7 +275,7 @@ UNICHAIN = NetworkConfig(
|
|
|
148
275
|
enabled=True,
|
|
149
276
|
)
|
|
150
277
|
|
|
151
|
-
# Monad
|
|
278
|
+
# Monad - supports USDC, AUSD
|
|
152
279
|
# NOTE: Monad uses 'USDC' (not 'USD Coin') for EIP-712 domain name
|
|
153
280
|
MONAD = NetworkConfig(
|
|
154
281
|
name="monad",
|
|
@@ -161,6 +288,20 @@ MONAD = NetworkConfig(
|
|
|
161
288
|
usdc_domain_version="2",
|
|
162
289
|
rpc_url="https://rpc.monad.xyz",
|
|
163
290
|
enabled=True,
|
|
291
|
+
tokens={
|
|
292
|
+
"usdc": TokenConfig(
|
|
293
|
+
address="0x754704bc059f8c67012fed69bc8a327a5aafb603",
|
|
294
|
+
decimals=6,
|
|
295
|
+
name="USDC",
|
|
296
|
+
version="2",
|
|
297
|
+
),
|
|
298
|
+
"ausd": TokenConfig(
|
|
299
|
+
address="0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
|
|
300
|
+
decimals=6,
|
|
301
|
+
name="Agora USD",
|
|
302
|
+
version="1",
|
|
303
|
+
),
|
|
304
|
+
},
|
|
164
305
|
)
|
|
165
306
|
|
|
166
307
|
# =============================================================================
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: uvd-x402-sdk
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python SDK for
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Python SDK for x402 payments - gasless crypto payments across 14 blockchains with multi-stablecoin support (USDC, EURC, AUSD, PYUSD, GHO, crvUSD)
|
|
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,web3,evm,solana,near,stellar,facilitator
|
|
10
|
+
Keywords: x402,payments,crypto,usdc,eurc,stablecoin,web3,evm,solana,near,stellar,facilitator,gasless,eip-712,eip-3009
|
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
|
12
12
|
Classifier: Intended Audience :: Developers
|
|
13
13
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -51,17 +51,18 @@ 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
|
|
54
|
+
Accept **gasless stablecoin 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
58
|
- **14 Networks**: EVM chains (Base, Ethereum, Polygon, etc.), SVM chains (Solana, Fogo), NEAR, and Stellar
|
|
59
|
+
- **6 Stablecoins**: USDC, EURC, AUSD, PYUSD, GHO, crvUSD (EVM chains)
|
|
59
60
|
- **x402 v1 & v2**: Full support for both protocol versions with auto-detection
|
|
60
61
|
- **Framework Integrations**: Flask, FastAPI, Django, AWS Lambda
|
|
61
|
-
- **Gasless Payments**: Users sign authorizations, facilitator pays all network fees
|
|
62
|
+
- **Gasless Payments**: Users sign EIP-712/EIP-3009 authorizations, facilitator pays all network fees
|
|
62
63
|
- **Simple API**: Decorators and middleware for quick integration
|
|
63
64
|
- **Type Safety**: Full Pydantic models and type hints
|
|
64
|
-
- **Extensible**: Register custom networks easily
|
|
65
|
+
- **Extensible**: Register custom networks and tokens easily
|
|
65
66
|
|
|
66
67
|
## Quick Start (5 Lines)
|
|
67
68
|
|
|
@@ -93,6 +94,17 @@ print(f"Paid by {result.payer_address}, tx: {result.transaction_hash}")
|
|
|
93
94
|
| NEAR | NEAR | - | `near:mainnet` | Active |
|
|
94
95
|
| Stellar | Stellar | - | `stellar:pubnet` | Active |
|
|
95
96
|
|
|
97
|
+
### Supported Tokens (EVM Chains)
|
|
98
|
+
|
|
99
|
+
| Token | Networks | Decimals |
|
|
100
|
+
|-------|----------|----------|
|
|
101
|
+
| USDC | All EVM chains | 6 |
|
|
102
|
+
| EURC | Ethereum, Base, Avalanche | 6 |
|
|
103
|
+
| AUSD | Ethereum, Arbitrum, Avalanche, Polygon, Monad | 6 |
|
|
104
|
+
| PYUSD | Ethereum | 6 |
|
|
105
|
+
| GHO | Ethereum, Base, Arbitrum | 18 |
|
|
106
|
+
| crvUSD | Ethereum, Arbitrum | 18 |
|
|
107
|
+
|
|
96
108
|
## Installation
|
|
97
109
|
|
|
98
110
|
```bash
|
|
@@ -610,6 +622,92 @@ config = X402Config(
|
|
|
610
622
|
|
|
611
623
|
---
|
|
612
624
|
|
|
625
|
+
## Multi-Token Support
|
|
626
|
+
|
|
627
|
+
The SDK supports 6 stablecoins on EVM chains. Use the token helper functions to query and work with different tokens.
|
|
628
|
+
|
|
629
|
+
### Querying Token Support
|
|
630
|
+
|
|
631
|
+
```python
|
|
632
|
+
from uvd_x402_sdk import (
|
|
633
|
+
TokenType,
|
|
634
|
+
get_token_config,
|
|
635
|
+
get_supported_tokens,
|
|
636
|
+
is_token_supported,
|
|
637
|
+
get_networks_by_token,
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
# Check which tokens a network supports
|
|
641
|
+
tokens = get_supported_tokens("ethereum")
|
|
642
|
+
print(tokens) # ['usdc', 'eurc', 'ausd', 'pyusd', 'gho', 'crvusd']
|
|
643
|
+
|
|
644
|
+
tokens = get_supported_tokens("base")
|
|
645
|
+
print(tokens) # ['usdc', 'eurc', 'gho']
|
|
646
|
+
|
|
647
|
+
# Check if a specific token is supported
|
|
648
|
+
if is_token_supported("ethereum", "eurc"):
|
|
649
|
+
print("EURC is available on Ethereum!")
|
|
650
|
+
|
|
651
|
+
# Get token configuration
|
|
652
|
+
config = get_token_config("ethereum", "eurc")
|
|
653
|
+
if config:
|
|
654
|
+
print(f"EURC address: {config.address}")
|
|
655
|
+
print(f"Decimals: {config.decimals}")
|
|
656
|
+
print(f"EIP-712 name: {config.name}")
|
|
657
|
+
print(f"EIP-712 version: {config.version}")
|
|
658
|
+
|
|
659
|
+
# Find all networks that support a token
|
|
660
|
+
networks = get_networks_by_token("gho")
|
|
661
|
+
for network in networks:
|
|
662
|
+
print(f"GHO available on: {network.display_name}")
|
|
663
|
+
# Output: GHO available on: Ethereum, Base, Arbitrum One
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
### Token Configuration
|
|
667
|
+
|
|
668
|
+
Each token has specific EIP-712 domain parameters required for signing:
|
|
669
|
+
|
|
670
|
+
```python
|
|
671
|
+
from uvd_x402_sdk import TokenConfig, get_token_config
|
|
672
|
+
|
|
673
|
+
# TokenConfig structure
|
|
674
|
+
# - address: Contract address
|
|
675
|
+
# - decimals: Token decimals (6 for most, 18 for GHO/crvUSD)
|
|
676
|
+
# - name: EIP-712 domain name (e.g., "USD Coin", "EURC", "Gho Token")
|
|
677
|
+
# - version: EIP-712 domain version
|
|
678
|
+
|
|
679
|
+
# Example: Get EURC config on Base
|
|
680
|
+
eurc = get_token_config("base", "eurc")
|
|
681
|
+
# TokenConfig(
|
|
682
|
+
# address="0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",
|
|
683
|
+
# decimals=6,
|
|
684
|
+
# name="EURC",
|
|
685
|
+
# version="2"
|
|
686
|
+
# )
|
|
687
|
+
|
|
688
|
+
# Example: Get GHO config on Ethereum (note: 18 decimals)
|
|
689
|
+
gho = get_token_config("ethereum", "gho")
|
|
690
|
+
# TokenConfig(
|
|
691
|
+
# address="0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f",
|
|
692
|
+
# decimals=18,
|
|
693
|
+
# name="Gho Token",
|
|
694
|
+
# version="1"
|
|
695
|
+
# )
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Available Tokens
|
|
699
|
+
|
|
700
|
+
| Token | Description | Decimals | Issuer |
|
|
701
|
+
|-------|-------------|----------|--------|
|
|
702
|
+
| `usdc` | USD Coin | 6 | Circle |
|
|
703
|
+
| `eurc` | Euro Coin | 6 | Circle |
|
|
704
|
+
| `ausd` | Agora USD | 6 | Agora Finance |
|
|
705
|
+
| `pyusd` | PayPal USD | 6 | PayPal/Paxos |
|
|
706
|
+
| `gho` | GHO Stablecoin | 18 | Aave |
|
|
707
|
+
| `crvusd` | Curve USD | 18 | Curve Finance |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
613
711
|
## Error Handling
|
|
614
712
|
|
|
615
713
|
```python
|
|
@@ -655,7 +753,7 @@ except X402Error as e:
|
|
|
655
753
|
|
|
656
754
|
## How x402 Works
|
|
657
755
|
|
|
658
|
-
The x402 protocol enables gasless USDC
|
|
756
|
+
The x402 protocol enables gasless stablecoin payments (USDC, EURC, AUSD, PYUSD, GHO, crvUSD):
|
|
659
757
|
|
|
660
758
|
```
|
|
661
759
|
1. User Request --> Client sends request without payment
|
|
@@ -698,13 +796,14 @@ The facilitator (https://facilitator.ultravioletadao.xyz) handles all on-chain i
|
|
|
698
796
|
## Security
|
|
699
797
|
|
|
700
798
|
- Users **NEVER** pay gas or submit transactions directly
|
|
701
|
-
- **EVM**: Users sign EIP-712 structured messages
|
|
799
|
+
- **EVM**: Users sign EIP-712 structured messages for any supported stablecoin (USDC, EURC, AUSD, PYUSD, GHO, crvUSD)
|
|
702
800
|
- **Solana/Fogo**: Users sign partial transactions (facilitator co-signs and submits)
|
|
703
801
|
- **Stellar**: Users sign Soroban authorization entries only
|
|
704
802
|
- **NEAR**: Users sign NEP-366 meta-transactions (DelegateAction)
|
|
705
803
|
- The facilitator submits and pays for all on-chain transactions
|
|
706
804
|
- All signatures include expiration timestamps (`validBefore`) for replay protection
|
|
707
805
|
- Nonces prevent double-spending of authorizations
|
|
806
|
+
- Each token has verified contract addresses and EIP-712 domain parameters
|
|
708
807
|
|
|
709
808
|
---
|
|
710
809
|
|
|
@@ -782,6 +881,20 @@ MIT License - see LICENSE file.
|
|
|
782
881
|
|
|
783
882
|
## Changelog
|
|
784
883
|
|
|
884
|
+
### v0.3.0 (2025-12-20)
|
|
885
|
+
|
|
886
|
+
- **Multi-Stablecoin Support**: Added support for 6 stablecoins on EVM chains
|
|
887
|
+
- USDC (all EVM chains)
|
|
888
|
+
- EURC (Ethereum, Base, Avalanche)
|
|
889
|
+
- AUSD (Ethereum, Arbitrum, Avalanche, Polygon, Monad)
|
|
890
|
+
- PYUSD (Ethereum)
|
|
891
|
+
- GHO (Ethereum, Base, Arbitrum)
|
|
892
|
+
- crvUSD (Ethereum, Arbitrum)
|
|
893
|
+
- Added `TokenType` literal type and `TokenConfig` dataclass
|
|
894
|
+
- Added token helper functions: `get_token_config()`, `get_supported_tokens()`, `is_token_supported()`, `get_networks_by_token()`
|
|
895
|
+
- Added `tokens` field to `NetworkConfig` for multi-token configurations
|
|
896
|
+
- Updated EVM network configurations with token contract addresses and EIP-712 domain parameters
|
|
897
|
+
|
|
785
898
|
### v0.2.2 (2025-12-16)
|
|
786
899
|
|
|
787
900
|
- Added Security section to documentation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
uvd_x402_sdk/__init__.py,sha256=
|
|
1
|
+
uvd_x402_sdk/__init__.py,sha256=0IwhkXv-aqP1TbTuoHtL91TeRp2JFVbH1q6AqAbqeWI,4901
|
|
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
|
|
@@ -10,14 +10,14 @@ uvd_x402_sdk/integrations/django_integration.py,sha256=e3xaV1Yz3HHI7zZBNcyTmV0Js
|
|
|
10
10
|
uvd_x402_sdk/integrations/fastapi_integration.py,sha256=j5h1IJwFLBBoWov7ANLCFaxeCa8pugn-XU9ibrzIL0Y,10205
|
|
11
11
|
uvd_x402_sdk/integrations/flask_integration.py,sha256=0iQKO5-WRxE76Pv-1jEl4lYhjCLmq_R-jxR5g9xIcKw,8825
|
|
12
12
|
uvd_x402_sdk/integrations/lambda_integration.py,sha256=nRf4o3nS6Syx-d5P0kEhz66y7jb_S4w-mwaIazgiA9c,10184
|
|
13
|
-
uvd_x402_sdk/networks/__init__.py,sha256=
|
|
14
|
-
uvd_x402_sdk/networks/base.py,sha256=
|
|
15
|
-
uvd_x402_sdk/networks/evm.py,sha256=
|
|
13
|
+
uvd_x402_sdk/networks/__init__.py,sha256=cqTW4NCuEKhsOSRAQDsusu1m1PaHCf791drVXLCYxUU,2100
|
|
14
|
+
uvd_x402_sdk/networks/base.py,sha256=3wrm2aAmMxxdeCqGBArKFXkpARwWtokkOM_jeg_gJNI,14505
|
|
15
|
+
uvd_x402_sdk/networks/evm.py,sha256=Ua1Rq7YPC_t5ZxnLi2_MK0kloaZNYW5ykllfQshYWMg,9950
|
|
16
16
|
uvd_x402_sdk/networks/near.py,sha256=sxbxT1NqjcENh8ysFLDpAx5DGizf1EI0YjwgviLfqcY,11608
|
|
17
17
|
uvd_x402_sdk/networks/solana.py,sha256=kVSHRi57eTJdBtgI8SUbHfQUxYzx-_YvI_bEB0HIvNg,9351
|
|
18
18
|
uvd_x402_sdk/networks/stellar.py,sha256=c-6re-dVc2-6gJ5rL4krUTaFsPz5vkactOJD-0wowBA,3534
|
|
19
|
-
uvd_x402_sdk-0.
|
|
20
|
-
uvd_x402_sdk-0.
|
|
21
|
-
uvd_x402_sdk-0.
|
|
22
|
-
uvd_x402_sdk-0.
|
|
23
|
-
uvd_x402_sdk-0.
|
|
19
|
+
uvd_x402_sdk-0.3.0.dist-info/LICENSE,sha256=OcLzB_iSgMbvk7b0dlyvleY_IbL2WUaPxvn1CHw2uAc,1073
|
|
20
|
+
uvd_x402_sdk-0.3.0.dist-info/METADATA,sha256=Yrj2HBiKah89TNsI3liY-LQYMCirwJxWUTsKO2WpPJw,26948
|
|
21
|
+
uvd_x402_sdk-0.3.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
22
|
+
uvd_x402_sdk-0.3.0.dist-info/top_level.txt,sha256=Exyjj_Kl7CDAGFMi72lT9oFPOYiRNZb3l8tr906mMmc,13
|
|
23
|
+
uvd_x402_sdk-0.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|