shadowPaySDK 0.2.0.10__tar.gz → 0.2.0.11__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.
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/PKG-INFO +1 -1
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/setup.py +1 -1
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/types/EVMcheque.py +12 -8
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK.egg-info/PKG-INFO +1 -1
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/LICENSE +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/README.md +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/setup.cfg +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/__init__.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/api.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/const.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/interface/__init__.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/interface/erc20.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/interface/erc721.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/interface/sol.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/types/SOLcheque.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/types/__init__.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/utils/__init__.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK/utils/utils.py +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK.egg-info/SOURCES.txt +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK.egg-info/requires.txt +0 -0
- {shadowpaysdk-0.2.0.10 → shadowpaysdk-0.2.0.11}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -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
|
+
version='0.2.0.11',
|
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',
|
@@ -7,13 +7,14 @@ import httpx
|
|
7
7
|
|
8
8
|
|
9
9
|
class Cheque:
|
10
|
-
def __init__(self, w3:Optional[Web3] = None,private_key:Optional[str] = None, ABI = __SHADOWPAY_ABI__ERC20__, allowed_chains = __ALLOW_CHAINS__, retunrn_build_tx:bool = False):
|
10
|
+
def __init__(self, w3:Optional[Web3] = None,private_key:Optional[str] = None, ABI = __SHADOWPAY_ABI__ERC20__, allowed_chains = __ALLOW_CHAINS__, retunrn_build_tx:bool = False,address:Optional[str] = None):
|
11
11
|
self.w3 = w3
|
12
12
|
|
13
13
|
self.amount = None
|
14
14
|
self.token = None
|
15
15
|
self.private_key = private_key
|
16
16
|
self.ABI = ABI
|
17
|
+
self.address = address
|
17
18
|
self.return_build_tx = retunrn_build_tx
|
18
19
|
self.allowed_chains = allowed_chains
|
19
20
|
if self.w3 != None:
|
@@ -47,7 +48,7 @@ class Cheque:
|
|
47
48
|
return contract
|
48
49
|
raise ValueError(f"Chain {chain_id} is not supported. Supported chains are: {list(__SHADOWPAY_CONTRACT_ADDRESS__ERC20__.keys())}")
|
49
50
|
|
50
|
-
def set_parameters(self,chain_id: Optional[str] = None, w3:Optional[Web3] = None, amount:Optional[int] = None, private_key:Optional[str] = None, token:Optional[str] = None):
|
51
|
+
def set_parameters(self,chain_id: Optional[str] = None, w3:Optional[Web3] = None, amount:Optional[int] = None, private_key:Optional[str] = None, token:Optional[str] = None,address:Optional[str] = None):
|
51
52
|
if w3:
|
52
53
|
self.w3 = w3
|
53
54
|
self.get_contract_for_chain(chain_id=chain_id or self.w3.eth.chain_id)
|
@@ -57,6 +58,9 @@ class Cheque:
|
|
57
58
|
self.private_key = private_key
|
58
59
|
if token:
|
59
60
|
self.token = token
|
61
|
+
if address:
|
62
|
+
self.address = address
|
63
|
+
|
60
64
|
def __convert__(self):
|
61
65
|
return self.w3.to_wei(self.amount, 'ether')
|
62
66
|
|
@@ -71,10 +75,10 @@ class Cheque:
|
|
71
75
|
'gasPrice': self.w3.eth.gas_price
|
72
76
|
})
|
73
77
|
txn = self.contract.functions.InitCheque(receiver).build_transaction({
|
74
|
-
'from': self.w3.eth.account.from_key(private_key or self.private_key).address,
|
78
|
+
'from': self.w3.eth.account.from_key(private_key or self.private_key).address or self.address,
|
75
79
|
'value': self.w3.to_wei(amount, 'ether'),
|
76
80
|
'nonce': self.w3.eth.get_transaction_count(
|
77
|
-
self.w3.eth.account.from_key(private_key or self.private_key).address
|
81
|
+
self.w3.eth.account.from_key(private_key or self.private_key).address or self.address
|
78
82
|
),
|
79
83
|
'gas': estimated_gas,
|
80
84
|
'gasPrice': self.w3.eth.gas_price,
|
@@ -114,7 +118,7 @@ class Cheque:
|
|
114
118
|
|
115
119
|
|
116
120
|
account = self.w3.eth.account.from_key(private_key)
|
117
|
-
sender_address = account.address
|
121
|
+
sender_address = account.address or self.address
|
118
122
|
|
119
123
|
|
120
124
|
nonce = self.w3.eth.get_transaction_count(sender_address)
|
@@ -203,14 +207,14 @@ class Cheque:
|
|
203
207
|
estimated_gas = self.contract.functions.CashOutTokenCheque(
|
204
208
|
Web3.to_bytes(hexstr=cheque_id)
|
205
209
|
).estimate_gas({
|
206
|
-
'from': account.address,
|
210
|
+
'from': account.address or self.address,
|
207
211
|
'gasPrice': self.w3.eth.gas_price
|
208
212
|
})
|
209
213
|
txn = self.contract.functions.CashOutTokenCheque(
|
210
214
|
Web3.to_bytes(hexstr=cheque_id)
|
211
215
|
).build_transaction({
|
212
|
-
'from': account.address,
|
213
|
-
'nonce': self.w3.eth.get_transaction_count(account.address),
|
216
|
+
'from': account.address or self.address,
|
217
|
+
'nonce': self.w3.eth.get_transaction_count(account.address or self.address),
|
214
218
|
'gas': estimated_gas,
|
215
219
|
'gasPrice': self.w3.eth.gas_price,
|
216
220
|
})
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|