shadowPaySDK 16.7.2025.5__tar.gz → 16.7.2025.7__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-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/PKG-INFO +3 -3
  2. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/setup.py +3 -3
  3. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/interface/erc20.py +5 -10
  4. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/interface/sol.py +0 -5
  5. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/types/EVMcheque.py +42 -27
  6. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/types/SOLcheque.py +0 -2
  7. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK.egg-info/PKG-INFO +3 -3
  8. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK.egg-info/SOURCES.txt +0 -1
  9. shadowpaysdk-16.7.2025.5/shadowPaySDK/api.py +0 -48
  10. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/LICENSE +0 -0
  11. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/README.md +0 -0
  12. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/setup.cfg +0 -0
  13. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/__init__.py +0 -0
  14. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/const.py +0 -0
  15. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/interface/__init__.py +0 -0
  16. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/interface/erc721.py +0 -0
  17. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/types/__init__.py +0 -0
  18. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/utils/__init__.py +0 -0
  19. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK/utils/utils.py +0 -0
  20. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
  21. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK.egg-info/requires.txt +0 -0
  22. {shadowpaysdk-16.7.2025.5 → shadowpaysdk-16.7.2025.7}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 16.7.2025.5
3
+ Version: 16.7.2025.7
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
@@ -2,12 +2,12 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='shadowPaySDK',
5
- version='16.07.2025.5',
5
+ version='16.07.2025.7',
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=[
@@ -43,7 +43,7 @@ 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
  def allowance(self, owner: str, spender: str) -> float:
49
49
  self._ensure_contract()
@@ -51,7 +51,7 @@ class ERC20Token:
51
51
  Web3.to_checksum_address(owner),
52
52
  Web3.to_checksum_address(spender)
53
53
  ).call()
54
- return raw / (10 ** self.get_decimals())
54
+ return raw
55
55
 
56
56
  def ensure_allowance(self, private_key: str, spender: str, amount, converted_amount: bool = False) -> Union[bool, str]:
57
57
  self._ensure_contract()
@@ -64,18 +64,17 @@ class ERC20Token:
64
64
  def transfer(self, private_key: str, to: str, amount: float) -> str:
65
65
  self._ensure_contract()
66
66
  account = self.web3.eth.account.from_key(private_key)
67
- decimals = self.get_decimals()
68
- value = int(amount * (10 ** decimals))
67
+
69
68
  estimated_gas = self.contract.functions.transfer(
70
69
  Web3.to_checksum_address(to),
71
- value
70
+ amount
72
71
  ).estimate_gas({
73
72
  'from': account.address,
74
73
  'gasPrice': self.web3.to_wei('5', 'gwei'),
75
74
  })
