safeheron-api-sdk-python 1.1.18__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.
@@ -0,0 +1,272 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class ListAccountRequest:
5
+ def __init__(self):
6
+ # Page number, start from 1 (default)
7
+ self.pageNumber = None
8
+ # The number of bars per page, the default is 10, max is 100
9
+ self.pageSize = None
10
+ # Filter whether there are not-displayed wallet accounts in Safeheron Console
11
+ # True: retrieve hidden wallet accounts
12
+ # False: retrieve displayed wallet accounts
13
+ # Default: retrieve all wallet accounts
14
+ self.hiddenOnUI = None
15
+ # Filter the response based on this account name prefix
16
+ self.namePrefix = None
17
+ # Filter the response based on this account name suffix
18
+ self.nameSuffix = None
19
+ # Merchant unique business ID (100 characters max)
20
+ self.customerRefId = None
21
+
22
+
23
+ class OneAccountRequest:
24
+ def __init__(self):
25
+ # Wallet account key
26
+ self.accountKey = None
27
+ # Merchant unique business ID (100 characters max)
28
+ self.customerRefId = None
29
+
30
+
31
+
32
+ class CreateAccountRequest:
33
+ def __init__(self):
34
+ # Account name, 50 characters max
35
+ self.accountName = None
36
+ # Merchant unique business ID (100 characters max)
37
+ # 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
+ self.customerRefId = None
39
+ # Whether display in Safeheron Console
40
+ # True: not display
41
+ # False: display
42
+ # Default: false
43
+ self.hiddenOnUI = None
44
+ # Account tag
45
+ self.accountTag = None
46
+ # Coin key list, 20 array elements max
47
+ self.coinKeyList = None
48
+
49
+
50
+ class BatchCreateAccountRequest:
51
+ def __init__(self):
52
+ # The prefix of wallet account name, 50 characters max
53
+ self.accountName = None
54
+ # Display status in Safeheron App
55
+ # True: not display
56
+ # False: display
57
+ # Default: true
58
+ self.hiddenOnUI = None
59
+ # Number of wallets to be created, greater than 0, less than 100
60
+ self.count = None
61
+ # Account tag
62
+ self.accountTag = None
63
+
64
+
65
+ class UpdateAccountShowStateRequest:
66
+ def __init__(self):
67
+ # Wallet account key
68
+ self.accountKey = None
69
+ # Whether display in Safeheron Console
70
+ # True: not display
71
+ # False: display
72
+ # Default: false
73
+ self.hiddenOnUI = None
74
+
75
+ class BatchUpdateAccountTagRequest:
76
+ def __init__(self):
77
+ # Wallet account key
78
+ self.accountKeyList = None
79
+ # Account tag
80
+ self.accountTag = None
81
+
82
+
83
+ class CreateAccountCoinRequest:
84
+ def __init__(self):
85
+ # Coin key
86
+ self.coinKey = None
87
+ # Account key
88
+ self.accountKey = None
89
+
90
+ class CreateAccountCoinRequestV2:
91
+ def __init__(self):
92
+ # Coin key list, 20 array elements max
93
+ self.coinKeyList = None
94
+ # Account key
95
+ self.accountKey = None
96
+
97
+
98
+ class BatchCreateAccountCoinRequest:
99
+ def __init__(self):
100
+ # Coin key
101
+ self.coinKey = None
102
+ # Account key, max is 100
103
+ self.accountKeyList = None
104
+ # Address group name, 30 characters max
105
+ self.addressGroupName = None
106
+
107
+
108
+ class ListAccountCoinRequest:
109
+ def __init__(self):
110
+ # Account key
111
+ self.accountKey = None
112
+
113
+
114
+ class ListAccountCoinAddressRequest:
115
+ def __init__(self):
116
+ # Page number, start from 1 (default)
117
+ self.pageNumber = None
118
+ # The number of bars per page, the default is 10, max is 100
119
+ self.pageSize = None
120
+ # Coin key
121
+ self.coinKey = None
122
+ # Account key
123
+ self.accountKey = None
124
+ # Merchant unique business ID (100 characters max) when adding an address group
125
+ self.customerRefId = None
126
+
127
+
128
+ class InfoAccountCoinAddressRequest:
129
+ def __init__(self):
130
+ # Coin key
131
+ self.coinKey = None
132
+ # Coin receiving address
133
+ self.address = None
134
+
135
+ class AccountCoinBalanceRequest:
136
+ def __init__(self):
137
+ # Coin Keys, max 10
138
+ self.coinKeyList = None
139
+
140
+
141
+ class RenameAccountCoinAddressRequest:
142
+ def __init__(self):
143
+ # Address group key
144
+ self.addressGroupKey = None
145
+ # Address group name, 30 characters max
146
+ self.addressGroupName = None
147
+
148
+
149
+ class CreateAccountCoinAddressRequest:
150
+ def __init__(self):
151
+ # Coin key
152
+ self.coinKey = None
153
+ # Account key
154
+ self.accountKey = None
155
+ # Address group name, 30 characters max
156
+ self.addressGroupName = None
157
+ # Merchant unique business ID (100 characters max)
158
+ # The customerRefId uniquely represents an address group. 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
159
+ self.customerRefId = None
160
+
161
+
162
+ class BatchCreateAccountCoinUTXORequest:
163
+ def __init__(self):
164
+ # Coin key
165
+ self.coinKey = None
166
+ # Account key
167
+ self.accountKey = None
168
+ # The number, max is 100
169
+ self.count = None
170
+ # Address group name, 30 characters max
171
+ self.addressGroupName = None
172
+
173
+
174
+ class AccountApi:
175
+
176
+ def __init__(self, config):
177
+ self.api_client = Client(config)
178
+
179
+ # List Wallet Accounts
180
+ # Filter wallet account lists in team according to different combinations of conditions.
181
+ def list_accounts(self, request: ListAccountRequest):
182
+ return self.api_client.send_request(request, '/v1/account/list')
183
+
184
+ # Retrieve a Single Wallet Account
185
+ # Retrieve a single wallet account in the team by providing accountKey.
186
+ def one_accounts(self, request: OneAccountRequest):
187
+ return self.api_client.send_request(request, '/v1/account/one')
188
+
189
+ # Create a new wallet account.
190
+ def create_account(self, request: CreateAccountRequest):
191
+ return self.api_client.send_request(request, '/v1/account/create')
192
+
193
+ # Batch Create Wallet Accounts V1
194
+ # Generate a batch of wallet accounts based on a specified quantity. By default, the wallet accounts created in bulk will not be displayed in the Safeheron App. For optimal results, we recommend using the V2 version.
195
+ def batchCreate_accountV1(self, request: BatchCreateAccountRequest):
196
+ return self.api_client.send_request(request, '/v1/account/batch/create')
197
+
198
+ # Batch Create Wallet Accounts V2
199
+ # Generate a batch of wallet accounts based on a specified quantity. By default, the wallet accounts created in bulk will not be displayed in the Safeheron App.
200
+ def batch_create_accountV2(self, request: BatchCreateAccountRequest):
201
+ return self.api_client.send_request(request, '/v2/account/batch/create')
202
+
203
+ # Change Display of Wallet Account in App
204
+ # Change wallet account status in Safeheron App.
205
+ def update_account_show_state(self, request: UpdateAccountShowStateRequest):
206
+ return self.api_client.send_request(request, '/v1/account/update/show/state')
207
+
208
+ # Batch Label Wallet Accounts
209
+ # Relabel a batch of wallet accounts.
210
+ # Please note that it only supports to label wallets which are created by API. And, the wallets have been used to sweep the target account cannot be relabelled.
211
+ def batch_update_account_tag(self, request: BatchUpdateAccountTagRequest):
212
+ return self.api_client.send_request(request, '/v1/account/batch/update/tag')
213
+
214
+ # Add Coins to a Wallet Account V1
215
+ # 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
+ # 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.
217
+ def create_account_coin(self, request: CreateAccountCoinRequest):
218
+ return self.api_client.send_request(request, '/v1/account/coin/create')
219
+
220
+ # Add Coins to a Wallet Account V2
221
+ # Add a new coin to your wallet account, and it will generate address information for the added coin. If the added currency already exists within the account, it will promptly return the existing address information for that coin.
222
+ def create_account_coin_v2(self, request: CreateAccountCoinRequestV2):
223
+ return self.api_client.send_request(request, '/v2/account/coin/create')
224
+
225
+ # Batch Add Coins to Wallet Accounts
226
+ # Bulk addition of specified coins to designated wallet accounts. And, it creates a default address group for each coin and returns the address information contained within the newly created default address group. If a wallet account already contains the currency being added, the function will return the default address group data for that existing coin.
227
+ #
228
+ def batch_create_account_coin(self, request: BatchCreateAccountCoinRequest):
229
+ return self.api_client.send_request(request, '/v1/account/batch/coin/create')
230
+
231
+ # List Coins Within a Wallet Account
232
+ # Retrieve a complete list of all coins associated with a wallet account, along with the default address group information for each coin.
233
+ #
234
+ def list_account_coin(self, request: ListAccountCoinRequest):
235
+ return self.api_client.send_request(request, '/v1/account/coin/list')
236
+
237
+ # List Coin Address Group of a Wallet Account
238
+ # Retrieve all address groups for a coin within the wallet account.
239
+ #
240
+ def list_account_coin_address(self, request: ListAccountCoinAddressRequest):
241
+ return self.api_client.send_request(request, '/v1/account/coin/address/list')
242
+
243
+ # Retrieve The Balance of an Address
244
+ # Retrieve the balance of a specific coin address.
245
+ def info_account_coin_address(self, request: InfoAccountCoinAddressRequest):
246
+ return self.api_client.send_request(request, '/v1/account/coin/address/info')
247
+
248
+ # Retrieve Coin Balance
249
+ # Get the coin balance of all asset wallets under the team.
250
+ def account_coin_balance(self, request: AccountCoinBalanceRequest):
251
+ return self.api_client.send_request(request, '/v1/account/coin/balance')
252
+
253
+
254
+ # Rename Coin Address Group of a Wallet Account
255
+ # Rename a coin address group of a wallet account.
256
+ def rename_account_coin_address(self, request: RenameAccountCoinAddressRequest):
257
+ return self.api_client.send_request(request, '/v1/account/coin/address/name')
258
+
259
+ # Add Address Group for UTXO-Based Coin V1
260
+ # Add a new address group for UTXO-based cryptocurrencies under a wallet account. If the coin does not exist, it will be added first, followed by the new address group. The function will return the details of the added address(es).
261
+ def create_account_coin_address(self, request: CreateAccountCoinAddressRequest):
262
+ return self.api_client.send_request(request, '/v1/account/coin/address/create')
263
+
264
+ # Add Address Group for UTXOs V2
265
+ # Add a new address group for UTXO-based cryptocurrencies under a wallet account.If the coin has not been added to the wallet, it will be added automatically.
266
+ def create_account_coin_address_v2(self, request: CreateAccountCoinAddressRequest):
267
+ return self.api_client.send_request(request, '/v2/account/coin/address/create')
268
+
269
+ # Batch Add Address Groups for UTXO-Based Coin
270
+ # For UTXO-based coins in a wallet account, it is possible to add multiple address groups to the account in bulk by specifying the wallet account and the desired number of address groups. The function will return the details of the added address groups. If the specified coin does not exist in the account, it will be added first, followed by the addition of the corresponding number of address groups.
271
+ def batch_create_account_coin_UTXO(self, request: BatchCreateAccountCoinUTXORequest):
272
+ return self.api_client.send_request(request, '/v1/account/coin/utxo/batch/create')
@@ -0,0 +1,18 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class ApiKeyManagementApi:
5
+
6
+ def __init__(self, config):
7
+ self.api_client = Client(config)
8
+
9
+ #
10
+ # Deactivate API Key
11
+ # This interface is used to apply to deactivate the currently used API Key (this can also be done in the Web Console). After the application is submitted, it will only take effect once a team administrator approves it in the Safeheron App. Once an API Key is deactivated, it will no longer be able to access any interfaces. For example, you can apply to deactivate an API Key in the following situations to protect your assets:
12
+ #
13
+ # The API Key is no longer in use and should be deactivated promptly to avoid risk;
14
+ # The API Key's private key is suspected of being leaked, and it needs to be deactivated immediately to ensure fund security;
15
+ # You receive an Illegal IP Request Event via Webhook and, after evaluation, need to deactivate the API Key (Event Type: ILLEGAL_IP_REQUEST);
16
+ # To resume using it, you can submit an activation request through the Web Console. This will also require approval from a team administrator before the API Key can be reactivated.
17
+ def disable_apikey(self):
18
+ return self.api_client.send_request(None, '/v1/apikey/disable')
@@ -0,0 +1,65 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class CheckCoinAddressRequest:
5
+ def __init__(self):
6
+ # Coin key
7
+ self.coinKey = None
8
+ # Coin receiving address
9
+ self.address = None
10
+ # Verify contract address (If no value is provided, 'false' by default)
11
+ # True: verify
12
+ # False: not verify
13
+ self.checkContract = None
14
+ # Verify AML compliance (If no value is provided or be verified, AML-compliant address by default)
15
+ # True: verify
16
+ # False: not verify
17
+ self.checkAml = None
18
+ # Verify the validity of address format (If no value is provided, 'false' by dafault)
19
+ # True: verify
20
+ # False: not verify
21
+ self.checkAddressValid = None
22
+
23
+
24
+ class CoinBalanceSnapshotRequest:
25
+ def __init__(self):
26
+ # Only supports querying data within the last 30 days, with the parameter a GMT+8 time in the format of yyyy-MM-dd provided.
27
+ # Note: If the provided value is the current date (not a historical date), it will return the balance up to the current time.
28
+ self.gmt8Date = None
29
+
30
+
31
+ class CoinBlockHeightRequest:
32
+ def __init__(self):
33
+ # Coin key, multiple coin keys are separated by commas
34
+ self.coinKey = None
35
+
36
+
37
+ class CoinApi:
38
+
39
+ def __init__(self, config):
40
+ self.api_client = Client(config)
41
+
42
+ # Coin List
43
+ # Retrieve the list of coins supported by Safeheron.
44
+ def list_coin(self):
45
+ return self.api_client.send_request(None, '/v1/coin/list')
46
+
47
+ # Coin Maintenance List
48
+ # Retrieve the information of coins under maintenance in Safeheron.
49
+ def list_coin_maintain(self):
50
+ return self.api_client.send_request(None, '/v1/coin/maintain/list')
51
+
52
+ # Verify Coin Address
53
+ # Verify the correctness of a cryptocurrency address based on the provided validation attributes.
54
+ def check_coin_address(self, request: CheckCoinAddressRequest):
55
+ return self.api_client.send_request(request, '/v1/coin/address/check')
56
+
57
+ # Snapshot the Coin Balance
58
+ # Safeheron takes and stores daily snapshots of balances based on the transaction block's creation time in GMT+8. Please note that the snapshot only keeps data within 30 days.
59
+ def coin_balance_snapshot(self, request: CoinBalanceSnapshotRequest):
60
+ return self.api_client.send_request(request, '/v1/coin/balance/snapshot')
61
+
62
+ # Retrieve Current Block Height for Currency
63
+ # Retrieve the current block height for a specific cryptocurrency by providing its key.
64
+ def coin_block_height(self, request: CoinBlockHeightRequest):
65
+ return self.api_client.send_request(request, '/v1/coin/block/height')
@@ -0,0 +1,21 @@
1
+ from safeheron_api_sdk_python.client import *
2
+ class GasTransactionsGetByTxKeyRequest:
3
+ def __init__(self):
4
+ # Transaction key, obtained from transactions created via the Create a Transaction V3 API, App, or Web Console.
5
+ self.txKey = None
6
+
7
+
8
+ class GasApi:
9
+
10
+ def __init__(self, config):
11
+ self.api_client = Client(config)
12
+
13
+ # Retrieve Gas Balance
14
+ # 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')
17
+
18
+ # Retrieve Automatic Gas Records for Transactions
19
+ # 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):
21
+ return self.api_client.send_request(request, '/v1/gas/transactions/getByTxKey')
@@ -0,0 +1,73 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class CreateMPCSignTransactionRequest:
5
+ def __init__(self):
6
+ # Merchant unique business ID (100 characters max)
7
+ self.customerRefId = None
8
+ # Merchant extended field (defined by merchant) shown to merchant (255 characters max)
9
+ self.customerExt1 = None
10
+ # Merchant extended field (defined by merchant) shown to merchant (255 characters max)
11
+ self.customerExt2 = None
12
+ # Source account key
13
+ self.sourceAccountKey = None
14
+ # Signature algorithm
15
+ self.signAlg = None
16
+ # Transaction fee rate, either txFeeLevel or feeRateDto
17
+ self.dataList = [self.Date()]
18
+
19
+ def asDict(self):
20
+ dict = self.__dict__
21
+ dict["dataList"] = [data.__dict__ for data in dict["dataList"]]
22
+ return dict
23
+
24
+ class Date:
25
+ def __init__(self):
26
+ # Transaction note (180 characters max)
27
+ self.note = None
28
+ # Transaction data to be signed (view description below for details)
29
+ self.data = None
30
+
31
+
32
+ class OneMPCSignTransactionsRequest:
33
+ def __init__(self):
34
+ # Transaction key
35
+ self.txKey = None
36
+ # Merchant unique business ID (100 characters max)
37
+ self.customerRefId = None
38
+
39
+
40
+ class ListMPCSignTransactionsRequest:
41
+ def __init__(self):
42
+ # Query page direction, NEXT by default
43
+ self.direct = None
44
+ # The number of items to retrieve at a time, default max value is 500
45
+ self.limit = None
46
+ # Txkey of the first transaction record. If the first page has no value, provide the txKey of the last transaction record from the previous result
47
+ self.fromId = None
48
+ # Start time for creating a transaction, UNIX timestamp (ms) (If no value is provided, the default value is createTimeMax minus 24 hours)
49
+ self.createTimeMin = None
50
+ # End time for creating a transaction, UNIX timestamp (ms) (If no value is provided, the default value is the current UTC time)
51
+ self.createTimeMax = None
52
+
53
+
54
+ class MPCSignApi:
55
+
56
+ def __init__(self, config):
57
+ self.api_client = Client(config)
58
+
59
+ # Create an MPC Sign Transaction
60
+ # Merchant can initiate MPC Sign via this interface. The merchant must first serialize the transaction data and generate a hash before using this interface to submit the hash and create a transaction. The resulting signature can be retrieved via the MPC Sign transaction interface or webhook. The merchant can proceed with the necessary follow-up processes to obtain the signature according to their specific needs.
61
+ def create_mpc_sign_transactions(self, request: CreateMPCSignTransactionRequest):
62
+ request.asDict()
63
+ return self.api_client.send_request(request, '/v1/transactions/mpcsign/create')
64
+
65
+ # Retrieve a Single MPC Sign Transaction
66
+ # To query a specific MPC Sign transaction, either customerRefId or txKey must be provided. If both parameters are provided, the query will be based on the txKey parameter.
67
+ def one_mpc_sign_transactions(self, request: OneMPCSignTransactionsRequest):
68
+ return self.api_client.send_request(request, '/v1/transactions/mpcsign/one')
69
+
70
+ # MPC Sign Transaction List
71
+ # Filter MPC Sign transaction history by various conditions.
72
+ def list_mpc_sign_transactions(self, request: ListMPCSignTransactionsRequest):
73
+ return self.api_client.send_request(request, '/v1/transactions/mpcsign/list')
@@ -0,0 +1,32 @@
1
+ from safeheron_api_sdk_python.client import *
2
+
3
+
4
+ class AmlCheckerRequestRequest:
5
+ def __init__(self):
6
+ # Blockchain network, supports:
7
+ # Bitcoin
8
+ # Ethereum
9
+ # Tron
10
+ self.network = None
11
+ # Address
12
+ self.address = None
13
+
14
+
15
+ class AmlCheckerRetrievesRequest:
16
+ def __init__(self):
17
+ # Risk assessment request ID, which can be created through the Create AML Risk Assessment Request interface.
18
+ self.requestId = None
19
+
20
+
21
+ class ToolsApi:
22
+
23
+ def __init__(self, config):
24
+ self.api_client = Client(config)
25
+
26
+ # Create AML Risk Assessment Request
27
+ def aml_checker_request(self, request: AmlCheckerRequestRequest):
28
+ return self.api_client.send_request(request, '/v1/tools/aml-checker/request')
29
+
30
+ # Retrieve AML Risk Assessment Result
31
+ def aml_checker_retrieves(self, request: AmlCheckerRetrievesRequest):
32
+ return self.api_client.send_request(request, '/v1/tools/aml-checker/retrieves')