shadowPaySDK 0.2.0.28__tar.gz → 1.0.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 (23) hide show
  1. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/PKG-INFO +5 -4
  2. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/README.md +2 -1
  3. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/setup.py +3 -3
  4. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/const.py +211 -127
  5. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/interface/erc20.py +10 -15
  6. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/interface/sol.py +0 -6
  7. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/types/EVMcheque.py +129 -42
  8. shadowpaysdk-1.0.0/shadowPaySDK/types/SOLcheque.py +486 -0
  9. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK.egg-info/PKG-INFO +5 -4
  10. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK.egg-info/SOURCES.txt +0 -1
  11. shadowpaysdk-0.2.0.28/shadowPaySDK/api.py +0 -48
  12. shadowpaysdk-0.2.0.28/shadowPaySDK/types/SOLcheque.py +0 -246
  13. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/LICENSE +0 -0
  14. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/setup.cfg +0 -0
  15. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/__init__.py +0 -0
  16. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/interface/__init__.py +0 -0
  17. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/interface/erc721.py +0 -0
  18. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/types/__init__.py +0 -0
  19. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/utils/__init__.py +0 -0
  20. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK/utils/utils.py +0 -0
  21. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
  22. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK.egg-info/requires.txt +0 -0
  23. {shadowpaysdk-0.2.0.28 → shadowpaysdk-1.0.0}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0.28
3
+ Version: 1.0.0
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
- Author: dazay(aka dazarius_)
6
- Author-email: your@email.com
5
+ Author: dazay
6
+ Author-email: shadowpay.protocol@gmail.com
7
7
  License: MIT
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
@@ -28,10 +28,11 @@ Dynamic: requires-dist
28
28
  Dynamic: requires-python
29
29
  Dynamic: summary
30
30
 
31
- # shadowPayS
31
+ # shadowPaySdk
32
32
 
33
33
  ```bash
34
34
  pip3 install shadowPaySDK
35
+ pip3 install --break-system-packages git+https://github.com/dazarius/SDK.git
35
36
  ```
36
37
  ```example to use cheque
37
38
 
@@ -1,7 +1,8 @@
1
- # shadowPayS
1
+ # shadowPaySdk
2
2
 
3
3
  ```bash
4
4
  pip3 install shadowPaySDK
5
+ pip3 install --break-system-packages git+https://github.com/dazarius/SDK.git
5
6
  ```
6
7
  ```example to use cheque
7
8
 
@@ -2,12 +2,12 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='shadowPaySDK',
5
- version='0.2.0.28',
5
+ version='1.0.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',
9
- author='dazay(aka dazarius_)',
10
- author_email='your@email.com',
9
+ author='dazay',
10
+ author_email='shadowpay.protocol@gmail.com',
11
11
  license='MIT',
12
12
  packages=find_packages(),
