shadowPaySDK 16.7.2025.259__py3-none-any.whl → 16.7.2025.513__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.
@@ -468,7 +468,7 @@ class Cheque:
468
468
  "amountOut": s[1],
469
469
  "spender": s[2],
470
470
  "receiver": s[3],
471
- "claimed": "claimed" if s[4] else "unclaimed"
471
+ "status": "claimed" if s[4] else "unclaimed"
472
472
  }
473
473
 
474
474
  class NFTcheque:
@@ -18,7 +18,7 @@ from solders.message import Message
18
18
  import spl
19
19
  import spl.token
20
20
  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
21
+ from spl.token.instructions import get_associated_token_address, create_associated_token_account, TransferCheckedParams, transfer_checked, transfer, close_account, TransferParams
22
22
  from solders.system_program import transfer as ts
23
23
  from solders.system_program import TransferParams as tsf
24
24
  from solders.pubkey import Pubkey
@@ -204,79 +204,100 @@ class SOLCheque:
204
204
 
205
205
  # init_token_cheque need fix...
206
206
 
207
- def init_token_cheque(self, token_mint: str, token_amount,token_decimals, recipient: str, treasury: str, CHEQUE_SPACE: int = 105):
207
+ def init_token_cheque(
208
+ self,
209
+ token_mint: str,
210
+ token_amount,
211
+ token_decimals,
212
+ recipient: str,
213
+ CHEQUE_SPACE: int = 155
214
+ ):
208
215
  if not self.key:
209
216
  raise ValueError("Keypair not set")
210
217
 
211
218
  payer = self.key
212
219
  payer_pubkey = payer.pubkey()
220
+
213
221
  token_mint_pubkey = Pubkey.from_string(token_mint)
214
222
  recipient_pubkey = Pubkey.from_string(recipient)
215
- treasury_pubkey = Pubkey.from_string(treasury)
216
223
 
217
224
  cheque_acc = solders.keypair.Keypair()
218
- cheque_pda = cheque_acc.pubkey()
225
+ cheque_pubkey = cheque_acc.pubkey()
219
226
 
220
227
  rent = self.provider.get_minimum_balance_for_rent_exemption(CHEQUE_SPACE).value
221
228
 
222
- create_cheque_acc = create_account(
229
+ # 1. Create raw cheque account
230
+ create_cheque_ix = create_account(
223
231
  CreateAccountParams(
224
232
  from_pubkey=payer_pubkey,
225
- to_pubkey=cheque_pda,
233
+ to_pubkey=cheque_pubkey,
226
234
  lamports=rent,
227
235
  space=CHEQUE_SPACE,
228
236
  owner=PROGRAM_ID
229
237
  )
230
238
  )
231
239
 
240
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
241
+
232
242
  tx1 = Transaction(
233
- message=Message(instructions=[create_cheque_acc], payer=payer_pubkey),
234
- recent_blockhash=self.provider.get_latest_blockhash().value.blockhash,
243
+ message=Message(instructions=[create_cheque_ix], payer=payer_pubkey),
244
+ recent_blockhash=blockhash,
235
245
  from_keypairs=[payer, cheque_acc]
236
246
  )
237
247
  self.provider.send_transaction(tx1, opts=TxOpts(skip_preflight=True))
238
248
 
239
- sender_ata = get_associated_token_address(payer_pubkey, token_mint_pubkey)
240
- cheque_ata = get_associated_token_address(cheque_pda, token_mint_pubkey)
241
- treasury_ata = get_associated_token_address(treasury_pubkey, token_mint_pubkey)
242
-
243
- ix_create_ata = create_associated_token_account(payer_pubkey, cheque_pda, token_mint_pubkey)
244
-
245
- amount = int(token_amount * (10 ** token_decimals))
246
249
 
247
250
 
251
+ ata_ix = create_associated_token_account(
252
+ payer=payer_pubkey,
253
+ owner=cheque_pubkey,
254
+ mint=token_mint_pubkey
255
+ )
256
+ cfg = self.get_config()
257
+ tressary = cfg["treasury"]
258
+ sender_ata = get_associated_token_address(payer_pubkey, token_mint_pubkey)
259
+ cheque_ata = get_associated_token_address(cheque_pubkey, token_mint_pubkey)
248
260
 
249
- data = bytes([2]) + struct.pack("<Q", amount)
261
+ # 4. Prepare your program instruction
262
+ amount = int(token_amount * (10 ** token_decimals))
263
+ data = bytes([2]) + struct.pack("<Q", amount) + bytes(recipient_pubkey)
250
264
 
251
265
  ix_program = Instruction(
252
266
  program_id=PROGRAM_ID,
253
267
  data=data,
254
268
  accounts=[
255
- AccountMeta(payer_pubkey, is_signer=True, is_writable=True),
256
- AccountMeta(cheque_pda, is_signer=True, is_writable=True),
257
- AccountMeta(token_mint_pubkey, is_signer=False, is_writable=True),
258
- AccountMeta(sender_ata, is_signer=False, is_writable=True),
259
- AccountMeta(cheque_ata, is_signer=False, is_writable=True),
260
- AccountMeta(treasury_ata, is_signer=False, is_writable=True),
261
- AccountMeta(Pubkey.from_string("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), is_signer=False, is_writable=False),
269
+ AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True), # 0 initializer
270
+ AccountMeta(pubkey=cheque_pubkey, is_signer=True, is_writable=True), # 1 cheque_pda
271
+ AccountMeta(pubkey=token_mint_pubkey, is_signer=False, is_writable=True), # 2 mint
272
+ AccountMeta(pubkey=sender_ata, is_signer=False, is_writable=True), # 3 sender ATA
273
+ AccountMeta(pubkey=cheque_ata, is_signer=False, is_writable=True), # 4 cheque ATA
274
+ AccountMeta(pubkey=TOKEN_PROGRAM_ID, is_signer=False, is_writable=False), # 5 token program
275
+ AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=False), # 6 config PDA
276
+ AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True), # 7 treasury ATA
262
277
  ]
263
278
  )
