dfns-sdk 0.0.0.dev0__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.
- dfns_sdk/__init__.py +24 -0
- dfns_sdk/_internal/__init__.py +5 -0
- dfns_sdk/_internal/http_client.py +395 -0
- dfns_sdk/auth.py +137 -0
- dfns_sdk/base_auth_api.py +129 -0
- dfns_sdk/client.py +81 -0
- dfns_sdk/delegated_client.py +97 -0
- dfns_sdk/generated/__init__.py +47 -0
- dfns_sdk/generated/agreements/__init__.py +7 -0
- dfns_sdk/generated/agreements/client.py +55 -0
- dfns_sdk/generated/agreements/delegated_client.py +95 -0
- dfns_sdk/generated/agreements/types.py +20 -0
- dfns_sdk/generated/allocations/__init__.py +7 -0
- dfns_sdk/generated/allocations/client.py +118 -0
- dfns_sdk/generated/allocations/delegated_client.py +187 -0
- dfns_sdk/generated/allocations/types.py +69 -0
- dfns_sdk/generated/auth/__init__.py +7 -0
- dfns_sdk/generated/auth/client.py +1215 -0
- dfns_sdk/generated/auth/delegated_client.py +1825 -0
- dfns_sdk/generated/auth/types.py +702 -0
- dfns_sdk/generated/exchanges/__init__.py +7 -0
- dfns_sdk/generated/exchanges/client.py +209 -0
- dfns_sdk/generated/exchanges/delegated_client.py +341 -0
- dfns_sdk/generated/exchanges/types.py +96 -0
- dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
- dfns_sdk/generated/fee_sponsors/client.py +161 -0
- dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
- dfns_sdk/generated/fee_sponsors/types.py +89 -0
- dfns_sdk/generated/keys/__init__.py +7 -0
- dfns_sdk/generated/keys/client.py +310 -0
- dfns_sdk/generated/keys/delegated_client.py +518 -0
- dfns_sdk/generated/keys/types.py +229 -0
- dfns_sdk/generated/networks/__init__.py +7 -0
- dfns_sdk/generated/networks/client.py +176 -0
- dfns_sdk/generated/networks/delegated_client.py +274 -0
- dfns_sdk/generated/networks/types.py +77 -0
- dfns_sdk/generated/permissions/__init__.py +7 -0
- dfns_sdk/generated/permissions/client.py +185 -0
- dfns_sdk/generated/permissions/delegated_client.py +344 -0
- dfns_sdk/generated/permissions/types.py +107 -0
- dfns_sdk/generated/policies/__init__.py +7 -0
- dfns_sdk/generated/policies/client.py +187 -0
- dfns_sdk/generated/policies/delegated_client.py +311 -0
- dfns_sdk/generated/policies/types.py +70 -0
- dfns_sdk/generated/signers/__init__.py +7 -0
- dfns_sdk/generated/signers/client.py +45 -0
- dfns_sdk/generated/signers/delegated_client.py +56 -0
- dfns_sdk/generated/signers/types.py +13 -0
- dfns_sdk/generated/staking/__init__.py +7 -0
- dfns_sdk/generated/staking/client.py +142 -0
- dfns_sdk/generated/staking/delegated_client.py +211 -0
- dfns_sdk/generated/staking/types.py +64 -0
- dfns_sdk/generated/swaps/__init__.py +7 -0
- dfns_sdk/generated/swaps/client.py +118 -0
- dfns_sdk/generated/swaps/delegated_client.py +157 -0
- dfns_sdk/generated/swaps/types.py +99 -0
- dfns_sdk/generated/wallets/__init__.py +7 -0
- dfns_sdk/generated/wallets/client.py +805 -0
- dfns_sdk/generated/wallets/delegated_client.py +1231 -0
- dfns_sdk/generated/wallets/types.py +534 -0
- dfns_sdk/generated/webhooks/__init__.py +7 -0
- dfns_sdk/generated/webhooks/client.py +193 -0
- dfns_sdk/generated/webhooks/delegated_client.py +320 -0
- dfns_sdk/generated/webhooks/types.py +101 -0
- dfns_sdk/types.py +72 -0
- dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
- dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
- dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
- dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""Client for the exchanges domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
from ..._internal import HttpClient
|
|
6
|
+
from . import types as T
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ExchangesClient:
|
|
10
|
+
"""Client for exchanges operations."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, http_client: HttpClient):
|
|
13
|
+
self._http = http_client
|
|
14
|
+
|
|
15
|
+
def get_exchange(self, exchange_id: str) -> T.GetExchangeResponse:
|
|
16
|
+
"""
|
|
17
|
+
Get Exchange.
|
|
18
|
+
|
|
19
|
+
Retrieve the details of a specific exchange integration configuration.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
exchange_id: Path parameter.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
T.GetExchangeResponse: The API response.
|
|
26
|
+
"""
|
|
27
|
+
return self._http.request(
|
|
28
|
+
method="GET",
|
|
29
|
+
path="/exchanges/{exchangeId}",
|
|
30
|
+
path_params={"exchangeId": exchange_id},
|
|
31
|
+
query_params=None,
|
|
32
|
+
body=None,
|
|
33
|
+
requires_signature=False,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
def delete_exchange(self, exchange_id: str) -> T.DeleteExchangeResponse:
|
|
37
|
+
"""
|
|
38
|
+
Delete Exchange.
|
|
39
|
+
|
|
40
|
+
Delete the exchange configuration from your organization.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
exchange_id: Path parameter.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
T.DeleteExchangeResponse: The API response.
|
|
47
|
+
"""
|
|
48
|
+
return self._http.request(
|
|
49
|
+
method="DELETE",
|
|
50
|
+
path="/exchanges/{exchangeId}",
|
|
51
|
+
path_params={"exchangeId": exchange_id},
|
|
52
|
+
query_params=None,
|
|
53
|
+
body=None,
|
|
54
|
+
requires_signature=True,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
def list_exchanges(self, query: Optional[T.ListExchangesQuery] = None) -> T.ListExchangesResponse:
|
|
58
|
+
"""
|
|
59
|
+
List Exchanges.
|
|
60
|
+
|
|
61
|
+
List all configured exchange integrations.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
query: Query parameters.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
T.ListExchangesResponse: The API response.
|
|
68
|
+
"""
|
|
69
|
+
return self._http.request(
|
|
70
|
+
method="GET",
|
|
71
|
+
path="/exchanges",
|
|
72
|
+
path_params={},
|
|
73
|
+
query_params=query,
|
|
74
|
+
body=None,
|
|
75
|
+
requires_signature=False,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def create_exchange(self, body: T.CreateExchangeRequest) -> T.CreateExchangeResponse:
|
|
79
|
+
"""
|
|
80
|
+
Create Exchange.
|
|
81
|
+
|
|
82
|
+
Link your organization with a cryptocurrency exchange.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
body: Request body.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
T.CreateExchangeResponse: The API response.
|
|
89
|
+
"""
|
|
90
|
+
return self._http.request(
|
|
91
|
+
method="POST",
|
|
92
|
+
path="/exchanges",
|
|
93
|
+
path_params={},
|
|
94
|
+
query_params=None,
|
|
95
|
+
body=body,
|
|
96
|
+
requires_signature=True,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def list_accounts(self, exchange_id: str, query: Optional[T.ListAccountsQuery] = None) -> T.ListAccountsResponse:
|
|
100
|
+
"""
|
|
101
|
+
List Accounts.
|
|
102
|
+
|
|
103
|
+
Get a list of accounts for a specific exchange.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
exchange_id: Path parameter.
|
|
107
|
+
query: Query parameters.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
T.ListAccountsResponse: The API response.
|
|
111
|
+
"""
|
|
112
|
+
return self._http.request(
|
|
113
|
+
method="GET",
|
|
114
|
+
path="/exchanges/{exchangeId}/accounts",
|
|
115
|
+
path_params={"exchangeId": exchange_id},
|
|
116
|
+
query_params=query,
|
|
117
|
+
body=None,
|
|
118
|
+
requires_signature=False,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
def list_account_assets(self, exchange_id: str, account_id: str, query: Optional[T.ListAccountAssetsQuery] = None) -> T.ListAccountAssetsResponse:
|
|
122
|
+
"""
|
|
123
|
+
List Account Assets.
|
|
124
|
+
|
|
125
|
+
Retrieve the list of assets for a specific account on a specific exchange.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
exchange_id: Path parameter.
|
|
129
|
+
account_id: Path parameter.
|
|
130
|
+
query: Query parameters.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
T.ListAccountAssetsResponse: The API response.
|
|
134
|
+
"""
|
|
135
|
+
return self._http.request(
|
|
136
|
+
method="GET",
|
|
137
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/assets",
|
|
138
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
139
|
+
query_params=query,
|
|
140
|
+
body=None,
|
|
141
|
+
requires_signature=False,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
def list_asset_withdrawal_networks(self, exchange_id: str, account_id: str, asset: str) -> list[TypedDict]:
|
|
145
|
+
"""
|
|
146
|
+
List Asset Withdrawal Networks.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
exchange_id: Path parameter.
|
|
150
|
+
account_id: Path parameter.
|
|
151
|
+
asset: Path parameter.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
list[TypedDict]: The API response.
|
|
155
|
+
"""
|
|
156
|
+
return self._http.request(
|
|
157
|
+
method="GET",
|
|
158
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/assets/{asset}/withdrawal-networks",
|
|
159
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id, "asset": asset},
|
|
160
|
+
query_params=None,
|
|
161
|
+
body=None,
|
|
162
|
+
requires_signature=False,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
def create_exchange_deposit(self, exchange_id: str, account_id: str, body: dict[str, Any]) -> T.CreateExchangeDepositResponse:
|
|
166
|
+
"""
|
|
167
|
+
Create Exchange Deposit.
|
|
168
|
+
|
|
169
|
+
Creates a new exchange deposit transaction.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
173
|
+
account_id: Unique identifier for the account like "spot"
|
|
174
|
+
body: Request body.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
T.CreateExchangeDepositResponse: The API response.
|
|
178
|
+
"""
|
|
179
|
+
return self._http.request(
|
|
180
|
+
method="POST",
|
|
181
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/deposits",
|
|
182
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
183
|
+
query_params=None,
|
|
184
|
+
body=body,
|
|
185
|
+
requires_signature=True,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
def create_exchange_withdrawal(self, exchange_id: str, account_id: str, body: dict[str, Any]) -> T.CreateExchangeWithdrawalResponse:
|
|
189
|
+
"""
|
|
190
|
+
Create Exchange Withdrawal.
|
|
191
|
+
|
|
192
|
+
Creates a new exchange withdrawal transaction.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
196
|
+
account_id: Unique identifier for the account like "spot"
|
|
197
|
+
body: Request body.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
T.CreateExchangeWithdrawalResponse: The API response.
|
|
201
|
+
"""
|
|
202
|
+
return self._http.request(
|
|
203
|
+
method="POST",
|
|
204
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/withdrawals",
|
|
205
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
206
|
+
query_params=None,
|
|
207
|
+
body=body,
|
|
208
|
+
requires_signature=True,
|
|
209
|
+
)
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"""Delegated client for the exchanges domain."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
5
|
+
|
|
6
|
+
from ..._internal import HttpClient
|
|
7
|
+
from ...base_auth_api import (
|
|
8
|
+
BaseAuthApi,
|
|
9
|
+
SignUserActionChallengeRequest,
|
|
10
|
+
UserActionChallengeResponse,
|
|
11
|
+
)
|
|
12
|
+
from . import types as T
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DelegatedExchangesClient:
|
|
16
|
+
"""
|
|
17
|
+
Delegated client for exchanges operations.
|
|
18
|
+
|
|
19
|
+
This client separates user action signing into _init() and _complete() method pairs,
|
|
20
|
+
allowing external systems to handle the signing process.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, http_client: HttpClient):
|
|
24
|
+
self._http = http_client
|
|
25
|
+
|
|
26
|
+
def get_exchange(self, exchange_id: str) -> T.GetExchangeResponse:
|
|
27
|
+
"""
|
|
28
|
+
Get Exchange.
|
|
29
|
+
|
|
30
|
+
Retrieve the details of a specific exchange integration configuration.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
exchange_id: Path parameter.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
T.GetExchangeResponse: The API response.
|
|
37
|
+
"""
|
|
38
|
+
return self._http.request(
|
|
39
|
+
method="GET",
|
|
40
|
+
path="/exchanges/{exchangeId}",
|
|
41
|
+
path_params={"exchangeId": exchange_id},
|
|
42
|
+
query_params=None,
|
|
43
|
+
body=None,
|
|
44
|
+
requires_signature=False,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def delete_exchange_init(self, exchange_id: str) -> UserActionChallengeResponse:
|
|
48
|
+
"""
|
|
49
|
+
Initialize Delete Exchange.
|
|
50
|
+
|
|
51
|
+
Creates a user action challenge for external signing.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
exchange_id: Path parameter.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
58
|
+
"""
|
|
59
|
+
path = "/exchanges/{exchangeId}"
|
|
60
|
+
path = path.replace("{exchangeId}", str(exchange_id))
|
|
61
|
+
payload = ""
|
|
62
|
+
|
|
63
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
64
|
+
self._http,
|
|
65
|
+
user_action_http_method="DELETE",
|
|
66
|
+
user_action_http_path=path,
|
|
67
|
+
user_action_payload=payload,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def delete_exchange_complete(self, exchange_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.DeleteExchangeResponse:
|
|
71
|
+
"""
|
|
72
|
+
Complete Delete Exchange.
|
|
73
|
+
|
|
74
|
+
Submits the signed challenge and makes the API request.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
exchange_id: Path parameter.
|
|
78
|
+
signed_challenge: The signed challenge from external signing.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
T.DeleteExchangeResponse: The API response.
|
|
82
|
+
"""
|
|
83
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
84
|
+
self._http, signed_challenge
|
|
85
|
+
)
|
|
86
|
+
user_action_token = user_action_result["userAction"]
|
|
87
|
+
|
|
88
|
+
return self._http.request_with_user_action(
|
|
89
|
+
method="DELETE",
|
|
90
|
+
path="/exchanges/{exchangeId}",
|
|
91
|
+
path_params={"exchangeId": exchange_id},
|
|
92
|
+
query_params=None,
|
|
93
|
+
body=None,
|
|
94
|
+
user_action=user_action_token,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
def list_exchanges(self, query: Optional[T.ListExchangesQuery] = None) -> T.ListExchangesResponse:
|
|
98
|
+
"""
|
|
99
|
+
List Exchanges.
|
|
100
|
+
|
|
101
|
+
List all configured exchange integrations.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
query: Query parameters.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
T.ListExchangesResponse: The API response.
|
|
108
|
+
"""
|
|
109
|
+
return self._http.request(
|
|
110
|
+
method="GET",
|
|
111
|
+
path="/exchanges",
|
|
112
|
+
path_params={},
|
|
113
|
+
query_params=query,
|
|
114
|
+
body=None,
|
|
115
|
+
requires_signature=False,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
def create_exchange_init(self, body: T.CreateExchangeRequest) -> UserActionChallengeResponse:
|
|
119
|
+
"""
|
|
120
|
+
Initialize Create Exchange.
|
|
121
|
+
|
|
122
|
+
Creates a user action challenge for external signing.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
body: Request body.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
129
|
+
"""
|
|
130
|
+
path = "/exchanges"
|
|
131
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
132
|
+
|
|
133
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
134
|
+
self._http,
|
|
135
|
+
user_action_http_method="POST",
|
|
136
|
+
user_action_http_path=path,
|
|
137
|
+
user_action_payload=payload,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def create_exchange_complete(self, body: T.CreateExchangeRequest, signed_challenge: SignUserActionChallengeRequest) -> T.CreateExchangeResponse:
|
|
141
|
+
"""
|
|
142
|
+
Complete Create Exchange.
|
|
143
|
+
|
|
144
|
+
Submits the signed challenge and makes the API request.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
body: Request body.
|
|
148
|
+
signed_challenge: The signed challenge from external signing.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
T.CreateExchangeResponse: The API response.
|
|
152
|
+
"""
|
|
153
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
154
|
+
self._http, signed_challenge
|
|
155
|
+
)
|
|
156
|
+
user_action_token = user_action_result["userAction"]
|
|
157
|
+
|
|
158
|
+
return self._http.request_with_user_action(
|
|
159
|
+
method="POST",
|
|
160
|
+
path="/exchanges",
|
|
161
|
+
path_params={},
|
|
162
|
+
query_params=None,
|
|
163
|
+
body=body,
|
|
164
|
+
user_action=user_action_token,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
def list_accounts(self, exchange_id: str, query: Optional[T.ListAccountsQuery] = None) -> T.ListAccountsResponse:
|
|
168
|
+
"""
|
|
169
|
+
List Accounts.
|
|
170
|
+
|
|
171
|
+
Get a list of accounts for a specific exchange.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
exchange_id: Path parameter.
|
|
175
|
+
query: Query parameters.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
T.ListAccountsResponse: The API response.
|
|
179
|
+
"""
|
|
180
|
+
return self._http.request(
|
|
181
|
+
method="GET",
|
|
182
|
+
path="/exchanges/{exchangeId}/accounts",
|
|
183
|
+
path_params={"exchangeId": exchange_id},
|
|
184
|
+
query_params=query,
|
|
185
|
+
body=None,
|
|
186
|
+
requires_signature=False,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def list_account_assets(self, exchange_id: str, account_id: str, query: Optional[T.ListAccountAssetsQuery] = None) -> T.ListAccountAssetsResponse:
|
|
190
|
+
"""
|
|
191
|
+
List Account Assets.
|
|
192
|
+
|
|
193
|
+
Retrieve the list of assets for a specific account on a specific exchange.
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
exchange_id: Path parameter.
|
|
197
|
+
account_id: Path parameter.
|
|
198
|
+
query: Query parameters.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
T.ListAccountAssetsResponse: The API response.
|
|
202
|
+
"""
|
|
203
|
+
return self._http.request(
|
|
204
|
+
method="GET",
|
|
205
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/assets",
|
|
206
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
207
|
+
query_params=query,
|
|
208
|
+
body=None,
|
|
209
|
+
requires_signature=False,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
def list_asset_withdrawal_networks(self, exchange_id: str, account_id: str, asset: str) -> list[TypedDict]:
|
|
213
|
+
"""
|
|
214
|
+
List Asset Withdrawal Networks.
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
exchange_id: Path parameter.
|
|
218
|
+
account_id: Path parameter.
|
|
219
|
+
asset: Path parameter.
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
list[TypedDict]: The API response.
|
|
223
|
+
"""
|
|
224
|
+
return self._http.request(
|
|
225
|
+
method="GET",
|
|
226
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/assets/{asset}/withdrawal-networks",
|
|
227
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id, "asset": asset},
|
|
228
|
+
query_params=None,
|
|
229
|
+
body=None,
|
|
230
|
+
requires_signature=False,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
def create_exchange_deposit_init(self, exchange_id: str, account_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
234
|
+
"""
|
|
235
|
+
Initialize Create Exchange Deposit.
|
|
236
|
+
|
|
237
|
+
Creates a user action challenge for external signing.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
241
|
+
account_id: Unique identifier for the account like "spot"
|
|
242
|
+
body: Request body.
|
|
243
|
+
|
|
244
|
+
Returns:
|
|
245
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
246
|
+
"""
|
|
247
|
+
path = "/exchanges/{exchangeId}/accounts/{accountId}/deposits"
|
|
248
|
+
path = path.replace("{exchangeId}", str(exchange_id))
|
|
249
|
+
path = path.replace("{accountId}", str(account_id))
|
|
250
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
251
|
+
|
|
252
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
253
|
+
self._http,
|
|
254
|
+
user_action_http_method="POST",
|
|
255
|
+
user_action_http_path=path,
|
|
256
|
+
user_action_payload=payload,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
def create_exchange_deposit_complete(self, exchange_id: str, account_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.CreateExchangeDepositResponse:
|
|
260
|
+
"""
|
|
261
|
+
Complete Create Exchange Deposit.
|
|
262
|
+
|
|
263
|
+
Submits the signed challenge and makes the API request.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
267
|
+
account_id: Unique identifier for the account like "spot"
|
|
268
|
+
body: Request body.
|
|
269
|
+
signed_challenge: The signed challenge from external signing.
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
T.CreateExchangeDepositResponse: The API response.
|
|
273
|
+
"""
|
|
274
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
275
|
+
self._http, signed_challenge
|
|
276
|
+
)
|
|
277
|
+
user_action_token = user_action_result["userAction"]
|
|
278
|
+
|
|
279
|
+
return self._http.request_with_user_action(
|
|
280
|
+
method="POST",
|
|
281
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/deposits",
|
|
282
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
283
|
+
query_params=None,
|
|
284
|
+
body=body,
|
|
285
|
+
user_action=user_action_token,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
def create_exchange_withdrawal_init(self, exchange_id: str, account_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
289
|
+
"""
|
|
290
|
+
Initialize Create Exchange Withdrawal.
|
|
291
|
+
|
|
292
|
+
Creates a user action challenge for external signing.
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
296
|
+
account_id: Unique identifier for the account like "spot"
|
|
297
|
+
body: Request body.
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
301
|
+
"""
|
|
302
|
+
path = "/exchanges/{exchangeId}/accounts/{accountId}/withdrawals"
|
|
303
|
+
path = path.replace("{exchangeId}", str(exchange_id))
|
|
304
|
+
path = path.replace("{accountId}", str(account_id))
|
|
305
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
306
|
+
|
|
307
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
308
|
+
self._http,
|
|
309
|
+
user_action_http_method="POST",
|
|
310
|
+
user_action_http_path=path,
|
|
311
|
+
user_action_payload=payload,
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
def create_exchange_withdrawal_complete(self, exchange_id: str, account_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.CreateExchangeWithdrawalResponse:
|
|
315
|
+
"""
|
|
316
|
+
Complete Create Exchange Withdrawal.
|
|
317
|
+
|
|
318
|
+
Submits the signed challenge and makes the API request.
|
|
319
|
+
|
|
320
|
+
Args:
|
|
321
|
+
exchange_id: The exchange id obtained from the Create Exchange endpoint. Ex: `ex-1f04s-lqc9q-xxxxxxxxxxxxxxxx`
|
|
322
|
+
account_id: Unique identifier for the account like "spot"
|
|
323
|
+
body: Request body.
|
|
324
|
+
signed_challenge: The signed challenge from external signing.
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
T.CreateExchangeWithdrawalResponse: The API response.
|
|
328
|
+
"""
|
|
329
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
330
|
+
self._http, signed_challenge
|
|
331
|
+
)
|
|
332
|
+
user_action_token = user_action_result["userAction"]
|
|
333
|
+
|
|
334
|
+
return self._http.request_with_user_action(
|
|
335
|
+
method="POST",
|
|
336
|
+
path="/exchanges/{exchangeId}/accounts/{accountId}/withdrawals",
|
|
337
|
+
path_params={"exchangeId": exchange_id, "accountId": account_id},
|
|
338
|
+
query_params=None,
|
|
339
|
+
body=body,
|
|
340
|
+
user_action=user_action_token,
|
|
341
|
+
)
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Types for the exchanges domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, NotRequired, Optional, TypedDict, Union
|
|
4
|
+
|
|
5
|
+
class GetExchangeResponse(TypedDict, total=False):
|
|
6
|
+
"""getExchange response."""
|
|
7
|
+
|
|
8
|
+
id: str
|
|
9
|
+
name: NotRequired[str]
|
|
10
|
+
kind: Literal["Binance", "Kraken", "CoinbaseApp", "CoinbasePrime"]
|
|
11
|
+
date_created: str
|
|
12
|
+
|
|
13
|
+
class DeleteExchangeResponse(TypedDict, total=False):
|
|
14
|
+
"""deleteExchange response."""
|
|
15
|
+
|
|
16
|
+
deleted: Literal[True]
|
|
17
|
+
|
|
18
|
+
class ListExchangesResponse(TypedDict, total=False):
|
|
19
|
+
"""listExchanges response."""
|
|
20
|
+
|
|
21
|
+
items: list[TypedDict]
|
|
22
|
+
next_page_token: NotRequired[str]
|
|
23
|
+
|
|
24
|
+
class ListExchangesQuery(TypedDict, total=False):
|
|
25
|
+
"""listExchanges query parameters."""
|
|
26
|
+
|
|
27
|
+
limit: NotRequired[int]
|
|
28
|
+
pagination_token: NotRequired[str]
|
|
29
|
+
|
|
30
|
+
class CreateExchangeRequest(TypedDict, total=False):
|
|
31
|
+
"""createExchange request body."""
|
|
32
|
+
|
|
33
|
+
name: NotRequired[str]
|
|
34
|
+
kind: Literal["Binance", "Kraken", "CoinbaseApp", "CoinbasePrime"]
|
|
35
|
+
read_configuration: TypedDict
|
|
36
|
+
write_configuration: TypedDict
|
|
37
|
+
|
|
38
|
+
class CreateExchangeResponse(TypedDict, total=False):
|
|
39
|
+
"""createExchange response."""
|
|
40
|
+
|
|
41
|
+
id: str
|
|
42
|
+
name: NotRequired[str]
|
|
43
|
+
kind: Literal["Binance", "Kraken", "CoinbaseApp", "CoinbasePrime"]
|
|
44
|
+
date_created: str
|
|
45
|
+
|
|
46
|
+
class ListAccountsResponse(TypedDict, total=False):
|
|
47
|
+
"""listAccounts response."""
|
|
48
|
+
|
|
49
|
+
items: list[TypedDict]
|
|
50
|
+
next_page_token: NotRequired[str]
|
|
51
|
+
|
|
52
|
+
class ListAccountsQuery(TypedDict, total=False):
|
|
53
|
+
"""listAccounts query parameters."""
|
|
54
|
+
|
|
55
|
+
limit: NotRequired[int]
|
|
56
|
+
pagination_token: NotRequired[str]
|
|
57
|
+
|
|
58
|
+
class ListAccountAssetsResponse(TypedDict, total=False):
|
|
59
|
+
"""listAccountAssets response."""
|
|
60
|
+
|
|
61
|
+
items: list[TypedDict]
|
|
62
|
+
next_page_token: NotRequired[str]
|
|
63
|
+
|
|
64
|
+
class ListAccountAssetsQuery(TypedDict, total=False):
|
|
65
|
+
"""listAccountAssets query parameters."""
|
|
66
|
+
|
|
67
|
+
limit: NotRequired[int]
|
|
68
|
+
pagination_token: NotRequired[str]
|
|
69
|
+
|
|
70
|
+
class CreateExchangeDepositResponse(TypedDict, total=False):
|
|
71
|
+
"""createExchangeDeposit response."""
|
|
72
|
+
|
|
73
|
+
id: str
|
|
74
|
+
exchange_id: str
|
|
75
|
+
account_id: str
|
|
76
|
+
transfer_id: NotRequired[str]
|
|
77
|
+
exchange_reference: NotRequired[str]
|
|
78
|
+
kind: Literal["Withdrawal", "Deposit"]
|
|
79
|
+
wallet_id: str
|
|
80
|
+
requester: TypedDict
|
|
81
|
+
request_body: TypedDict
|
|
82
|
+
date_created: str
|
|
83
|
+
|
|
84
|
+
class CreateExchangeWithdrawalResponse(TypedDict, total=False):
|
|
85
|
+
"""createExchangeWithdrawal response."""
|
|
86
|
+
|
|
87
|
+
id: str
|
|
88
|
+
exchange_id: str
|
|
89
|
+
account_id: str
|
|
90
|
+
transfer_id: NotRequired[str]
|
|
91
|
+
exchange_reference: NotRequired[str]
|
|
92
|
+
kind: Literal["Withdrawal", "Deposit"]
|
|
93
|
+
wallet_id: str
|
|
94
|
+
requester: TypedDict
|
|
95
|
+
request_body: TypedDict
|
|
96
|
+
date_created: str
|