shadowPaySDK 0.2.0__py3-none-any.whl → 0.2.0.1__py3-none-any.whl

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/const.py CHANGED
@@ -11,6 +11,9 @@ __ALLOW_CHAINS__ = [
11
11
  0xa
12
12
  ]
13
13
 
14
+
15
+
16
+
14
17
  __VERSION__ = "0.1.2"
15
18
 
16
19
 
@@ -543,4 +546,5 @@ __SHADOWPAY_ABI__ERC20__= json.loads("""[
543
546
  __SHADOWPAY_ABI__ERC721__ = json.loads("""[]""")
544
547
  __SHADOWPAY_CONTRACT_ADDRESS__ERC721__ = {
545
548
  "0x1": "0x3c5b8d6f2e"
546
- }
549
+ }
550
+
@@ -109,6 +109,5 @@ class ERC20Token:
109
109
  tx_receipt = self.web3.eth.wait_for_transaction_receipt(tx_hash)
110
110
  if tx_receipt.status != 1:
111
111
  raise ValueError(f"aaprove fail.\n {self._format_tx(self.web3.to_hex(tx_hash))}")
112
-
113
112
  return f"approve: {self._format_tx(self.web3.to_hex(tx_hash))}"
114
113
 
@@ -7,18 +7,17 @@ import httpx
7
7
 
8
8
 
9
9
  class Cheque:
10
- def __init__(self, w3:Web3,private_key:str, ABI = __SHADOWPAY_ABI__ERC20__, allowed_chains = __ALLOW_CHAINS__):
10
+ def __init__(self, w3:Optional[Web3] = None,private_key:Optional[str] = None, ABI = __SHADOWPAY_ABI__ERC20__, allowed_chains = __ALLOW_CHAINS__):
11
11
  self.w3 = w3
12
- print(f"chain id: {self.w3.eth.chain_id}")
13
- print(f"allowed chains", allowed_chains)
12
+
14
13
  self.amount = None
15
14
  self.token = None
16
15
  self.private_key = private_key
17
16
  self.ABI = ABI
18
17
 
19
18
  self.allowed_chains = allowed_chains
20
- if self.__allow__():
21
- print(f"Allowed chains: {self.allowed_chains}")
19
+ if self.w3 != None:
20
+ self.__allow__()
22
21
 
23
22
  def __get__id(self, tx):
24
23
  try:
@@ -40,10 +39,8 @@ class Cheque:
40
39
  def get_contract_for_chain(self,chain_id: str):
41
40
  c = None
42
41
  for chain in __SHADOWPAY_CONTRACT_ADDRESS__ERC20__ :
43
- print(f"Checking chain {chain} against {self.w3.eth.chain_id}")
44
42
  if str(chain) == str(chain_id):
45
43
  c = __SHADOWPAY_CONTRACT_ADDRESS__ERC20__[chain_id]
46
- print(f"Contract address: {c}, type {type(c)} ")
47
44
  contract_address = Web3.to_checksum_address(c)
48
45
  contract = self.w3.eth.contract(address=contract_address, abi=__SHADOWPAY_ABI__ERC20__)
49
46
  self.contract = contract
@@ -92,6 +89,8 @@ class Cheque:
92
89
  cheque_id = logs
93
90
  else:
94
91
  cheque_id = None
92
+ if txn_receipt.status != 1:
93
+ return False
95
94
  return {
96
95
  "hash": txn_hash.hex(),
97
96
  "chequeId": cheque_id,
@@ -133,10 +132,12 @@ class Cheque:
133
132
  print(f"⏳ Transaction sent: {tx_hash.hex()}")
134
133
  receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
135
134
  print(f"✅ Transaction confirmed in block {receipt.blockNumber}")
135
+ if receipt.status != 1:
136
+ return False
136
137
  return receipt
137
138
 
138
139
  async def InitTokenCheque(self, token_address:str, amount, reciver:str, private_key:Optional[str] = None):
139
- # collectedFes
140
+
140
141
 
141
142
  erc20 = shadowPaySDK.ERC20Token(w3=self.w3)
142
143
  erc20.set_params(token_address=token_address)
@@ -174,7 +175,8 @@ class Cheque:
174
175
  cheque_id = logs
175
176
  else:
176
177
  cheque_id = None
177
-
178
+ if txn_receipt.status != 1:
179
+ return False
178
180
  return {
179
181
  "hash": txn_hash.hex(),
180
182
  "chequeId": cheque_id,
@@ -211,6 +213,8 @@ class Cheque:
211
213
  # Получаем подтверждение
212
214
  receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
213
215
 
216
+ if receipt.status != 1:
217
+ return False
214
218
  return {
215
219
  "hash": tx_hash.hex(),
216
220
  "status": receipt.status # 1 = success, 0 = fail
@@ -259,6 +263,8 @@ class Cheque:
259
263
  cheque_id = logs
260
264
  else:
261
265
  cheque_id = None
266
+ if txn_receipt.status != 1:
267
+ return False
262
268
  return {
263
269
  "hash": txn_hash.hex(),
264
270
  "chequeId": cheque_id
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0
3
+ Version: 0.2.0.1
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazarius_
6
6
  Author-email: your@email.com
@@ -1,17 +1,17 @@
1
1
  shadowPaySDK/__init__.py,sha256=f3O3u7UX-WTEuy1DPS6vQ8w672nzR1ZbVMu8hciqxM8,821
2
2
  shadowPaySDK/api.py,sha256=cv5Z171cOh-Idi-lMA4AORzeGDPPrk8BCQ9e5V9MAaM,1461
3
- shadowPaySDK/const.py,sha256=WC560zlT9MlG9QKlJb8Ww6ITfL4xR6vRH4kcGzVHFRI,9893
3
+ shadowPaySDK/const.py,sha256=T7TJPKFLqCtxwpUYO1AOryGMr65G-vVuotxfL8gWcME,9898
4
4
  shadowPaySDK/interface/__init__.py,sha256=QceU3dWteSgwvMnR3JDVdmS8OgdRPjvl9JzRs7IsA74,152
5
- shadowPaySDK/interface/erc20.py,sha256=rsdfjIrPNxC_xHbUT9FQbNhURdIqZHcylxTbskPHu1k,4453
5
+ shadowPaySDK/interface/erc20.py,sha256=UpmO8OVkXS5zUPB002KT2bbsuTO8GwGTlusw1aTYNtg,4444
6
6
  shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
7
7
  shadowPaySDK/interface/sol.py,sha256=xgJZsg4xE-_dRctGUW_mHuGj_o_0OlKNp4Gr7IXvTEc,5586
8
- shadowPaySDK/types/EVMcheque.py,sha256=lmPvHlt-ERkaYx2DTYwGmbF_TI1B_ZTT3G_FIQPBm_o,12466
8
+ shadowPaySDK/types/EVMcheque.py,sha256=7GXS0oPG6xIDLz-Uuzkub-Uv0oLbOeVFLiVtFflcUgc,12514
9
9
  shadowPaySDK/types/SOLcheque.py,sha256=gmivsCK4hm_6pzQ9whPGuQ_f7qfcUfiJfQgb5ZsJYDo,884
10
10
  shadowPaySDK/types/__init__.py,sha256=sG6pNZfKGvENXqsnv6MrQtKrJ898fAXkMvAZY1k1-Qg,97
11
11
  shadowPaySDK/utils/__init__.py,sha256=aja3iYO4rT-ptMM-pzw0GRFTziBdXdcEi-4kE84zH64,61
12
12
  shadowPaySDK/utils/utils.py,sha256=g4bGvLDdjhNGsAj1eaZnNWFNaiN-cVhhM-5PrnG5aIQ,720
13
- shadowpaysdk-0.2.0.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
14
- shadowpaysdk-0.2.0.dist-info/METADATA,sha256=isG77oQEH1Cme87jqVOOHJr4gNmuMmaNUmmHjZJCOfA,837
15
- shadowpaysdk-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- shadowpaysdk-0.2.0.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
17
- shadowpaysdk-0.2.0.dist-info/RECORD,,
13
+ shadowpaysdk-0.2.0.1.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
14
+ shadowpaysdk-0.2.0.1.dist-info/METADATA,sha256=mA7LSvQh1E7CmbMDFeMj8WbgcBNKyfUNajhEhF0kfSA,839
15
+ shadowpaysdk-0.2.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ shadowpaysdk-0.2.0.1.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
17
+ shadowpaysdk-0.2.0.1.dist-info/RECORD,,