safeheron-api-sdk-python 1.1.20__tar.gz → 1.1.21__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 (24) hide show
  1. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/PKG-INFO +1 -1
  2. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/account_api.py +8 -1
  3. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/web3_api.py +11 -0
  4. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/tools.py +9 -10
  5. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/PKG-INFO +1 -1
  6. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/setup.py +1 -1
  7. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/LICENSE +0 -0
  8. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/README.rst +0 -0
  9. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/api_key_management_api.py +0 -0
  10. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/coin_api.py +0 -0
  11. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/gas_api.py +0 -0
  12. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/mpc_sign_api.py +0 -0
  13. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/tools_api.py +0 -0
  14. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/transaction_api.py +0 -0
  15. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/webhook_api.py +0 -0
  16. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/whitelist_api.py +0 -0
  17. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/client.py +0 -0
  18. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/cosigner/co_signer_converter.py +0 -0
  19. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/webhook/webhook_converter.py +0 -0
  20. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/SOURCES.txt +0 -0
  21. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/dependency_links.txt +0 -0
  22. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/requires.txt +0 -0
  23. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/top_level.txt +0 -0
  24. {safeheron_api_sdk_python-1.1.20 → safeheron_api_sdk_python-1.1.21}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: safeheron_api_sdk_python
3
- Version: 1.1.20
3
+ Version: 1.1.21
4
4
  Summary: Python for Safeheron API
5
5
  Home-page: https://github.com/Safeheron/safeheron-api-sdk-python
6
6
  Author: safeheron
@@ -36,7 +36,10 @@ class OneAccountRequest:
36
36
  # Merchant unique business ID (100 characters max)
37
37
  self.customerRefId = None
38
38
 
39
-
39
+ class OneAccountByAddressRequest:
40
+ def __init__(self):
41
+ # The wallet address. Note: Wallet addresses for the TRON, Solana, and TON networks are case-sensitive, while other networks are case-insensitive
42
+ self.address = None
40
43
 
41
44
  class CreateAccountRequest:
42
45
  def __init__(self):
@@ -206,6 +209,10 @@ class AccountApi:
206
209
  def one_accounts(self, request: OneAccountRequest):
207
210
  return self.api_client.send_request(request, '/v1/account/one')
208
211
 
212
+ # Query Wallet Account by Address
213
+ def get_account_by_address(self, request: OneAccountByAddressRequest):
214
+ return self.api_client.send_request(request, '/v1/account/getByAddress')
215
+
209
216
  # Create a new wallet account.
210
217
  def create_account(self, request: CreateAccountRequest):
211
218
  return self.api_client.send_request(request, '/v1/account/create')
@@ -41,6 +41,12 @@ class ListWeb3AccountRequest:
41
41
  # Merchant unique business ID (100 characters max)
42
42
  self.customerRefId = None
43
43
 
44
+ class OneWeb3AccountRequest:
45
+ def __init__(self):
46
+ # Account Key, the only account identifier。The Account Key, which is the unique identifier for the account. Cannot be empty at the same time as the customerRefId parameter. If both are provided, the accountKey parameter will take precedence.
47
+ self.accountKey = None
48
+ # Merchant unique business ID (100 characters max)
49
+ self.customerRefId = None
44
50
 
45
51
  class CreateWeb3EthSignRequest:
46
52
  def __init__(self):
@@ -239,6 +245,11 @@ class Web3Api:
239
245
  def listWeb3Accounts(self, request: ListWeb3AccountRequest):
240
246
  return self.api_client.send_request(request, '/v1/web3/account/list')
241
247
 
248
+ # List Web3 Wallet Accounts
249
+ # Filter Web3 wallet account lists by various conditions.
250
+ def oneWeb3Account(self, request: OneWeb3AccountRequest):
251
+ return self.api_client.send_request(request, '/v1/web3/account/one')
252
+
242
253
  # Create ethSign
243
254
  # Merchants can initiate an ethSign signature through this interface. The merchant is required to serialize the transaction data, generating a corresponding hash (supporting both 0x and non-0x formatted data). The hash is then submitted through this interface to create a signature, which can be obtained by Retrieve a Single Web3 Signature interface or webhook. From there, merchants can complete the subsequent steps according to their own needs once they have obtained the signature.
244
255
  def createWeb3EthSign(self, request: CreateWeb3EthSignRequest):
@@ -62,11 +62,8 @@ def aes_encrypt(key: bytes, iv: bytes, message: bytes):
62
62
 
63
63
  def aes_gcm_encrypt(key: bytes, iv: bytes, message: bytes):
64
64
  check_key_and_iv(key, iv)
65
- try:
66
- cipher = AES.new(key, AES.MODE_GCM, iv)
67
- cipher_text, tag = cipher.encrypt_and_digest(message)
68
- except Exception as e:
69
- raise Exception("aes encrypt error: %s" % e)
65
+ cipher = AES.new(key, AES.MODE_GCM, iv)
66
+ cipher_text, tag = cipher.encrypt_and_digest(message)
70
67
  return cipher_text + tag
71
68
 
72
69
 
@@ -82,12 +79,14 @@ def aes_decrypt(key: bytes, iv: bytes, encrypt_text: bytes):
82
79
 
83
80
  def aes_gcm_decrypt(key: bytes, iv: bytes, encrypt_text: bytes):
84
81
  check_key_and_iv(key, iv)
82
+ if len(encrypt_text) < 16:
83
+ raise Exception("aes decrypt error: invalid ciphertext")
84
+ ciphertext, tag = encrypt_text[:-16], encrypt_text[-16:]
85
+ cipher = AES.new(key, AES.MODE_GCM, iv)
85
86
  try:
86
- cipher = AES.new(key, AES.MODE_GCM, iv)
87
- pad_text = cipher.decrypt(encrypt_text)
88
- except Exception as e:
89
- raise Exception("aes decrypt error: %s" % e)
90
- return pad_text[0:len(pad_text)-len(iv)]
87
+ return cipher.decrypt_and_verify(ciphertext, tag)
88
+ except ValueError as exc:
89
+ raise Exception("aes decrypt error: tag verification failed") from exc
91
90
 
92
91
 
93
92
  def get_rsa_key(key_pem, passphrase=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: safeheron_api_sdk_python
3
- Version: 1.1.20
3
+ Version: 1.1.21
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.20',
6
+ version='1.1.21',
7
7
  description='Python for Safeheron API',
8
8
  long_description=long_description,
9
9
  author='safeheron',