shadowPaySDK 0.2.0.28__py3-none-any.whl → 16.7.2025__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
@@ -1,5 +1,5 @@
1
1
  import json
2
-
2
+ from solders.pubkey import Pubkey
3
3
  __ALLOW_CHAINS__ = [
4
4
  56, # BSC Mainnet
5
5
  97, # BSC Testnet
@@ -553,3 +553,6 @@ LAMPORTS_PER_SOL = 1_000_000_000
553
553
  WRAPED_SOL = "So11111111111111111111111111111111111111112"
554
554
  TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
555
555
  NATIVE_DECIMALS: int = 9
556
+ PROGRAM_ID = Pubkey.from_string("CrfYLvU4FdVjkBno2rRi6u5U6nGCykpQnQKSBg3uVXTw")
557
+
558
+ CONFIG_PDA=Pubkey.find_program_address([b"config"], PROGRAM_ID)
@@ -46,17 +46,15 @@ import httpx
46
46
  import base64
47
47
  import re
48
48
  import struct
49
- from shadowPaySDK.const import LAMPORTS_PER_SOL
49
+ from shadowPaySDK.const import LAMPORTS_PER_SOL, PROGRAM_ID, CONFIG_PDA
50
50
 
51
- PROGRAM_ID = Pubkey.from_string("4PYNfaoDaJR8hrmUCngrwxJHAD9vkdnFySndPYC8HgNH")
52
51
 
53
- CONFIG_PDA=Pubkey.find_program_address([b"config"], PROGRAM_ID)
54
- PROGRAM_ID_STR = "5nfYDCgBgm72XdpYFEtWX2X1JQSyZdeBH2uuBZ6ZvQfi"
55
52
 
56
53
  class SOLCheque:
57
54
  def __init__(self, rpc_url: str = "https://api.mainnet-beta.solana.com", key: Wallet = None):
58
55
  self.rpc_url = rpc_url
59
- self.key = solders.keypair.Keypair.from_base58_string(key)
56
+ if key:
57
+ self.key = solders.keypair.Keypair.from_base58_string(key)
60
58
  self.provider = Client(rpc_url)
61
59
  self.WRAPED_SOL = spl_constants.WRAPPED_SOL_MINT # wrapped SOL token mint address
62
60
  # self.idl = Idl.from_json(sol_interface.Idl) # Load the IDL for the program
@@ -64,19 +62,53 @@ class SOLCheque:
64
62
  pubkey = SOL.get_pubkey(KEYPAIR=solders.keypair.Keypair.from_base58_string(self.keystore))
65
63
 
66
64
  return pubkey
65
+ def get_config(self):
66
+ program_id = PROGRAM_ID
67
+ config_pda, _ = Pubkey.find_program_address([b"config"], program_id)
68
+
69
+ response = self.provider.get_account_info(config_pda)
70
+ if response.value is None:
71
+ print("❌ Config PDA not found.")
72
+ return None
73
+
74
+ # 🧠 У тебя data — это list[int], его нужно превратить в bytes
75
+ raw = bytes(response.value.data)
76
+
77
+ if len(raw) < 89:
78
+ print("❌ Invalid config data length.")
79
+ return None
80
+
81
+ admin = Pubkey.from_bytes(raw[0:32])
82
+ treasury = Pubkey.from_bytes(raw[32:64])
83
+ fee_bps = struct.unpack("<Q", raw[64:72])[0]
84
+ token_in_bps = struct.unpack("<Q", raw[72:80])[0]
85
+ token_out_bps = struct.unpack("<Q", raw[80:88])[0]
86
+ initialized = bool(raw[88])
87
+
88
+
89
+ return {
90
+ "pda": str(config_pda),
91
+ "admin": str(admin),
92
+ "treasury": str(treasury),
93
+ "fee_bps": fee_bps,
94
+ "token_in_bps": token_in_bps,
95
+ "token_out_bps": token_out_bps,
96
+ "initialized": initialized,
97
+ }
67
98
  def set_params(self, rpc_url = None, key = None):
68
99
  if rpc_url:
69
100
  self.rpc_url = rpc_url
70
101
  self.provider = Client(rpc_url)
71
102
  if key:
72
- self.key = key
103
+ self.key = solders.keypair.Keypair.from_base58_string(key)
104
+ # init_cheque & claim_cheque status on 15.07.2025 work
73
105
 
74
- def init_cheque(self, cheque_amount, recipient: str, SPACE: int = 100):
106
+ def init_cheque(self, cheque_amount, recipient: str, SPACE: int = 100, build_tx: bool = False):
75
107
  """
76
108
  Initialize a cheque withc the specified amount and recipient.
77
109
  """
78
- if not self.key:
79
- raise ValueError("Keypair is not set. Please set the keypair before initializing a cheque.")
110
+ # if not self.key:
111
+ # raise ValueError("Keypair is not set. Please set the keypair before initializing a cheque.")
80
112
  CHEQUE_PDA_SIGNATURE = None
81
113
  CHEQUE_SPACE = SPACE
82
114
  CHEQUE_RENT = self.provider.get_minimum_balance_for_rent_exemption(CHEQUE_SPACE)
@@ -100,6 +132,7 @@ class SOLCheque:
100
132
  message = Message(instructions=[ix_create], payer=pubkey)
101
133
 
102
134
  t = Transaction(message=message, from_keypairs=[payer, newAcc], recent_blockhash=recent_blockhash)
135
+
103
136
  r = self.provider.send_transaction(t,opts=TxOpts())
104
137
  CHEQUE_PDA_SIGNATURE = r.value
105
138
  CHEQUE_PDA = newAccPubkey
@@ -113,15 +146,16 @@ class SOLCheque:
113
146
 
114
147
  data = bytes([0]) + bytes(r) + struct.pack("<Q", total_lamports)
115
148
 
116
-
117
-
149
+ cfg = self.get_config()
150
+ tresury = cfg["treasury"]
118
151
  instruction = Instruction(
119
152
  program_id=PROGRAM_ID,
120
153
  data=data,
121
154
  accounts=[
122
155
  AccountMeta(pubkey=pubkey, is_signer=True, is_writable=True), # payer
123
156
  AccountMeta(pubkey=CHEQUE_PDA, is_signer=False, is_writable=True), # cheque PDA
124
- AccountMeta(pubkey=Pubkey.from_string("11111111111111111111111111111111"), is_signer=False, is_writable=False)
157
+ AccountMeta(pubkey=Pubkey.from_string("11111111111111111111111111111111"), is_signer=False, is_writable=False),
158
+ AccountMeta(pubkey=Pubkey.from_string(tresury), is_signer=False, is_writable=True), # treasury
125
159
 
126
160
  ]
127
161
  )
@@ -141,13 +175,13 @@ class SOLCheque:
141
175
  }
