shadowPaySDK 16.7.2025.512__tar.gz → 16.7.2025.513__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.
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/PKG-INFO +1 -1
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/setup.py +1 -1
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/types/SOLcheque.py +47 -26
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/PKG-INFO +1 -1
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/LICENSE +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/README.md +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/setup.cfg +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/__init__.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/const.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/interface/__init__.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/interface/erc20.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/interface/erc721.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/interface/sol.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/types/EVMcheque.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/types/__init__.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/utils/__init__.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/utils/utils.py +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/SOURCES.txt +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/dependency_links.txt +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/requires.txt +0 -0
- {shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/top_level.txt +0 -0
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='shadowPaySDK',
|
5
|
-
version='16.7.2025.
|
5
|
+
version='16.7.2025.513',
|
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',
|
@@ -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(
|
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
|
-
|
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
|
-
|
229
|
+
# 1. Create raw cheque account
|
230
|
+
create_cheque_ix = create_account(
|
223
231
|
CreateAccountParams(
|
224
232
|
from_pubkey=payer_pubkey,
|
225
|
-
to_pubkey=
|
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=[
|
234
|
-
recent_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
|
-
|
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(
|
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(
|
261
|
-
AccountMeta(
|
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=[
|
271
|
-
recent_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
|
-
"
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK/interface/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/dependency_links.txt
RENAMED
File without changes
|
{shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/requires.txt
RENAMED
File without changes
|
{shadowpaysdk-16.7.2025.512 → shadowpaysdk-16.7.2025.513}/shadowPaySDK.egg-info/top_level.txt
RENAMED
File without changes
|