264
279
 
280
+
265
281
  print("Accounts (ix_program):")
266
282
  for i, acc in enumerate(ix_program.accounts):
267
283
  print(f"[{i}] {acc.pubkey} | signer={acc.is_signer} | writable={acc.is_writable}")
268
284
 
285
+ # 5. Send final transaction with ATA crea tion + program call
286
+ blockhash = self.provider.get_latest_blockhash().value.blockhash
269
287
  tx2 = Transaction(
270
- message=Message(instructions=[ix_create_ata, ix_program], payer=payer_pubkey),
271
- recent_blockhash=self.provider.get_latest_blockhash().value.blockhash,
288
+ message=Message(instructions=[ata_ix, ix_program], payer=payer_pubkey),
289
+ recent_blockhash=blockhash,
272
290
  from_keypairs=[payer, cheque_acc]
273
291
  )
274
292
 
275
293
  sig = self.provider.send_transaction(tx2, opts=TxOpts(skip_preflight=True)).value
294
+
276
295
  return {
277
- "cheque_pda": str(cheque_pda),
296
+ "cheque_pubkey": str(cheque_pubkey),
278
297
  "signature": str(sig),
279
298
  "amount": token_amount
280
299
  }
300
+
301
+
281
302
  def claim_token_cheque(self, pda_acc: str):
282
303
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shadowPaySDK
3
- Version: 16.7.2025.259
3
+ Version: 16.7.2025.513
4
4
  Summary: ShadowPay SDK for ERC20/ERC721 and P2P smart contract interaction
5
5
  Author: dazay
6
6
  Author-email: shadowpay.protocol@gmail.com
@@ -4,13 +4,13 @@ shadowPaySDK/interface/__init__.py,sha256=ggSZCV22udnzXm_Wv_3x6VN3hNIAEiwgwHZc2J
4
4
  shadowPaySDK/interface/erc20.py,sha256=zUTdwhf1hznSGxeEw0HsEFVf1nafHPcxj1X3djPczSo,4477
5
5
  shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
6
6
  shadowPaySDK/interface/sol.py,sha256=LsgwE8BzCstsVAxgcbKcYiXAORYMBHcQmNZdzsNkaLQ,7998
7
- shadowPaySDK/types/EVMcheque.py,sha256=pWXKD8m1cTRPV0sPH1nJiUWxP92tOgdmWx9DCSZKMCs,17913
8
- shadowPaySDK/types/SOLcheque.py,sha256=ZzQgQXBerwa9lelbV8O6JBr1nevCAmJDxrdo8FtKT-4,11795
7
+ shadowPaySDK/types/EVMcheque.py,sha256=RFhvTb-etNz2vF5x9WvDNNbjM84JHHJkd3V1wyURWv0,17912
8
+ shadowPaySDK/types/SOLcheque.py,sha256=QJnYumMxyFyqd34-Q7Wvx2YLlwpum6MynBeZi7AW1Dc,12417
9
9
  shadowPaySDK/types/__init__.py,sha256=sG6pNZfKGvENXqsnv6MrQtKrJ898fAXkMvAZY1k1-Qg,97
10
10
  shadowPaySDK/utils/__init__.py,sha256=aja3iYO4rT-ptMM-pzw0GRFTziBdXdcEi-4kE84zH64,61
11
11
  shadowPaySDK/utils/utils.py,sha256=g4bGvLDdjhNGsAj1eaZnNWFNaiN-cVhhM-5PrnG5aIQ,720
12
- shadowpaysdk-16.7.2025.259.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
13
- shadowpaysdk-16.7.2025.259.dist-info/METADATA,sha256=Kfg9Rd5Pu3S4mLZc0SSH6lNjJFWxP0TBTBY1_TNLuW8,1047
14
- shadowpaysdk-16.7.2025.259.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- shadowpaysdk-16.7.2025.259.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
16
- shadowpaysdk-16.7.2025.259.dist-info/RECORD,,
12
+ shadowpaysdk-16.7.2025.513.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
13
+ shadowpaysdk-16.7.2025.513.dist-info/METADATA,sha256=XH8OeixabyrHHD1t9NZA2krSnIUwyRm86_5J8_FywTg,1047
14
+ shadowpaysdk-16.7.2025.513.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ shadowpaysdk-16.7.2025.513.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
16
+ shadowpaysdk-16.7.2025.513.dist-info/RECORD,,