142
176
  return data
143
177
 
144
- def claim_cheque(self, pda_acc: str, rent_resiver:str = None ):
178
+ def claim_cheque(self, pda_acc: str ):
145
179
  instruction_data = bytes([1])
146
180
  payer = self.key
147
181
  payer_pubkey = payer.pubkey()
148
- if not rent_resiver:
149
- rent_resiver = payer_pubkey
150
- rent_resiver = Pubkey.from_string(rent_resiver)
182
+ cfg = self.get_config()
183
+ tressary = cfg["treasury"]
184
+
151
185
 
152
186
  ix = Instruction(
153
187
  program_id=PROGRAM_ID,
@@ -155,7 +189,8 @@ class SOLCheque:
155
189
  accounts = [
156
190
  AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True),
157
191
  AccountMeta(pubkey=Pubkey.from_string(pda_acc), is_signer=False, is_writable=True),
158
- AccountMeta(pubkey=rent_resiver, is_signer=False, is_writable=True) # rent receiver
192
+ AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=True), # rent receiver
193
+ AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True) # treasury
159
194
  ]
160
195
  )
161
196
 
@@ -168,6 +203,7 @@ class SOLCheque:
168
203
  "pda_account": pda_acc,
169
204
  }
170
205
 
206
+ # init_token_cheque need fix...
171
207
 
