shadowPaySDK 0.2.0.5__tar.gz → 0.2.0.6__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 (22) hide show
  1. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/PKG-INFO +1 -1
  2. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/setup.py +1 -1
  3. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/types/EVMcheque.py +46 -1
  4. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK.egg-info/PKG-INFO +1 -1
  5. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/LICENSE +0 -0
  6. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/README.md +0 -0
  7. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/setup.cfg +0 -0
  8. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/__init__.py +0 -0
  9. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/api.py +0 -0
  10. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/const.py +0 -0
  11. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/interface/__init__.py +0 -0
  12. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/interface/erc20.py +0 -0
  13. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/interface/erc721.py +0 -0
  14. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/interface/sol.py +0 -0
  15. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/types/SOLcheque.py +0 -0
  16. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/types/__init__.py +0 -0
  17. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/utils/__init__.py +0 -0
  18. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK/utils/utils.py +0 -0
  19. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK.egg-info/SOURCES.txt +0 -0
  20. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
  21. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/shadowPaySDK.egg-info/requires.txt +0 -0
  22. {shadowpaysdk-0.2.0.5 → shadowpaysdk-0.2.0.6}/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.2.0.5
3
+ Version: 0.2.0.6
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazarius_
6
6
  Author-email: your@email.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='shadowPaySDK',
5
- version='0.2.0.5',
5
+ version='0.2.0.6',
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',
@@ -262,6 +262,47 @@ class Cheque:
262
262
  "hash": txn_hash.hex(),
263
263
  "chequeId": cheque_id
264
264
  }
265
+
266
+ async def CashOutSwapCheque(self, cheque_id: str, private_key: Optional[str] = None):
267
+ swapDetail = await self.getSwaoDetail(cheque_id)
268
+ print(swapDetail)
269
+ if private_key is None:
270
+ private_key = self.private_key
271
+ token_out = swapDetail["tokenOut"]
272
+ amount_out = swapDetail["amountOut"]
273
+ erc20 = shadowPaySDK.ERC20Token(w3=self.w3)
274
+ erc20.set_params(token_address=token_out)
275
+ encure_allowance = erc20.ensure_allowance(
276
+ private_key=private_key,
277
+ spender=self.contract.address,
278
+ amount=amount_out,
279
+ )
280
+ estimated_gas = self.contract.functions.CashOutSwapCheque(
281
+ Web3.to_bytes(hexstr=cheque_id)
282
+ ).estimate_gas({
283
+ 'from': self.w3.eth.account.from_key(private_key).address,
284
+ 'gasPrice': self.w3.eth.gas_price
285
+ })
286
+ swa = self.contract.functions.CashOutSwapCheque(
287
+ Web3.to_bytes(hexstr=cheque_id)
288
+ ).build_transaction({
289
+ 'from': self.w3.eth.account.from_key(private_key).address,
290
+ 'nonce': self.w3.eth.get_transaction_count(self.w3.eth.account.from_key(private_key).address),
291
+ 'gas': 300_000,
292
+ 'gasPrice': self.w3.eth.gas_price
293
+ })
294
+ signed_txn = self.w3.eth.account.sign_transaction(swa, private_key=private_key)
295
+ tx_hash = self.w3.eth.send_raw_transaction(signed_txn.raw_transaction)
296
+ receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
297
+ if receipt.status != 1:
298
+ return False
299
+ return {
300
+ "hash": tx_hash.hex(),
301
+ }
302
+
303
+
304
+
305
+
265
306
  async def getComunityPool(self):
266
307
  # fee = self.contract.functions.getCollectedFee().call()
267
308
  fee = 50000000000000
@@ -273,7 +314,11 @@ class Cheque:
273
314
  return self.contract.functions.getTreasery().call()
274
315
  async def getSwaoDetail(self, cheque_id: str):
275
316
  cheque_id_bytes = Web3.to_bytes(hexstr=cheque_id)
276
- return self.contract.functions.getSwapDetail(cheque_id_bytes).call()
317
+ s = self.contract.functions.getSwapDetail(cheque_id_bytes).call()
318
+ return{
319
+ "tokenOut": s[0],
320
+ "amountOut": s[1],
321
+ }
277
322
  class NFTcheque:
278
323
  def __init__(self, w3:Web3, token:str, amount:int, spender:str):
279
324
  self.w3 = w3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0.5
3
+ Version: 0.2.0.6
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazarius_
6
6
  Author-email: your@email.com
File without changes
File without changes
File without changes