shadowPaySDK 0.2.0.28__py3-none-any.whl → 1.0.0__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.
@@ -10,6 +10,7 @@ from solana.rpc.api import Client
10
10
  import asyncio
11
11
  import solana
12
12
  from solana.rpc.async_api import AsyncClient, GetTokenAccountsByOwnerResp
13
+
13
14
  from solders.transaction import Transaction
14
15
  from solders.system_program import TransferParams as p
15
16
  from solders.instruction import Instruction, AccountMeta
@@ -18,7 +19,7 @@ from solders.message import Message
18
19
  import spl
19
20
  import spl.token
20
21
  import spl.token.constants
21
- from spl.token.instructions import get_associated_token_address, create_associated_token_account,TransferCheckedParams, transfer_checked, transfer, close_account, TransferParams
22
+ from spl.token.instructions import get_associated_token_address, create_associated_token_account, TransferCheckedParams, transfer_checked, transfer, close_account, TransferParams
22
23
  from solders.system_program import transfer as ts
23
24
  from solders.system_program import TransferParams as tsf
24
25
  from solders.pubkey import Pubkey
@@ -46,17 +47,15 @@ import httpx
46
47
  import base64
47
48
  import re
48
49
  import struct
49
- from shadowPaySDK.const import LAMPORTS_PER_SOL
50
+ from shadowPaySDK.const import LAMPORTS_PER_SOL, PROGRAM_ID, CONFIG_PDA
50
51
 
51
- PROGRAM_ID = Pubkey.from_string("4PYNfaoDaJR8hrmUCngrwxJHAD9vkdnFySndPYC8HgNH")
52
52
 
53
- CONFIG_PDA=Pubkey.find_program_address([b"config"], PROGRAM_ID)
54
- PROGRAM_ID_STR = "5nfYDCgBgm72XdpYFEtWX2X1JQSyZdeBH2uuBZ6ZvQfi"
55
53
 
56
54
  class SOLCheque:
57
55
  def __init__(self, rpc_url: str = "https://api.mainnet-beta.solana.com", key: Wallet = None):
58
56
  self.rpc_url = rpc_url
59
- self.key = solders.keypair.Keypair.from_base58_string(key)
57
+ if key:
58
+ self.key = solders.keypair.Keypair.from_base58_string(key)
60
59
  self.provider = Client(rpc_url)
61
60
  self.WRAPED_SOL = spl_constants.WRAPPED_SOL_MINT # wrapped SOL token mint address
62
61
  # self.idl = Idl.from_json(sol_interface.Idl) # Load the IDL for the program
@@ -64,19 +63,100 @@ class SOLCheque:
64
63
  pubkey = SOL.get_pubkey(KEYPAIR=solders.keypair.Keypair.from_base58_string(self.keystore))
65
64
 
66
65
  return pubkey
66
+ def get_config(self):
67
+ program_id = PROGRAM_ID
68
+ config_pda, _ = Pubkey.find_program_address([b"config"], program_id)
69
+
70
+ response = self.provider.get_account_info(config_pda)
71
+ if response.value is None:
72
+ print("❌ Config PDA not found.")
73
+ return None
74
+
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
+ }
98
+ def parse_token_cheque_data(self,pda):
99
+ if isinstance(pda, str):
100
+ pda_pubkey = Pubkey.from_string(pda)
101
+ pda_pubkey = pda
102
+ response = self.provider.get_account_info(pda_pubkey)
103
+ if response.value is None:
104
+ return None
105
+
106
+ raw_data = bytes(response.value.data)
107
+ id = int.from_bytes(raw_data[0:8], "little")
108
+ amount = int.from_bytes(raw_data[8:16], "little")
109
+ mint = Pubkey.from_bytes(raw_data[16:48])
110
+ recipient = Pubkey.from_bytes(raw_data[48:80])
111
+ claimed = raw_data[80] != 0
112
+
113
+ return {
114
+ "id": id,
115
+ "amount": amount,
116
+ "mint": str(mint),
117
+ "recipient": str(recipient),
118
+ "claimed": claimed,
119
+ }
120
+ def parse_swap_cheque_data(self,pda:str):
121
+ if isinstance(pda, str):
122
+ pda_pubkey = Pubkey.from_string(pda)
123
+ response = self.provider.get_account_info(pda_pubkey)
124
+ if response.value is None:
125
+ return None
126
+
127
+ raw_data = bytes(response.value.data)
128
+ amountIn = struct.unpack("<Q", raw_data[0:8])[0]
129
+ amountOut = struct.unpack("<Q", raw_data[8:16])[0]
130
+ tokenIn = Pubkey.from_bytes(raw_data[16:48])
131
+ tokenOut = Pubkey.from_bytes(raw_data[48:80])
132
+ recipient = Pubkey.from_bytes(raw_data[80:112])
133
+ claimed = struct.unpack("<?", raw_data[112:113])[0]
134
+
135
+ return {
136
+ "id": id,
137
+ "amountIn": amountIn,
138
+ "amountOut": amountOut,
139
+
140
+ "tokenIn": str(tokenIn),
141
+ "tokenOut": str(tokenOut),
142
+
143
+ "recipient": str(recipient),
144
+ "claimed": claimed,
145
+ }
67
146
  def set_params(self, rpc_url = None, key = None):
