shadowPaySDK 0.1.2__tar.gz → 0.2.0__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 (26) hide show
  1. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/PKG-INFO +7 -4
  2. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/setup.py +9 -4
  3. shadowpaysdk-0.2.0/shadowPaySDK/__init__.py +29 -0
  4. shadowpaysdk-0.2.0/shadowPaySDK/api.py +48 -0
  5. shadowpaysdk-0.2.0/shadowPaySDK/const.py +546 -0
  6. shadowpaysdk-0.2.0/shadowPaySDK/interface/__init__.py +4 -0
  7. shadowpaysdk-0.2.0/shadowPaySDK/interface/erc20.py +114 -0
  8. shadowpaysdk-0.2.0/shadowPaySDK/interface/sol.py +162 -0
  9. shadowpaysdk-0.2.0/shadowPaySDK/types/EVMcheque.py +325 -0
  10. shadowpaysdk-0.2.0/shadowPaySDK/types/SOLcheque.py +27 -0
  11. shadowpaysdk-0.2.0/shadowPaySDK/types/__init__.py +4 -0
  12. shadowpaysdk-0.2.0/shadowPaySDK/utils/__init__.py +8 -0
  13. shadowpaysdk-0.2.0/shadowPaySDK/utils/utils.py +28 -0
  14. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/shadowPaySDK.egg-info/PKG-INFO +7 -4
  15. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/shadowPaySDK.egg-info/SOURCES.txt +9 -1
  16. shadowpaysdk-0.2.0/shadowPaySDK.egg-info/requires.txt +6 -0
  17. shadowpaysdk-0.1.2/shadowPaySDK/__init__.py +0 -2
  18. shadowpaysdk-0.1.2/shadowPaySDK/interface/__init__.py +0 -4
  19. shadowpaysdk-0.1.2/shadowPaySDK/interface/erc20.py +0 -102
  20. shadowpaysdk-0.1.2/shadowPaySDK.egg-info/requires.txt +0 -3
  21. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/LICENSE +0 -0
  22. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/README.md +0 -0
  23. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/setup.cfg +0 -0
  24. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/shadowPaySDK/interface/erc721.py +0 -0
  25. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
  26. {shadowpaysdk-0.1.2 → shadowpaysdk-0.2.0}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazarius_
6
6
  Author-email: your@email.com
@@ -11,9 +11,12 @@ Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.9
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
- Requires-Dist: web3>=6.0.0
15
- Requires-Dist: requests>=2.28.0
16
- Requires-Dist: solana>=0.35.0
14
+ Requires-Dist: web3
15
+ Requires-Dist: requests
16
+ Requires-Dist: solana
17
+ Requires-Dist: anchorpy
18
+ Requires-Dist: solders
19
+ Requires-Dist: httpx==0.28.1
17
20
  Dynamic: author
18
21
  Dynamic: author-email
19
22
  Dynamic: classifier
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='shadowPaySDK',
5
- version='0.1.2',
5
+ version='0.2.0',
6
6
  description='ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',
@@ -16,9 +16,14 @@ setup(
16
16
  'Operating System :: OS Independent',
17
17
  ],
18
18
  install_requires=[
19
- 'web3>=6.0.0',
20
- 'requests>=2.28.0',
21
- 'solana>=0.35.0'
19
+ 'web3',
20
+ 'requests',
21
+ 'solana',
22
+ 'anchorpy',
23
+
24
+ 'solders',
25
+ 'httpx==0.28.1'
26
+
22
27
  ],
23
28
  python_requires='>=3.9',
24
29
  )