172
208
  def init_token_cheque(self, token_mint: str, token_amount,token_decimals, recipient: str, treasury: str, CHEQUE_SPACE: int = 105):
173
209
  if not self.key:
@@ -243,4 +279,6 @@ class SOLCheque:
243
279
  "cheque_pda": str(cheque_pda),
244
280
  "signature": str(sig),
245
281
  "amount": token_amount
246
- }
282
+ }
283
+ def claim_token_cheque(self, pda_acc: str):
284
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0.28
3
+ Version: 16.7.2025
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazay(aka dazarius_)
6
6
  Author-email: your@email.com
@@ -28,10 +28,11 @@ Dynamic: requires-dist
28
28
  Dynamic: requires-python
29
29
  Dynamic: summary
30
30
 
31
- # shadowPayS
31
+ # shadowPaySdk
32
32
 
33
33
  ```bash
34
34
  pip3 install shadowPaySDK
35
+ pip3 install --break-system-packages git+https://github.com/dazarius/SDK.git
35
36
  ```
36
37
  ```example to use cheque
37
38
 
@@ -1,17 +1,17 @@
1
1
  shadowPaySDK/__init__.py,sha256=CMwAuP_6hJN-WueU-XlTNta9Oyd28sFo8OojdgD_pxA,681
2
2
  shadowPaySDK/api.py,sha256=cv5Z171cOh-Idi-lMA4AORzeGDPPrk8BCQ9e5V9MAaM,1461
3
- shadowPaySDK/const.py,sha256=ogzTSFbJ_hQK49qEo2ZfxPiI_CTZLh7a706OKN41KYM,10140
3
+ shadowPaySDK/const.py,sha256=dIifSDi2SEW7W3e-Z1nG3TwpAqPNnXvnFipGP0cgPwE,10318
4
4
  shadowPaySDK/interface/__init__.py,sha256=ggSZCV22udnzXm_Wv_3x6VN3hNIAEiwgwHZc2Jwc688,146
5
5
  shadowPaySDK/interface/erc20.py,sha256=7p8eU5LzhI2MsH80PZhq6IRhbfMGlNYucGl3OtyS9SI,4669
6
6
  shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
7
7
  shadowPaySDK/interface/sol.py,sha256=TDp62OtQkR8Wy9I4UBVmL_K_FQeMVS--Lojgbvq5T2E,8146
8
8
  shadowPaySDK/types/EVMcheque.py,sha256=8M1EzpZGqf4uidrd9yDKiR7BvIl85p93A_9AMZtshSs,14570
9
- shadowPaySDK/types/SOLcheque.py,sha256=QxRJVPQKOn3n0Y0FQf4REjt0-garpp-L2E9B9PddDTA,10414
9
+ shadowPaySDK/types/SOLcheque.py,sha256=h1u-VaIhdb5hFWScdePCQDeDhIyyFhKgtZWmZ8vckh4,11991
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.28.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
14
- shadowpaysdk-0.2.0.28.dist-info/METADATA,sha256=jNmFSnt4Wv5zXzY0-BfpoQkBGRFEZFsGN3N-p52kaoM,964
15
- shadowpaysdk-0.2.0.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- shadowpaysdk-0.2.0.28.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
17
- shadowpaysdk-0.2.0.28.dist-info/RECORD,,
13
+ shadowpaysdk-16.7.2025.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
14
+ shadowpaysdk-16.7.2025.dist-info/METADATA,sha256=tQhhhmL8EhfnqO_BkjBfAGFmKVccigApYJaVNJ8wZL8,1044
15
+ shadowpaysdk-16.7.2025.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ shadowpaysdk-16.7.2025.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
17
+ shadowpaysdk-16.7.2025.dist-info/RECORD,,