68
147
  if rpc_url:
69
148
  self.rpc_url = rpc_url
70
149
  self.provider = Client(rpc_url)
71
150
  if key:
72
- self.key = key
151
+ self.key = solders.keypair.Keypair.from_base58_string(key)
152
+ # init_cheque & claim_cheque status on 15.07.2025 work
73
153
 
74
- def init_cheque(self, cheque_amount, recipient: str, SPACE: int = 100):
154
+ async def init_cheque(self, cheque_amount, recipient: str, SPACE: int = 100, build_tx: bool = False):
75
155
  """
76
156
  Initialize a cheque withc the specified amount and recipient.
77
157
  """
78
- if not self.key:
79
- raise ValueError("Keypair is not set. Please set the keypair before initializing a cheque.")
158
+ # if not self.key:
159
+ # raise ValueError("Keypair is not set. Please set the keypair before initializing a cheque.")
80
160
  CHEQUE_PDA_SIGNATURE = None
81
161
  CHEQUE_SPACE = SPACE
82
162
  CHEQUE_RENT = self.provider.get_minimum_balance_for_rent_exemption(CHEQUE_SPACE)
@@ -100,6 +180,7 @@ class SOLCheque:
100
180
  message = Message(instructions=[ix_create], payer=pubkey)
101
181
 
102
182
  t = Transaction(message=message, from_keypairs=[payer, newAcc], recent_blockhash=recent_blockhash)
183
+
103
184
  r = self.provider.send_transaction(t,opts=TxOpts())
104
185
  CHEQUE_PDA_SIGNATURE = r.value
105
186
  CHEQUE_PDA = newAccPubkey
@@ -113,15 +194,16 @@ class SOLCheque:
113
194
 
114
195
  data = bytes([0]) + bytes(r) + struct.pack("<Q", total_lamports)
115
196
 
116
-
117
-
197
+ cfg = self.get_config()
198
+ tresury = cfg["treasury"]
118
199
  instruction = Instruction(
119
200
  program_id=PROGRAM_ID,
120
201
  data=data,
121
202
  accounts=[
122
203
  AccountMeta(pubkey=pubkey, is_signer=True, is_writable=True), # payer
123
204
  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)
205
+ AccountMeta(pubkey=Pubkey.from_string("11111111111111111111111111111111"), is_signer=False, is_writable=False),
206
+ AccountMeta(pubkey=Pubkey.from_string(tresury), is_signer=False, is_writable=True), # treasury
125
207
 
126
208
  ]
127
209
  )
@@ -141,13 +223,13 @@ class SOLCheque:
141
223
  }
142
224
  return data
143
225
 
144
- def claim_cheque(self, pda_acc: str, rent_resiver:str = None ):
226
+ async def claim_cheque(self, pda_acc: str ):
145
227
  instruction_data = bytes([1])
146
228
  payer = self.key
147
229
  payer_pubkey = payer.pubkey()
148
- if not rent_resiver:
149
- rent_resiver = payer_pubkey
150
- rent_resiver = Pubkey.from_string(rent_resiver)
230
+ cfg = self.get_config()
231
+ tressary = cfg["treasury"]
232
+
151
233
 
152
234
  ix = Instruction(
153
235
  program_id=PROGRAM_ID,
@@ -155,7 +237,8 @@ class SOLCheque:
155
237
  accounts = [
156
238
  AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True),
157
239
  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
240
+ AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=True), # rent receiver
241
+ AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True) # treasury
159
242
  ]
