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,1231 @@
|
|
|
1
|
+
"""Delegated client for the wallets domain."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
5
|
+
from warnings import deprecated
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from ..._internal import HttpClient
|
|
9
|
+
from ...base_auth_api import (
|
|
10
|
+
BaseAuthApi,
|
|
11
|
+
SignUserActionChallengeRequest,
|
|
12
|
+
UserActionChallengeResponse,
|
|
13
|
+
)
|
|
14
|
+
from . import types as T
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DelegatedWalletsClient:
|
|
18
|
+
"""
|
|
19
|
+
Delegated client for wallets operations.
|
|
20
|
+
|
|
21
|
+
This client separates user action signing into _init() and _complete() method pairs,
|
|
22
|
+
allowing external systems to handle the signing process.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, http_client: HttpClient):
|
|
26
|
+
self._http = http_client
|
|
27
|
+
|
|
28
|
+
def activate_wallet_init(self, wallet_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
29
|
+
"""
|
|
30
|
+
Initialize Activate Wallet.
|
|
31
|
+
|
|
32
|
+
Creates a user action challenge for external signing.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
wallet_id: Wallet id.
|
|
36
|
+
body: Request body.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
40
|
+
"""
|
|
41
|
+
path = "/wallets/{walletId}/activate"
|
|
42
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
43
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
44
|
+
|
|
45
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
46
|
+
self._http,
|
|
47
|
+
user_action_http_method="POST",
|
|
48
|
+
user_action_http_path=path,
|
|
49
|
+
user_action_payload=payload,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def activate_wallet_complete(self, wallet_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.ActivateWalletResponse:
|
|
53
|
+
"""
|
|
54
|
+
Complete Activate Wallet.
|
|
55
|
+
|
|
56
|
+
Submits the signed challenge and makes the API request.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
wallet_id: Wallet id.
|
|
60
|
+
body: Request body.
|
|
61
|
+
signed_challenge: The signed challenge from external signing.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
T.ActivateWalletResponse: The API response.
|
|
65
|
+
"""
|
|
66
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
67
|
+
self._http, signed_challenge
|
|
68
|
+
)
|
|
69
|
+
user_action_token = user_action_result["userAction"]
|
|
70
|
+
|
|
71
|
+
return self._http.request_with_user_action(
|
|
72
|
+
method="POST",
|
|
73
|
+
path="/wallets/{walletId}/activate",
|
|
74
|
+
path_params={"walletId": wallet_id},
|
|
75
|
+
query_params=None,
|
|
76
|
+
body=body,
|
|
77
|
+
user_action=user_action_token,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def list_transactions(self, wallet_id: str, query: Optional[T.ListTransactionsQuery] = None) -> T.ListTransactionsResponse:
|
|
81
|
+
"""
|
|
82
|
+
List Transactions.
|
|
83
|
+
|
|
84
|
+
Retrieves a list of transactions requests for the specified wallet.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
wallet_id: Path parameter.
|
|
88
|
+
query: Query parameters.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
T.ListTransactionsResponse: The API response.
|
|
92
|
+
"""
|
|
93
|
+
return self._http.request(
|
|
94
|
+
method="GET",
|
|
95
|
+
path="/wallets/{walletId}/transactions",
|
|
96
|
+
path_params={"walletId": wallet_id},
|
|
97
|
+
query_params=query,
|
|
98
|
+
body=None,
|
|
99
|
+
requires_signature=False,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def sign_and_broadcast_transaction_init(self, wallet_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
103
|
+
"""
|
|
104
|
+
Initialize Sign and Broadcast Transaction.
|
|
105
|
+
|
|
106
|
+
Creates a user action challenge for external signing.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
wallet_id: Path parameter.
|
|
110
|
+
body: Request body.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
114
|
+
"""
|
|
115
|
+
path = "/wallets/{walletId}/transactions"
|
|
116
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
117
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
118
|
+
|
|
119
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
120
|
+
self._http,
|
|
121
|
+
user_action_http_method="POST",
|
|
122
|
+
user_action_http_path=path,
|
|
123
|
+
user_action_payload=payload,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
def sign_and_broadcast_transaction_complete(self, wallet_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.SignAndBroadcastTransactionResponse:
|
|
127
|
+
"""
|
|
128
|
+
Complete Sign and Broadcast Transaction.
|
|
129
|
+
|
|
130
|
+
Submits the signed challenge and makes the API request.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
wallet_id: Path parameter.
|
|
134
|
+
body: Request body.
|
|
135
|
+
signed_challenge: The signed challenge from external signing.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
T.SignAndBroadcastTransactionResponse: The API response.
|
|
139
|
+
"""
|
|
140
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
141
|
+
self._http, signed_challenge
|
|
142
|
+
)
|
|
143
|
+
user_action_token = user_action_result["userAction"]
|
|
144
|
+
|
|
145
|
+
return self._http.request_with_user_action(
|
|
146
|
+
method="POST",
|
|
147
|
+
path="/wallets/{walletId}/transactions",
|
|
148
|
+
path_params={"walletId": wallet_id},
|
|
149
|
+
query_params=None,
|
|
150
|
+
body=body,
|
|
151
|
+
user_action=user_action_token,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def cancel_transaction_init(self, wallet_id: str, transaction_id: str) -> UserActionChallengeResponse:
|
|
155
|
+
"""
|
|
156
|
+
Initialize Cancel Transaction.
|
|
157
|
+
|
|
158
|
+
Creates a user action challenge for external signing.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
wallet_id: Wallet id.
|
|
162
|
+
transaction_id: Transaction id.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
166
|
+
"""
|
|
167
|
+
path = "/wallets/{walletId}/transactions/{transactionId}/cancel"
|
|
168
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
169
|
+
path = path.replace("{transactionId}", str(transaction_id))
|
|
170
|
+
payload = ""
|
|
171
|
+
|
|
172
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
173
|
+
self._http,
|
|
174
|
+
user_action_http_method="POST",
|
|
175
|
+
user_action_http_path=path,
|
|
176
|
+
user_action_payload=payload,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def cancel_transaction_complete(self, wallet_id: str, transaction_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.CancelTransactionResponse:
|
|
180
|
+
"""
|
|
181
|
+
Complete Cancel Transaction.
|
|
182
|
+
|
|
183
|
+
Submits the signed challenge and makes the API request.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
wallet_id: Wallet id.
|
|
187
|
+
transaction_id: Transaction id.
|
|
188
|
+
signed_challenge: The signed challenge from external signing.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
T.CancelTransactionResponse: The API response.
|
|
192
|
+
"""
|
|
193
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
194
|
+
self._http, signed_challenge
|
|
195
|
+
)
|
|
196
|
+
user_action_token = user_action_result["userAction"]
|
|
197
|
+
|
|
198
|
+
return self._http.request_with_user_action(
|
|
199
|
+
method="POST",
|
|
200
|
+
path="/wallets/{walletId}/transactions/{transactionId}/cancel",
|
|
201
|
+
path_params={"walletId": wallet_id, "transactionId": transaction_id},
|
|
202
|
+
query_params=None,
|
|
203
|
+
body=None,
|
|
204
|
+
user_action=user_action_token,
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
def cancel_transfer_init(self, wallet_id: str, transfer_id: str) -> UserActionChallengeResponse:
|
|
208
|
+
"""
|
|
209
|
+
Initialize Cancel Transfer.
|
|
210
|
+
|
|
211
|
+
Creates a user action challenge for external signing.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
wallet_id: Wallet id.
|
|
215
|
+
transfer_id: Transfer id.
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
219
|
+
"""
|
|
220
|
+
path = "/wallets/{walletId}/transfers/{transferId}/cancel"
|
|
221
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
222
|
+
path = path.replace("{transferId}", str(transfer_id))
|
|
223
|
+
payload = ""
|
|
224
|
+
|
|
225
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
226
|
+
self._http,
|
|
227
|
+
user_action_http_method="POST",
|
|
228
|
+
user_action_http_path=path,
|
|
229
|
+
user_action_payload=payload,
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
def cancel_transfer_complete(self, wallet_id: str, transfer_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.CancelTransferResponse:
|
|
233
|
+
"""
|
|
234
|
+
Complete Cancel Transfer.
|
|
235
|
+
|
|
236
|
+
Submits the signed challenge and makes the API request.
|
|
237
|
+
|
|
238
|
+
Args:
|
|
239
|
+
wallet_id: Wallet id.
|
|
240
|
+
transfer_id: Transfer id.
|
|
241
|
+
signed_challenge: The signed challenge from external signing.
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
T.CancelTransferResponse: The API response.
|
|
245
|
+
"""
|
|
246
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
247
|
+
self._http, signed_challenge
|
|
248
|
+
)
|
|
249
|
+
user_action_token = user_action_result["userAction"]
|
|
250
|
+
|
|
251
|
+
return self._http.request_with_user_action(
|
|
252
|
+
method="POST",
|
|
253
|
+
path="/wallets/{walletId}/transfers/{transferId}/cancel",
|
|
254
|
+
path_params={"walletId": wallet_id, "transferId": transfer_id},
|
|
255
|
+
query_params=None,
|
|
256
|
+
body=None,
|
|
257
|
+
user_action=user_action_token,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
def speed_up_transaction_init(self, wallet_id: str, transaction_id: str) -> UserActionChallengeResponse:
|
|
261
|
+
"""
|
|
262
|
+
Initialize Speed Up Transaction.
|
|
263
|
+
|
|
264
|
+
Creates a user action challenge for external signing.
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
wallet_id: Wallet id.
|
|
268
|
+
transaction_id: Transaction id.
|
|
269
|
+
|
|
270
|
+
Returns:
|
|
271
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
272
|
+
"""
|
|
273
|
+
path = "/wallets/{walletId}/transactions/{transactionId}/speed-up"
|
|
274
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
275
|
+
path = path.replace("{transactionId}", str(transaction_id))
|
|
276
|
+
payload = ""
|
|
277
|
+
|
|
278
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
279
|
+
self._http,
|
|
280
|
+
user_action_http_method="POST",
|
|
281
|
+
user_action_http_path=path,
|
|
282
|
+
user_action_payload=payload,
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
def speed_up_transaction_complete(self, wallet_id: str, transaction_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.SpeedUpTransactionResponse:
|
|
286
|
+
"""
|
|
287
|
+
Complete Speed Up Transaction.
|
|
288
|
+
|
|
289
|
+
Submits the signed challenge and makes the API request.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
wallet_id: Wallet id.
|
|
293
|
+
transaction_id: Transaction id.
|
|
294
|
+
signed_challenge: The signed challenge from external signing.
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
T.SpeedUpTransactionResponse: The API response.
|
|
298
|
+
"""
|
|
299
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
300
|
+
self._http, signed_challenge
|
|
301
|
+
)
|
|
302
|
+
user_action_token = user_action_result["userAction"]
|
|
303
|
+
|
|
304
|
+
return self._http.request_with_user_action(
|
|
305
|
+
method="POST",
|
|
306
|
+
path="/wallets/{walletId}/transactions/{transactionId}/speed-up",
|
|
307
|
+
path_params={"walletId": wallet_id, "transactionId": transaction_id},
|
|
308
|
+
query_params=None,
|
|
309
|
+
body=None,
|
|
310
|
+
user_action=user_action_token,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
def speed_up_transfer_init(self, wallet_id: str, transfer_id: str) -> UserActionChallengeResponse:
|
|
314
|
+
"""
|
|
315
|
+
Initialize Speed Up Transfer.
|
|
316
|
+
|
|
317
|
+
Creates a user action challenge for external signing.
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
wallet_id: Wallet id.
|
|
321
|
+
transfer_id: Transfer id.
|
|
322
|
+
|
|
323
|
+
Returns:
|
|
324
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
325
|
+
"""
|
|
326
|
+
path = "/wallets/{walletId}/transfers/{transferId}/speed-up"
|
|
327
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
328
|
+
path = path.replace("{transferId}", str(transfer_id))
|
|
329
|
+
payload = ""
|
|
330
|
+
|
|
331
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
332
|
+
self._http,
|
|
333
|
+
user_action_http_method="POST",
|
|
334
|
+
user_action_http_path=path,
|
|
335
|
+
user_action_payload=payload,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
def speed_up_transfer_complete(self, wallet_id: str, transfer_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.SpeedUpTransferResponse:
|
|
339
|
+
"""
|
|
340
|
+
Complete Speed Up Transfer.
|
|
341
|
+
|
|
342
|
+
Submits the signed challenge and makes the API request.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
wallet_id: Wallet id.
|
|
346
|
+
transfer_id: Transfer id.
|
|
347
|
+
signed_challenge: The signed challenge from external signing.
|
|
348
|
+
|
|
349
|
+
Returns:
|
|
350
|
+
T.SpeedUpTransferResponse: The API response.
|
|
351
|
+
"""
|
|
352
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
353
|
+
self._http, signed_challenge
|
|
354
|
+
)
|
|
355
|
+
user_action_token = user_action_result["userAction"]
|
|
356
|
+
|
|
357
|
+
return self._http.request_with_user_action(
|
|
358
|
+
method="POST",
|
|
359
|
+
path="/wallets/{walletId}/transfers/{transferId}/speed-up",
|
|
360
|
+
path_params={"walletId": wallet_id, "transferId": transfer_id},
|
|
361
|
+
query_params=None,
|
|
362
|
+
body=None,
|
|
363
|
+
user_action=user_action_token,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
def list_wallets(self, query: Optional[T.ListWalletsQuery] = None) -> T.ListWalletsResponse:
|
|
367
|
+
"""
|
|
368
|
+
List Wallets.
|
|
369
|
+
|
|
370
|
+
Retrieves the list of Wallets in your organization. You can filter the results by owner (either by owner id or owner username). Pagination is supported via limit and paginationToken parameters.
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
query: Query parameters.
|
|
374
|
+
|
|
375
|
+
Returns:
|
|
376
|
+
T.ListWalletsResponse: The API response.
|
|
377
|
+
"""
|
|
378
|
+
return self._http.request(
|
|
379
|
+
method="GET",
|
|
380
|
+
path="/wallets",
|
|
381
|
+
path_params={},
|
|
382
|
+
query_params=query,
|
|
383
|
+
body=None,
|
|
384
|
+
requires_signature=False,
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
def create_wallet_init(self, body: T.CreateWalletRequest) -> UserActionChallengeResponse:
|
|
388
|
+
"""
|
|
389
|
+
Initialize Create Wallet.
|
|
390
|
+
|
|
391
|
+
Creates a user action challenge for external signing.
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
body: Request body.
|
|
395
|
+
|
|
396
|
+
Returns:
|
|
397
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
398
|
+
"""
|
|
399
|
+
path = "/wallets"
|
|
400
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
401
|
+
|
|
402
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
403
|
+
self._http,
|
|
404
|
+
user_action_http_method="POST",
|
|
405
|
+
user_action_http_path=path,
|
|
406
|
+
user_action_payload=payload,
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
def create_wallet_complete(self, body: T.CreateWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.CreateWalletResponse:
|
|
410
|
+
"""
|
|
411
|
+
Complete Create Wallet.
|
|
412
|
+
|
|
413
|
+
Submits the signed challenge and makes the API request.
|
|
414
|
+
|
|
415
|
+
Args:
|
|
416
|
+
body: Request body.
|
|
417
|
+
signed_challenge: The signed challenge from external signing.
|
|
418
|
+
|
|
419
|
+
Returns:
|
|
420
|
+
T.CreateWalletResponse: The API response.
|
|
421
|
+
"""
|
|
422
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
423
|
+
self._http, signed_challenge
|
|
424
|
+
)
|
|
425
|
+
user_action_token = user_action_result["userAction"]
|
|
426
|
+
|
|
427
|
+
return self._http.request_with_user_action(
|
|
428
|
+
method="POST",
|
|
429
|
+
path="/wallets",
|
|
430
|
+
path_params={},
|
|
431
|
+
query_params=None,
|
|
432
|
+
body=body,
|
|
433
|
+
user_action=user_action_token,
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
def delegate_wallet_init(self, wallet_id: str, body: T.DelegateWalletRequest) -> UserActionChallengeResponse:
|
|
437
|
+
"""
|
|
438
|
+
Initialize Delegate Wallet.
|
|
439
|
+
|
|
440
|
+
Creates a user action challenge for external signing.
|
|
441
|
+
|
|
442
|
+
Args:
|
|
443
|
+
wallet_id: Path parameter.
|
|
444
|
+
body: Request body.
|
|
445
|
+
|
|
446
|
+
Returns:
|
|
447
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
448
|
+
"""
|
|
449
|
+
path = "/wallets/{walletId}/delegate"
|
|
450
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
451
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
452
|
+
|
|
453
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
454
|
+
self._http,
|
|
455
|
+
user_action_http_method="POST",
|
|
456
|
+
user_action_http_path=path,
|
|
457
|
+
user_action_payload=payload,
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
def delegate_wallet_complete(self, wallet_id: str, body: T.DelegateWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.DelegateWalletResponse:
|
|
461
|
+
"""
|
|
462
|
+
Complete Delegate Wallet.
|
|
463
|
+
|
|
464
|
+
Submits the signed challenge and makes the API request.
|
|
465
|
+
|
|
466
|
+
Args:
|
|
467
|
+
wallet_id: Path parameter.
|
|
468
|
+
body: Request body.
|
|
469
|
+
signed_challenge: The signed challenge from external signing.
|
|
470
|
+
|
|
471
|
+
Returns:
|
|
472
|
+
T.DelegateWalletResponse: The API response.
|
|
473
|
+
"""
|
|
474
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
475
|
+
self._http, signed_challenge
|
|
476
|
+
)
|
|
477
|
+
user_action_token = user_action_result["userAction"]
|
|
478
|
+
|
|
479
|
+
return self._http.request_with_user_action(
|
|
480
|
+
method="POST",
|
|
481
|
+
path="/wallets/{walletId}/delegate",
|
|
482
|
+
path_params={"walletId": wallet_id},
|
|
483
|
+
query_params=None,
|
|
484
|
+
body=body,
|
|
485
|
+
user_action=user_action_token,
|
|
486
|
+
)
|
|
487
|
+
|
|
488
|
+
def export_wallet_init(self, wallet_id: str, body: T.ExportWalletRequest) -> UserActionChallengeResponse:
|
|
489
|
+
"""
|
|
490
|
+
Initialize Export Wallet.
|
|
491
|
+
|
|
492
|
+
Creates a user action challenge for external signing.
|
|
493
|
+
|
|
494
|
+
Args:
|
|
495
|
+
wallet_id: Path parameter.
|
|
496
|
+
body: Request body.
|
|
497
|
+
|
|
498
|
+
Returns:
|
|
499
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
500
|
+
"""
|
|
501
|
+
path = "/wallets/{walletId}/export"
|
|
502
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
503
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
504
|
+
|
|
505
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
506
|
+
self._http,
|
|
507
|
+
user_action_http_method="POST",
|
|
508
|
+
user_action_http_path=path,
|
|
509
|
+
user_action_payload=payload,
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
def export_wallet_complete(self, wallet_id: str, body: T.ExportWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.ExportWalletResponse:
|
|
513
|
+
"""
|
|
514
|
+
Complete Export Wallet.
|
|
515
|
+
|
|
516
|
+
Submits the signed challenge and makes the API request.
|
|
517
|
+
|
|
518
|
+
Args:
|
|
519
|
+
wallet_id: Path parameter.
|
|
520
|
+
body: Request body.
|
|
521
|
+
signed_challenge: The signed challenge from external signing.
|
|
522
|
+
|
|
523
|
+
Returns:
|
|
524
|
+
T.ExportWalletResponse: The API response.
|
|
525
|
+
"""
|
|
526
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
527
|
+
self._http, signed_challenge
|
|
528
|
+
)
|
|
529
|
+
user_action_token = user_action_result["userAction"]
|
|
530
|
+
|
|
531
|
+
return self._http.request_with_user_action(
|
|
532
|
+
method="POST",
|
|
533
|
+
path="/wallets/{walletId}/export",
|
|
534
|
+
path_params={"walletId": wallet_id},
|
|
535
|
+
query_params=None,
|
|
536
|
+
body=body,
|
|
537
|
+
user_action=user_action_token,
|
|
538
|
+
)
|
|
539
|
+
|
|
540
|
+
@deprecated("This endpoint is deprecated.")
|
|
541
|
+
def list_signatures(self, wallet_id: str, query: Optional[T.ListSignaturesQuery] = None) -> T.ListSignaturesResponse:
|
|
542
|
+
"""
|
|
543
|
+
List Signatures.
|
|
544
|
+
|
|
545
|
+
List all signature requests for a specific wallet.
|
|
546
|
+
|
|
547
|
+
<Danger>
|
|
548
|
+
Generating Signatures from a Wallet is deprecated. Please use the [Keys](https://docs.dfns.co/api-reference/keys) endpoints instead.
|
|
549
|
+
</Danger>
|
|
550
|
+
|
|
551
|
+
Args:
|
|
552
|
+
wallet_id: Path parameter.
|
|
553
|
+
query: Query parameters.
|
|
554
|
+
|
|
555
|
+
Returns:
|
|
556
|
+
T.ListSignaturesResponse: The API response.
|
|
557
|
+
"""
|
|
558
|
+
return self._http.request(
|
|
559
|
+
method="GET",
|
|
560
|
+
path="/wallets/{walletId}/signatures",
|
|
561
|
+
path_params={"walletId": wallet_id},
|
|
562
|
+
query_params=query,
|
|
563
|
+
body=None,
|
|
564
|
+
requires_signature=False,
|
|
565
|
+
)
|
|
566
|
+
|
|
567
|
+
def generate_signature_init(self, wallet_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
568
|
+
"""
|
|
569
|
+
Initialize Generate Signature.
|
|
570
|
+
|
|
571
|
+
Creates a user action challenge for external signing.
|
|
572
|
+
|
|
573
|
+
Args:
|
|
574
|
+
wallet_id: Path parameter.
|
|
575
|
+
body: Request body.
|
|
576
|
+
|
|
577
|
+
Returns:
|
|
578
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
579
|
+
"""
|
|
580
|
+
path = "/wallets/{walletId}/signatures"
|
|
581
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
582
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
583
|
+
|
|
584
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
585
|
+
self._http,
|
|
586
|
+
user_action_http_method="POST",
|
|
587
|
+
user_action_http_path=path,
|
|
588
|
+
user_action_payload=payload,
|
|
589
|
+
)
|
|
590
|
+
|
|
591
|
+
def generate_signature_complete(self, wallet_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.GenerateSignatureResponse:
|
|
592
|
+
"""
|
|
593
|
+
Complete Generate Signature.
|
|
594
|
+
|
|
595
|
+
Submits the signed challenge and makes the API request.
|
|
596
|
+
|
|
597
|
+
Args:
|
|
598
|
+
wallet_id: Path parameter.
|
|
599
|
+
body: Request body.
|
|
600
|
+
signed_challenge: The signed challenge from external signing.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
T.GenerateSignatureResponse: The API response.
|
|
604
|
+
"""
|
|
605
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
606
|
+
self._http, signed_challenge
|
|
607
|
+
)
|
|
608
|
+
user_action_token = user_action_result["userAction"]
|
|
609
|
+
|
|
610
|
+
return self._http.request_with_user_action(
|
|
611
|
+
method="POST",
|
|
612
|
+
path="/wallets/{walletId}/signatures",
|
|
613
|
+
path_params={"walletId": wallet_id},
|
|
614
|
+
query_params=None,
|
|
615
|
+
body=body,
|
|
616
|
+
user_action=user_action_token,
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
@deprecated("This endpoint is deprecated.")
|
|
620
|
+
def get_signature(self, wallet_id: str, signature_id: str) -> T.GetSignatureResponse:
|
|
621
|
+
"""
|
|
622
|
+
Get Signature.
|
|
623
|
+
|
|
624
|
+
Retrieves a Transaction Request information by its ID.
|
|
625
|
+
|
|
626
|
+
<Danger>
|
|
627
|
+
Generating Signatures from a Wallet is deprecated. Please use the [Keys](https://docs.dfns.co/api-reference/keys) endpoints instead.
|
|
628
|
+
</Danger>
|
|
629
|
+
|
|
630
|
+
Args:
|
|
631
|
+
wallet_id: Path parameter.
|
|
632
|
+
signature_id: Path parameter.
|
|
633
|
+
|
|
634
|
+
Returns:
|
|
635
|
+
T.GetSignatureResponse: The API response.
|
|
636
|
+
"""
|
|
637
|
+
return self._http.request(
|
|
638
|
+
method="GET",
|
|
639
|
+
path="/wallets/{walletId}/signatures/{signatureId}",
|
|
640
|
+
path_params={"walletId": wallet_id, "signatureId": signature_id},
|
|
641
|
+
query_params=None,
|
|
642
|
+
body=None,
|
|
643
|
+
requires_signature=False,
|
|
644
|
+
)
|
|
645
|
+
|
|
646
|
+
def get_transaction(self, wallet_id: str, transaction_id: str) -> T.GetTransactionResponse:
|
|
647
|
+
"""
|
|
648
|
+
Get Transaction.
|
|
649
|
+
|
|
650
|
+
Retrieve information about a specific transaction.
|
|
651
|
+
|
|
652
|
+
Args:
|
|
653
|
+
wallet_id: Path parameter.
|
|
654
|
+
transaction_id: Path parameter.
|
|
655
|
+
|
|
656
|
+
Returns:
|
|
657
|
+
T.GetTransactionResponse: The API response.
|
|
658
|
+
"""
|
|
659
|
+
return self._http.request(
|
|
660
|
+
method="GET",
|
|
661
|
+
path="/wallets/{walletId}/transactions/{transactionId}",
|
|
662
|
+
path_params={"walletId": wallet_id, "transactionId": transaction_id},
|
|
663
|
+
query_params=None,
|
|
664
|
+
body=None,
|
|
665
|
+
requires_signature=False,
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
def get_transfer(self, wallet_id: str, transfer_id: str) -> T.GetTransferResponse:
|
|
669
|
+
"""
|
|
670
|
+
Get Transfer.
|
|
671
|
+
|
|
672
|
+
Retrieves a Wallet Transfer Request by its ID.
|
|
673
|
+
|
|
674
|
+
Args:
|
|
675
|
+
wallet_id: Path parameter.
|
|
676
|
+
transfer_id: Path parameter.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
T.GetTransferResponse: The API response.
|
|
680
|
+
"""
|
|
681
|
+
return self._http.request(
|
|
682
|
+
method="GET",
|
|
683
|
+
path="/wallets/{walletId}/transfers/{transferId}",
|
|
684
|
+
path_params={"walletId": wallet_id, "transferId": transfer_id},
|
|
685
|
+
query_params=None,
|
|
686
|
+
body=None,
|
|
687
|
+
requires_signature=False,
|
|
688
|
+
)
|
|
689
|
+
|
|
690
|
+
def get_wallet(self, wallet_id: str) -> T.GetWalletResponse:
|
|
691
|
+
"""
|
|
692
|
+
Get Wallet.
|
|
693
|
+
|
|
694
|
+
Retrieves a Wallet information by its ID.
|
|
695
|
+
|
|
696
|
+
Args:
|
|
697
|
+
wallet_id: Path parameter.
|
|
698
|
+
|
|
699
|
+
Returns:
|
|
700
|
+
T.GetWalletResponse: The API response.
|
|
701
|
+
"""
|
|
702
|
+
return self._http.request(
|
|
703
|
+
method="GET",
|
|
704
|
+
path="/wallets/{walletId}",
|
|
705
|
+
path_params={"walletId": wallet_id},
|
|
706
|
+
query_params=None,
|
|
707
|
+
body=None,
|
|
708
|
+
requires_signature=False,
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
def update_wallet_init(self, wallet_id: str, body: T.UpdateWalletRequest) -> UserActionChallengeResponse:
|
|
712
|
+
"""
|
|
713
|
+
Initialize Update Wallet.
|
|
714
|
+
|
|
715
|
+
Creates a user action challenge for external signing.
|
|
716
|
+
|
|
717
|
+
Args:
|
|
718
|
+
wallet_id: Path parameter.
|
|
719
|
+
body: Request body.
|
|
720
|
+
|
|
721
|
+
Returns:
|
|
722
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
723
|
+
"""
|
|
724
|
+
path = "/wallets/{walletId}"
|
|
725
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
726
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
727
|
+
|
|
728
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
729
|
+
self._http,
|
|
730
|
+
user_action_http_method="PUT",
|
|
731
|
+
user_action_http_path=path,
|
|
732
|
+
user_action_payload=payload,
|
|
733
|
+
)
|
|
734
|
+
|
|
735
|
+
def update_wallet_complete(self, wallet_id: str, body: T.UpdateWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.UpdateWalletResponse:
|
|
736
|
+
"""
|
|
737
|
+
Complete Update Wallet.
|
|
738
|
+
|
|
739
|
+
Submits the signed challenge and makes the API request.
|
|
740
|
+
|
|
741
|
+
Args:
|
|
742
|
+
wallet_id: Path parameter.
|
|
743
|
+
body: Request body.
|
|
744
|
+
signed_challenge: The signed challenge from external signing.
|
|
745
|
+
|
|
746
|
+
Returns:
|
|
747
|
+
T.UpdateWalletResponse: The API response.
|
|
748
|
+
"""
|
|
749
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
750
|
+
self._http, signed_challenge
|
|
751
|
+
)
|
|
752
|
+
user_action_token = user_action_result["userAction"]
|
|
753
|
+
|
|
754
|
+
return self._http.request_with_user_action(
|
|
755
|
+
method="PUT",
|
|
756
|
+
path="/wallets/{walletId}",
|
|
757
|
+
path_params={"walletId": wallet_id},
|
|
758
|
+
query_params=None,
|
|
759
|
+
body=body,
|
|
760
|
+
user_action=user_action_token,
|
|
761
|
+
)
|
|
762
|
+
|
|
763
|
+
def get_wallet_assets(self, wallet_id: str, query: Optional[T.GetWalletAssetsQuery] = None) -> T.GetWalletAssetsResponse:
|
|
764
|
+
"""
|
|
765
|
+
Get Wallet Assets.
|
|
766
|
+
|
|
767
|
+
Retrieves a list of assets owned by the specified wallet. Return values vary by chain as shown below.
|
|
768
|
+
|
|
769
|
+
Args:
|
|
770
|
+
wallet_id: Path parameter.
|
|
771
|
+
query: Query parameters.
|
|
772
|
+
|
|
773
|
+
Returns:
|
|
774
|
+
T.GetWalletAssetsResponse: The API response.
|
|
775
|
+
"""
|
|
776
|
+
return self._http.request(
|
|
777
|
+
method="GET",
|
|
778
|
+
path="/wallets/{walletId}/assets",
|
|
779
|
+
path_params={"walletId": wallet_id},
|
|
780
|
+
query_params=query,
|
|
781
|
+
body=None,
|
|
782
|
+
requires_signature=False,
|
|
783
|
+
)
|
|
784
|
+
|
|
785
|
+
def get_wallet_history(self, wallet_id: str, query: Optional[T.GetWalletHistoryQuery] = None) -> T.GetWalletHistoryResponse:
|
|
786
|
+
"""
|
|
787
|
+
Get Wallet History.
|
|
788
|
+
|
|
789
|
+
Retrieves a list of historical on chain activities for the specified wallet.
|
|
790
|
+
|
|
791
|
+
The list reflects the indexed on-chain activity: it includes confirmed transactions only.
|
|
792
|
+
|
|
793
|
+
If you need to list your on-going or failed transactions please use the related endpoints (
|
|
794
|
+
[List Transfers](https://docs.dfns.co/api-reference/wallets/list-transfers) or
|
|
795
|
+
[List Transactions](https://docs.dfns.co/api-reference/wallets/list-transactions)
|
|
796
|
+
depending on the API you are using).
|
|
797
|
+
|
|
798
|
+
Args:
|
|
799
|
+
wallet_id: Wallet you want to get the history from.
|
|
800
|
+
query: Query parameters.
|
|
801
|
+
|
|
802
|
+
Returns:
|
|
803
|
+
T.GetWalletHistoryResponse: The API response.
|
|
804
|
+
"""
|
|
805
|
+
return self._http.request(
|
|
806
|
+
method="GET",
|
|
807
|
+
path="/wallets/{walletId}/history",
|
|
808
|
+
path_params={"walletId": wallet_id},
|
|
809
|
+
query_params=query,
|
|
810
|
+
body=None,
|
|
811
|
+
requires_signature=False,
|
|
812
|
+
)
|
|
813
|
+
|
|
814
|
+
def get_wallet_nfts(self, wallet_id: str) -> T.GetWalletNftsResponse:
|
|
815
|
+
"""
|
|
816
|
+
Get Wallet Nfts.
|
|
817
|
+
|
|
818
|
+
Retrieves a list of NFTs owned by the specified Wallet.
|
|
819
|
+
|
|
820
|
+
Args:
|
|
821
|
+
wallet_id: Path parameter.
|
|
822
|
+
|
|
823
|
+
Returns:
|
|
824
|
+
T.GetWalletNftsResponse: The API response.
|
|
825
|
+
"""
|
|
826
|
+
return self._http.request(
|
|
827
|
+
method="GET",
|
|
828
|
+
path="/wallets/{walletId}/nfts",
|
|
829
|
+
path_params={"walletId": wallet_id},
|
|
830
|
+
query_params=None,
|
|
831
|
+
body=None,
|
|
832
|
+
requires_signature=False,
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
def import_wallet_init(self, body: T.ImportWalletRequest) -> UserActionChallengeResponse:
|
|
836
|
+
"""
|
|
837
|
+
Initialize Import Wallet.
|
|
838
|
+
|
|
839
|
+
Creates a user action challenge for external signing.
|
|
840
|
+
|
|
841
|
+
Args:
|
|
842
|
+
body: Request body.
|
|
843
|
+
|
|
844
|
+
Returns:
|
|
845
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
846
|
+
"""
|
|
847
|
+
path = "/wallets/import"
|
|
848
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
849
|
+
|
|
850
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
851
|
+
self._http,
|
|
852
|
+
user_action_http_method="POST",
|
|
853
|
+
user_action_http_path=path,
|
|
854
|
+
user_action_payload=payload,
|
|
855
|
+
)
|
|
856
|
+
|
|
857
|
+
def import_wallet_complete(self, body: T.ImportWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.ImportWalletResponse:
|
|
858
|
+
"""
|
|
859
|
+
Complete Import Wallet.
|
|
860
|
+
|
|
861
|
+
Submits the signed challenge and makes the API request.
|
|
862
|
+
|
|
863
|
+
Args:
|
|
864
|
+
body: Request body.
|
|
865
|
+
signed_challenge: The signed challenge from external signing.
|
|
866
|
+
|
|
867
|
+
Returns:
|
|
868
|
+
T.ImportWalletResponse: The API response.
|
|
869
|
+
"""
|
|
870
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
871
|
+
self._http, signed_challenge
|
|
872
|
+
)
|
|
873
|
+
user_action_token = user_action_result["userAction"]
|
|
874
|
+
|
|
875
|
+
return self._http.request_with_user_action(
|
|
876
|
+
method="POST",
|
|
877
|
+
path="/wallets/import",
|
|
878
|
+
path_params={},
|
|
879
|
+
query_params=None,
|
|
880
|
+
body=body,
|
|
881
|
+
user_action=user_action_token,
|
|
882
|
+
)
|
|
883
|
+
|
|
884
|
+
def list_transfers(self, wallet_id: str, query: Optional[T.ListTransfersQuery] = None) -> T.ListTransfersResponse:
|
|
885
|
+
"""
|
|
886
|
+
List Transfers.
|
|
887
|
+
|
|
888
|
+
Retrieves a list of transfer requests for the specified wallet.
|
|
889
|
+
|
|
890
|
+
Args:
|
|
891
|
+
wallet_id: Path parameter.
|
|
892
|
+
query: Query parameters.
|
|
893
|
+
|
|
894
|
+
Returns:
|
|
895
|
+
T.ListTransfersResponse: The API response.
|
|
896
|
+
"""
|
|
897
|
+
return self._http.request(
|
|
898
|
+
method="GET",
|
|
899
|
+
path="/wallets/{walletId}/transfers",
|
|
900
|
+
path_params={"walletId": wallet_id},
|
|
901
|
+
query_params=query,
|
|
902
|
+
body=None,
|
|
903
|
+
requires_signature=False,
|
|
904
|
+
)
|
|
905
|
+
|
|
906
|
+
def transfer_asset_init(self, wallet_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
|
|
907
|
+
"""
|
|
908
|
+
Initialize Transfer Asset.
|
|
909
|
+
|
|
910
|
+
Creates a user action challenge for external signing.
|
|
911
|
+
|
|
912
|
+
Args:
|
|
913
|
+
wallet_id: The source wallet id (`wa-...`).
|
|
914
|
+
body: Request body.
|
|
915
|
+
|
|
916
|
+
Returns:
|
|
917
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
918
|
+
"""
|
|
919
|
+
path = "/wallets/{walletId}/transfers"
|
|
920
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
921
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
922
|
+
|
|
923
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
924
|
+
self._http,
|
|
925
|
+
user_action_http_method="POST",
|
|
926
|
+
user_action_http_path=path,
|
|
927
|
+
user_action_payload=payload,
|
|
928
|
+
)
|
|
929
|
+
|
|
930
|
+
def transfer_asset_complete(self, wallet_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.TransferAssetResponse:
|
|
931
|
+
"""
|
|
932
|
+
Complete Transfer Asset.
|
|
933
|
+
|
|
934
|
+
Submits the signed challenge and makes the API request.
|
|
935
|
+
|
|
936
|
+
Args:
|
|
937
|
+
wallet_id: The source wallet id (`wa-...`).
|
|
938
|
+
body: Request body.
|
|
939
|
+
signed_challenge: The signed challenge from external signing.
|
|
940
|
+
|
|
941
|
+
Returns:
|
|
942
|
+
T.TransferAssetResponse: The API response.
|
|
943
|
+
"""
|
|
944
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
945
|
+
self._http, signed_challenge
|
|
946
|
+
)
|
|
947
|
+
user_action_token = user_action_result["userAction"]
|
|
948
|
+
|
|
949
|
+
return self._http.request_with_user_action(
|
|
950
|
+
method="POST",
|
|
951
|
+
path="/wallets/{walletId}/transfers",
|
|
952
|
+
path_params={"walletId": wallet_id},
|
|
953
|
+
query_params=None,
|
|
954
|
+
body=body,
|
|
955
|
+
user_action=user_action_token,
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
def tag_wallet_init(self, wallet_id: str, body: T.TagWalletRequest) -> UserActionChallengeResponse:
|
|
959
|
+
"""
|
|
960
|
+
Initialize Tag Wallet.
|
|
961
|
+
|
|
962
|
+
Creates a user action challenge for external signing.
|
|
963
|
+
|
|
964
|
+
Args:
|
|
965
|
+
wallet_id: Path parameter.
|
|
966
|
+
body: Request body.
|
|
967
|
+
|
|
968
|
+
Returns:
|
|
969
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
970
|
+
"""
|
|
971
|
+
path = "/wallets/{walletId}/tags"
|
|
972
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
973
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
974
|
+
|
|
975
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
976
|
+
self._http,
|
|
977
|
+
user_action_http_method="PUT",
|
|
978
|
+
user_action_http_path=path,
|
|
979
|
+
user_action_payload=payload,
|
|
980
|
+
)
|
|
981
|
+
|
|
982
|
+
def tag_wallet_complete(self, wallet_id: str, body: T.TagWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.TagWalletResponse:
|
|
983
|
+
"""
|
|
984
|
+
Complete Tag Wallet.
|
|
985
|
+
|
|
986
|
+
Submits the signed challenge and makes the API request.
|
|
987
|
+
|
|
988
|
+
Args:
|
|
989
|
+
wallet_id: Path parameter.
|
|
990
|
+
body: Request body.
|
|
991
|
+
signed_challenge: The signed challenge from external signing.
|
|
992
|
+
|
|
993
|
+
Returns:
|
|
994
|
+
T.TagWalletResponse: The API response.
|
|
995
|
+
"""
|
|
996
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
997
|
+
self._http, signed_challenge
|
|
998
|
+
)
|
|
999
|
+
user_action_token = user_action_result["userAction"]
|
|
1000
|
+
|
|
1001
|
+
return self._http.request_with_user_action(
|
|
1002
|
+
method="PUT",
|
|
1003
|
+
path="/wallets/{walletId}/tags",
|
|
1004
|
+
path_params={"walletId": wallet_id},
|
|
1005
|
+
query_params=None,
|
|
1006
|
+
body=body,
|
|
1007
|
+
user_action=user_action_token,
|
|
1008
|
+
)
|
|
1009
|
+
|
|
1010
|
+
def untag_wallet_init(self, wallet_id: str, body: T.UntagWalletRequest) -> UserActionChallengeResponse:
|
|
1011
|
+
"""
|
|
1012
|
+
Initialize Untag Wallet.
|
|
1013
|
+
|
|
1014
|
+
Creates a user action challenge for external signing.
|
|
1015
|
+
|
|
1016
|
+
Args:
|
|
1017
|
+
wallet_id: Path parameter.
|
|
1018
|
+
body: Request body.
|
|
1019
|
+
|
|
1020
|
+
Returns:
|
|
1021
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
1022
|
+
"""
|
|
1023
|
+
path = "/wallets/{walletId}/tags"
|
|
1024
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
1025
|
+
payload = json.dumps(body, separators=(",", ":")) if body else ""
|
|
1026
|
+
|
|
1027
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
1028
|
+
self._http,
|
|
1029
|
+
user_action_http_method="DELETE",
|
|
1030
|
+
user_action_http_path=path,
|
|
1031
|
+
user_action_payload=payload,
|
|
1032
|
+
)
|
|
1033
|
+
|
|
1034
|
+
def untag_wallet_complete(self, wallet_id: str, body: T.UntagWalletRequest, signed_challenge: SignUserActionChallengeRequest) -> T.UntagWalletResponse:
|
|
1035
|
+
"""
|
|
1036
|
+
Complete Untag Wallet.
|
|
1037
|
+
|
|
1038
|
+
Submits the signed challenge and makes the API request.
|
|
1039
|
+
|
|
1040
|
+
Args:
|
|
1041
|
+
wallet_id: Path parameter.
|
|
1042
|
+
body: Request body.
|
|
1043
|
+
signed_challenge: The signed challenge from external signing.
|
|
1044
|
+
|
|
1045
|
+
Returns:
|
|
1046
|
+
T.UntagWalletResponse: The API response.
|
|
1047
|
+
"""
|
|
1048
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
1049
|
+
self._http, signed_challenge
|
|
1050
|
+
)
|
|
1051
|
+
user_action_token = user_action_result["userAction"]
|
|
1052
|
+
|
|
1053
|
+
return self._http.request_with_user_action(
|
|
1054
|
+
method="DELETE",
|
|
1055
|
+
path="/wallets/{walletId}/tags",
|
|
1056
|
+
path_params={"walletId": wallet_id},
|
|
1057
|
+
query_params=None,
|
|
1058
|
+
body=body,
|
|
1059
|
+
user_action=user_action_token,
|
|
1060
|
+
)
|
|
1061
|
+
|
|
1062
|
+
def get_offer(self, wallet_id: str, offer_id: str) -> T.GetOfferResponse:
|
|
1063
|
+
"""
|
|
1064
|
+
Get Offer.
|
|
1065
|
+
|
|
1066
|
+
Retrieve information about a specific offer received on your wallet.
|
|
1067
|
+
|
|
1068
|
+
Args:
|
|
1069
|
+
wallet_id: Wallet id.
|
|
1070
|
+
offer_id: Offer id.
|
|
1071
|
+
|
|
1072
|
+
Returns:
|
|
1073
|
+
T.GetOfferResponse: The API response.
|
|
1074
|
+
"""
|
|
1075
|
+
return self._http.request(
|
|
1076
|
+
method="GET",
|
|
1077
|
+
path="/wallets/{walletId}/offers/{offerId}",
|
|
1078
|
+
path_params={"walletId": wallet_id, "offerId": offer_id},
|
|
1079
|
+
query_params=None,
|
|
1080
|
+
body=None,
|
|
1081
|
+
requires_signature=False,
|
|
1082
|
+
)
|
|
1083
|
+
|
|
1084
|
+
def list_offers(self, wallet_id: str, query: Optional[T.ListOffersQuery] = None) -> T.ListOffersResponse:
|
|
1085
|
+
"""
|
|
1086
|
+
List Offers.
|
|
1087
|
+
|
|
1088
|
+
List all offers received on a specific wallet.
|
|
1089
|
+
|
|
1090
|
+
Args:
|
|
1091
|
+
wallet_id: Wallet id.
|
|
1092
|
+
query: Query parameters.
|
|
1093
|
+
|
|
1094
|
+
Returns:
|
|
1095
|
+
T.ListOffersResponse: The API response.
|
|
1096
|
+
"""
|
|
1097
|
+
return self._http.request(
|
|
1098
|
+
method="GET",
|
|
1099
|
+
path="/wallets/{walletId}/offers",
|
|
1100
|
+
path_params={"walletId": wallet_id},
|
|
1101
|
+
query_params=query,
|
|
1102
|
+
body=None,
|
|
1103
|
+
requires_signature=False,
|
|
1104
|
+
)
|
|
1105
|
+
|
|
1106
|
+
def accept_offer_init(self, wallet_id: str, offer_id: str) -> UserActionChallengeResponse:
|
|
1107
|
+
"""
|
|
1108
|
+
Initialize Accept Offer.
|
|
1109
|
+
|
|
1110
|
+
Creates a user action challenge for external signing.
|
|
1111
|
+
|
|
1112
|
+
Args:
|
|
1113
|
+
wallet_id: Wallet id.
|
|
1114
|
+
offer_id: Offer id.
|
|
1115
|
+
|
|
1116
|
+
Returns:
|
|
1117
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
1118
|
+
"""
|
|
1119
|
+
path = "/wallets/{walletId}/offers/{offerId}/accept"
|
|
1120
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
1121
|
+
path = path.replace("{offerId}", str(offer_id))
|
|
1122
|
+
payload = ""
|
|
1123
|
+
|
|
1124
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
1125
|
+
self._http,
|
|
1126
|
+
user_action_http_method="PUT",
|
|
1127
|
+
user_action_http_path=path,
|
|
1128
|
+
user_action_payload=payload,
|
|
1129
|
+
)
|
|
1130
|
+
|
|
1131
|
+
def accept_offer_complete(self, wallet_id: str, offer_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.AcceptOfferResponse:
|
|
1132
|
+
"""
|
|
1133
|
+
Complete Accept Offer.
|
|
1134
|
+
|
|
1135
|
+
Submits the signed challenge and makes the API request.
|
|
1136
|
+
|
|
1137
|
+
Args:
|
|
1138
|
+
wallet_id: Wallet id.
|
|
1139
|
+
offer_id: Offer id.
|
|
1140
|
+
signed_challenge: The signed challenge from external signing.
|
|
1141
|
+
|
|
1142
|
+
Returns:
|
|
1143
|
+
T.AcceptOfferResponse: The API response.
|
|
1144
|
+
"""
|
|
1145
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
1146
|
+
self._http, signed_challenge
|
|
1147
|
+
)
|
|
1148
|
+
user_action_token = user_action_result["userAction"]
|
|
1149
|
+
|
|
1150
|
+
return self._http.request_with_user_action(
|
|
1151
|
+
method="PUT",
|
|
1152
|
+
path="/wallets/{walletId}/offers/{offerId}/accept",
|
|
1153
|
+
path_params={"walletId": wallet_id, "offerId": offer_id},
|
|
1154
|
+
query_params=None,
|
|
1155
|
+
body=None,
|
|
1156
|
+
user_action=user_action_token,
|
|
1157
|
+
)
|
|
1158
|
+
|
|
1159
|
+
def reject_offer_init(self, wallet_id: str, offer_id: str) -> UserActionChallengeResponse:
|
|
1160
|
+
"""
|
|
1161
|
+
Initialize Reject Offer.
|
|
1162
|
+
|
|
1163
|
+
Creates a user action challenge for external signing.
|
|
1164
|
+
|
|
1165
|
+
Args:
|
|
1166
|
+
wallet_id: Wallet id.
|
|
1167
|
+
offer_id: Offer id.
|
|
1168
|
+
|
|
1169
|
+
Returns:
|
|
1170
|
+
UserActionChallengeResponse: The challenge to sign externally.
|
|
1171
|
+
"""
|
|
1172
|
+
path = "/wallets/{walletId}/offers/{offerId}/reject"
|
|
1173
|
+
path = path.replace("{walletId}", str(wallet_id))
|
|
1174
|
+
path = path.replace("{offerId}", str(offer_id))
|
|
1175
|
+
payload = ""
|
|
1176
|
+
|
|
1177
|
+
return BaseAuthApi.create_user_action_challenge(
|
|
1178
|
+
self._http,
|
|
1179
|
+
user_action_http_method="PUT",
|
|
1180
|
+
user_action_http_path=path,
|
|
1181
|
+
user_action_payload=payload,
|
|
1182
|
+
)
|
|
1183
|
+
|
|
1184
|
+
def reject_offer_complete(self, wallet_id: str, offer_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.RejectOfferResponse:
|
|
1185
|
+
"""
|
|
1186
|
+
Complete Reject Offer.
|
|
1187
|
+
|
|
1188
|
+
Submits the signed challenge and makes the API request.
|
|
1189
|
+
|
|
1190
|
+
Args:
|
|
1191
|
+
wallet_id: Wallet id.
|
|
1192
|
+
offer_id: Offer id.
|
|
1193
|
+
signed_challenge: The signed challenge from external signing.
|
|
1194
|
+
|
|
1195
|
+
Returns:
|
|
1196
|
+
T.RejectOfferResponse: The API response.
|
|
1197
|
+
"""
|
|
1198
|
+
user_action_result = BaseAuthApi.sign_user_action_challenge(
|
|
1199
|
+
self._http, signed_challenge
|
|
1200
|
+
)
|
|
1201
|
+
user_action_token = user_action_result["userAction"]
|
|
1202
|
+
|
|
1203
|
+
return self._http.request_with_user_action(
|
|
1204
|
+
method="PUT",
|
|
1205
|
+
path="/wallets/{walletId}/offers/{offerId}/reject",
|
|
1206
|
+
path_params={"walletId": wallet_id, "offerId": offer_id},
|
|
1207
|
+
query_params=None,
|
|
1208
|
+
body=None,
|
|
1209
|
+
user_action=user_action_token,
|
|
1210
|
+
)
|
|
1211
|
+
|
|
1212
|
+
def list_org_wallet_history(self, query: T.ListOrgWalletHistoryQuery) -> Union[TypedDict, str]:
|
|
1213
|
+
"""
|
|
1214
|
+
List Org Wallet History.
|
|
1215
|
+
|
|
1216
|
+
Retrieve the transaction history across all wallets within a specified timeframe.
|
|
1217
|
+
|
|
1218
|
+
Args:
|
|
1219
|
+
query: Query parameters.
|
|
1220
|
+
|
|
1221
|
+
Returns:
|
|
1222
|
+
Union[TypedDict, str]: The API response.
|
|
1223
|
+
"""
|
|
1224
|
+
return self._http.request(
|
|
1225
|
+
method="GET",
|
|
1226
|
+
path="/wallets/all/history",
|
|
1227
|
+
path_params={},
|
|
1228
|
+
query_params=query,
|
|
1229
|
+
body=None,
|
|
1230
|
+
requires_signature=False,
|
|
1231
|
+
)
|