13
13
  classifiers=[
@@ -1,8 +1,9 @@
1
1
  import json
2
-
2
+ from solders.pubkey import Pubkey
3
3
  __ALLOW_CHAINS__ = [
4
4
  56, # BSC Mainnet
5
5
  97, # BSC Testnet
6
+ 10143,
6
7
  0x1,
7
8
  0x1f984,
8
9
  0x38,
@@ -30,10 +31,61 @@ __ERC20_ABI__ = json.loads("""[
30
31
  ]""")
31
32
 
32
33
  __SHADOWPAY_CONTRACT_ADDRESS__ERC20__ = {
33
- 97: "0x5487C0DdCbD5465F26B446c6CAB88D8d6F7DF23b"
34
+ 97: "0x5487C0DdCbD5465F26B446c6CAB88D8d6F7DF23b",
35
+ 10143: "0x1d856f2eA4738d1a89E27dbfc8950a4976Db41a5"
34
36
  }
35
37
 
36
38
  __SHADOWPAY_ABI__ERC20__= json.loads("""[
39
+ {
40
+ "inputs": [
41
+ {
42
+ "internalType": "address",
43
+ "name": "_trassary",
44
+ "type": "address"
45
+ }
46
+ ],
47
+ "stateMutability": "nonpayable",
48
+ "type": "constructor"
49
+ },
50
+ {
51
+ "anonymous": false,
52
+ "inputs": [
53
+ {
54
+ "indexed": false,
55
+ "internalType": "bytes32",
56
+ "name": "id",
57
+ "type": "bytes32"
58
+ }
59
+ ],
60
+ "name": "ChequeClaimed",
61
+ "type": "event"
62
+ },
63
+ {
64
+ "anonymous": false,
65
+ "inputs": [
66
+ {
67
+ "indexed": false,
68
+ "internalType": "bytes32",
69
+ "name": "id",
70
+ "type": "bytes32"
71
+ }
72
+ ],
73
+ "name": "ChequeCreated",
74
+ "type": "event"
75
+ },
76
+ {
77
+ "anonymous": false,
78
+ "inputs": [
79
+ {
80
+ "indexed": true,
81
+ "internalType": "bytes32",
82
+ "name": "id",
83
+ "type": "bytes32"
84
+ }
85
+ ],
86
+ "name": "redeem",
87
+ "type": "event"
88
+ },
37
89
  {
38
90
  "inputs": [
39
91
  {
@@ -74,16 +126,16 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
74
126
  "type": "function"
75
127
  },
76
128
  {
77
- "inputs": [
129
+ "inputs": [],
130
+ "name": "FEE_DENOMINATOR",
131
+ "outputs": [
78
132
  {
79
- "internalType": "address",
80
- "name": "newOwner",
81
- "type": "address"
133
+ "internalType": "uint256",
134
+ "name": "",
135
+ "type": "uint256"
82
136
  }
83
137
  ],
84
- "name": "changeOwner",
85
- "outputs": [],
86
- "stateMutability": "nonpayable",
138
+ "stateMutability": "view",
87
139
  "type": "function"
88
140
  },
89
141
  {
@@ -144,43 +196,6 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
144
196
  "stateMutability": "nonpayable",
145
197
  "type": "function"
146
198
  },
147
- {
148
- "inputs": [
149
- {
150
- "internalType": "address",
151
- "name": "_treaseryAddress",
152
- "type": "address"
153
- }
154
- ],
155
- "name": "setTreasery",
156
- "outputs": [],
157
- "stateMutability": "nonpayable",
158
- "type": "function"
159
- },
160
- {
161
- "inputs": [
162
- {
163
- "internalType": "address",
164
- "name": "_trassary",
165
- "type": "address"
166
- }
167
- ],
168
- "stateMutability": "nonpayable",
169
- "type": "constructor"
170
- },
171
- {
172
- "anonymous": false,
173
- "inputs": [
174
- {
175
- "indexed": false,
176
- "internalType": "bytes32",
177
- "name": "id",
178
- "type": "bytes32"
179
- }
180
- ],
181
- "name": "ChequeCreated",
182
- "type": "event"
183
- },
184
199
  {
185
200
  "inputs": [
186
201
  {
@@ -210,68 +225,15 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
210
225
  "stateMutability": "payable",
211
226
  "type": "function"
212
227
  },
213
- {
214
- "anonymous": false,
215
- "inputs": [
216
- {
217
- "indexed": true,
218
- "internalType": "bytes32",
219
- "name": "id",
220
- "type": "bytes32"
221
- }
222
- ],
223
- "name": "redeem",
224
- "type": "event"
225
- },
226
- {
227
- "inputs": [
228
- {
229
- "internalType": "uint256",
230
- "name": "_minFee",
231
- "type": "uint256"
232
- },
233
- {
234
- "internalType": "uint256",
235
- "name": "_maxFees",
236
- "type": "uint256"
237
- },
238
- {
239
- "internalType": "uint256",
240
- "name": "_minEth",
241
- "type": "uint256"
242
- },
243
- {
244
- "internalType": "uint256",
245
- "name": "_baseFee",
246
- "type": "uint256"
247
- }
248
- ],
249
- "name": "setFees",
250
- "outputs": [],
251
- "stateMutability": "nonpayable",
252
- "type": "function"
253
- },
254
228
  {
255
229
  "inputs": [
256
- {
257
- "internalType": "uint256",
258
- "name": "amount",
259
- "type": "uint256"
260
- },
261
230
  {
262
231
  "internalType": "address",
263
- "name": "_to",
232
+ "name": "newOwner",
264
233
  "type": "address"
265
234
  }
266
235
  ],
267
- "name": "withdrawAmount",
268
- "outputs": [],
269
- "stateMutability": "nonpayable",
270
- "type": "function"
271
- },
272
- {
273
- "inputs": [],
274
- "name": "withdrawFees",
236
+ "name": "changeOwner",
275
237
  "outputs": [],
276
238
  "stateMutability": "nonpayable",
277
239
  "type": "function"
@@ -289,19 +251,6 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
289
251
  "stateMutability": "view",
290
252
  "type": "function"
291
253
  },
292
- {
293
- "inputs": [],
294
- "name": "FEE_DENOMINATOR",
295
- "outputs": [
296
- {
297
- "internalType": "uint256",
298
- "name": "",
299
- "type": "uint256"
300
- }
301
- ],
302
- "stateMutability": "view",
303
- "type": "function"
304
- },
305
254
  {
306
255
  "inputs": [],
307
256
  "name": "feeBasisPoints",
@@ -334,6 +283,11 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
334
283
  "internalType": "bytes32",
335
284
  "name": "id",
336
285
  "type": "bytes32"
286
+ },
287
+ {
288
+ "internalType": "address",
289
+ "name": "from",
290
+ "type": "address"
337
291
  }
338
292
  ],
339
293
  "name": "getChequeInfo",
@@ -347,6 +301,11 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
347
301
  "internalType": "address payable[]",
348
302
  "name": "to",
349
303
  "type": "address[]"
304
+ },
305
+ {
306
+ "internalType": "bool",
307
+ "name": "claimed",
308
+ "type": "bool"
350
309
  }
351
310
  ],
352
311
  "stateMutability": "view",
@@ -397,38 +356,63 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
397
356
  "internalType": "uint256",
398
357
  "name": "amountOut",
399
358
  "type": "uint256"
359
+ },
360
+ {
361
+ "internalType": "address",
362
+ "name": "spender",
363
+ "type": "address"
364
+ },
365
+ {
366
+ "internalType": "address",
367
+ "name": "receiver",
368
+ "type": "address"
369
+ },
370
+ {
371
+ "internalType": "bool",
372
+ "name": "claimed",
373
+ "type": "bool"
400
374
  }
401
375
  ],
402
376
  "stateMutability": "view",
403
377
  "type": "function"
404
378
  },
405
379
  {
406
- "inputs": [],
407
- "name": "getTreasery",
380
+ "inputs": [
381
+ {
382
+ "internalType": "bytes32",
383
+ "name": "id",
384
+ "type": "bytes32"
385
+ }
386
+ ],
387
+ "name": "getTokenChequeDetail",
408
388
  "outputs": [
409
389
  {
410
390
  "internalType": "address",
411
- "name": "",
391
+ "name": "spender",
392
+ "type": "address"
393
+ },
394
+ {
395
+ "internalType": "address",
396
+ "name": "receiver",
412
397
  "type": "address"
398
+ },
399
+ {
400
+ "internalType": "bool",
401
+ "name": "claimed",
402
+ "type": "bool"
413
403
  }
414
404
  ],
415
405
  "stateMutability": "view",
416
406
  "type": "function"
417
407
  },
418
408
  {
419
- "inputs": [
420
- {
421
- "internalType": "address",
422
- "name": "_addrr",
423
- "type": "address"
424
- }
425
- ],
426
- "name": "getUserChequeCount",
409
+ "inputs": [],
410
+ "name": "getTreasery",
427
411
  "outputs": [
428
412
  {
429
- "internalType": "uint256",
413
+ "internalType": "address",
430
414
  "name": "",
431
- "type": "uint256"
415
+ "type": "address"
432
416
  }
433
417
  ],
434
418
  "stateMutability": "view",
@@ -479,6 +463,78 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
479
463
  "stateMutability": "view",
480
464
  "type": "function"
481
465
  },
466
+ {
467
+ "inputs": [
468
+ {
469
+ "internalType": "uint256",
470
+ "name": "_minFee",
471
+ "type": "uint256"
472
+ },
473
+ {
474
+ "internalType": "uint256",
475
+ "name": "_maxFees",
476
+ "type": "uint256"
477
+ },
478
+ {
479
+ "internalType": "uint256",
480
+ "name": "_minEth",
481
+ "type": "uint256"
482
+ },
483
+ {
484
+ "internalType": "uint256",
485
+ "name": "_baseFee",
486
+ "type": "uint256"
487
+ }
488
+ ],
489
+ "name": "setFees",
490
+ "outputs": [],
491
+ "stateMutability": "nonpayable",
492
+ "type": "function"
493
+ },
494
+ {
495
+ "inputs": [
496
+ {
497
+ "internalType": "uint256",
498
+ "name": "_TokenChequepercentage",
499
+ "type": "uint256"
500
+ },
501
+ {
502
+ "internalType": "uint256",
503
+ "name": "_SwapTokenChequepercentage",
504
+ "type": "uint256"
505
+ }
506
+ ],
507
+ "name": "setTokenFees",
508
+ "outputs": [],
509
+ "stateMutability": "nonpayable",
510
+ "type": "function"
511
+ },
512
+ {
513
+ "inputs": [
514
+ {
515
+ "internalType": "address",
516
+ "name": "_treaseryAddress",
517
+ "type": "address"
518
+ }
519
+ ],
520
+ "name": "setTreasery",
521
+ "outputs": [],
522
+ "stateMutability": "nonpayable",
523
+ "type": "function"
524
+ },
525
+ {
526
+ "inputs": [],
527
+ "name": "swapBasicPoints",
528
+ "outputs": [
529
+ {
530
+ "internalType": "uint256",
531
+ "name": "",
532
+ "type": "uint256"
533
+ }
534
+ ],
535
+ "stateMutability": "view",
536
+ "type": "function"
537
+ },
482
538
  {
483
539
  "inputs": [
484
540
  {
@@ -540,6 +596,31 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
540
596
  ],
541
597
  "stateMutability": "view",
542
598
  "type": "function"
599
+ },
600
+ {
601
+ "inputs": [
602
+ {
603
+ "internalType": "uint256",
604
+ "name": "amount",
605
+ "type": "uint256"
606
+ },
607
+ {
608
+ "internalType": "address",
609
+ "name": "_to",
610
+ "type": "address"
611
+ }
612
+ ],
613
+ "name": "withdrawAmount",
614
+ "outputs": [],
615
+ "stateMutability": "nonpayable",
616
+ "type": "function"
617
+ },
618
+ {
619
+ "inputs": [],
620
+ "name": "withdrawFees",
621
+ "outputs": [],
622
+ "stateMutability": "nonpayable",
623
+ "type": "function"
543
624
  }
544
625
  ]""")
545
626
 
@@ -553,3 +634,6 @@ LAMPORTS_PER_SOL = 1_000_000_000
553
634
  WRAPED_SOL = "So11111111111111111111111111111111111111112"
554
635
  TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
555
636
  NATIVE_DECIMALS: int = 9
637
+ PROGRAM_ID = Pubkey.from_string("CrfYLvU4FdVjkBno2rRi6u5U6nGCykpQnQKSBg3uVXTw")
638
+
639
+ CONFIG_PDA=Pubkey.find_program_address([b"config"], PROGRAM_ID)
@@ -43,7 +43,8 @@ class ERC20Token:
43
43
  def get_balance(self, wallet_address: str) -> float:
44
44
  self._ensure_contract()
45
45
  raw = self.contract.functions.balanceOf(Web3.to_checksum_address(wallet_address)).call()
46
- return raw / (10 ** self.get_decimals())
46
+ return raw
47
+
47
48
 
48
49
  def allowance(self, owner: str, spender: str) -> float:
49
50
  self._ensure_contract()
@@ -51,31 +52,30 @@ class ERC20Token:
51
52
  Web3.to_checksum_address(owner),
52
53
  Web3.to_checksum_address(spender)
53
54
  ).call()
54
- return raw / (10 ** self.get_decimals())
55
+ return raw
55
56
 
56
- def ensure_allowance(self, private_key: str, spender: str, amount) -> Union[bool, str]:
57
+ def ensure_allowance(self, private_key: str, spender: str, amount, converted_amount: bool = False) -> Union[bool, str]:
57
58
  self._ensure_contract()
58
59
  account = self.web3.eth.account.from_key(private_key)
59
60
  current = self.allowance(account.address, spender)
60
61
  if current == amount:
61
62
  return True
62
- return self.approve(private_key, spender, amount)
63
+ return self.approve(private_key, spender, amount, conveted_amount=converted_amount)
63
64
 
64
65
  def transfer(self, private_key: str, to: str, amount: float) -> str:
65
66
  self._ensure_contract()
66
67
  account = self.web3.eth.account.from_key(private_key)
67
- decimals = self.get_decimals()
68
- value = int(amount * (10 ** decimals))
68
+
69
69
  estimated_gas = self.contract.functions.transfer(
70
70
  Web3.to_checksum_address(to),
71
- value
71
+ amount
72
72
  ).estimate_gas({
73
73
  'from': account.address,
74
74
  'gasPrice': self.web3.to_wei('5', 'gwei'),
75
75
  })
76
76
  txn = self.contract.functions.transfer(
77
77
  Web3.to_checksum_address(to),
78
- value
78
+ amount
79
79
  ).build_transaction({
80
80
  'from': account.address,
81
81
  'nonce': self.web3.eth.get_transaction_count(account.address),
@@ -87,7 +87,7 @@ class ERC20Token:
87
87
  tx_hash = self.web3.eth.send_raw_transaction(signed.raw_transaction)
88
88
  return self._format_tx(self.web3.to_hex(tx_hash))
89
89
 
90
- def approve(self, spender: str, amount: float,address:Optional[str] = None, private_key: Optional[str] = None, build_tx: bool = False) -> str:
90
+ def approve(self, spender: str, amount: float,address:Optional[str] = None, private_key: Optional[str] = None, conveted_amount: bool = True) -> str:
91
91
 
92
92
  self._ensure_contract()
93
93
  key = private_key
@@ -99,10 +99,6 @@ class ERC20Token:
99
99
  address = Web3.to_checksum_address(self.address)
100
100
  else:
101
101
  raise ValueError("No private key or address provided")
102
-
103
- decimals = self.get_decimals()
104
- amount = int(amount * (10 ** decimals))
105
-
106
102
  txn = self.contract.functions.approve(
107
103
  Web3.to_checksum_address(spender),
108
104
  amount
@@ -113,8 +109,7 @@ class ERC20Token:
113
109
 
114
110
  'gasPrice': self.web3.eth.gas_price,
115
111
  })
116
- if build_tx:
117
- return txn
112
+
118
113
 
119
114
  signed = self.web3.eth.account.sign_transaction(txn, key)
120
115
  tx_hash = self.web3.eth.send_raw_transaction(signed.raw_transaction)
@@ -118,12 +118,7 @@ class SOL:
118
118
 
119
119
 
120
120
  return token_data
121
- async def is_connected(self):
122
- return await self.client.is_connected()
123
121
 
124
- async def close(self):
125
- await self.client.close()
126
-
127
122
  async def fetch_metadata_raw(self,mint_address: str):
128
123
  METADATA_PROGRAM_ID = solders.pubkey.Pubkey.from_string("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")
129
124
  mint = solders.pubkey.Pubkey.from_string(mint_address)
@@ -159,7 +154,6 @@ class SOL:
159
154
  return {
160
155
  "mint": mint_address,
161
156
  "name": name,
162
-
163
157
 
164
158
  }
165
159
  async def transfer_token(self, to: str, amount: float):