160
243
  )
161
244
 
@@ -168,79 +251,236 @@ class SOLCheque:
168
251
  "pda_account": pda_acc,
169
252
  }
170
253
 
254
+ # init_token_cheque work succesfuly
171
255
 
172
- def init_token_cheque(self, token_mint: str, token_amount,token_decimals, recipient: str, treasury: str, CHEQUE_SPACE: int = 105):
256
+ async def init_token_cheque(
257
+ self,
258
+ token_mint: str,
259
+ token_amount,
260
+ recipient: str,
261
+ CHEQUE_SPACE: int = 100
262
+ ):
173
263
  if not self.key:
174
264
  raise ValueError("Keypair not set")
175
265
 
176
266
  payer = self.key
177
267
  payer_pubkey = payer.pubkey()
268
+
178
269
  token_mint_pubkey = Pubkey.from_string(token_mint)
179
270
  recipient_pubkey = Pubkey.from_string(recipient)
180
- treasury_pubkey = Pubkey.from_string(treasury)
181
271
 
182
272
  cheque_acc = solders.keypair.Keypair()
183
- cheque_pda = cheque_acc.pubkey()
273
+ cheque_pubkey = cheque_acc.pubkey()
184
274
 
185
275
  rent = self.provider.get_minimum_balance_for_rent_exemption(CHEQUE_SPACE).value
186
276
 
187
- create_cheque_acc = create_account(
277
+ create_cheque_ix = create_account(
188
278
  CreateAccountParams(
189
279
  from_pubkey=payer_pubkey,
190
- to_pubkey=cheque_pda,
280
+ to_pubkey=cheque_pubkey,
191
281
  lamports=rent,
192
282
  space=CHEQUE_SPACE,
193
283
  owner=PROGRAM_ID
194
284
  )
195
285
  )
196
286
 
287
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
288
+
197
289
  tx1 = Transaction(
198
- message=Message(instructions=[create_cheque_acc], payer=payer_pubkey),
199
- recent_blockhash=self.provider.get_latest_blockhash().value.blockhash,
290
+ message=Message(instructions=[create_cheque_ix], payer=payer_pubkey),
291
+ recent_blockhash=blockhash,
200
292
  from_keypairs=[payer, cheque_acc]
201
293
  )
202
294
  self.provider.send_transaction(tx1, opts=TxOpts(skip_preflight=True))
203
295
 
204
- sender_ata = get_associated_token_address(payer_pubkey, token_mint_pubkey)
205
- cheque_ata = get_associated_token_address(cheque_pda, token_mint_pubkey)
206
- treasury_ata = get_associated_token_address(treasury_pubkey, token_mint_pubkey)
207
-
208
- ix_create_ata = create_associated_token_account(payer_pubkey, cheque_pda, token_mint_pubkey)
209
-
210
- amount = int(token_amount * (10 ** token_decimals))
211
296
 
212
297
 
213
-
214
- data = bytes([2]) + struct.pack("<Q", amount)
298
+ ata_ix = create_associated_token_account(
299
+ payer=payer_pubkey,
300
+ owner=cheque_pubkey,
301
+ mint=token_mint_pubkey
302
+ )
303
+ cfg = self.get_config()
304
+ tressary = cfg["treasury"]
305
+ sender_ata = get_associated_token_address(payer_pubkey, token_mint_pubkey)
306
+ cheque_ata = get_associated_token_address(cheque_pubkey, token_mint_pubkey)
307
+ token = AsyncToken(
308
+ self.provider,
309
+ token_mint_pubkey,
310
+ TOKEN_PROGRAM_ID,
311
+ payer
312
+ )
313
+ token_decimals = (await token.get_mint_info()).decimals
314
+ amount = int(token_amount * (10 ** token_decimals))
315
+ data = bytes([2]) + struct.pack("<Q", amount) + bytes(recipient_pubkey)
215
316
 
216
317
  ix_program = Instruction(
217
318
  program_id=PROGRAM_ID,
218
319
  data=data,
219
320
  accounts=[
220
- AccountMeta(payer_pubkey, is_signer=True, is_writable=True),
221
- AccountMeta(cheque_pda, is_signer=True, is_writable=True),
222
- AccountMeta(token_mint_pubkey, is_signer=False, is_writable=True),
223
- AccountMeta(sender_ata, is_signer=False, is_writable=True),
224
- AccountMeta(cheque_ata, is_signer=False, is_writable=True),
225
- AccountMeta(treasury_ata, is_signer=False, is_writable=True),
226
- AccountMeta(Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), is_signer=False, is_writable=False),
321
+ AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True), # 0 initializer
322
+ AccountMeta(pubkey=cheque_pubkey, is_signer=True, is_writable=True), # 1 cheque_pda
323
+ AccountMeta(pubkey=token_mint_pubkey, is_signer=False, is_writable=True), # 2 mint
324
+ AccountMeta(pubkey=sender_ata, is_signer=False, is_writable=True), # 3 sender ATA
325
+ AccountMeta(pubkey=cheque_ata, is_signer=False, is_writable=True), # 4 cheque ATA
326
+ AccountMeta(pubkey=TOKEN_PROGRAM_ID, is_signer=False, is_writable=False), # 5 token program
327
+ AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=False), # 6 config PDA
328
+ AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True), # 7 treasury ATA
227
329
  ]
