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.
Files changed (69) hide show
  1. dfns_sdk/__init__.py +24 -0
  2. dfns_sdk/_internal/__init__.py +5 -0
  3. dfns_sdk/_internal/http_client.py +395 -0
  4. dfns_sdk/auth.py +137 -0
  5. dfns_sdk/base_auth_api.py +129 -0
  6. dfns_sdk/client.py +81 -0
  7. dfns_sdk/delegated_client.py +97 -0
  8. dfns_sdk/generated/__init__.py +47 -0
  9. dfns_sdk/generated/agreements/__init__.py +7 -0
  10. dfns_sdk/generated/agreements/client.py +55 -0
  11. dfns_sdk/generated/agreements/delegated_client.py +95 -0
  12. dfns_sdk/generated/agreements/types.py +20 -0
  13. dfns_sdk/generated/allocations/__init__.py +7 -0
  14. dfns_sdk/generated/allocations/client.py +118 -0
  15. dfns_sdk/generated/allocations/delegated_client.py +187 -0
  16. dfns_sdk/generated/allocations/types.py +69 -0
  17. dfns_sdk/generated/auth/__init__.py +7 -0
  18. dfns_sdk/generated/auth/client.py +1215 -0
  19. dfns_sdk/generated/auth/delegated_client.py +1825 -0
  20. dfns_sdk/generated/auth/types.py +702 -0
  21. dfns_sdk/generated/exchanges/__init__.py +7 -0
  22. dfns_sdk/generated/exchanges/client.py +209 -0
  23. dfns_sdk/generated/exchanges/delegated_client.py +341 -0
  24. dfns_sdk/generated/exchanges/types.py +96 -0
  25. dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
  26. dfns_sdk/generated/fee_sponsors/client.py +161 -0
  27. dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
  28. dfns_sdk/generated/fee_sponsors/types.py +89 -0
  29. dfns_sdk/generated/keys/__init__.py +7 -0
  30. dfns_sdk/generated/keys/client.py +310 -0
  31. dfns_sdk/generated/keys/delegated_client.py +518 -0
  32. dfns_sdk/generated/keys/types.py +229 -0
  33. dfns_sdk/generated/networks/__init__.py +7 -0
  34. dfns_sdk/generated/networks/client.py +176 -0
  35. dfns_sdk/generated/networks/delegated_client.py +274 -0
  36. dfns_sdk/generated/networks/types.py +77 -0
  37. dfns_sdk/generated/permissions/__init__.py +7 -0
  38. dfns_sdk/generated/permissions/client.py +185 -0
  39. dfns_sdk/generated/permissions/delegated_client.py +344 -0
  40. dfns_sdk/generated/permissions/types.py +107 -0
  41. dfns_sdk/generated/policies/__init__.py +7 -0
  42. dfns_sdk/generated/policies/client.py +187 -0
  43. dfns_sdk/generated/policies/delegated_client.py +311 -0
  44. dfns_sdk/generated/policies/types.py +70 -0
  45. dfns_sdk/generated/signers/__init__.py +7 -0
  46. dfns_sdk/generated/signers/client.py +45 -0
  47. dfns_sdk/generated/signers/delegated_client.py +56 -0
  48. dfns_sdk/generated/signers/types.py +13 -0
  49. dfns_sdk/generated/staking/__init__.py +7 -0
  50. dfns_sdk/generated/staking/client.py +142 -0
  51. dfns_sdk/generated/staking/delegated_client.py +211 -0
  52. dfns_sdk/generated/staking/types.py +64 -0
  53. dfns_sdk/generated/swaps/__init__.py +7 -0
  54. dfns_sdk/generated/swaps/client.py +118 -0
  55. dfns_sdk/generated/swaps/delegated_client.py +157 -0
  56. dfns_sdk/generated/swaps/types.py +99 -0
  57. dfns_sdk/generated/wallets/__init__.py +7 -0
  58. dfns_sdk/generated/wallets/client.py +805 -0
  59. dfns_sdk/generated/wallets/delegated_client.py +1231 -0
  60. dfns_sdk/generated/wallets/types.py +534 -0
  61. dfns_sdk/generated/webhooks/__init__.py +7 -0
  62. dfns_sdk/generated/webhooks/client.py +193 -0
  63. dfns_sdk/generated/webhooks/delegated_client.py +320 -0
  64. dfns_sdk/generated/webhooks/types.py +101 -0
  65. dfns_sdk/types.py +72 -0
  66. dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
  67. dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
  68. dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
  69. dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,805 @@
