safeheron-api-sdk-python 1.1.7__tar.gz → 1.1.8__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.
- {safeheron_api_sdk_python-1.1.7/safeheron_api_sdk_python.egg-info → safeheron_api_sdk_python-1.1.8}/PKG-INFO +2 -2
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/api/account_api.py +7 -3
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/api/coin_api.py +0 -3
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/api/mpc_sign_api.py +0 -3
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/api/transaction_api.py +4 -7
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/api/web3_api.py +5 -3
- safeheron_api_sdk_python-1.1.8/safeheron_api_sdk_python/api/webhook_api.py +49 -0
- safeheron_api_sdk_python-1.1.8/safeheron_api_sdk_python/api/whitelist_api.py +116 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/cosigner/co_signer_converter.py +0 -3
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/webhook/webhook_converter.py +0 -3
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8/safeheron_api_sdk_python.egg-info}/PKG-INFO +2 -2
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python.egg-info/SOURCES.txt +2 -1
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python.egg-info/requires.txt +1 -1
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/setup.py +2 -2
- safeheron_api_sdk_python-1.1.7/README.md +0 -135
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/LICENSE +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/README.rst +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/client.py +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/tools.py +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python.egg-info/dependency_links.txt +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python.egg-info/top_level.txt +0 -0
- {safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: safeheron_api_sdk_python
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.8
|
|
4
4
|
Summary: Python for Safeheron API
|
|
5
5
|
Home-page: https://github.com/Safeheron/safeheron-api-sdk-python
|
|
6
6
|
Author: safeheron
|
|
@@ -10,7 +10,7 @@ Platform: all
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist:
|
|
13
|
+
Requires-Dist: pycryptodomex
|
|
14
14
|
Requires-Dist: requests
|
|
15
15
|
Requires-Dist: cryptography
|
|
16
16
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
sys.path.pop(0)
|
|
4
1
|
from safeheron_api_sdk_python.client import *
|
|
5
2
|
|
|
6
3
|
|
|
@@ -19,12 +16,16 @@ class ListAccountRequest:
|
|
|
19
16
|
self.namePrefix = None
|
|
20
17
|
# Filter the response based on this account name suffix
|
|
21
18
|
self.nameSuffix = None
|
|
19
|
+
# Merchant unique business ID (100 characters max)
|
|
20
|
+
self.customerRefId = None
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
class OneAccountRequest:
|
|
25
24
|
def __init__(self):
|
|
26
25
|
# Wallet account key
|
|
27
26
|
self.accountKey = None
|
|
27
|
+
# Merchant unique business ID (100 characters max)
|
|
28
|
+
self.customerRefId = None
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
@@ -32,6 +33,9 @@ class CreateAccountRequest:
|
|
|
32
33
|
def __init__(self):
|
|
33
34
|
# Account name, within 30 characters
|
|
34
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
|
|
35
39
|
# Whether display in Safeheron Console
|
|
36
40
|
# True: not display
|
|
37
41
|
# False: display
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
sys.path.pop(0)
|
|
4
1
|
from safeheron_api_sdk_python.client import *
|
|
5
2
|
|
|
6
3
|
|
|
@@ -202,8 +199,8 @@ class CreateTransactionsUTXOMultiDestRequest:
|
|
|
202
199
|
dict = self.__dict__
|
|
203
200
|
dict["feeRateDto"] = dict["feeRateDto"].__dict__
|
|
204
201
|
destinationAddressList = []
|
|
205
|
-
for
|
|
206
|
-
destinationAddressList.append(
|
|
202
|
+
for item in dict["destinationAddressList"]:
|
|
203
|
+
destinationAddressList.append(item.__dict__)
|
|
207
204
|
dict["destinationAddressList"] = destinationAddressList
|
|
208
205
|
return dict
|
|
209
206
|
|
|
@@ -263,8 +260,8 @@ class TransactionsFeeRateRequest:
|
|
|
263
260
|
def asDict(self):
|
|
264
261
|
dict = self.__dict__
|
|
265
262
|
destinationAddressList = []
|
|
266
|
-
for
|
|
267
|
-
destinationAddressList.append(
|
|
263
|
+
for item in dict["destinationAddressList"]:
|
|
264
|
+
destinationAddressList.append(item.__dict__)
|
|
268
265
|
dict["destinationAddressList"] = destinationAddressList
|
|
269
266
|
return dict
|
|
270
267
|
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
sys.path.pop(0)
|
|
4
1
|
from safeheron_api_sdk_python.client import *
|
|
5
2
|
|
|
6
3
|
|
|
@@ -13,6 +10,9 @@ class CreateWeb3AccountRequest:
|
|
|
13
10
|
# False: display
|
|
14
11
|
# Default: false
|
|
15
12
|
self.hiddenOnUI = None
|
|
13
|
+
# Merchant unique business ID (100 characters max)
|
|
14
|
+
# 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
|
|
15
|
+
self.customerRefId = None
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class BatchCreateWeb3AccountRequest:
|
|
@@ -33,6 +33,8 @@ class ListWeb3AccountRequest:
|
|
|
33
33
|
self.fromId = None
|
|
34
34
|
# Filter the response based on this account name prefix
|
|
35
35
|
self.namePrefix = None
|
|
36
|
+
# Merchant unique business ID (100 characters max)
|
|
37
|
+
self.customerRefId = None
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
class CreateWeb3EthSignRequest:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from safeheron_api_sdk_python.client import *
|
|
2
|
+
|
|
3
|
+
class ResendWebhookRequest:
|
|
4
|
+
def __init__(self):
|
|
5
|
+
# Supported events:
|
|
6
|
+
# TRANSACTION
|
|
7
|
+
# MPC_SIGN
|
|
8
|
+
# WEB3_SIGN
|
|
9
|
+
self.category = None
|
|
10
|
+
# Transaction key
|
|
11
|
+
self.txKey = None
|
|
12
|
+
|
|
13
|
+
class ResendFailedRequest:
|
|
14
|
+
def __init__(self):
|
|
15
|
+
# Start time in UNIX timestamp (ms). The time interval [startTime, endTime] is up to 1 hour
|
|
16
|
+
self.startTime = None
|
|
17
|
+
# End time in UNIX timestamp (ms). The time interval [startTime, endTime] is up to 1 hour
|
|
18
|
+
self.endTime = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class WebhookApi:
|
|
22
|
+
|
|
23
|
+
def __init__(self, config):
|
|
24
|
+
self.api_client = Client(config)
|
|
25
|
+
# Re-push Transaction Webhook Events
|
|
26
|
+
# Re-push the transaction webhook events generated in the last month. In certain situations, such as network jitter or your system being unavailable to receive webhook events, you may miss receiving notifications. You can use this interface to notify Safeheron to re-push the webhook events. It is important to note that for a single transaction, only the last webhook event will be re-pushed. For example, during the lifecycle of a transaction, multiple TRANSACTION_STATUS_CHANGED webhook events such as BROADCASTING, CONFIRMING, COMPLETED, etc., may be generated. The re-push will only send the last webhook event recorded by the current system. Re-pushing is supported for the following types of webhook events:
|
|
27
|
+
# Events related to asset transactions, including TRANSACTION_CREATED and TRANSACTION_STATUS_CHANGED.
|
|
28
|
+
# Events related to MPC signing, including MPC_SIGN_CREATED and MPC_SIGN_STATUS_CHANGED.
|
|
29
|
+
# Events related to Web3, including WEB3_SIGN_CREATED and WEB3_SIGN_STATUS_CHANGED.
|
|
30
|
+
# More types of webhook events will be supported in the future.
|
|
31
|
+
def resend_webhook(self, request: ResendWebhookRequest):
|
|
32
|
+
return self.api_client.send_request(request, '/v1/webhook/resend')
|
|
33
|
+
|
|
34
|
+
# Push All Failed Webhook Events
|
|
35
|
+
# Resend all webhook events that failed to push within any duration not exceeding 1 hour in the past 7 days (limited to 1 call every 10 minutes). In certain situations, such as network failures or your system being unavailable to receive webhook events, you may miss receiving notifications. Once the issue is resolved, you can use this interface to notify Safeheron to resend all webhook events that failed to push within a certain period. Support re-pushing the following types of webhook events:
|
|
36
|
+
# TRANSACTION_CREATED
|
|
37
|
+
# TRANSACTION_STATUS_CHANGED
|
|
38
|
+
# MPC_SIGN_CREATED
|
|
39
|
+
# MPC_SIGN_STATUS_CHANGED
|
|
40
|
+
# WEB3_SIGN_CREATED
|
|
41
|
+
# WEB3_SIGN_STATUS_CHANGED
|
|
42
|
+
# ILLEGAL_IP_REQUEST
|
|
43
|
+
# NO_MATCHING_TRANSACTION_POLICY
|
|
44
|
+
# More types of webhook events will be supported in the future.
|
|
45
|
+
# Please note that when re-pushing all failed webhook events, your system needs to avoid rollback issues. For example, during the lifecycle of a transaction, multiple TRANSACTION_STATUS_CHANGED webhook events may be generated, such as BROADCASTING, CONFIRMING, and COMPLETED. If your system did not receive the CONFIRMING event due to network issues but did receive the COMPLETED event, using this interface would cause Safeheron to attempt resending the CONFIRMING event to your system. Your system needs to ensure that the transaction does not incorrectly revert from the COMPLETED status back to the CONFIRMING status.
|
|
46
|
+
def resend_failed(self, request: ResendFailedRequest):
|
|
47
|
+
return self.api_client.send_request(request, '/v1/webhook/resend/failed')
|
|
48
|
+
|
|
49
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from safeheron_api_sdk_python.client import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ListWhitelistRequest:
|
|
5
|
+
def __init__(self):
|
|
6
|
+
# Query page direction, NEXT by default
|
|
7
|
+
self.direct = None
|
|
8
|
+
# The number of items to retrieve at a time, default max value is 500
|
|
9
|
+
self.limit = None
|
|
10
|
+
# 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
|
|
11
|
+
self.fromId = None
|
|
12
|
+
# The supported public blockchains for whitelist addresses are:
|
|
13
|
+
# EVM: Ethereum-compatible public chain networks or Layer 2 addresses that can receive its native token and other tokens
|
|
14
|
+
# Bitcoin: Bitcoin mainnet addresses that can receive Bitcoin
|
|
15
|
+
# Bitcoin Cash: Bitcoin Cash network, which can receive BCH
|
|
16
|
+
# Dash: anonymous Dash network, which can receive DASH
|
|
17
|
+
# TRON: Tron mainnet addresses, which can receive TRX and TRC20 tokens, such as USDT and USDC
|
|
18
|
+
# NEAR: NEAR mainnet, which can receive native token NEAR
|
|
19
|
+
# Filecoin: Receive Filecoin native token FIL, but does not support receiving FIL or tokens from the FVM network
|
|
20
|
+
# Sui: Sui mainnet, which can receive native token Sui and other tokens
|
|
21
|
+
# Aptos: Aptos mainnet, which only supports receiving native token Aptos and does not support other tokens yet
|
|
22
|
+
# Solana: Solana mainnet, which can receive native token SOL and other tokens
|
|
23
|
+
# Bitcoin Testnet: Bitcoin testnet, which can receive Bitcoin testnet ass
|
|
24
|
+
self.chainType = None
|
|
25
|
+
# Whitelist status
|
|
26
|
+
# AUDIT: pending approval
|
|
27
|
+
# APPROVED: active
|
|
28
|
+
# REJECTED: rejected
|
|
29
|
+
self.whitelistStatus = None
|
|
30
|
+
# Start time for creating a whitelist in UNIX timestamp (ms) (If no value is provided, the default value is createTimeMax minus 24 hours)
|
|
31
|
+
self.createTimeMin = None
|
|
32
|
+
# End time for creating a whitelist in UNIX timestamp (ms) (If no value is provided, the default value is the current UTC time)
|
|
33
|
+
self.createTimeMax = None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class OneWhitelistRequest:
|
|
37
|
+
def __init__(self):
|
|
38
|
+
# Whitelist unique identifier. It is required if address is not provided. If both are provided, the whitelistKey takes precedence
|
|
39
|
+
self.whitelistKey = None
|
|
40
|
+
# Whitelist address. It is required if whitelistKey is not provided and please make sure the provided address is correct
|
|
41
|
+
self.address = None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class CreateWhitelistRequest:
|
|
46
|
+
def __init__(self):
|
|
47
|
+
# Whitelist unique name, 20 characters max
|
|
48
|
+
self.whitelistName = None
|
|
49
|
+
# The supported public blockchains for whitelist addresses are:
|
|
50
|
+
# EVM: Ethereum-compatible public chain networks or Layer 2 addresses that can receive its native token and other tokens
|
|
51
|
+
# Bitcoin: Bitcoin mainnet addresses that can receive Bitcoin
|
|
52
|
+
# Bitcoin Cash: Bitcoin Cash network, which can receive BCH
|
|
53
|
+
# Dash: anonymous Dash network, which can receive DASH
|
|
54
|
+
# TRON: Tron mainnet addresses, which can receive TRX and TRC20 tokens, such as USDT and USDC
|
|
55
|
+
# NEAR: NEAR mainnet, which can receive native token NEAR
|
|
56
|
+
# Filecoin: Receive Filecoin native token FIL, but does not support receiving FIL or tokens from the FVM network
|
|
57
|
+
# Sui: Sui mainnet, which can receive native token Sui and other tokens
|
|
58
|
+
# Aptos: Aptos mainnet, which only supports receiving native token Aptos and does not support other tokens yet
|
|
59
|
+
# Solana: Solana mainnet, which can receive native token SOL and other tokens
|
|
60
|
+
# Bitcoin Testnet: Bitcoin testnet, which can receive Bitcoin testnet assets
|
|
61
|
+
self.chainType = None
|
|
62
|
+
# Public blockchain address and the address format needs to meet the requirements of the chain
|
|
63
|
+
self.address = None
|
|
64
|
+
|
|
65
|
+
class EditWhitelistRequest:
|
|
66
|
+
def __init__(self):
|
|
67
|
+
# Whitelist unique identifier
|
|
68
|
+
self.whitelistKey = None
|
|
69
|
+
# Whitelist unique name, 20 characters max
|
|
70
|
+
self.whitelistName = None
|
|
71
|
+
# Public blockchain address and the address format needs to meet the requirements of the chain
|
|
72
|
+
self.address = None
|
|
73
|
+
# When the whitelist is involved in a transaction approval policy, modifications will result in the new whitelist being directly applied to the approval policy. False by default, meaning that when involved in a transaction approval policy, it will not be modified.
|
|
74
|
+
self.force = None
|
|
75
|
+
|
|
76
|
+
class DeleteWhitelistRequest:
|
|
77
|
+
def __init__(self):
|
|
78
|
+
# Whitelist unique identifier
|
|
79
|
+
self.whitelistKey = None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class WhitelistApi:
|
|
83
|
+
|
|
84
|
+
def __init__(self, config):
|
|
85
|
+
self.api_client = Client(config)
|
|
86
|
+
|
|
87
|
+
# List Whitelist Data
|
|
88
|
+
# Paginate the whitelist data based on the query criteria.
|
|
89
|
+
def list_whitelist(self, request: ListWhitelistRequest):
|
|
90
|
+
return self.api_client.send_request(request, '/v1/whitelist/list')
|
|
91
|
+
|
|
92
|
+
# Retrieve a Single Whitelist
|
|
93
|
+
# * Retrieve the data of a whitelist.
|
|
94
|
+
def one_whitelist(self, request: OneWhitelistRequest):
|
|
95
|
+
return self.api_client.send_request(request, '/v1/whitelist/one')
|
|
96
|
+
|
|
97
|
+
# Create a Whitelist
|
|
98
|
+
# Add a new whitelisted address. The newly added address needs to be approved in the Safeheron App before it becomes effective. The approval details are as follows:
|
|
99
|
+
# Admin approval: If a custom whitelist approval process is not set, it will become effective after being approved by the team admins according to the team's decision-making process.
|
|
100
|
+
# Custom whitelist approval: If a whitelist approval process is set, it will become effective after being approved according to the process.
|
|
101
|
+
def create_whitelist(self, request: CreateWhitelistRequest):
|
|
102
|
+
return self.api_client.send_request(request, '/v1/whitelist/create')
|
|
103
|
+
|
|
104
|
+
# Modify a Whitelist
|
|
105
|
+
# Modify a whitelist based on its unique identifier. The whitelist only supports modifying its name and address; whitelists pending for approval cannot be modified. After modifying the whitelist, it needs to be reviewed and approved in the Safeheron App before it becomes effective. The approval details are as follows:
|
|
106
|
+
# Admin approval: If a custom whitelist approval process is not set, it will become effective after being approved by the team admins according to the team's decision-making process.
|
|
107
|
+
# Custom whitelist approval: If a whitelist approval process is set, it will become effective after being approved according to the process.
|
|
108
|
+
def edit_whitelist(self, request: EditWhitelistRequest):
|
|
109
|
+
return self.api_client.send_request(request, '/v1/whitelist/edit')
|
|
110
|
+
|
|
111
|
+
# Delete a Whitelist
|
|
112
|
+
# To delete a whitelisted address, note that no approval is required for deletion. If a whitelisted address that is under approval is deleted, the approval task will also be automatically cancelled.
|
|
113
|
+
def delete_whitelist(self, request: DeleteWhitelistRequest):
|
|
114
|
+
return self.api_client.send_request(request, '/v1/whitelist/delete')
|
|
115
|
+
|
|
116
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: safeheron_api_sdk_python
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.8
|
|
4
4
|
Summary: Python for Safeheron API
|
|
5
5
|
Home-page: https://github.com/Safeheron/safeheron-api-sdk-python
|
|
6
6
|
Author: safeheron
|
|
@@ -10,7 +10,7 @@ Platform: all
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist:
|
|
13
|
+
Requires-Dist: pycryptodomex
|
|
14
14
|
Requires-Dist: requests
|
|
15
15
|
Requires-Dist: cryptography
|
|
16
16
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
LICENSE
|
|
2
|
-
README.md
|
|
3
2
|
README.rst
|
|
4
3
|
setup.py
|
|
5
4
|
safeheron_api_sdk_python/client.py
|
|
@@ -14,5 +13,7 @@ safeheron_api_sdk_python/api/coin_api.py
|
|
|
14
13
|
safeheron_api_sdk_python/api/mpc_sign_api.py
|
|
15
14
|
safeheron_api_sdk_python/api/transaction_api.py
|
|
16
15
|
safeheron_api_sdk_python/api/web3_api.py
|
|
16
|
+
safeheron_api_sdk_python/api/webhook_api.py
|
|
17
|
+
safeheron_api_sdk_python/api/whitelist_api.py
|
|
17
18
|
safeheron_api_sdk_python/cosigner/co_signer_converter.py
|
|
18
19
|
safeheron_api_sdk_python/webhook/webhook_converter.py
|
|
@@ -3,14 +3,14 @@ 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.
|
|
6
|
+
version='1.1.8',
|
|
7
7
|
description='Python for Safeheron API',
|
|
8
8
|
long_description=long_description,
|
|
9
9
|
author='safeheron',
|
|
10
10
|
author_email='support@safeheron.com',
|
|
11
11
|
url='https://github.com/Safeheron/safeheron-api-sdk-python',
|
|
12
12
|
install_requires=[
|
|
13
|
-
'
|
|
13
|
+
'pycryptodomex',
|
|
14
14
|
'requests',
|
|
15
15
|
'cryptography'
|
|
16
16
|
],
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Python SDK for Safeheron API
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-

|
|
5
|
-
|
|
6
|
-
# API Documentation
|
|
7
|
-
- [Official documentation](https://docs.safeheron.com/api/index.html)
|
|
8
|
-
|
|
9
|
-
# Installation
|
|
10
|
-
|
|
11
|
-
```shell
|
|
12
|
-
$ pip install safeheron-api-sdk-python
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
# Usage
|
|
16
|
-
```python
|
|
17
|
-
from safeheron_api_sdk_python.api.account_api import *
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
> Take [`/v1/account/create`](https://docs.safeheron.com/api/index.html) as an example to explain, the complete code can be found in `demo/api_demo` directory
|
|
21
|
-
|
|
22
|
-
* Construct `config`
|
|
23
|
-
```python
|
|
24
|
-
# You can get `ApiKey` and `SafeheronRsaPublicKey` from Safeheron Web Console: https://www.safeheron.com/console.
|
|
25
|
-
config={
|
|
26
|
-
'apiKey': '5921aa306f*******368db9abf',
|
|
27
|
-
'privateKeyPemFile': './my_private.pem',
|
|
28
|
-
'safeheronPublicKey': 'MIICIjANBgkqhkiG9w0***********+zSdC+8eBdZyI7nMdPIj6xOhUCAwEAAQ==',
|
|
29
|
-
'baseUrl': 'https://api.safeheron.vip',
|
|
30
|
-
'RequestTimeout': 20000
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
* Call `create_account` api with `config`
|
|
34
|
-
```python
|
|
35
|
-
account_api = AccountApi(config)
|
|
36
|
-
param = CreateAccountRequest()
|
|
37
|
-
param.accountName = "accountNameTest"
|
|
38
|
-
res = account_api.create_account(param)
|
|
39
|
-
# Your code to process response
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
# Test
|
|
45
|
-
|
|
46
|
-
## Test Create Wallet Account
|
|
47
|
-
* Before run the test code, modify `demo/api_demo/account/config.yaml.example` according to the comments
|
|
48
|
-
```yaml
|
|
49
|
-
# Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
50
|
-
apiKey: 080d****e06e60
|
|
51
|
-
# Your private key, as an alternative, you can use privateKeyPemFile to config your private key
|
|
52
|
-
privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
|
|
53
|
-
# path to your private key file, pem encoded.PrivateKeyPemFile priority is higher than privateKey.
|
|
54
|
-
privateKeyPemFile: './my_private.pem'
|
|
55
|
-
# Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
56
|
-
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
57
|
-
# Safeheron API url
|
|
58
|
-
baseUrl: https://api.safeheron.vip
|
|
59
|
-
# RequestTimeout (Millisecond), Default: 20000
|
|
60
|
-
requestTimeout: 20000
|
|
61
|
-
```
|
|
62
|
-
* Copy config to `config.yaml` file.
|
|
63
|
-
```bash
|
|
64
|
-
$ cd demo/api_demo/account
|
|
65
|
-
$ cp config.yaml.example config.yaml
|
|
66
|
-
```
|
|
67
|
-
* Pytest
|
|
68
|
-
|
|
69
|
-
Execute `test_create_account` unit in `/demo/api_demo/account/account_api_demo.py` Python file.
|
|
70
|
-
|
|
71
|
-
## Test Send A Transaction
|
|
72
|
-
* Before run the test code, modify `demo/api_demo/transaction/config.yaml.example` according to the comments
|
|
73
|
-
```yaml
|
|
74
|
-
# Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
75
|
-
apiKey: 080d****e06e60
|
|
76
|
-
# Your private key, as an alternative, you can use privateKeyPemFile to config your private key
|
|
77
|
-
privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
|
|
78
|
-
# path to your private key file, pem encoded.PrivateKeyPemFile priority is higher than privateKey.
|
|
79
|
-
privateKeyPemFile: './my_private.pem'
|
|
80
|
-
# Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
81
|
-
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
82
|
-
# Safeheron API url
|
|
83
|
-
baseUrl: https://api.safeheron.vip
|
|
84
|
-
# RequestTimeout (Millisecond), Default: 20000
|
|
85
|
-
requestTimeout: 20000
|
|
86
|
-
# Wallet Account key
|
|
87
|
-
accountKey: account****5ecad40
|
|
88
|
-
# To address
|
|
89
|
-
destinationAddress: "0x943****0BF95f5"
|
|
90
|
-
```
|
|
91
|
-
* Copy config to `config.yaml` file.
|
|
92
|
-
```bash
|
|
93
|
-
$ cd demo/api_demo/transaction
|
|
94
|
-
$ cp config.yaml.example config.yaml
|
|
95
|
-
```
|
|
96
|
-
* Pytest
|
|
97
|
-
|
|
98
|
-
Execute `test_create_transactions` unit in `/demo/api_demo/transaction/transaction_api_demo.py` Python file.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
## Test MPC Sign
|
|
102
|
-
* Before run the test code, modify `demo/api_demo/mpc_sign/config.yaml.example` according to the comments
|
|
103
|
-
```yaml
|
|
104
|
-
# Your api key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
105
|
-
apiKey: 080d****e06e60
|
|
106
|
-
# Your private key, as an alternative, you can use privateKeyPemFile to config your private key
|
|
107
|
-
privateKey: MIIJRQIBA*******DtGRBdennqu8g95jcrMxCUhsifVgzP6vUyg==
|
|
108
|
-
# path to your private key file, pem encoded.PrivateKeyPemFile priority is higher than privateKey.
|
|
109
|
-
privateKeyPemFile: './my_private.pem'
|
|
110
|
-
# Safeheron API public key, you can get it from Safeheron Web Console: https://www.safeheron.com/console.
|
|
111
|
-
safeheronPublicKey: MIICI****QuTOTECAwEAAQ==
|
|
112
|
-
# Safeheron API url
|
|
113
|
-
baseUrl: https://api.safeheron.vip
|
|
114
|
-
# RequestTimeout (Millisecond), Default: 20000
|
|
115
|
-
requestTimeout: 20000
|
|
116
|
-
# Wallet Account key
|
|
117
|
-
accountKey: account****5ecad40
|
|
118
|
-
# Goerli testnet token address in wallet account
|
|
119
|
-
accountTokenAddress: "0x970****4ffD59"
|
|
120
|
-
# erc20 token contract address
|
|
121
|
-
erc20ContractAddress: "0x078****Eaa37F"
|
|
122
|
-
# address to receive token
|
|
123
|
-
toAddress: "0x53B****321789"
|
|
124
|
-
# Ethereum RPC API
|
|
125
|
-
ethereumRpcApi: https://goerli.infura.io/v3/802******bc2fcb
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
* Copy config to `config.yaml` file.
|
|
129
|
-
```bash
|
|
130
|
-
$ cd demo/api_demo/mpc_sign
|
|
131
|
-
$ cp config.yaml.example config.yaml
|
|
132
|
-
```
|
|
133
|
-
* Pytest
|
|
134
|
-
|
|
135
|
-
Execute `test_create_mpc_sign_transactions` unit in `/demo/api_demo/mpc_sign/mpc_sign_api_demo.py` Python file.
|
|
File without changes
|
|
File without changes
|
{safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/client.py
RENAMED
|
File without changes
|
{safeheron_api_sdk_python-1.1.7 → safeheron_api_sdk_python-1.1.8}/safeheron_api_sdk_python/tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|