safeheron-api-sdk-python 1.1.19__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.19 → safeheron_api_sdk_python-1.1.21}/PKG-INFO +1 -1
  2. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/account_api.py +34 -2
  3. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/web3_api.py +11 -0
  4. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/tools.py +9 -10
  5. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/PKG-INFO +1 -1
  6. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/setup.py +1 -1
  7. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/LICENSE +0 -0
  8. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/README.rst +0 -0
  9. {safeheron_api_sdk_python-1.1.19 → 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.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/coin_api.py +0 -0
  11. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/gas_api.py +0 -0
  12. {safeheron_api_sdk_python-1.1.19 → 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.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/tools_api.py +0 -0
  14. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/transaction_api.py +0 -0
  15. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/webhook_api.py +0 -0
  16. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/api/whitelist_api.py +0 -0
  17. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/client.py +0 -0
  18. {safeheron_api_sdk_python-1.1.19 → 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.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python/webhook/webhook_converter.py +0 -0
  20. {safeheron_api_sdk_python-1.1.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/SOURCES.txt +0 -0
  21. {safeheron_api_sdk_python-1.1.19 → 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.19 → safeheron_api_sdk_python-1.1.21}/safeheron_api_sdk_python.egg-info/requires.txt +0 -0
  23. {safeheron_api_sdk_python-1.1.19 → 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.19 → 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.19
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
@@ -12,6 +12,15 @@ class ListAccountRequest:
12
12
  # False: retrieve displayed wallet accounts
13
13
  # Default: retrieve all wallet accounts
14
14
  self.hiddenOnUI = None
15
+ # Filter wallets based on autoFuel setting:
16
+ # Default: Ignore this query parameter
17
+ # true: Only query wallets where autoFuel is set to true
18
+ # false: Only query wallets where autoFuel is set to false
19
+ self.autoFuel = None
20
+ # Wallet's archive status in Safeheron App and Web Console
21
+ # True: Archived
22
+ # False: Unarchived
23
+ self.archived = None
15
24
  # Filter the response based on this account name prefix
16
25
  self.namePrefix = None
17
26
  # Filter the response based on this account name suffix
@@ -27,7 +36,10 @@ class OneAccountRequest:
27
36
  # Merchant unique business ID (100 characters max)
28
37
  self.customerRefId = None
29
38
 
30
-
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
31
43
 
32
44
  class CreateAccountRequest:
33
45
  def __init__(self):
@@ -36,11 +48,13 @@ class CreateAccountRequest:
36
48
  # Merchant unique business ID (100 characters max)
37
49
  # The customerRefId uniquely represents a wallet. In the case of duplicate customerRefId values (for example, when resubmitting due to request timeouts or other errors), the data returned by the interface will remain consistent
38
50
  self.customerRefId = None
39
- # Whether display in Safeheron Console
51
+ # Whether display in Safeheron Console
40
52
  # True: not display
41
53
  # False: display
42
54
  # Default: false
43
55
  self.hiddenOnUI = None
56
+ # Auto-refuel. If set to true, the Gas Service will automatically supplement the Gas fee for the wallet when a transaction is initiated. The default value is false
57
+ self.autoFuel = None
44
58
  # Account tag
45
59
  self.accountTag = None
46
60
  # Coin key list, 20 array elements max
@@ -56,6 +70,8 @@ class BatchCreateAccountRequest:
56
70
  # False: display
57
71
  # Default: true
58
72
  self.hiddenOnUI = None
73
+ # Auto-refuel. If set to true, the Gas Service will automatically supplement the Gas fee for the wallet when a transaction is initiated. The default value is false
74
+ self.autoFuel = None
59
75
  # Number of wallets to be created, greater than 0, less than 100
60
76
  self.count = None
61
77
  # Account tag
@@ -79,6 +95,13 @@ class BatchUpdateAccountTagRequest:
79
95
  # Account tag
80
96
  self.accountTag = None
81
97
 
98
+ class BatchUpdateAccountFuelRequest:
99
+ def __init__(self):
100
+ # Account key, max is 100
101
+ self.accountKeyList = None
102
+ # If set to true, Gas Service will automatically supplement the transaction fee (Gas) for the wallet when a transaction is initiated
103
+ self.autoFuel = None
104
+
82
105
 
83
106
  class CreateAccountCoinRequest:
84
107
  def __init__(self):
@@ -186,6 +209,10 @@ class AccountApi:
186
209
  def one_accounts(self, request: OneAccountRequest):
187
210
  return self.api_client.send_request(request, '/v1/account/one')
188
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
+
189
216
  # Create a new wallet account.
190
217
  def create_account(self, request: CreateAccountRequest):
191
218
  return self.api_client.send_request(request, '/v1/account/create')
@@ -211,6 +238,11 @@ class AccountApi:
211
238
  def batch_update_account_tag(self, request: BatchUpdateAccountTagRequest):
212
239
  return self.api_client.send_request(request, '/v1/account/batch/update/tag')
213
240
 
241
+ # Batch Set Auto-Fuel
242
+ # Set the autoFuel property for a batch of wallet accounts. Setting it to true means that the Gas Service will automatically supplement the transaction fee (Gas) for that wallet when a transaction is initiated; setting it to false means the Gas Service will no longer supplement the transaction fee for the wallet.
243
+ def batch_update_account_autofuel(self, request: BatchUpdateAccountFuelRequest):
244
+ return self.api_client.send_request(request, '/v1/account/batch/update/autofuel')
245
+
214
246
  # Add Coins to a Wallet Account V1
215
247
  # Add a new coin to your wallet account, while generating the default address group for the added coin. Once successfully completed, it will return the address information of the newly created default address group. In case the added currency already exists within the account, it will promptly return the existing default address group information for that coin.
216
248
  # In a wallet account, UTXO-based cryptocurrencies can have multiple address groups, while other types of cryptocurrencies usually have only one. To check whether a particular cryptocurrency supports the addition of multiple address groups, simply check the 'isMultipleAddress' parameter through the Coin List.
@@ -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.19
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.19',
6
+ version='1.1.21',
7
7
  description='Python for Safeheron API',
8
8
  long_description=long_description,
9
9
  author='safeheron',