1
+ """Client for the wallets domain."""
2
+
3
+ from typing import Any, Literal, Optional, TypedDict, Union
4
+ from warnings import deprecated
5
+
6
+
7
+ from ..._internal import HttpClient
8
+ from . import types as T
9
+
10
+
11
+ class WalletsClient:
12
+ """Client for wallets operations."""
13
+
14
+ def __init__(self, http_client: HttpClient):
15
+ self._http = http_client
16
+
17
+ def activate_wallet(self, wallet_id: str, body: dict[str, Any]) -> T.ActivateWalletResponse:
18
+ """
19
+ Activate Wallet.
20
+
21
+ Activates a wallet by deploying the account contract on-chain, making it ready for transactions.
22
+
23
+ This operation is required for wallets on networks where you need to explicitly activate your account on-chain
24
+ before it can be used for transactions.
25
+
26
+ - **Starknet**: Deploys the account contract using the wallet's public key to initialize the account on the blockchain. No additional parameters required.
27
+ - **Concordium**: Deploys the account using credential deployment information and cryptographic randomness returned by the IDApp.
28
+
29
+ Args:
30
+ wallet_id: Wallet id.
31
+ body: Request body.
32
+
33
+ Returns:
34
+ T.ActivateWalletResponse: The API response.
35
+ """
36
+ return self._http.request(
37
+ method="POST",
38
+ path="/wallets/{walletId}/activate",
39
+ path_params={"walletId": wallet_id},
40
+ query_params=None,
41
+ body=body,
42
+ requires_signature=True,
43
+ )
44
+
45
+ def list_transactions(self, wallet_id: str, query: Optional[T.ListTransactionsQuery] = None) -> T.ListTransactionsResponse:
46
+ """
47
+ List Transactions.
48
+
49
+ Retrieves a list of transactions requests for the specified wallet.
50
+
51
+ Args:
52
+ wallet_id: Path parameter.
53
+ query: Query parameters.
54
+
55
+ Returns:
56
+ T.ListTransactionsResponse: The API response.
57
+ """
58
+ return self._http.request(
59
+ method="GET",
60
+ path="/wallets/{walletId}/transactions",
61
+ path_params={"walletId": wallet_id},
62
+ query_params=query,
63
+ body=None,
64
+ requires_signature=False,
65
+ )
66
+
67
+ def sign_and_broadcast_transaction(self, wallet_id: str, body: dict[str, Any]) -> T.SignAndBroadcastTransactionResponse:
68
+ """
69
+ Sign and Broadcast Transaction.
70
+
71
+ Sign & Broadcast transaction enables communication with any arbitrary smart contract of the target blockchain. You can construct a transaction that performs a complex task and this endpoint will sign the transaction, add the signature and broadcast it to chain. It can be used to call smart contract functions like mint tokens and even deploy new smart contracts.
72
+
73
+ | Status | Definition |
74
+ |-------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
75
+ | Pending | The request is pending approval due to a policy applied to the wallet. |
76
+ | Executing | The request is approved and is in the process of being executed. note this status is only set for a short time between pending and broadcasted. |
77
+ | Broadcasted | The transaction has been successfully written to the mempool. |
78
+ | Confirmed | The transaction has been confirmed on-chain by our indexing pipeline. |
79
+ | Failed | Indicates either a system failure to complete the request or the transaction failed on chain. |
80
+ | Rejected | The request has been rejected by a policy approval action. |
81
+
82
+
83
+ <Info>
84
+ for reading from a "view" function on EVM chains, please use [Read Contract](https://docs.dfns.co/api-reference/networks/read-contract) endpoint.
85
+ </Info>
86
+
87
+ Args:
88
+ wallet_id: Path parameter.
89
+ body: Request body.
90
+
91
+ Returns:
92
+ T.SignAndBroadcastTransactionResponse: The API response.
93
+ """
94
+ return self._http.request(
95
+ method="POST",
96
+ path="/wallets/{walletId}/transactions",
97
+ path_params={"walletId": wallet_id},
98
+ query_params=None,
99
+ body=body,
100
+ requires_signature=True,
101
+ )
102
+
103
+ def cancel_transaction(self, wallet_id: str, transaction_id: str) -> T.CancelTransactionResponse:
104
+ """
105
+ Cancel Transaction.
106
+
107
+ Cancels an EVM transaction by creating a replacement transaction with the same nonce but with a self-transfer of 0 native tokens.
108
+
109
+ This endpoint only works for:
110
+ - EVM-compatible networks (Ethereum, Polygon, BSC, etc.)
111
+ - Transactions that are in 'Broadcasted' status (already submitted to blockchain, but not confirmed yet)
112
+ - Transactions that haven't been included in a block yet
113
+
114
+ The cancellation works by:
115
+ 1. Extracting the nonce from the original broadcasted transaction
116
+ 2. Creating a new native transfer to the same wallet address with 0 amount
117
+ 3. Using the same nonce to replace the original transaction in the mempool
118
+
119
+ Note: Success is not guaranteed as it depends on network conditions and whether the original transaction has already been mined.
120
+
121
+ Args:
122
+ wallet_id: Wallet id.
123
+ transaction_id: Transaction id.
124
+
125
+ Returns:
126
+ T.CancelTransactionResponse: The API response.
127
+ """
128
+ return self._http.request(
129
+ method="POST",
130
+ path="/wallets/{walletId}/transactions/{transactionId}/cancel",
131
+ path_params={"walletId": wallet_id, "transactionId": transaction_id},
132
+ query_params=None,
133
+ body=None,
134
+ requires_signature=True,
135
+ )
136
+
137
+ def cancel_transfer(self, wallet_id: str, transfer_id: str) -> T.CancelTransferResponse:
138
+ """
139
+ Cancel Transfer.
140
+
141
+ Cancels an EVM transfer by creating a replacement transaction with the same nonce but with a self-transfer of 0 native tokens.
142
+
143
+ This endpoint only works for:
144
+ - EVM-compatible networks (Ethereum, Polygon, BSC, etc.)
145
+ - Transfers that are in 'Broadcasted' status (already submitted to blockchain)
146
+ - Transfers that haven't been confirmed yet
147
+
148
+ The cancellation works by:
149
+ 1. Extracting the nonce from the original broadcasted transaction
150
+ 2. Creating a new native transfer to the same wallet address with 0 amount
151
+ 3. Using the same nonce to replace the original transaction in the mempool
152
+
153
+ Note: Success is not guaranteed as it depends on network conditions and whether the original transaction has already been mined.
154
+
155
+ Args:
156
+ wallet_id: Wallet id.
157
+ transfer_id: Transfer id.
158
+
159
+ Returns:
160
+ T.CancelTransferResponse: The API response.
161
+ """
162
+ return self._http.request(
163
+ method="POST",
164
+ path="/wallets/{walletId}/transfers/{transferId}/cancel",
165
+ path_params={"walletId": wallet_id, "transferId": transfer_id},
166
+ query_params=None,
167
+ body=None,
168
+ requires_signature=True,
169
+ )
170
+
171
+ def speed_up_transaction(self, wallet_id: str, transaction_id: str) -> T.SpeedUpTransactionResponse:
172
+ """
173
+ Speed Up Transaction.
174
+
175
+ Speeds up a transaction by creating a replacement transaction with the same parameters but higher gas fees.
176
+
177
+ This endpoint only works for:
178
+ - EVM-compatible networks (Ethereum, Polygon, BSC, etc.)
179
+ - Transactions that are in 'Broadcasted' status (already submitted to blockchain, but not confirmed yet)
180
+ - Transactions that haven't been included in a block yet
181
+
182
+ The speed-up works by:
183
+ 1. Extracting the parameters from the original broadcasted transaction
184
+ 2. Creating a new transaction with the same nonce, recipient, value, and data
185
+ 3. Using higher gas fees (maximum between 10% bump or Fast network fees)
186
+ 4. Replacing the original transaction in the mempool
187
+
188
+ Note: Success is not guaranteed as it depends on network conditions and whether the original transaction has already been mined.
189
+
190
+ Args:
191
+ wallet_id: Wallet id.
192
+ transaction_id: Transaction id.
193
+
194
+ Returns:
195
+ T.SpeedUpTransactionResponse: The API response.
196
+ """
197
+ return self._http.request(
198
+ method="POST",
199
+ path="/wallets/{walletId}/transactions/{transactionId}/speed-up",
200
+ path_params={"walletId": wallet_id, "transactionId": transaction_id},
201
+ query_params=None,
202
+ body=None,
203
+ requires_signature=True,
204
+ )
205
+
206
+ def speed_up_transfer(self, wallet_id: str, transfer_id: str) -> T.SpeedUpTransferResponse:
207
+ """
208
+ Speed Up Transfer.
209
+
210
+ Speeds up a transfer by creating a replacement transaction with the same parameters but higher gas fees.
211
+
212
+ This endpoint only works for:
213
+ - EVM-compatible networks (Ethereum, Polygon, BSC, etc.)
214
+ - Transfers that are in 'Broadcasted' status (already submitted to blockchain, but not confirmed yet)
215
+ - Transfers that haven't been included in a block yet
216
+
217
+ The speed-up works by:
218
+ 1. Extracting the parameters from the original broadcasted transfer
219
+ 2. Creating a new transaction with the same nonce, recipient, value, and data
220
+ 3. Using higher gas fees (maximum between 10% bump or Fast network fees)
221
+ 4. Replacing the original transaction in the mempool
222
+
223
+ Note: Success is not guaranteed as it depends on network conditions and whether the original transaction has already been mined.
224
+
225
+ Args:
226
+ wallet_id: Wallet id.
227
+ transfer_id: Transfer id.
228
+
229
+ Returns:
230
+ T.SpeedUpTransferResponse: The API response.
231
+ """
232
+ return self._http.request(
233
+ method="POST",
234
+ path="/wallets/{walletId}/transfers/{transferId}/speed-up",
235
+ path_params={"walletId": wallet_id, "transferId": transfer_id},
236
+ query_params=None,
237
+ body=None,
238
+ requires_signature=True,
239
+ )
240
+
241
+ def list_wallets(self, query: Optional[T.ListWalletsQuery] = None) -> T.ListWalletsResponse:
242
+ """
243
+ List Wallets.
244
+
245
+ 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.
246
+
247
+ Args:
248
+ query: Query parameters.
249
+
250
+ Returns:
251
+ T.ListWalletsResponse: The API response.
252
+ """
253
+ return self._http.request(
254
+ method="GET",
255
+ path="/wallets",
256
+ path_params={},
257
+ query_params=query,
258
+ body=None,
259
+ requires_signature=False,
260
+ )
261
+
262
+ def create_wallet(self, body: T.CreateWalletRequest) -> T.CreateWalletResponse:
263
+ """
264
+ Create Wallet.
265
+
266
+ Creates a new Wallet associated with the given chain (such as Bitcoin or Ethereum ). Returns a new wallet entity.
267
+
268
+ Args:
269
+ body: Request body.
270
+
271
+ Returns:
272
+ T.CreateWalletResponse: The API response.
273
+ """
274
+ return self._http.request(
275
+ method="POST",
276
+ path="/wallets",
277
+ path_params={},
278
+ query_params=None,
279
+ body=body,
280
+ requires_signature=True,
281
+ )
282
+
283
+ @deprecated("This endpoint is deprecated.")
284
+ def delegate_wallet(self, wallet_id: str, body: T.DelegateWalletRequest) -> T.DelegateWalletResponse:
285
+ """
286
+ Delegate Wallet.
287
+
288
+ <Danger>
289
+ Delegate Wallet is deprecated. Please use [Delegate Key](https://docs.dfns.co/api-reference/keys/delegate-key) instead.
290
+ </Danger>
291
+
292
+ In most cases, when you want to implement Delegated Signing, simply have the end-user create the wallet, in which case it will the non-custodial from the start. There are some rare cases, however, where the wallet must be created before the user has accessed the system. To accommodate this, we've added the ability to create a wallet from a service account, and then later delegate it (ie. transfer ownership of it) to an end user via this endpoint.
293
+
294
+ Args:
295
+ wallet_id: Path parameter.
296
+ body: Request body.
297
+
298
+ Returns:
299
+ T.DelegateWalletResponse: The API response.
300
+ """
301
+ return self._http.request(
302
+ method="POST",
303
+ path="/wallets/{walletId}/delegate",
304
+ path_params={"walletId": wallet_id},
305
+ query_params=None,
306
+ body=body,
307
+ requires_signature=True,
308
+ )
309
+
310
+ @deprecated("This endpoint is deprecated.")
311
+ def export_wallet(self, wallet_id: str, body: T.ExportWalletRequest) -> T.ExportWalletResponse:
312
+ """
313
+ Export Wallet.
314
+
315
+ <Danger>
316
+ Export Wallet is deprecated. Please use [Export Key](https://docs.dfns.co/api-reference/keys/export-key) instead.
317
+ </Danger>
318
+
319
+ Args:
320
+ wallet_id: Path parameter.
321
+ body: Request body.
322
+
323
+ Returns:
324
+ T.ExportWalletResponse: The API response.
325
+ """
326
+ return self._http.request(
327
+ method="POST",
328
+ path="/wallets/{walletId}/export",
329
+ path_params={"walletId": wallet_id},
330
+ query_params=None,
331
+ body=body,
332
+ requires_signature=True,
333
+ )
334
+
335
+ @deprecated("This endpoint is deprecated.")
336
+ def list_signatures(self, wallet_id: str, query: Optional[T.ListSignaturesQuery] = None) -> T.ListSignaturesResponse:
337
+ """
338
+ List Signatures.
339
+
340
+ List all signature requests for a specific wallet.
341
+
342
+ <Danger>
343
+ Generating Signatures from a Wallet is deprecated. Please use the [Keys](https://docs.dfns.co/api-reference/keys) endpoints instead.
344
+ </Danger>
345
+
346
+ Args:
347
+ wallet_id: Path parameter.
348
+ query: Query parameters.
349
+
350
+ Returns:
351
+ T.ListSignaturesResponse: The API response.
352
+ """
353
+ return self._http.request(
354
+ method="GET",
355
+ path="/wallets/{walletId}/signatures",
356
+ path_params={"walletId": wallet_id},
357
+ query_params=query,
358
+ body=None,
359
+ requires_signature=False,
360
+ )
361
+
362
+ @deprecated("This endpoint is deprecated.")
363
+ def generate_signature(self, wallet_id: str, body: dict[str, Any]) -> T.GenerateSignatureResponse:
364
+ """
365
+ Generate Signature.
366
+
367
+ <Danger>
368
+ Generating Signatures from a Wallet is deprecated. Please use the Key's [Generate Signature](https://docs.dfns.co/api-reference/keys/generate-signature) endpoint instead.
369
+ </Danger>
370
+
371
+ Args:
372
+ wallet_id: Path parameter.
373
+ body: Request body.
374
+
375
+ Returns:
376
+ T.GenerateSignatureResponse: The API response.
377
+ """
378
+ return self._http.request(
379
+ method="POST",
380
+ path="/wallets/{walletId}/signatures",
381
+ path_params={"walletId": wallet_id},
382
+ query_params=None,
383
+ body=body,
384
+ requires_signature=True,
385
+ )
386
+
387
+ @deprecated("This endpoint is deprecated.")
388
+ def get_signature(self, wallet_id: str, signature_id: str) -> T.GetSignatureResponse:
389
+ """
390
+ Get Signature.
391
+
392
+ Retrieves a Transaction Request information by its ID.
393
+
394
+ <Danger>
395
+ Generating Signatures from a Wallet is deprecated. Please use the [Keys](https://docs.dfns.co/api-reference/keys) endpoints instead.
396
+ </Danger>
397
+
398
+ Args:
399
+ wallet_id: Path parameter.
400
+ signature_id: Path parameter.
401
+
402
+ Returns:
403
+ T.GetSignatureResponse: The API response.
404
+ """
405
+ return self._http.request(
406
+ method="GET",
407
+ path="/wallets/{walletId}/signatures/{signatureId}",
408
+ path_params={"walletId": wallet_id, "signatureId": signature_id},
409
+ query_params=None,
410
+ body=None,
411
+ requires_signature=False,
412
+ )
413
+
414
+ def get_transaction(self, wallet_id: str, transaction_id: str) -> T.GetTransactionResponse:
415
+ """
416
+ Get Transaction.
417
+
418
+ Retrieve information about a specific transaction.
419
+
420
+ Args:
421
+ wallet_id: Path parameter.
422
+ transaction_id: Path parameter.
423
+
424
+ Returns:
425
+ T.GetTransactionResponse: The API response.
426
+ """
427
+ return self._http.request(
428
+ method="GET",
429
+ path="/wallets/{walletId}/transactions/{transactionId}",
430
+ path_params={"walletId": wallet_id, "transactionId": transaction_id},
431
+ query_params=None,
432
+ body=None,
433
+ requires_signature=False,
434
+ )
435
+
436
+ def get_transfer(self, wallet_id: str, transfer_id: str) -> T.GetTransferResponse:
437
+ """
438
+ Get Transfer.
439
+
440
+ Retrieves a Wallet Transfer Request by its ID.
441
+
442
+ Args:
443
+ wallet_id: Path parameter.
444
+ transfer_id: Path parameter.
445
+
446
+ Returns:
447
+ T.GetTransferResponse: The API response.
448
+ """
449
+ return self._http.request(
450
+ method="GET",
451
+ path="/wallets/{walletId}/transfers/{transferId}",
452
+ path_params={"walletId": wallet_id, "transferId": transfer_id},
453
+ query_params=None,
454
+ body=None,
455
+ requires_signature=False,
456
+ )
457
+
458
+ def get_wallet(self, wallet_id: str) -> T.GetWalletResponse:
459
+ """
460
+ Get Wallet.
461
+
462
+ Retrieves a Wallet information by its ID.
463
+
464
+ Args:
465
+ wallet_id: Path parameter.
466
+
467
+ Returns:
468
+ T.GetWalletResponse: The API response.
469
+ """
470
+ return self._http.request(
471
+ method="GET",
472
+ path="/wallets/{walletId}",
473
+ path_params={"walletId": wallet_id},
474
+ query_params=None,
475
+ body=None,
476
+ requires_signature=False,
477
+ )
478
+
479
+ def update_wallet(self, wallet_id: str, body: T.UpdateWalletRequest) -> T.UpdateWalletResponse:
480
+ """
481
+ Update Wallet.
482
+
483
+ Updates the name of an existing wallet.
484
+
485
+ Args:
486
+ wallet_id: Path parameter.
487
+ body: Request body.
488
+
489
+ Returns:
490
+ T.UpdateWalletResponse: The API response.
491
+ """
492
+ return self._http.request(
493
+ method="PUT",
494
+ path="/wallets/{walletId}",
495
+ path_params={"walletId": wallet_id},
496
+ query_params=None,
497
+ body=body,
498
+ requires_signature=True,
499
+ )
500
+
501
+ def get_wallet_assets(self, wallet_id: str, query: Optional[T.GetWalletAssetsQuery] = None) -> T.GetWalletAssetsResponse:
502
+ """
503
+ Get Wallet Assets.
504
+
505
+ Retrieves a list of assets owned by the specified wallet. Return values vary by chain as shown below.
506
+
507
+ Args:
508
+ wallet_id: Path parameter.
509
+ query: Query parameters.
510
+
511
+ Returns:
512
+ T.GetWalletAssetsResponse: The API response.
513
+ """
514
+ return self._http.request(
515
+ method="GET",
516
+ path="/wallets/{walletId}/assets",
517
+ path_params={"walletId": wallet_id},
518
+ query_params=query,
519
+ body=None,
520
+ requires_signature=False,
521
+ )
522
+
523
+ def get_wallet_history(self, wallet_id: str, query: Optional[T.GetWalletHistoryQuery] = None) -> T.GetWalletHistoryResponse:
524
+ """
525
+ Get Wallet History.
526
+
527
+ Retrieves a list of historical on chain activities for the specified wallet.
528
+
529
+ The list reflects the indexed on-chain activity: it includes confirmed transactions only.
530
+
531
+ If you need to list your on-going or failed transactions please use the related endpoints (
532
+ [List Transfers](https://docs.dfns.co/api-reference/wallets/list-transfers) or
533
+ [List Transactions](https://docs.dfns.co/api-reference/wallets/list-transactions)
534
+ depending on the API you are using).
535
+
536
+ Args:
537
+ wallet_id: Wallet you want to get the history from.
538
+ query: Query parameters.
539
+
540
+ Returns:
541
+ T.GetWalletHistoryResponse: The API response.
542
+ """
543
+ return self._http.request(
544
+ method="GET",
545
+ path="/wallets/{walletId}/history",
546
+ path_params={"walletId": wallet_id},
547
+ query_params=query,
548
+ body=None,
549
+ requires_signature=False,
550
+ )
551
+
552
+ def get_wallet_nfts(self, wallet_id: str) -> T.GetWalletNftsResponse:
553
+ """
554
+ Get Wallet Nfts.
555
+
556
+ Retrieves a list of NFTs owned by the specified Wallet.
557
+
558
+ Args:
559
+ wallet_id: Path parameter.
560
+
561
+ Returns:
562
+ T.GetWalletNftsResponse: The API response.
563
+ """
564
+ return self._http.request(
565
+ method="GET",
566
+ path="/wallets/{walletId}/nfts",
567
+ path_params={"walletId": wallet_id},
568
+ query_params=None,
569
+ body=None,
570
+ requires_signature=False,
571
+ )
572
+
573
+ def import_wallet(self, body: T.ImportWalletRequest) -> T.ImportWalletResponse:
574
+ """
575
+ Import Wallet.
576
+
577
+ <Warning>
578
+ This endpoint is not enabled by default. [Contact Dfns](https://support.dfns.co) to have it activated.
579
+ </Warning>
580
+
581
+ Dfns secures private keys by generating them as MPC key shares in our decentralized key management network. This happens by default when you [create a wallet](https://docs.dfns.co/api-reference/wallets/create-wallet).
582
+
583
+ In some circumstances, however, you may need to import an existing wallet (an existing private key) into Dfns infrastructure, instead of creating a brand new wallet with Dfns and transfer funds to it. As an example, you might want to keep an existing wallet if its address is tied to a smart contract which you don't want to re-deploy.
584
+
585
+ In such a case, Dfns exposes this wallet import API endpoint, which can be used in conjunction with our [import SDK](https://github.com/dfns/dfns-sdk-ts/tree/m/examples/sdk/import-wallet). Note this is intended to be used only to migrate wallets when first onboarding onto the Dfns platform.
586
+
587
+ <Danger>
588
+ Dfns can not guarantee the security of imported wallets, as we have no way to control who had access to the private key prior to import. For this reason, this feature is restricted to Enterprise customers who have signed a contractual addendum limiting our liability for imported keys. Please contact your sales representative for more information.
589
+ </Danger>
590
+
591
+ Args:
592
+ body: Request body.
593
+
594
+ Returns:
595
+ T.ImportWalletResponse: The API response.
596
+ """
597
+ return self._http.request(
598
+ method="POST",
599
+ path="/wallets/import",
600
+ path_params={},
601
+ query_params=None,
602
+ body=body,
603
+ requires_signature=True,
604
+ )
605
+
606
+ def list_transfers(self, wallet_id: str, query: Optional[T.ListTransfersQuery] = None) -> T.ListTransfersResponse:
607
+ """
608
+ List Transfers.
609
+
610
+ Retrieves a list of transfer requests for the specified wallet.
611
+
612
+ Args:
613
+ wallet_id: Path parameter.
614
+ query: Query parameters.
615
+
616
+ Returns:
617
+ T.ListTransfersResponse: The API response.
618
+ """
619
+ return self._http.request(
620
+ method="GET",
621
+ path="/wallets/{walletId}/transfers",
622
+ path_params={"walletId": wallet_id},
623
+ query_params=query,
624
+ body=None,
625
+ requires_signature=False,
626
+ )
627
+
628
+ def transfer_asset(self, wallet_id: str, body: dict[str, Any]) -> T.TransferAssetResponse:
629
+ """
630
+ Transfer Asset.
631
+
632
+ Transfer an asset out of the specified wallet to a destination address.
633
+ For all fungible token transfers, the transfer amount must be specified in the minimum denomination of that token.
634
+ For example, use the amount in Satoshi for a Bitcoin transfer, or the amount in Wei for an Ethereum transfer etc.
635
+
636
+ See the different options in the Body description below. You can also select your kind of transfers in the payload examples in the different languages.
637
+
638
+ Args:
639
+ wallet_id: The source wallet id (`wa-...`).
640
+ body: Request body.
641
+
642
+ Returns:
643
+ T.TransferAssetResponse: The API response.
644
+ """
645
+ return self._http.request(
646
+ method="POST",
647
+ path="/wallets/{walletId}/transfers",
648
+ path_params={"walletId": wallet_id},
649
+ query_params=None,
650
+ body=body,
651
+ requires_signature=True,
652
+ )
653
+
654
+ def tag_wallet(self, wallet_id: str, body: T.TagWalletRequest) -> T.TagWalletResponse:
655
+ """
656
+ Tag Wallet.
657
+
658
+ Add a [Tag](https://docs.dfns.co/api-reference/wallets/tags) to a wallet.
659
+
660
+ Args:
661
+ wallet_id: Path parameter.
662
+ body: Request body.
663
+
664
+ Returns:
665
+ T.TagWalletResponse: The API response.
666
+ """
667
+ return self._http.request(
668
+ method="PUT",
669
+ path="/wallets/{walletId}/tags",
670
+ path_params={"walletId": wallet_id},
671
+ query_params=None,
672
+ body=body,
673
+ requires_signature=True,
674
+ )
675
+
676
+ def untag_wallet(self, wallet_id: str, body: T.UntagWalletRequest) -> T.UntagWalletResponse:
677
+ """
678
+ Untag Wallet.
679
+
680
+ Removes the specified tags from a wallet.
681
+
682
+ Args:
683
+ wallet_id: Path parameter.
684
+ body: Request body.
685
+
686
+ Returns:
687
+ T.UntagWalletResponse: The API response.
688
+ """
689
+ return self._http.request(
690
+ method="DELETE",
691
+ path="/wallets/{walletId}/tags",
692
+ path_params={"walletId": wallet_id},
693
+ query_params=None,
694
+ body=body,
695
+ requires_signature=True,
696
+ )
697
+
698
+ def get_offer(self, wallet_id: str, offer_id: str) -> T.GetOfferResponse:
699
+ """
700
+ Get Offer.
701
+
702
+ Retrieve information about a specific offer received on your wallet.
703
+
704
+ Args:
705
+ wallet_id: Wallet id.
706
+ offer_id: Offer id.
707
+
708
+ Returns:
709
+ T.GetOfferResponse: The API response.
710
+ """
711
+ return self._http.request(
712
+ method="GET",
713
+ path="/wallets/{walletId}/offers/{offerId}",
714
+ path_params={"walletId": wallet_id, "offerId": offer_id},
715
+ query_params=None,
716
+ body=None,
717
+ requires_signature=False,
718
+ )
719
+
720
+ def list_offers(self, wallet_id: str, query: Optional[T.ListOffersQuery] = None) -> T.ListOffersResponse:
721
+ """
722
+ List Offers.
723
+
724
+ List all offers received on a specific wallet.
725
+
726
+ Args:
727
+ wallet_id: Wallet id.
728
+ query: Query parameters.
729
+
730
+ Returns:
731
+ T.ListOffersResponse: The API response.
732
+ """
733
+ return self._http.request(
734
+ method="GET",
735
+ path="/wallets/{walletId}/offers",
736
+ path_params={"walletId": wallet_id},
737
+ query_params=query,
738
+ body=None,
739
+ requires_signature=False,
740
+ )
741
+
742
+ def accept_offer(self, wallet_id: str, offer_id: str) -> T.AcceptOfferResponse:
743
+ """
744
+ Accept Offer.
745
+
746
+ Accept an offer received on your wallet.
747
+
748
+ Args:
749
+ wallet_id: Wallet id.
750
+ offer_id: Offer id.
751
+
752
+ Returns:
753
+ T.AcceptOfferResponse: The API response.
754
+ """
755
+ return self._http.request(
756
+ method="PUT",
757
+ path="/wallets/{walletId}/offers/{offerId}/accept",
758
+ path_params={"walletId": wallet_id, "offerId": offer_id},
759
+ query_params=None,
760
+ body=None,
761
+ requires_signature=True,
762
+ )
763
+
764
+ def reject_offer(self, wallet_id: str, offer_id: str) -> T.RejectOfferResponse:
765
+ """
766
+ Reject Offer.
767
+
768
+ Reject an offer received on your wallet.
769
+
770
+ Args:
771
+ wallet_id: Wallet id.
772
+ offer_id: Offer id.
773
+
774
+ Returns:
775
+ T.RejectOfferResponse: The API response.
776
+ """
777
+ return self._http.request(
778
+ method="PUT",
779
+ path="/wallets/{walletId}/offers/{offerId}/reject",
780
+ path_params={"walletId": wallet_id, "offerId": offer_id},
781
+ query_params=None,
782
+ body=None,
783
+ requires_signature=True,
784
+ )
785
+
786
+ def list_org_wallet_history(self, query: T.ListOrgWalletHistoryQuery) -> Union[TypedDict, str]:
787
+ """
788
+ List Org Wallet History.
789
+
790
+ Retrieve the transaction history across all wallets within a specified timeframe.
791
+
792
+ Args:
793
+ query: Query parameters.
794
+
795
+ Returns:
796
+ Union[TypedDict, str]: The API response.
797
+ """
798
+ return self._http.request(
799
+ method="GET",
800
+ path="/wallets/all/history",
801
+ path_params={},
802
+ query_params=query,
803
+ body=None,
804
+ requires_signature=False,
805
+ )