uvd-x402-sdk 0.2.2__py3-none-any.whl → 0.2.3__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
@@ -1,169 +1,169 @@
1
- """
2
- uvd-x402-sdk: Python SDK for x402 payments via Ultravioleta DAO facilitator.
3
-
4
- This SDK enables developers to easily integrate x402 cryptocurrency payments
5
- into their Python applications with support for 14 blockchain networks across
6
- 4 network types (EVM, SVM, NEAR, Stellar).
7
-
8
- Supports both x402 v1 and v2 protocols:
9
- - v1: network as string ("base", "solana")
10
- - v2: network as CAIP-2 ("eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")
11
-
12
- Example usage:
13
- from uvd_x402_sdk import X402Client, require_payment
14
-
15
- # Create a client
16
- client = X402Client(
17
- recipient_address="0xYourWallet...",
18
- facilitator_url="https://facilitator.ultravioletadao.xyz"
19
- )
20
-
21
- # Verify and settle a payment
22
- result = client.process_payment(
23
- x_payment_header=request.headers.get("X-PAYMENT"),
24
- expected_amount_usd=Decimal("10.00")
25
- )
26
-
27
- # Or use the decorator
28
- @require_payment(amount_usd=Decimal("1.00"))
29
- def protected_endpoint():
30
- return {"message": "Payment verified!"}
31
-
32
- Supported Networks (14 total):
33
- - EVM (10): Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche, Celo,
34
- HyperEVM, Unichain, Monad
35
- - SVM (2): Solana, Fogo
36
- - NEAR (1): NEAR Protocol
37
- - Stellar (1): Stellar
38
- """
39
-
40
- __version__ = "0.2.2"
41
- __author__ = "Ultravioleta DAO"
42
-
43
- from uvd_x402_sdk.client import X402Client
44
- from uvd_x402_sdk.config import X402Config, NetworkConfig, MultiPaymentConfig
45
- from uvd_x402_sdk.decorators import require_payment, x402_required, configure_x402
46
- from uvd_x402_sdk.exceptions import (
47
- X402Error,
48
- PaymentRequiredError,
49
- PaymentVerificationError,
50
- PaymentSettlementError,
51
- UnsupportedNetworkError,
52
- InvalidPayloadError,
53
- FacilitatorError,
54
- ConfigurationError,
55
- TimeoutError as X402TimeoutError,
56
- )
57
- from uvd_x402_sdk.models import (
58
- # Payload models
59
- PaymentPayload,
60
- EVMPayloadContent,
61
- SVMPayloadContent,
62
- SolanaPayloadContent, # Alias for backward compatibility
63
- NEARPayloadContent,
64
- StellarPayloadContent,
65
- # Requirements models (v1)
66
- PaymentRequirements,
67
- # Requirements models (v2)
68
- PaymentOption,
69
- PaymentRequirementsV2,
70
- # Request/Response models
71
- VerifyRequest,
72
- VerifyResponse,
73
- SettleRequest,
74
- SettleResponse,
75
- PaymentResult,
76
- )
77
- from uvd_x402_sdk.networks import (
78
- SUPPORTED_NETWORKS,
79
- get_network,
80
- get_network_by_chain_id,
81
- register_network,
82
- list_networks,
83
- get_supported_chain_ids,
84
- get_supported_network_names,
85
- NetworkType,
86
- # CAIP-2 utilities (v2 support)
87
- parse_caip2_network,
88
- to_caip2_network,
89
- is_caip2_format,
90
- normalize_network,
91
- )
92
- from uvd_x402_sdk.response import (
93
- # v1 response helpers
94
- create_402_response,
95
- create_402_headers,
96
- payment_required_response,
97
- Payment402Builder,
98
- # v2 response helpers
99
- create_402_response_v2,
100
- create_402_headers_v2,
101
- payment_required_response_v2,
102
- Payment402BuilderV2,
103
- )
104
-
105
- __all__ = [
106
- # Version
107
- "__version__",
108
- # Main client
109
- "X402Client",
110
- # Configuration
111
- "X402Config",
112
- "NetworkConfig",
113
- "MultiPaymentConfig",
114
- # Decorators
115
- "require_payment",
116
- "x402_required",
117
- "configure_x402",
118
- # Exceptions
119
- "X402Error",
120
- "PaymentRequiredError",
121
- "PaymentVerificationError",
122
- "PaymentSettlementError",
123
- "UnsupportedNetworkError",
124
- "InvalidPayloadError",
125
- "FacilitatorError",
126
- "ConfigurationError",
127
- "X402TimeoutError",
128
- # Payload models
129
- "PaymentPayload",
130
- "EVMPayloadContent",
131
- "SVMPayloadContent",
132
- "SolanaPayloadContent",
133
- "NEARPayloadContent",
134
- "StellarPayloadContent",
135
- # Requirements models
136
- "PaymentRequirements",
137
- "PaymentOption",
138
- "PaymentRequirementsV2",
139
- # Request/Response models
140
- "VerifyRequest",
141
- "VerifyResponse",
142
- "SettleRequest",
143
- "SettleResponse",
144
- "PaymentResult",
145
- # Networks
146
- "SUPPORTED_NETWORKS",
147
- "get_network",
148
- "get_network_by_chain_id",
149
- "register_network",
150
- "list_networks",
151
- "get_supported_chain_ids",
152
- "get_supported_network_names",
153
- "NetworkType",
154
- # CAIP-2 utilities
155
- "parse_caip2_network",
156
- "to_caip2_network",
157
- "is_caip2_format",
158
- "normalize_network",
159
- # Response helpers (v1)
160
- "create_402_response",
161
- "create_402_headers",
162
- "payment_required_response",
163
- "Payment402Builder",
164
- # Response helpers (v2)
165
- "create_402_response_v2",
166
- "create_402_headers_v2",
167
- "payment_required_response_v2",
168
- "Payment402BuilderV2",
169
- ]
1
+ """
2
+ uvd-x402-sdk: Python SDK for x402 payments via Ultravioleta DAO facilitator.
3
+
4
+ This SDK enables developers to easily integrate x402 cryptocurrency payments
5
+ into their Python applications with support for 14 blockchain networks across
6
+ 4 network types (EVM, SVM, NEAR, Stellar).
7
+
8
+ Supports both x402 v1 and v2 protocols:
9
+ - v1: network as string ("base", "solana")
10
+ - v2: network as CAIP-2 ("eip155:8453", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp")
11
+
12
+ Example usage:
13
+ from uvd_x402_sdk import X402Client, require_payment
14
+
15
+ # Create a client
16
+ client = X402Client(
17
+ recipient_address="0xYourWallet...",
18
+ facilitator_url="https://facilitator.ultravioletadao.xyz"
19
+ )
20
+
21
+ # Verify and settle a payment
22
+ result = client.process_payment(
23
+ x_payment_header=request.headers.get("X-PAYMENT"),
24
+ expected_amount_usd=Decimal("10.00")
25
+ )
26
+
27
+ # Or use the decorator
28
+ @require_payment(amount_usd=Decimal("1.00"))
29
+ def protected_endpoint():
30
+ return {"message": "Payment verified!"}
31
+
32
+ Supported Networks (14 total):
33
+ - EVM (10): Base, Ethereum, Polygon, Arbitrum, Optimism, Avalanche, Celo,
34
+ HyperEVM, Unichain, Monad
35
+ - SVM (2): Solana, Fogo
36
+ - NEAR (1): NEAR Protocol
37
+ - Stellar (1): Stellar
38
+ """
39
+
40
+ __version__ = "0.2.3"
41
+ __author__ = "Ultravioleta DAO"
42
+
43
+ from uvd_x402_sdk.client import X402Client
44
+ from uvd_x402_sdk.config import X402Config, NetworkConfig, MultiPaymentConfig
45
+ from uvd_x402_sdk.decorators import require_payment, x402_required, configure_x402
46
+ from uvd_x402_sdk.exceptions import (
47
+ X402Error,
48
+ PaymentRequiredError,
49
+ PaymentVerificationError,
50
+ PaymentSettlementError,
51
+ UnsupportedNetworkError,
52
+ InvalidPayloadError,
53
+ FacilitatorError,
54
+ ConfigurationError,
55
+ TimeoutError as X402TimeoutError,
56
+ )
57
+ from uvd_x402_sdk.models import (
58
+ # Payload models
59
+ PaymentPayload,
60
+ EVMPayloadContent,
61
+ SVMPayloadContent,
62
+ SolanaPayloadContent, # Alias for backward compatibility
63
+ NEARPayloadContent,
64
+ StellarPayloadContent,
65
+ # Requirements models (v1)
66
+ PaymentRequirements,
67
+ # Requirements models (v2)
68
+ PaymentOption,
69
+ PaymentRequirementsV2,
70
+ # Request/Response models
71
+ VerifyRequest,
72
+ VerifyResponse,
73
+ SettleRequest,
74
+ SettleResponse,
75
+ PaymentResult,
76
+ )
77
+ from uvd_x402_sdk.networks import (
78
+ SUPPORTED_NETWORKS,
79
+ get_network,
80
+ get_network_by_chain_id,
81
+ register_network,
82
+ list_networks,
83
+ get_supported_chain_ids,
84
+ get_supported_network_names,
85
+ NetworkType,
86
+ # CAIP-2 utilities (v2 support)
87
+ parse_caip2_network,
88
+ to_caip2_network,
89
+ is_caip2_format,
90
+ normalize_network,
91
+ )
92
+ from uvd_x402_sdk.response import (
93
+ # v1 response helpers
94
+ create_402_response,
95
+ create_402_headers,
96
+ payment_required_response,
97
+ Payment402Builder,
98
+ # v2 response helpers
99
+ create_402_response_v2,
100
+ create_402_headers_v2,
101
+ payment_required_response_v2,
102
+ Payment402BuilderV2,
103
+ )
104
+
105
+ __all__ = [
106
+ # Version
107
+ "__version__",
108
+ # Main client
109
+ "X402Client",
110
+ # Configuration
111
+ "X402Config",
112
+ "NetworkConfig",
113
+ "MultiPaymentConfig",
114
+ # Decorators
115
+ "require_payment",
116
+ "x402_required",
117
+ "configure_x402",
118
+ # Exceptions
119
+ "X402Error",
120
+ "PaymentRequiredError",
121
+ "PaymentVerificationError",
122
+ "PaymentSettlementError",
123
+ "UnsupportedNetworkError",
124
+ "InvalidPayloadError",
125
+ "FacilitatorError",
126
+ "ConfigurationError",
127
+ "X402TimeoutError",
128
+ # Payload models
129
+ "PaymentPayload",
130
+ "EVMPayloadContent",
131
+ "SVMPayloadContent",
132
+ "SolanaPayloadContent",
133
+ "NEARPayloadContent",
134
+ "StellarPayloadContent",
135
+ # Requirements models
136
+ "PaymentRequirements",
137
+ "PaymentOption",
138
+ "PaymentRequirementsV2",
139
+ # Request/Response models
140
+ "VerifyRequest",
141
+ "VerifyResponse",
142
+ "SettleRequest",
143
+ "SettleResponse",
144
+ "PaymentResult",
145
+ # Networks
146
+ "SUPPORTED_NETWORKS",
147
+ "get_network",
148
+ "get_network_by_chain_id",
149
+ "register_network",
150
+ "list_networks",
151
+ "get_supported_chain_ids",
152
+ "get_supported_network_names",
153
+ "NetworkType",
154
+ # CAIP-2 utilities
155
+ "parse_caip2_network",
156
+ "to_caip2_network",
157
+ "is_caip2_format",
158
+ "normalize_network",
159
+ # Response helpers (v1)
160
+ "create_402_response",
161
+ "create_402_headers",
162
+ "payment_required_response",
163
+ "Payment402Builder",
164
+ # Response helpers (v2)
165
+ "create_402_response_v2",
166
+ "create_402_headers_v2",
167
+ "payment_required_response_v2",
168
+ "Payment402BuilderV2",
169
+ ]