shadowPaySDK 0.2.0.3__tar.gz → 0.2.0.4__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.3 → shadowpaysdk-0.2.0.4}/PKG-INFO +1 -1
  2. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/setup.py +1 -1
  3. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/interface/erc20.py +8 -7
  4. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK.egg-info/PKG-INFO +1 -1
  5. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/LICENSE +0 -0
  6. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/README.md +0 -0
  7. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/setup.cfg +0 -0
  8. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/__init__.py +0 -0
  9. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/api.py +0 -0
  10. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/const.py +0 -0
  11. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/interface/__init__.py +0 -0
  12. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/interface/erc721.py +0 -0
  13. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/interface/sol.py +0 -0
  14. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/types/EVMcheque.py +0 -0
  15. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/types/SOLcheque.py +0 -0
  16. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/types/__init__.py +0 -0
  17. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/utils/__init__.py +0 -0
  18. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK/utils/utils.py +0 -0
  19. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK.egg-info/SOURCES.txt +0 -0
  20. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
  21. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/shadowPaySDK.egg-info/requires.txt +0 -0
  22. {shadowpaysdk-0.2.0.3 → shadowpaysdk-0.2.0.4}/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.3
3
+ Version: 0.2.0.4
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.3',
5
+ version='0.2.0.4',
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,6 +9,7 @@ class ERC20Token:
9
9
  def __init__(self, w3:Web3, explorer: Optional[str] = None):
10
10
  self.web3 = w3
11
11
  self.explorer = explorer
12
+
12
13
  self.address = None
13
14
  self.contract = None
14
15
 
@@ -21,7 +22,7 @@ class ERC20Token:
21
22
 
22
23
  def _ensure_contract(self):
23
24
  if not self.contract:
24
- raise ValueError("Token address is not set. Use set_token(token_address) first.")
25
+ raise ValueError("Token address is not set. Use set_params first.")
25
26
 
26
27
  def _format_tx(self, tx_hash: str) -> str:
27
28
  if self.explorer:
@@ -44,7 +45,7 @@ class ERC20Token:
44
45
  raw = self.contract.functions.balanceOf(Web3.to_checksum_address(wallet_address)).call()
45
46
  return raw / (10 ** self.get_decimals())
46
47
 
47
- def allowance(self, owner: str, spender: str, token) -> float:
48
+ def allowance(self, owner: str, spender: str) -> float:
48
49
  self._ensure_contract()
49
50
  raw = self.contract.functions.allowance(
50
51
  Web3.to_checksum_address(owner),
@@ -52,13 +53,13 @@ class ERC20Token:
52
53
  ).call()
53
54
  return raw / (10 ** self.get_decimals())
54
55
 
55
- def ensure_allowance(self, private_key: str, spender: str, amount, token) -> Union[bool, str]:
56
+ def ensure_allowance(self, private_key: str, spender: str, amount) -> Union[bool, str]:
56
57
  self._ensure_contract()
57
58
  account = self.web3.eth.account.from_key(private_key)
58
- current = self.allowance(account.address, spender, token)
59
+ current = self.allowance(account.address, spender)
59
60
  if current == amount:
60
61
  return True
61
- return self.approve(private_key, spender, amount, token)
62
+ return self.approve(private_key, spender, amount)
62
63
 
63
64
  def transfer(self, private_key: str, to: str, amount: float) -> str:
64
65
  self._ensure_contract()
@@ -86,10 +87,10 @@ class ERC20Token:
86
87
  tx_hash = self.web3.eth.send_raw_transaction(signed.raw_transaction)
87
88
  return self._format_tx(self.web3.to_hex(tx_hash))
88
89
 
89
- def approve(self, private_key: str, spender: str, amount: float, token) -> str:
90
+ def approve(self, private_key: str, spender: str, amount: float) -> str:
90
91
  self._ensure_contract()
91
92
  account = self.web3.eth.account.from_key(private_key)
92
- decimals = self.get_decimals(token=token)
93
+ decimals = self.get_decimals()
93
94
  amount = int(amount * (10 ** decimals))
94
95
 
95
96
  txn = self.contract.functions.approve(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0.3
3
+ Version: 0.2.0.4
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