shadowPaySDK 16.7.2025.513__py3-none-any.whl → 16.7.2025.514__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/types/SOLcheque.py +70 -3
- {shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/METADATA +1 -1
- {shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/RECORD +6 -6
- {shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/WHEEL +0 -0
- {shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/licenses/LICENSE +0 -0
- {shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/top_level.txt +0 -0
shadowPaySDK/types/SOLcheque.py
CHANGED
@@ -94,6 +94,29 @@ class SOLCheque:
|
|
94
94
|
"token_out_bps": token_out_bps,
|
95
95
|
"initialized": initialized,
|
96
96
|
}
|
97
|
+
def parse_token_cheque_data(self,pda):
|
98
|
+
if isinstance(pda, str):
|
99
|
+
pda_pubkey = Pubkey.from_string(pda)
|
100
|
+
pda_pubkey = pda
|
101
|
+
response = self.provider.get_account_info(pda_pubkey)
|
102
|
+
if response.value is None:
|
103
|
+
return None
|
104
|
+
|
105
|
+
raw_data = bytes(response.value.data)
|
106
|
+
id = int.from_bytes(raw_data[0:8], "little")
|
107
|
+
amount = int.from_bytes(raw_data[8:16], "little")
|
108
|
+
mint = Pubkey.from_bytes(raw_data[16:48])
|
109
|
+
recipient = Pubkey.from_bytes(raw_data[48:80])
|
110
|
+
claimed = raw_data[80] != 0
|
111
|
+
|
112
|
+
return {
|
113
|
+
"id": id,
|
114
|
+
"amount": amount,
|
115
|
+
"mint": str(mint),
|
116
|
+
"recipient": str(recipient),
|
117
|
+
"claimed": claimed,
|
118
|
+
}
|
119
|
+
|
97
120
|
def set_params(self, rpc_url = None, key = None):
|
98
121
|
if rpc_url:
|
99
122
|
self.rpc_url = rpc_url
|
@@ -202,7 +225,7 @@ class SOLCheque:
|
|
202
225
|
"pda_account": pda_acc,
|
203
226
|
}
|
204
227
|
|
205
|
-
# init_token_cheque
|
228
|
+
# init_token_cheque work succesfuly
|
206
229
|
|
207
230
|
def init_token_cheque(
|
208
231
|
self,
|
@@ -299,5 +322,49 @@ class SOLCheque:
|
|
299
322
|
}
|
300
323
|
|
301
324
|
|
302
|
-
def claim_token_cheque(self,
|
303
|
-
|
325
|
+
def claim_token_cheque(self, pda_acc: str):
|
326
|
+
payer = self.key
|
327
|
+
payer_pubkey = payer.pubkey()
|
328
|
+
pada_acc = solders.keypair.Keypair.from_base58_string(pda_acc)
|
329
|
+
pda_pubkey = pada_acc.pubkey()
|
330
|
+
cheque_data = self.parse_token_cheque_data(pda=solders.keypair.Keypair.from_base58_string(pda_acc).pubkey())
|
331
|
+
|
332
|
+
cheque_token_account = get_associated_token_address(pda_pubkey, Pubkey.from_string(cheque_data["mint"]))
|
333
|
+
recipient_token_account = get_associated_token_address(
|
334
|
+
Pubkey.from_string(cheque_data["recipient"]), Pubkey.from_string(cheque_data["mint"])
|
335
|
+
)
|
336
|
+
cfg = self.get_config()
|
337
|
+
tressary = cfg["treasury"]
|
338
|
+
data = bytes([3])
|
339
|
+
ix_program = Instruction(
|
340
|
+
program_id=PROGRAM_ID,
|
341
|
+
data=bytes([3]),
|
342
|
+
accounts=[
|
343
|
+
AccountMeta(pubkey=payer_pubkey, is_signer=True, is_writable=True), # 0 claimer
|
344
|
+
AccountMeta(pubkey=pda_pubkey, is_signer=False, is_writable=True), # 1 cheque_pda
|
345
|
+
AccountMeta(pubkey=cheque_token_account, is_signer=False, is_writable=True), # 2 cheque_token_account
|
346
|
+
AccountMeta(pubkey=recipient_token_account, is_signer=False, is_writable=True), # 3 recipient_token_account
|
347
|
+
AccountMeta(pubkey=TOKEN_PROGRAM_ID, is_signer=False, is_writable=False), # 4 token_program
|
348
|
+
AccountMeta(pubkey=CONFIG_PDA[0], is_signer=False, is_writable=False), # 5 config_account
|
349
|
+
AccountMeta(pubkey=Pubkey.from_string(tressary), is_signer=False, is_writable=True), # 6 treasury_account
|
350
|
+
]
|
351
|
+
)
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
blockhash = self.provider.get_latest_blockhash().value.blockhash
|
358
|
+
|
359
|
+
tx = Transaction(
|
360
|
+
message=Message(instructions=[ix_program], payer=payer_pubkey),
|
361
|
+
recent_blockhash=blockhash,
|
362
|
+
from_keypairs=[payer]
|
363
|
+
)
|
364
|
+
|
365
|
+
sig = self.provider.send_transaction(tx, opts=TxOpts(skip_preflight=True)).value
|
366
|
+
|
367
|
+
return {
|
368
|
+
"pda_pubkey": str(pda_pubkey),
|
369
|
+
"signature": str(sig)
|
370
|
+
}
|
@@ -5,12 +5,12 @@ shadowPaySDK/interface/erc20.py,sha256=zUTdwhf1hznSGxeEw0HsEFVf1nafHPcxj1X3djPcz
|
|
5
5
|
shadowPaySDK/interface/erc721.py,sha256=4AlWfDjrvl85wFocnN93j-oM54kTsLLwv9SdtcLj4eM,3094
|
6
6
|
shadowPaySDK/interface/sol.py,sha256=LsgwE8BzCstsVAxgcbKcYiXAORYMBHcQmNZdzsNkaLQ,7998
|
7
7
|
shadowPaySDK/types/EVMcheque.py,sha256=RFhvTb-etNz2vF5x9WvDNNbjM84JHHJkd3V1wyURWv0,17912
|
8
|
-
shadowPaySDK/types/SOLcheque.py,sha256=
|
8
|
+
shadowPaySDK/types/SOLcheque.py,sha256=uPFXw-rCRw6DftpgHj9F262fAq7ZL_WAvY3RkCN3p0w,15512
|
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.
|
13
|
-
shadowpaysdk-16.7.2025.
|
14
|
-
shadowpaysdk-16.7.2025.
|
15
|
-
shadowpaysdk-16.7.2025.
|
16
|
-
shadowpaysdk-16.7.2025.
|
12
|
+
shadowpaysdk-16.7.2025.514.dist-info/licenses/LICENSE,sha256=EG13vNmyBfkG3oKj40oOYfUGLKko8OouU6PfO6MlAk4,1066
|
13
|
+
shadowpaysdk-16.7.2025.514.dist-info/METADATA,sha256=piIWUez5L_kak2sK2vQUR_fu6tkmywCwuM6FXfewyyE,1047
|
14
|
+
shadowpaysdk-16.7.2025.514.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
15
|
+
shadowpaysdk-16.7.2025.514.dist-info/top_level.txt,sha256=RSJc73GEf31NMdZp9KovEduzfhm10eQ2t5GTZ44aN1U,13
|
16
|
+
shadowpaysdk-16.7.2025.514.dist-info/RECORD,,
|
File without changes
|
{shadowpaysdk-16.7.2025.513.dist-info → shadowpaysdk-16.7.2025.514.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|