chipi-stack 2.0.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.
- chipi_sdk/__init__.py +342 -0
- chipi_sdk/client.py +505 -0
- chipi_sdk/constants.py +171 -0
- chipi_sdk/encryption.py +179 -0
- chipi_sdk/errors.py +130 -0
- chipi_sdk/execute_paymaster.py +434 -0
- chipi_sdk/formatters.py +154 -0
- chipi_sdk/models/__init__.py +145 -0
- chipi_sdk/models/core.py +96 -0
- chipi_sdk/models/session.py +119 -0
- chipi_sdk/models/sku.py +28 -0
- chipi_sdk/models/sku_transaction.py +30 -0
- chipi_sdk/models/transaction.py +192 -0
- chipi_sdk/models/user.py +31 -0
- chipi_sdk/models/wallet.py +178 -0
- chipi_sdk/models/x402.py +117 -0
- chipi_sdk/py.typed +1 -0
- chipi_sdk/sdk.py +1021 -0
- chipi_sdk/sessions.py +836 -0
- chipi_sdk/sku_transactions.py +58 -0
- chipi_sdk/skus.py +93 -0
- chipi_sdk/transactions.py +447 -0
- chipi_sdk/users.py +92 -0
- chipi_sdk/validators.py +75 -0
- chipi_sdk/wallets.py +465 -0
- chipi_sdk/x402_client.py +207 -0
- chipi_sdk/x402_facilitator.py +200 -0
- chipi_sdk/x402_middleware.py +280 -0
- chipi_stack-2.0.0.dist-info/METADATA +366 -0
- chipi_stack-2.0.0.dist-info/RECORD +33 -0
- chipi_stack-2.0.0.dist-info/WHEEL +5 -0
- chipi_stack-2.0.0.dist-info/licenses/LICENSE +21 -0
- chipi_stack-2.0.0.dist-info/top_level.txt +1 -0
chipi_sdk/__init__.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Chipi Python SDK for Starknet Gasless Transactions.
|
|
3
|
+
|
|
4
|
+
A Python SDK for interacting with Chipi's gasless transaction infrastructure on Starknet.
|
|
5
|
+
Supports wallet creation, transaction execution, session keys, and more.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "2.0.0"
|
|
9
|
+
|
|
10
|
+
# Main SDK class
|
|
11
|
+
from .sdk import ChipiSDK
|
|
12
|
+
|
|
13
|
+
# Client
|
|
14
|
+
from .client import ChipiClient
|
|
15
|
+
|
|
16
|
+
# Service managers
|
|
17
|
+
from .wallets import ChipiWallets
|
|
18
|
+
from .transactions import ChipiTransactions
|
|
19
|
+
from .sessions import ChipiSessions
|
|
20
|
+
from .skus import ChipiSkus
|
|
21
|
+
from .sku_transactions import ChipiSkuTransactions
|
|
22
|
+
from .users import ChipiUsers
|
|
23
|
+
|
|
24
|
+
# Models - Core
|
|
25
|
+
from .models.core import (
|
|
26
|
+
Chain,
|
|
27
|
+
ChainToken,
|
|
28
|
+
ChipiSDKConfig,
|
|
29
|
+
PaginatedResponse,
|
|
30
|
+
PaginationQuery,
|
|
31
|
+
StarknetContract,
|
|
32
|
+
STARKNET_CONTRACTS,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Models - Wallet
|
|
36
|
+
from .models.wallet import (
|
|
37
|
+
CreateCustodialWalletParams,
|
|
38
|
+
CreateWalletParams,
|
|
39
|
+
CreateWalletResponse,
|
|
40
|
+
DeploymentData,
|
|
41
|
+
GetTokenBalanceParams,
|
|
42
|
+
GetTokenBalanceResponse,
|
|
43
|
+
GetWalletParams,
|
|
44
|
+
GetWalletResponse,
|
|
45
|
+
PasskeyMetadata,
|
|
46
|
+
PrepareWalletCreationResponse,
|
|
47
|
+
WalletData,
|
|
48
|
+
WalletType,
|
|
49
|
+
PrepareWalletUpgradeParams,
|
|
50
|
+
PrepareWalletUpgradeResponse,
|
|
51
|
+
ExecuteWalletUpgradeParams,
|
|
52
|
+
ExecuteWalletUpgradeResponse,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Models - Transaction
|
|
56
|
+
from .models.transaction import (
|
|
57
|
+
ApproveParams,
|
|
58
|
+
Call,
|
|
59
|
+
CallAnyContractParams,
|
|
60
|
+
ExecuteSponsoredTransactionParams,
|
|
61
|
+
ExecuteSponsoredTransactionResponse,
|
|
62
|
+
ExecuteTransactionParams,
|
|
63
|
+
GetTransactionListQuery,
|
|
64
|
+
GetTransactionParams,
|
|
65
|
+
GetTransactionStatusParams,
|
|
66
|
+
OnChainTxStatus,
|
|
67
|
+
TransactionStatusResponse,
|
|
68
|
+
PrepareTypedDataParams,
|
|
69
|
+
PrepareTypedDataResponse,
|
|
70
|
+
RecordSendTransactionParams,
|
|
71
|
+
StakeVesuUsdcParams,
|
|
72
|
+
Transaction,
|
|
73
|
+
TransferParams,
|
|
74
|
+
WithdrawVesuUsdcParams,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Models - Session
|
|
78
|
+
from .models.session import (
|
|
79
|
+
AddSessionKeyParams,
|
|
80
|
+
CreateSessionKeyParams,
|
|
81
|
+
ExecuteWithSessionParams,
|
|
82
|
+
GetSessionDataParams,
|
|
83
|
+
GetSpendingPolicyParams,
|
|
84
|
+
RemoveSpendingPolicyParams,
|
|
85
|
+
RevokeSessionKeyParams,
|
|
86
|
+
SessionConfig,
|
|
87
|
+
SessionDataResponse,
|
|
88
|
+
SessionKeyData,
|
|
89
|
+
SetSpendingPolicyParams,
|
|
90
|
+
SpendingPolicyConfig,
|
|
91
|
+
SpendingPolicyData,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Models - SKU
|
|
95
|
+
from .models.sku import (
|
|
96
|
+
GetSkuListQuery,
|
|
97
|
+
Sku,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
# Models - SKU Transaction
|
|
101
|
+
from .models.sku_transaction import (
|
|
102
|
+
CreateSkuTransactionParams,
|
|
103
|
+
SkuTransaction,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Models - User
|
|
107
|
+
from .models.user import (
|
|
108
|
+
CreateUserParams,
|
|
109
|
+
GetUserParams,
|
|
110
|
+
User,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# x402 Payment Protocol
|
|
114
|
+
from .x402_client import X402Client
|
|
115
|
+
from .x402_facilitator import X402Facilitator, NonceStore, InMemoryNonceStore
|
|
116
|
+
from .x402_middleware import fastapi_x402_dependency, flask_x402_required
|
|
117
|
+
|
|
118
|
+
# Models - x402
|
|
119
|
+
from .models.x402 import (
|
|
120
|
+
PaymentRequirement,
|
|
121
|
+
PaymentPayload,
|
|
122
|
+
PaymentPayloadData,
|
|
123
|
+
PaymentSignature,
|
|
124
|
+
VerifyResponse,
|
|
125
|
+
SettleResponse,
|
|
126
|
+
X402ClientConfig,
|
|
127
|
+
X402PaymentConfig,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Errors
|
|
131
|
+
from .errors import (
|
|
132
|
+
ChipiApiError,
|
|
133
|
+
ChipiAuthError,
|
|
134
|
+
ChipiError,
|
|
135
|
+
ChipiSessionError,
|
|
136
|
+
ChipiSkuError,
|
|
137
|
+
ChipiTransactionError,
|
|
138
|
+
ChipiValidationError,
|
|
139
|
+
ChipiWalletError,
|
|
140
|
+
WalletNotCompatibleError,
|
|
141
|
+
WalletClassHashNotFoundError,
|
|
142
|
+
PaymasterIncompatibleError,
|
|
143
|
+
handle_api_error,
|
|
144
|
+
is_chipi_error,
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Constants
|
|
148
|
+
from .constants import (
|
|
149
|
+
API_ENDPOINTS,
|
|
150
|
+
API_VERSION,
|
|
151
|
+
API_VERSION_DATE,
|
|
152
|
+
CARRIER_IDS,
|
|
153
|
+
CHAIN_TOKEN_TYPES,
|
|
154
|
+
CHAIN_TYPES,
|
|
155
|
+
CONTRACT_ADDRESSES,
|
|
156
|
+
DEFAULT_PAGINATION,
|
|
157
|
+
ERRORS,
|
|
158
|
+
LEGACY_CHIPI_CLASS_HASHES,
|
|
159
|
+
PAYMASTER_CONFIG,
|
|
160
|
+
SERVICE_TYPES,
|
|
161
|
+
SESSION_DEFAULTS,
|
|
162
|
+
SESSION_ENTRYPOINTS,
|
|
163
|
+
SESSION_ERRORS,
|
|
164
|
+
SKU_CONTRACTS,
|
|
165
|
+
STARKNET_NETWORKS,
|
|
166
|
+
TOKEN_DECIMALS,
|
|
167
|
+
WALLET_CLASS_HASHES,
|
|
168
|
+
WALLET_RPC_ENDPOINTS,
|
|
169
|
+
get_wallet_type_from_class_hash,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# Utilities
|
|
173
|
+
from .formatters import (
|
|
174
|
+
camel_to_snake,
|
|
175
|
+
capitalize_first,
|
|
176
|
+
format_address,
|
|
177
|
+
format_amount,
|
|
178
|
+
format_currency,
|
|
179
|
+
format_number,
|
|
180
|
+
format_transaction_hash,
|
|
181
|
+
snake_to_camel,
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
from .validators import (
|
|
185
|
+
is_valid_api_key,
|
|
186
|
+
validate_address,
|
|
187
|
+
validate_error_response,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
from .encryption import (
|
|
191
|
+
decrypt_private_key,
|
|
192
|
+
encrypt_private_key,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
__all__ = [
|
|
196
|
+
# Version
|
|
197
|
+
"__version__",
|
|
198
|
+
# Main SDK
|
|
199
|
+
"ChipiSDK",
|
|
200
|
+
# Client
|
|
201
|
+
"ChipiClient",
|
|
202
|
+
# Service managers
|
|
203
|
+
"ChipiWallets",
|
|
204
|
+
"ChipiTransactions",
|
|
205
|
+
"ChipiSessions",
|
|
206
|
+
"ChipiSkus",
|
|
207
|
+
"ChipiSkuTransactions",
|
|
208
|
+
"ChipiUsers",
|
|
209
|
+
# Core models
|
|
210
|
+
"Chain",
|
|
211
|
+
"ChainToken",
|
|
212
|
+
"ChipiSDKConfig",
|
|
213
|
+
"PaginatedResponse",
|
|
214
|
+
"PaginationQuery",
|
|
215
|
+
"StarknetContract",
|
|
216
|
+
"STARKNET_CONTRACTS",
|
|
217
|
+
# Wallet models
|
|
218
|
+
"CreateCustodialWalletParams",
|
|
219
|
+
"CreateWalletParams",
|
|
220
|
+
"CreateWalletResponse",
|
|
221
|
+
"DeploymentData",
|
|
222
|
+
"GetTokenBalanceParams",
|
|
223
|
+
"GetTokenBalanceResponse",
|
|
224
|
+
"GetWalletParams",
|
|
225
|
+
"GetWalletResponse",
|
|
226
|
+
"PasskeyMetadata",
|
|
227
|
+
"PrepareWalletCreationResponse",
|
|
228
|
+
"WalletData",
|
|
229
|
+
"WalletType",
|
|
230
|
+
"PrepareWalletUpgradeParams",
|
|
231
|
+
"PrepareWalletUpgradeResponse",
|
|
232
|
+
"ExecuteWalletUpgradeParams",
|
|
233
|
+
"ExecuteWalletUpgradeResponse",
|
|
234
|
+
# Transaction models
|
|
235
|
+
"ApproveParams",
|
|
236
|
+
"Call",
|
|
237
|
+
"CallAnyContractParams",
|
|
238
|
+
"ExecuteSponsoredTransactionParams",
|
|
239
|
+
"ExecuteSponsoredTransactionResponse",
|
|
240
|
+
"ExecuteTransactionParams",
|
|
241
|
+
"GetTransactionListQuery",
|
|
242
|
+
"GetTransactionParams",
|
|
243
|
+
"GetTransactionStatusParams",
|
|
244
|
+
"OnChainTxStatus",
|
|
245
|
+
"TransactionStatusResponse",
|
|
246
|
+
"PrepareTypedDataParams",
|
|
247
|
+
"PrepareTypedDataResponse",
|
|
248
|
+
"RecordSendTransactionParams",
|
|
249
|
+
"StakeVesuUsdcParams",
|
|
250
|
+
"Transaction",
|
|
251
|
+
"TransferParams",
|
|
252
|
+
"WithdrawVesuUsdcParams",
|
|
253
|
+
# Session models
|
|
254
|
+
"AddSessionKeyParams",
|
|
255
|
+
"CreateSessionKeyParams",
|
|
256
|
+
"ExecuteWithSessionParams",
|
|
257
|
+
"GetSessionDataParams",
|
|
258
|
+
"GetSpendingPolicyParams",
|
|
259
|
+
"RemoveSpendingPolicyParams",
|
|
260
|
+
"RevokeSessionKeyParams",
|
|
261
|
+
"SessionConfig",
|
|
262
|
+
"SessionDataResponse",
|
|
263
|
+
"SessionKeyData",
|
|
264
|
+
"SetSpendingPolicyParams",
|
|
265
|
+
"SpendingPolicyConfig",
|
|
266
|
+
"SpendingPolicyData",
|
|
267
|
+
# SKU models
|
|
268
|
+
"GetSkuListQuery",
|
|
269
|
+
"Sku",
|
|
270
|
+
# SKU Transaction models
|
|
271
|
+
"CreateSkuTransactionParams",
|
|
272
|
+
"SkuTransaction",
|
|
273
|
+
# User models
|
|
274
|
+
"CreateUserParams",
|
|
275
|
+
"GetUserParams",
|
|
276
|
+
"User",
|
|
277
|
+
# Errors
|
|
278
|
+
"ChipiApiError",
|
|
279
|
+
"ChipiAuthError",
|
|
280
|
+
"ChipiError",
|
|
281
|
+
"ChipiSessionError",
|
|
282
|
+
"ChipiSkuError",
|
|
283
|
+
"ChipiTransactionError",
|
|
284
|
+
"ChipiValidationError",
|
|
285
|
+
"ChipiWalletError",
|
|
286
|
+
"WalletNotCompatibleError",
|
|
287
|
+
"WalletClassHashNotFoundError",
|
|
288
|
+
"PaymasterIncompatibleError",
|
|
289
|
+
"handle_api_error",
|
|
290
|
+
"is_chipi_error",
|
|
291
|
+
# Constants
|
|
292
|
+
"API_ENDPOINTS",
|
|
293
|
+
"API_VERSION",
|
|
294
|
+
"API_VERSION_DATE",
|
|
295
|
+
"CARRIER_IDS",
|
|
296
|
+
"CHAIN_TOKEN_TYPES",
|
|
297
|
+
"CHAIN_TYPES",
|
|
298
|
+
"CONTRACT_ADDRESSES",
|
|
299
|
+
"DEFAULT_PAGINATION",
|
|
300
|
+
"ERRORS",
|
|
301
|
+
"PAYMASTER_CONFIG",
|
|
302
|
+
"SERVICE_TYPES",
|
|
303
|
+
"SESSION_DEFAULTS",
|
|
304
|
+
"SESSION_ENTRYPOINTS",
|
|
305
|
+
"SESSION_ERRORS",
|
|
306
|
+
"SKU_CONTRACTS",
|
|
307
|
+
"STARKNET_NETWORKS",
|
|
308
|
+
"TOKEN_DECIMALS",
|
|
309
|
+
"WALLET_CLASS_HASHES",
|
|
310
|
+
"LEGACY_CHIPI_CLASS_HASHES",
|
|
311
|
+
"get_wallet_type_from_class_hash",
|
|
312
|
+
"WALLET_RPC_ENDPOINTS",
|
|
313
|
+
# Utilities
|
|
314
|
+
"camel_to_snake",
|
|
315
|
+
"capitalize_first",
|
|
316
|
+
"format_address",
|
|
317
|
+
"format_amount",
|
|
318
|
+
"format_currency",
|
|
319
|
+
"format_number",
|
|
320
|
+
"format_transaction_hash",
|
|
321
|
+
"snake_to_camel",
|
|
322
|
+
"is_valid_api_key",
|
|
323
|
+
"validate_address",
|
|
324
|
+
"validate_error_response",
|
|
325
|
+
"decrypt_private_key",
|
|
326
|
+
"encrypt_private_key",
|
|
327
|
+
# x402 Payment Protocol
|
|
328
|
+
"X402Client",
|
|
329
|
+
"X402Facilitator",
|
|
330
|
+
"NonceStore",
|
|
331
|
+
"InMemoryNonceStore",
|
|
332
|
+
"fastapi_x402_dependency",
|
|
333
|
+
"flask_x402_required",
|
|
334
|
+
"PaymentRequirement",
|
|
335
|
+
"PaymentPayload",
|
|
336
|
+
"PaymentPayloadData",
|
|
337
|
+
"PaymentSignature",
|
|
338
|
+
"VerifyResponse",
|
|
339
|
+
"SettleResponse",
|
|
340
|
+
"X402ClientConfig",
|
|
341
|
+
"X402PaymentConfig",
|
|
342
|
+
]
|