76
75
  txn = self.contract.functions.transfer(
77
76
  Web3.to_checksum_address(to),
78
- value
77
+ amount
79
78
  ).build_transaction({
80
79
  'from': account.address,
81
80
  'nonce': self.web3.eth.get_transaction_count(account.address),
@@ -99,10 +98,6 @@ class ERC20Token:
99
98
  address = Web3.to_checksum_address(self.address)
100
99
  else:
101
100
  raise ValueError("No private key or address provided")
102
- if conveted_amount:
103
- decimals = self.get_decimals()
104
- amount = int(amount * (10 ** decimals))
105
-
106
101
  txn = self.contract.functions.approve(
107
102
  Web3.to_checksum_address(spender),
108
103
  amount
@@ -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)
@@ -1,6 +1,5 @@
1
1
  import shadowPaySDK
2
2
  from shadowPaySDK.const import __SHADOWPAY_ABI__ERC20__, __ALLOW_CHAINS__, __SHADOWPAY_CONTRACT_ADDRESS__ERC20__
3
- from shadowPaySDK.api import __CREATE__CHEQUE__
4
3
  from web3 import Web3
5
4
  from typing import Optional
6
5
  import httpx
@@ -36,6 +35,7 @@ class Cheque:
36
35
  print(f"Failed to get cheque ID from transaction receipt: {str(e)}")
37
36
  return False
38
37
  def __allow__(self):
38
+ print("Checking if chain is allowed", self.w3.eth.chain_id)
39
39
  for chain in self.allowed_chains:
40
40
 
41
41
  if chain == self.w3.eth.chain_id:
@@ -46,13 +46,16 @@ class Cheque:
46
46
  raise ValueError(f"Chain {str(self.w3.eth.chain_id)} is not allowed. Allowed chains are: {self.allowed_chains}")
47
47
  def get_contract_for_chain(self,chain_id: str):
48
48
  c = None
49
- for chain in __SHADOWPAY_CONTRACT_ADDRESS__ERC20__ :
50
- if str(chain) == str(chain_id):
51
- c = __SHADOWPAY_CONTRACT_ADDRESS__ERC20__[chain_id]
52
- contract_address = Web3.to_checksum_address(c)
53
- contract = self.w3.eth.contract(address=contract_address, abi=__SHADOWPAY_ABI__ERC20__)
54
- self.contract = contract
55
- return contract
49
+ chain_id = int(chain_id)
50
+
51
+ for key,value in __SHADOWPAY_CONTRACT_ADDRESS__ERC20__.items():
52
+ print("Checking address", value, "for chain_id", chain_id)
53
+ if key == chain_id:
54
+ c = value
55
+ contract_address = Web3.to_checksum_address(c)
56
+ contract = self.w3.eth.contract(address=contract_address, abi=__SHADOWPAY_ABI__ERC20__)
57
+ self.contract = contract
58
+ return contract
56
59
  raise ValueError(f"Chain {chain_id} is not supported. Supported chains are: {list(__SHADOWPAY_CONTRACT_ADDRESS__ERC20__.keys())}")
57
60
  async def get_address(self):
58
61
  if self.address:
@@ -141,41 +144,54 @@ class Cheque:
141
144
  async def CashOutCheque(
142
145
  self,
143
146
  private_key: str,
144
- cheque_id: str # hex-строка типа "0xabc..."
147
+ cheque_id: str
145
148
  ):
146
149
  if not private_key:
147
150
  private_key = self.private_key
148
151
 
149
-
150
152
  account = self.w3.eth.account.from_key(private_key)
151
153
  sender_address = account.address or self.address
152
-
153
-
154
154
  nonce = self.w3.eth.get_transaction_count(sender_address)
155
155
 
156
- txn = self.contract.functions.CashOutCheque(
157
- Web3.to_bytes(hexstr=cheque_id)).build_transaction({
156
+ latest_block = self.w3.eth.get_block('latest')
157
+ supports_eip1559 = 'baseFeePerGas' in latest_block
158
+
159
+ tx_common = {
158
160
  'from': sender_address,
159
161
  'nonce': nonce,
160
162
  'gas': 300_000,
161
- 'gasPrice': self.w3.to_wei('5', 'gwei'),
162
- })
163
- if self.return_build_tx:
164
- return {
165
- "build_tx": txn
166
- }
163
+ }
167
164
 
168
- signed_txn = self.w3.eth.account.sign_transaction(txn, private_key=private_key)
165
+ if supports_eip1559:
166
+ # EIP-1559 style
167
+ base_fee = latest_block['baseFeePerGas']
168
+ priority_fee = self.w3.to_wei(2, 'gwei') # можно поднять до 5
169
+ max_fee = base_fee + priority_fee * 2
169
170
 
171
+ tx_common.update({
172
+ 'maxFeePerGas': max_fee,
173
+ 'maxPriorityFeePerGas': priority_fee
174
+ })
175
+ else:
176
+ # Legacy gas price style
177
+ tx_common.update({
178
+ 'gasPrice': self.w3.to_wei('5', 'gwei')
179
+ })
170
180
 
171
- tx_hash = self.w3.eth.send_raw_transaction(signed_txn.raw_transaction)
181
+ txn = self.contract.functions.CashOutCheque(
182
+ Web3.to_bytes(hexstr=cheque_id)
183
+ ).build_transaction(tx_common)
184
+
185
+ if self.return_build_tx:
186
+ return {"build_tx": txn}
172
187
 
188
+ signed_txn = self.w3.eth.account.sign_transaction(txn, private_key=private_key)
189
+ tx_hash = self.w3.eth.send_raw_transaction(signed_txn.raw_transaction)
173
190
  receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
191
+
174
192
  if receipt.status != 1:
175
193
  return False
176
- return {
177
- "hash": tx_hash.hex()
178
- }
194
+ return {"hash": tx_hash.hex()}
179
195
 
180
196
  async def InitTokenCheque(self, token_address:str, amount, reciver:str, private_key:Optional[str] = None):
181
197
  key = private_key or self.private_key
@@ -385,8 +401,7 @@ class Cheque:
385
401
 
386
402
 
387
403
  async def getComunityPool(self):
388
- # fee = self.contract.functions.getCollectedFee().call()
389
- fee = 50000000000000
404
+ fee = self.contract.functions.getCollectedFee().call()
390
405
  half_fee_eth = self.w3.from_wei(fee // 2, 'ether')
391
406
  return half_fee_eth
392
407
  async def getOwner(self):
@@ -71,7 +71,6 @@ class SOLCheque:
71
71
  print("❌ Config PDA not found.")
72
72
  return None
73
73
 
74
- # 🧠 У тебя data — это list[int], его нужно превратить в bytes
75
74
  raw = bytes(response.value.data)
76
75
 
77
76
  if len(raw) < 89:
@@ -263,7 +262,6 @@ class SOLCheque:
263
262
  ]
264
263
  )
265
264
 
266
- # === 6. Собираем и отправляем всё в одном tx ===
267
265
  print("Accounts (ix_program):")
268
266
  for i, acc in enumerate(ix_program.accounts):
269
267
  print(f"[{i}] {acc.pubkey} | signer={acc.is_signer} | writable={acc.is_writable}")
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 16.7.2025.5
3
+ Version: 16.7.2025.7
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
@@ -2,7 +2,6 @@ LICENSE
2
2
  README.md
3
3
  setup.py
4
4
  shadowPaySDK/__init__.py
5
- shadowPaySDK/api.py
6
5
  shadowPaySDK/const.py
7
6
  shadowPaySDK.egg-info/PKG-INFO
8
7
  shadowPaySDK.egg-info/SOURCES.txt
@@ -1,48 +0,0 @@
1
- import httpx
2
- import json
3
- from typing import Optional
4
- from web3 import Web3
5
-
6
- __MAIN__URL__= "http://0.0.0.0:8000"
7
- __CREATE__CHEQUE__ = f"{__MAIN__URL__}/validate"
8
- __MY__CHEQUES__ = f"{__MAIN__URL__}/mycheque"
9
-
10
-
11
-
12
- async def __validate__cheque__(id, sender,action, receiver:Optional[str] = None, chain_id: Optional[int] = None, type:Optional[str] = None):
13
- async with httpx.AsyncClient() as client:
14
- response = await client.post(
15
- __CREATE__CHEQUE__,
16
- json={
17
- "cheque_id": id,
18
- "chain_id":chain_id,
19
- "receiver": receiver,
20
- "type": type,
21
- "sender":sender,
22
- "action": action
23
- }
24
- )
25
- if response.status_code == 200:
26
- return response.json()
27
- else:
28
- print(f"Failed to create cheque: {response.text}")
29
- return False
30
-
31
-
32
- async def get_my_cheques(private_key):
33
- if not private_key:
34
- raise ValueError("Private key is required to fetch cheques.")
35
- sender = Web3.eth.account.from_key(private_key).address
36
-
37
- async with httpx.AsyncClient() as client:
38
- response = await client.get(
39
- __MY__CHEQUES__,
40
- params={
41
- "sender": sender
42
- }
43
- )
44
- if response.status_code == 200:
45
- return response.json()
46
- else:
47
- print(f"Failed to fetch cheques: {response.text}")
48
- return False