@@ -0,0 +1,29 @@
1
+ import json
2
+ from shadowPaySDK.interface.erc20 import ERC20Token
3
+ from shadowPaySDK.interface.erc721 import ERC721Token
4
+ from shadowPaySDK.interface.sol import SolTokens
5
+ from shadowPaySDK.interface.sol import SOL
6
+ from shadowPaySDK.types.EVMcheque import Cheque
7
+ from shadowPaySDK.types.SOLcheque import SOLCheque
8
+ from shadowPaySDK.const import __ERC20_ABI__, __SHADOWPAY_ABI__ERC20__,__ALLOW_CHAINS__, __SHADOWPAY_CONTRACT_ADDRESS__ERC20__
9
+ from shadowPaySDK.api import __MAIN__URL__, __CREATE__CHEQUE__, get_my_cheques, create_cheque
10
+
11
+
12
+ # from shadowPaySDK.utils import parse_tx as PARSE_TX
13
+
14
+ __all__ = [
15
+ "ERC20",
16
+ "ERC721",
17
+ "PARSE_TX",
18
+ "Cheque",
19
+ "SOLCheque",
20
+ "SOL",
21
+ "SolTokens",
22
+ "__SHADOWPAY_ABI__ERC20__",
23
+ "__ERC20_ABI__ ",
24
+ "create_cheque",
25
+ "get_my_cheques"
26
+
27
+ ]
28
+
29
+
@@ -0,0 +1,48 @@
1
+ import httpx
2
+ import json
3
+ from typing import Optional
4
+ from web3 import Web3
5
+
6
+ __MAIN__URL__= "http://0.0.0.0:8000"
7
+ __CREATE__CHEQUE__ = f"{__MAIN__URL__}/validate"
8
+ __MY__CHEQUES__ = f"{__MAIN__URL__}/mycheque"
9
+
10
+
11
+
12
+ async def __validate__cheque__(id, sender,action, receiver:Optional[str] = None, chain_id: Optional[int] = None, type:Optional[str] = None):
13
+ async with httpx.AsyncClient() as client:
14
+ response = await client.post(
15
+ __CREATE__CHEQUE__,
16
+ json={
17
+ "cheque_id": id,
18
+ "chain_id":chain_id,
19
+ "receiver": receiver,
20
+ "type": type,
21
+ "sender":sender,
22
+ "action": action
23
+ }
24
+ )
25
+ if response.status_code == 200:
26
+ return response.json()
27
+ else:
28
+ print(f"Failed to create cheque: {response.text}")
29
+ return False
30
+
31
+
32
+ async def get_my_cheques(private_key):
33
+ if not private_key:
34
+ raise ValueError("Private key is required to fetch cheques.")
35
+ sender = Web3.eth.account.from_key(private_key).address
36
+
37
+ async with httpx.AsyncClient() as client:
38
+ response = await client.get(
39
+ __MY__CHEQUES__,
40
+ params={
41
+ "sender": sender
42
+ }
43
+ )
44
+ if response.status_code == 200:
45
+ return response.json()
46
+ else:
47
+ print(f"Failed to fetch cheques: {response.text}")
48
+ return False
@@ -0,0 +1,546 @@
1
+ import json
2
+
3
+ __ALLOW_CHAINS__ = [
4
+ 56, # BSC Mainnet
5
+ 97, # BSC Testnet
6
+ 0x1,
7
+ 0x1f984,
8
+ 0x38,
9
+ 0x66eed,
10
+ 0x89,
11
+ 0xa
12
+ ]
13
+
14
+ __VERSION__ = "0.1.2"
15
+
16
+
17
+ __ERC20_ABI__ = json.loads("""[
18
+ {"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"type":"function"},
19
+ {"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"type":"function"},
20
+ {"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"type":"function"},
21
+ {"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"type":"function"},
22
+ {"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"type":"function"},
23
+ {"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"type":"function"},
24
+ {"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"type":"function"},
25
+ {"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},
26
+ {"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"", "type":"bool"}],"type":"function"}
27
+ ]""")
28
+
29
+ __SHADOWPAY_CONTRACT_ADDRESS__ERC20__ = {
30
+ 97: "0x17a82E53a3b3f2acA7ceae8CA6B6b3B8F14e4441"
31
+ }
32
+
33
+ __SHADOWPAY_ABI__ERC20__= json.loads("""[
34
+ {
35
+ "inputs": [
36
+ {
37
+ "internalType": "bytes32",
38
+ "name": "groupIdv1",
39
+ "type": "bytes32"
40
+ }
41
+ ],
42
+ "name": "CashOutCheque",
43
+ "outputs": [],
44
+ "stateMutability": "nonpayable",
45
+ "type": "function"
46
+ },
47
+ {
48
+ "inputs": [
49
+ {
50
+ "internalType": "bytes32",
51
+ "name": "_id",
52
+ "type": "bytes32"
53
+ }
54
+ ],
55
+ "name": "CashOutSwapCheque",
56
+ "outputs": [],
57
+ "stateMutability": "nonpayable",
58
+ "type": "function"
59
+ },
60
+ {
61
+ "inputs": [
62
+ {
63
+ "internalType": "bytes32",
64
+ "name": "id",
65
+ "type": "bytes32"
66
+ }
67
+ ],
68
+ "name": "CashOutTokenCheque",
69
+ "outputs": [],
70
+ "stateMutability": "nonpayable",
71
+ "type": "function"
72
+ },
73
+ {
74
+ "inputs": [
75
+ {
76
+ "internalType": "address",
77
+ "name": "newOwner",
78
+ "type": "address"
79
+ }
80
+ ],
81
+ "name": "changeOwner",
82
+ "outputs": [],
83
+ "stateMutability": "nonpayable",
84
+ "type": "function"
85
+ },
86
+ {
87
+ "inputs": [
88
+ {
89
+ "internalType": "address payable[]",
90
+ "name": "_to",
91
+ "type": "address[]"
92
+ }
93
+ ],
94
+ "name": "InitCheque",
95
+ "outputs": [
96
+ {
97
+ "internalType": "bytes32",
98
+ "name": "groupIdv1",
99
+ "type": "bytes32"
100
+ }
101
+ ],
102
+ "stateMutability": "payable",
103
+ "type": "function"
104
+ },
105
+ {
106
+ "inputs": [
107
+ {
108
+ "internalType": "address",
109
+ "name": "_reciever",
110
+ "type": "address"
111
+ },
112
+ {
113
+ "internalType": "address",
114
+ "name": "_tokenIn",
115
+ "type": "address"
116
+ },
117
+ {
118
+ "internalType": "uint256",
119
+ "name": "_amountIn",
120
+ "type": "uint256"
121
+ },
122
+ {
123
+ "internalType": "address",
124
+ "name": "_tokenOut",
125
+ "type": "address"
126
+ },
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "_amountOut",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "name": "InitSwapCheque",
134
+ "outputs": [
135
+ {
136
+ "internalType": "bytes32",
137
+ "name": "chequeId",
138
+ "type": "bytes32"
139
+ }
140
+ ],
141
+ "stateMutability": "nonpayable",
142
+ "type": "function"
143
+ },
144
+ {
145
+ "inputs": [
146
+ {
147
+ "internalType": "address",
148
+ "name": "_treaseryAddress",
149
+ "type": "address"
150
+ }
151
+ ],
152
+ "name": "setTreasery",
153
+ "outputs": [],
154
+ "stateMutability": "nonpayable",
155
+ "type": "function"
156
+ },
157
+ {
158
+ "inputs": [
159
+ {
160
+ "internalType": "address",
161
+ "name": "_trassary",
162
+ "type": "address"
163
+ }
164
+ ],
165
+ "stateMutability": "nonpayable",
166
+ "type": "constructor"
167
+ },
168
+ {
169
+ "anonymous": false,
170
+ "inputs": [
171
+ {
172
+ "indexed": false,
173
+ "internalType": "bytes32",
174
+ "name": "id",
175
+ "type": "bytes32"
176
+ }
177
+ ],
178
+ "name": "ChequeCreated",
179
+ "type": "event"
180
+ },
181
+ {
182
+ "inputs": [
183
+ {
184
+ "internalType": "address",
185
+ "name": "tokenAddrr",
186
+ "type": "address"
187
+ },
188
+ {
189
+ "internalType": "uint256",
190
+ "name": "amount",
191
+ "type": "uint256"
192
+ },
193
+ {
194
+ "internalType": "address payable",
195
+ "name": "to",
196
+ "type": "address"
197
+ }
198
+ ],
199
+ "name": "InitTokenCheque",
200
+ "outputs": [
201
+ {
202
+ "internalType": "bytes32",
203
+ "name": "",
204
+ "type": "bytes32"
205
+ }
206
+ ],
207
+ "stateMutability": "payable",
208
+ "type": "function"
209
+ },
210
+ {
211
+ "anonymous": false,
212
+ "inputs": [
213
+ {
214
+ "indexed": true,
215
+ "internalType": "bytes32",
216
+ "name": "id",
217
+ "type": "bytes32"
218
+ }
219
+ ],
220
+ "name": "redeem",
221
+ "type": "event"
222
+ },
223
+ {
224
+ "inputs": [
225
+ {
226
+ "internalType": "uint256",
227
+ "name": "_minFee",
228
+ "type": "uint256"
229
+ },
230
+ {
231
+ "internalType": "uint256",
232
+ "name": "_maxFees",
233
+ "type": "uint256"
234
+ },
235
+ {
236
+ "internalType": "uint256",
237
+ "name": "_minEth",
238
+ "type": "uint256"
239
+ },
240
+ {
241
+ "internalType": "uint256",
242
+ "name": "_baseFee",
243
+ "type": "uint256"
244
+ }
245
+ ],
246
+ "name": "setFees",
247
+ "outputs": [],
248
+ "stateMutability": "nonpayable",
249
+ "type": "function"
250
+ },
251
+ {
252
+ "inputs": [
253
+ {
254
+ "internalType": "uint256",
255
+ "name": "amount",
256
+ "type": "uint256"
257
+ },
258
+ {
259
+ "internalType": "address",
260
+ "name": "_to",
261
+ "type": "address"
262
+ }
263
+ ],
264
+ "name": "withdrawAmount",
265
+ "outputs": [],
266
+ "stateMutability": "nonpayable",
267
+ "type": "function"
268
+ },
269
+ {
270
+ "inputs": [],
271
+ "name": "withdrawFees",
272
+ "outputs": [],
273
+ "stateMutability": "nonpayable",
274
+ "type": "function"
275
+ },
276
+ {
277
+ "inputs": [],
278
+ "name": "collectedFees",
279
+ "outputs": [
280
+ {
281
+ "internalType": "uint256",
282
+ "name": "",
283
+ "type": "uint256"
284
+ }
285
+ ],
286
+ "stateMutability": "view",
287
+ "type": "function"
288
+ },
289
+ {
290
+ "inputs": [],
291
+ "name": "FEE_DENOMINATOR",
292
+ "outputs": [
293
+ {
294
+ "internalType": "uint256",
295
+ "name": "",
296
+ "type": "uint256"
297
+ }
298
+ ],
299
+ "stateMutability": "view",
300
+ "type": "function"
301
+ },
302
+ {
303
+ "inputs": [],
304
+ "name": "feeBasisPoints",
305
+ "outputs": [
306
+ {
307
+ "internalType": "uint256",
308
+ "name": "",
309
+ "type": "uint256"
310
+ }
311
+ ],
312
+ "stateMutability": "view",
313
+ "type": "function"
314
+ },
315
+ {
316
+ "inputs": [],
317
+ "name": "getBalance",
318
+ "outputs": [
319
+ {
320
+ "internalType": "uint256",
321
+ "name": "",
322
+ "type": "uint256"
323
+ }
324
+ ],
325
+ "stateMutability": "view",
326
+ "type": "function"
327
+ },
328
+ {
329
+ "inputs": [
330
+ {
331
+ "internalType": "bytes32",
332
+ "name": "id",
333
+ "type": "bytes32"
334
+ }
335
+ ],
336
+ "name": "getChequeInfo",
337
+ "outputs": [
338
+ {
339
+ "internalType": "uint256",
340
+ "name": "amount",
341
+ "type": "uint256"
342
+ },
343
+ {
344
+ "internalType": "address payable[]",
345
+ "name": "to",
346
+ "type": "address[]"
347
+ }
348
+ ],
349
+ "stateMutability": "view",
350
+ "type": "function"
351
+ },
352
+ {
353
+ "inputs": [],
354
+ "name": "getCollectedFee",
355
+ "outputs": [
356
+ {
357
+ "internalType": "uint256",
358
+ "name": "",
359
+ "type": "uint256"
360
+ }
361
+ ],
362
+ "stateMutability": "view",
363
+ "type": "function"
364
+ },
365
+ {
366
+ "inputs": [],
367
+ "name": "getOwner",
368
+ "outputs": [
369
+ {
370
+ "internalType": "address",
371
+ "name": "",
372
+ "type": "address"
373
+ }
374
+ ],
375
+ "stateMutability": "view",
376
+ "type": "function"
377
+ },
378
+ {
379
+ "inputs": [
380
+ {
381
+ "internalType": "bytes32",
382
+ "name": "id",
383
+ "type": "bytes32"
384
+ }
385
+ ],
386
+ "name": "getSwapDetail",
387
+ "outputs": [
388
+ {
389
+ "internalType": "address",
390
+ "name": "tokenOut",
391
+ "type": "address"
392
+ },
393
+ {
394
+ "internalType": "uint256",
395
+ "name": "amountOut",
396
+ "type": "uint256"
397
+ }
398
+ ],
399
+ "stateMutability": "view",
400
+ "type": "function"
401
+ },
402
+ {
403
+ "inputs": [],
404
+ "name": "getTreasery",
405
+ "outputs": [
406
+ {
407
+ "internalType": "address",
408
+ "name": "",
409
+ "type": "address"
410
+ }
411
+ ],
412
+ "stateMutability": "view",
413
+ "type": "function"
414
+ },
415
+ {
416
+ "inputs": [
417
+ {
418
+ "internalType": "address",
419
+ "name": "_addrr",
420
+ "type": "address"
421
+ }
422
+ ],
423
+ "name": "getUserChequeCount",
424
+ "outputs": [
425
+ {
426
+ "internalType": "uint256",
427
+ "name": "",
428
+ "type": "uint256"
429
+ }
430
+ ],
431
+ "stateMutability": "view",
432
+ "type": "function"
433
+ },
434
+ {
435
+ "inputs": [],
436
+ "name": "nextAvailableWithdraw",
437
+ "outputs": [
438
+ {
439
+ "internalType": "uint256",
440
+ "name": "timestamp",
441
+ "type": "uint256"
442
+ }
443
+ ],
444
+ "stateMutability": "view",
445
+ "type": "function"
446
+ },
447
+ {
448
+ "inputs": [
449
+ {
450
+ "internalType": "address",
451
+ "name": "",
452
+ "type": "address"
453
+ }
454
+ ],
455
+ "name": "nonces",
456
+ "outputs": [
457
+ {
458
+ "internalType": "uint256",
459
+ "name": "",
460
+ "type": "uint256"
461
+ }
462
+ ],
463
+ "stateMutability": "view",
464
+ "type": "function"
465
+ },
466
+ {
467
+ "inputs": [],
468
+ "name": "owner",
469
+ "outputs": [
470
+ {
471
+ "internalType": "address",
472
+ "name": "",
473
+ "type": "address"
474
+ }
475
+ ],
476
+ "stateMutability": "view",
477
+ "type": "function"
478
+ },
479
+ {
480
+ "inputs": [
481
+ {
482
+ "internalType": "bytes32",
483
+ "name": "",
484
+ "type": "bytes32"
485
+ }
486
+ ],
487
+ "name": "swapCheques",
488
+ "outputs": [
489
+ {
490
+ "internalType": "address",
491
+ "name": "spender",
492
+ "type": "address"
493
+ },
494
+ {
495
+ "internalType": "address",
496
+ "name": "receiver",
497
+ "type": "address"
498
+ },
499
+ {
500
+ "internalType": "address",
501
+ "name": "tokenIn",
502
+ "type": "address"
503
+ },
504
+ {
505
+ "internalType": "uint256",
506
+ "name": "amountIn",
507
+ "type": "uint256"
508
+ },
509
+ {
510
+ "internalType": "address",
511
+ "name": "tokenOut",
512
+ "type": "address"
513
+ },
514
+ {
515
+ "internalType": "uint256",
516
+ "name": "amountOut",
517
+ "type": "uint256"
518
+ },
519
+ {
520
+ "internalType": "bool",
521
+ "name": "claimed",
522
+ "type": "bool"
523
+ }
524
+ ],
525
+ "stateMutability": "view",
526
+ "type": "function"
527
+ },
528
+ {
529
+ "inputs": [],
530
+ "name": "treasery",
531
+ "outputs": [
532
+ {
533
+ "internalType": "address",
534
+ "name": "",
535
+ "type": "address"
536
+ }
537
+ ],
538
+ "stateMutability": "view",
539
+ "type": "function"
540
+ }
541
+ ]""")
542
+
543
+ __SHADOWPAY_ABI__ERC721__ = json.loads("""[]""")
544
+ __SHADOWPAY_CONTRACT_ADDRESS__ERC721__ = {
545
+ "0x1": "0x3c5b8d6f2e"
546
+ }
@@ -0,0 +1,4 @@
1
+ from .erc20 import ERC20Token as ERC20
2
+ from .erc721 import ERC721Token as ERC721
3
+ from .sol import SolTokens as SPL
4
+ __all__ = ["ERC20", "ERC721", "SPL"]