safeheron-api-sdk-python 1.1.22__tar.gz → 1.1.24__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.
Files changed (26) hide show
  1. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/LICENSE +1 -1
  2. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/PKG-INFO +1 -1
  3. safeheron_api_sdk_python-1.1.24/safeheron_api_sdk_python/api/compliance_api.py +68 -0
  4. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/gas_api.py +13 -3
  5. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/tools.py +0 -53
  6. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python.egg-info/PKG-INFO +1 -1
  7. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/setup.py +1 -1
  8. safeheron_api_sdk_python-1.1.22/safeheron_api_sdk_python/api/compliance_api.py +0 -19
  9. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/README.rst +0 -0
  10. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/account_api.py +0 -0
  11. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/api_key_management_api.py +0 -0
  12. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/coin_api.py +0 -0
  13. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/mpc_sign_api.py +0 -0
  14. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/tools_api.py +0 -0
  15. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/transaction_api.py +0 -0
  16. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/web3_api.py +0 -0
  17. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/webhook_api.py +0 -0
  18. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/api/whitelist_api.py +0 -0
  19. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/client.py +0 -0
  20. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/cosigner/co_signer_converter.py +0 -0
  21. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python/webhook/webhook_converter.py +0 -0
  22. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python.egg-info/SOURCES.txt +0 -0
  23. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python.egg-info/dependency_links.txt +0 -0
  24. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python.egg-info/requires.txt +0 -0
  25. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/safeheron_api_sdk_python.egg-info/top_level.txt +0 -0
  26. {safeheron_api_sdk_python-1.1.22 → safeheron_api_sdk_python-1.1.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Safeheron Inc.
3
+ Copyright (c) 2026 Safeheron Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: safeheron_api_sdk_python
3
- Version: 1.1.22
3
+ Version: 1.1.24
4
4
  Summary: Python for Safeheron API
5
5
  Home-page: https://github.com/Safeheron/safeheron-api-sdk-python
6
6
  Author: safeheron
@@ -0,0 +1,68 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class KytReportRequest:
5
+ def __init__(self):
6
+ # Transaction Key. Cannot be empty at the same time as customerRefId. If both are provided, txKey takes precedence
7
+ self.txKey = None
8
+ # Merchant unique business ID (100 characters max)
9
+ self.customerRefId = None
10
+
11
+
12
+ class CreateKyaScreeningRequest:
13
+ def __init__(self):
14
+ # On-chain address to screen (not limited to Safeheron addresses)
15
+ self.address = None
16
+ # Chain type. See "Retrieve Supported Networks & Providers" for valid values
17
+ self.chainType = None
18
+ # Blockchain network identifier. Required when providers contains MistTrack
19
+ self.network = None
20
+ # Screening providers — at least one, no duplicates, screened in parallel. Valid values: MistTrack, Elliptic, Chainalysis
21
+ self.providers = None
22
+
23
+
24
+ class KyaScreeningOneRequest:
25
+ def __init__(self):
26
+ # Screening request ID
27
+ self.screenId = None
28
+
29
+
30
+ class KyaScreeningOrderOneRequest:
31
+ def __init__(self):
32
+ # Screening order ID
33
+ self.screenOrderId = None
34
+
35
+
36
+ class KyaSupportedNetworksRequest:
37
+ def __init__(self):
38
+ pass
39
+
40
+
41
+ class ComplianceApi:
42
+
43
+ def __init__(self, config):
44
+ self.api_client = Client(config)
45
+
46
+ # Retrieve Transaction KYT Report
47
+ def kyt_report(self, request: KytReportRequest):
48
+ return self.api_client.send_request(request, '/v1/compliance/kyt/report')
49
+
50
+ # Create KYA Screening Request
51
+ # Initiates an address screening request against one or more AML providers in parallel
52
+ def create_kya_screening(self, request: CreateKyaScreeningRequest):
53
+ return self.api_client.send_request(request, '/v1/compliance/kya/screening/create')
54
+
55
+ # Retrieve KYA Screening Summary
56
+ # Returns the overall status and per-order results for a screening request
57
+ def kya_screening_one(self, request: KyaScreeningOneRequest):
58
+ return self.api_client.send_request(request, '/v1/compliance/kya/screening/one')
59
+
60
+ # Retrieve KYA Screening Order Details
61
+ # Returns the detailed result of a single provider screening order, including the raw provider payload
62
+ def kya_screening_order_one(self, request: KyaScreeningOrderOneRequest):
63
+ return self.api_client.send_request(request, '/v1/compliance/kya/screening/order/one')
64
+
65
+ # Retrieve Supported Networks & Providers
66
+ # Returns the list of blockchain networks and the AML providers that support each network
67
+ def kya_supported_networks(self):
68
+ return self.api_client.send_request(KyaSupportedNetworksRequest(), '/v1/compliance/kya/supportedNetworks')
@@ -1,4 +1,10 @@
1
1
  from safeheron_api_sdk_python.client import *
2
+
3
+ class GasStatusRequest:
4
+ def __init__(self):
5
+ # networkMode
6
+ self.networkMode = None
7
+
2
8
  class GasTransactionsGetByTxKeyRequest:
3
9
  def __init__(self):
4
10
  # Transaction key, obtained from transactions created via the Create a Transaction V3 API, App, or Web Console.
@@ -12,10 +18,14 @@ class GasApi:
12
18
 
13
19
  # Retrieve Gas Balance
14
20
  # Retrieve your Gas balance for the TRON energy rental service.
15
- def gas_status(self):
16
- return self.api_client.send_request(None, '/v1/gas/status')
21
+ def gas_status(self, request: GasStatusRequest):
22
+ return self.api_client.send_request(request, '/v1/gas/status')
23
+
24
+ #@deprecated: This method has been abandoned, please use the gas_transactions_get_by_tx_key
25
+ def gas_transactions_ge_b_tx_key(self, request: GasTransactionsGetByTxKeyRequest):
26
+ return self.api_client.send_request(request, '/v1/gas/transactions/getByTxKey')
17
27
 
18
28
  # Retrieve Automatic Gas Records for Transactions
19
29
  # When the TRON energy rental service is enabled, Safeheron automatically tops up the required Gas fees for TRON network transactions. This API allows you to query the energy rental records used by a transaction. A single transaction may have multiple records. The actual Gas fee consumed by the transaction is the sum of all records with SUCCESS and FAILURE_GAS_CONSUMED statuses.
20
- def gas_transactions_ge_b_tx_key(self, request: GasTransactionsGetByTxKeyRequest):
30
+ def gas_transactions_get_by_tx_key(self, request: GasTransactionsGetByTxKeyRequest):
21
31
  return self.api_client.send_request(request, '/v1/gas/transactions/getByTxKey')
@@ -274,59 +274,6 @@ def decrypt_response(response_dict, platform_rsa_pk, api_user_rsa_sk):
274
274
 
275
275
  return json.loads(r.decode())
276
276
 
277
- #Used for webhook decryption callback request data
278
- def decrypt_request(response_dict, verify_rsa_pk, decrypt_rsa_sk):
279
- verify_rsa_pk = get_rsa_key(PEM_PUBLIC_HEAD + verify_rsa_pk + PEM_PUBLIC_END)
280
- decrypt_rsa_sk = get_rsa_key(decrypt_rsa_sk)
281
- # 1 rsa verify
282
- sig = response_dict.pop('sig')
283
- need_sign_message = sort_request(response_dict)
284
- v = rsa_verify(verify_rsa_pk, need_sign_message, sig)
285
- if not v:
286
- raise Exception("rsa verify: false")
287
-
288
- # 2 get aes key and iv
289
- aes_data = rsa_decrypt(decrypt_rsa_sk, response_dict['key'])
290
- aes_key = aes_data[0:32]
291
- aes_iv = aes_data[32:48]
292
-
293
- # 3 aes decrypt data, get response data
294
- r = aes_decrypt(aes_key, aes_iv, b64decode(response_dict['bizContent']))
295
-
296
- return json.loads(r.decode())
297
-
298
- #For webhook to send encrypted response content
299
- def encrypt_response(raw_data,encrpyt_rsa_pk, sign_rsa_sk):
300
- encrpyt_rsa_pk = get_rsa_key(PEM_PUBLIC_HEAD + encrpyt_rsa_pk + PEM_PUBLIC_END)
301
- sign_rsa_sk = get_rsa_key(sign_rsa_sk)
302
- ret = dict()
303
- # prepare aes key and iv
304
- aes_key = get_random_bytes(32)
305
- aes_iv = get_random_bytes(16)
306
- res_data = json.dumps(raw_data).replace('\n', '').encode('utf-8')
307
-
308
- # 1 rsa encrypt aes key + iv
309
- aes_data = aes_key + aes_iv
310
- ret['key'] = rsa_encrypt(encrpyt_rsa_pk, aes_data)
311
-
312
- # 2 aes encrypt request data
313
- aes_encrypted_bytes = aes_encrypt(aes_key, aes_iv, res_data)
314
- ret['bizContent'] = b64encode(aes_encrypted_bytes).decode()
315
-
316
- # 3 set timestamp , no need to add
317
- ret['timestamp'] = str(int(time.time() * 1000))
318
-
319
- # 4 code
320
- ret['code'] = "200"
321
-
322
- # 5 message
323
- ret['message'] = "callback_ok"
324
-
325
- # 6 sign request
326
- need_sign_message = sort_request(ret)
327
- ret['sig'] = rsa_sign(sign_rsa_sk, need_sign_message)
328
- return ret
329
-
330
277
  def rsa_gen_key():
331
278
  rsa_key = RSA.generate(4096)
332
279
  sk = rsa_key.export_key()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: safeheron_api_sdk_python
3
- Version: 1.1.22
3
+ Version: 1.1.24
4
4
  Summary: Python for Safeheron API
5
5
  Home-page: https://github.com/Safeheron/safeheron-api-sdk-python
6
6
  Author: safeheron
@@ -3,7 +3,7 @@ from setuptools import find_packages
3
3
  with open("README.rst", "r") as f:
4
4
  long_description = f.read()
5
5
  setup(name='safeheron_api_sdk_python',
6
- version='1.1.22',
6
+ version='1.1.24',
7
7
  description='Python for Safeheron API',
8
8
  long_description=long_description,
9
9
  author='safeheron',
@@ -1,19 +0,0 @@
1
- from safeheron_api_sdk_python.client import *
2
-
3
-
4
- class KytReportRequest:
5
- def __init__(self):
6
- # Transaction Key. Cannot be empty at the same time as customerRefId. If both are provided, txKey takes precedence
7
- self.txKey = None
8
- # Merchant unique business ID (100 characters max)
9
- self.customerRefId = None
10
-
11
-
12
- class ComplianceApi:
13
-
14
- def __init__(self, config):
15
- self.api_client = Client(config)
16
-
17
- # Retrieve Transaction KYT Report
18
- def kyt_report(self, request: KytReportRequest):
19
- return self.api_client.send_request(request, '/v1/compliance/kyt/report')