228
330
  )
229
331
 
230
- # === 6. Собираем и отправляем всё в одном tx ===
332
+
231
333
  print("Accounts (ix_program):")
232
334
  for i, acc in enumerate(ix_program.accounts):
233
335
  print(f"[{i}] {acc.pubkey} | signer={acc.is_signer} | writable={acc.is_writable}")
234
336
 
337
+ # 5. Send final transaction with ATA crea tion + program call
338
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
235
339
  tx2 = Transaction(
236
- message=Message(instructions=[ix_create_ata, ix_program], payer=payer_pubkey),
237
- recent_blockhash=self.provider.get_latest_blockhash().value.blockhash,
340
+ message=Message(instructions=[ata_ix, ix_program], payer=payer_pubkey),
341
+ recent_blockhash=blockhash,
238
342
  from_keypairs=[payer, cheque_acc]
239
343
  )
240
344
 
241
345
  sig = self.provider.send_transaction(tx2, opts=TxOpts(skip_preflight=True)).value
346
+
242
347
  return {
243
- "cheque_pda": str(cheque_pda),
348
+ "cheque_pubkey": str(cheque_pubkey),
244
349
  "signature": str(sig),
245
350
  "amount": token_amount
351
+ }
352
+
353
+
354
+ async def claim_token_cheque(self, pda_acc: str):
355
+
356
+ payer = self.key
357
+ payer_pubkey = payer.pubkey()
358
+ pada_acc = solders.keypair.Keypair.from_base58_string(pda_acc)
359
+ pda_pubkey = pada_acc.pubkey()
360
+ cheque_data = self.parse_token_cheque_data(pda=solders.keypair.Keypair.from_base58_string(pda_acc).pubkey())
361
+
362
+ cheque_token_account = get_associated_token_address(pda_pubkey, Pubkey.from_string(cheque_data["mint"]))
363
+ recipient_token_account = get_associated_token_address(
364
+ Pubkey.from_string(cheque_data["recipient"]), Pubkey.from_string(cheque_data["mint"])
365
+ )
366
+ cfg = self.get_config()
367
+ tressary = cfg["treasury"]
368
+ data = bytes([3])
369
+ ix_program = Instruction(
370
+ program_id=PROGRAM_ID,
371
+ data=bytes([3]),
372
+ accounts=[
373
+ AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True), # 0 claimer
374
+ AccountMeta(pubkey=pda_pubkey, is_signer=False, is_writable=True), # 1 cheque_pda
375
+ AccountMeta(pubkey=cheque_token_account, is_signer=False, is_writable=True), # 2 cheque_token_account
376
+ AccountMeta(pubkey=recipient_token_account, is_signer=False, is_writable=True), # 3 recipient_token_account
377
+ AccountMeta(pubkey=TOKEN_PROGRAM_ID, is_signer=False, is_writable=False), # 4 token_program
378
+ AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=False), # 5 config_account
379
+ AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True), # 6 treasury_account
380
+ ]
381
+ )
382
+
383
+
384
+
385
+
386
+
387
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
388
+
389
+ tx = Transaction(
390
+ message=Message(instructions=[ix_program], payer=payer_pubkey),
391
+ recent_blockhash=blockhash,
392
+ from_keypairs=[payer]
393
+ )
394
+
395
+ sig = self.provider.send_transaction(tx, opts=TxOpts(skip_preflight=True)).value
396
+
397
+ return {
398
+ "pda_pubkey": str(pda_pubkey),
399
+ "signature": str(sig)
400
+ }
401
+
402
+ async def init_swap_cheque(self,tokenIn, tokenOut, amoutIn, amountOut,recepient,CHEQUE_SPACE = 115):
403
+ client = AsyncClient(self.rpc_url)
404
+ tokenA = AsyncToken(
405
+ client,
406
+ Pubkey.from_string(tokenIn),
407
+ TOKEN_PROGRAM_ID,
408
+ self.key
409
+ )
410
+ tokenInDecimals = (await tokenA.get_mint_info()).decimals
411
+ tokenB = AsyncToken(
412
+ client,
413
+ Pubkey.from_string(tokenOut),
414
+ TOKEN_PROGRAM_ID,
415
+ self.key
416
+ )
417
+
418
+ tokenOutDecimals = (await tokenB.get_mint_info()).decimals
419
+ amoutIn = int(amoutIn * (10 ** tokenInDecimals))
420
+ amountOut = int(amountOut * (10 ** tokenOutDecimals))
421
+ cheque_acc = solders.keypair.Keypair()
422
+ cheque_pubkey = cheque_acc.pubkey()
423
+ payer_pubkey = self.key.pubkey()
424
+ rent = self.provider.get_minimum_balance_for_rent_exemption(CHEQUE_SPACE).value
425
+
426
+ create_cheque_ix = create_account(
427
+ CreateAccountParams(
428
+ from_pubkey=payer_pubkey,
429
+ to_pubkey=cheque_pubkey,
430
+ lamports=rent,
431
+ space=CHEQUE_SPACE,
432
+ owner=PROGRAM_ID
433
+ )
434
+ )
435
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
436
+
437
+ tx1 = Transaction(
438
+ message=Message(instructions=[create_cheque_ix], payer=payer_pubkey),
439
+ recent_blockhash=blockhash,
440
+ from_keypairs=[self.key, cheque_acc]
441
+ )
442
+ self.provider.send_transaction(tx1, opts=TxOpts(skip_preflight=True))
443
+
444
+ ix_create_ata = create_associated_token_account(
445
+ payer=payer_pubkey,
446
+ owner=cheque_pubkey,
447
+ mint=Pubkey.from_string(tokenIn)
448
+ )
449
+
450
+
451
+ sender_ata = get_associated_token_address(payer_pubkey, Pubkey.from_string(tokenIn))
452
+ cheque_ata = get_associated_token_address(cheque_pubkey, Pubkey.from_string(tokenIn))
453
+
454
+
455
+ data = bytes([4]) + struct.pack("<Q", amoutIn) + struct.pack("<Q", amountOut) + bytes(Pubkey.from_string(recepient))
456
+ swap_cheque = Instruction(
457
+ program_id=PROGRAM_ID,
458
+ data=data,
459
+ accounts=[
460
+ AccountMeta(payer_pubkey, is_signer=True,is_writable=True),
461
+ AccountMeta(cheque_pubkey, is_signer=True, is_writable=True),
462
+ AccountMeta(Pubkey.from_string(tokenIn), is_signer=False, is_writable=False),
463
+ AccountMeta(Pubkey.from_string(tokenOut), is_signer=False, is_writable=False),
464
+ AccountMeta(sender_ata, is_signer=False, is_writable=True),
465
+ AccountMeta(cheque_ata, is_signer=False,is_writable=True),
466
+ AccountMeta(TOKEN_PROGRAM_ID, is_signer=False,is_writable=False)
467
+
468
+ ]
469
+ )
470
+ print("accounts:")
471
+
472
+ # for i in swap_cheque["accunts"]:
473
+ # print (i)
474
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
475
+
476
+ tx2 = Transaction(
477
+ message=Message(instructions=[ix_create_ata,swap_cheque], payer=payer_pubkey),
478
+ recent_blockhash=blockhash,
479
+ from_keypairs=[self.key, cheque_acc]
480
+ )
481
+ sig = self.provider.send_transaction(tx2, opts=TxOpts(skip_preflight=True)).value
482
+ return {
483
+ "cheque_key": str(cheque_acc),
484
+ "cheque_pda": str(cheque_pubkey),
485
+ "signature": str(sig)
246
486
  }
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 0.2.0.28
3
+ Version: 1.0.0
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
@@ -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
 
@@ -0,0 +1,16 @@
1
+ shadowPaySDK/__init__.py,sha256=CMwAuP_6hJN-WueU-XlTNta9Oyd28sFo8OojdgD_pxA,681
2
+ shadowPaySDK/const.py,sha256=30WE442-C_wQ2cwmIMrcTF0nIB23nRlnExwu-g45Zsg,11710
3
+ shadowPaySDK/interface/__init__.py,sha256=ggSZCV22udnzXm_Wv_3x6VN3hNIAEiwgwHZc2Jwc688,146
4
+ shadowPaySDK/interface/erc20.py,sha256=zUTdwhf1hznSGxeEw0HsEFVf1nafHPcxj1X3djPczSo,4477
5
+ shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
6
+ shadowPaySDK/interface/sol.py,sha256=b16odfGiNrNVd71Jl4yaYZx6s-hlTfpOqiqILxgsnLQ,7985
7
+ shadowPaySDK/types/EVMcheque.py,sha256=RFhvTb-etNz2vF5x9WvDNNbjM84JHHJkd3V1wyURWv0,17912
8
+ shadowPaySDK/types/SOLcheque.py,sha256=tAcJPPvP43F-I9Gae1t3NP4R6WsttqypQ1hu5PjSGYc,20428
9
+ shadowPaySDK/types/__init__.py,sha256=sG6pNZfKGvENXqsnv6MrQtKrJ898fAXkMvAZY1k1-Qg,97
10
+ shadowPaySDK/utils/__init__.py,sha256=aja3iYO4rT-ptMM-pzw0GRFTziBdXdcEi-4kE84zH64,61
11
+ shadowPaySDK/utils/utils.py,sha256=g4bGvLDdjhNGsAj1eaZnNWFNaiN-cVhhM-5PrnG5aIQ,720
12
+ shadowpaysdk-1.0.0.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
13
+ shadowpaysdk-1.0.0.dist-info/METADATA,sha256=jQ-oeRAzikyu9YGRokqO3mDYTc9NQP4P6Q536Mw8t_M,1039
14
+ shadowpaysdk-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ shadowpaysdk-1.0.0.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
16
+ shadowpaysdk-1.0.0.dist-info/RECORD,,
shadowPaySDK/api.py DELETED
@@ -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
@@ -1,17 +0,0 @@
1
- shadowPaySDK/__init__.py,sha256=CMwAuP_6hJN-WueU-XlTNta9Oyd28sFo8OojdgD_pxA,681
2
- shadowPaySDK/api.py,sha256=cv5Z171cOh-Idi-lMA4AORzeGDPPrk8BCQ9e5V9MAaM,1461
3
- shadowPaySDK/const.py,sha256=ogzTSFbJ_hQK49qEo2ZfxPiI_CTZLh7a706OKN41KYM,10140
4
- shadowPaySDK/interface/__init__.py,sha256=ggSZCV22udnzXm_Wv_3x6VN3hNIAEiwgwHZc2Jwc688,146
5
- shadowPaySDK/interface/erc20.py,sha256=7p8eU5LzhI2MsH80PZhq6IRhbfMGlNYucGl3OtyS9SI,4669
6
- shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
7
- shadowPaySDK/interface/sol.py,sha256=TDp62OtQkR8Wy9I4UBVmL_K_FQeMVS--Lojgbvq5T2E,8146
8
- shadowPaySDK/types/EVMcheque.py,sha256=8M1EzpZGqf4uidrd9yDKiR7BvIl85p93A_9AMZtshSs,14570
9
- shadowPaySDK/types/SOLcheque.py,sha256=QxRJVPQKOn3n0Y0FQf4REjt0-garpp-L2E9B9PddDTA,10414
10
- shadowPaySDK/types/__init__.py,sha256=sG6pNZfKGvENXqsnv6MrQtKrJ898fAXkMvAZY1k1-Qg,97
11
- shadowPaySDK/utils/__init__.py,sha256=aja3iYO4rT-ptMM-pzw0GRFTziBdXdcEi-4kE84zH64,61
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,,