compass_api_sdk 1.0.0__py3-none-any.whl → 1.0.2__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.

Potentially problematic release.


This version of compass_api_sdk might be problematic. Click here for more details.

Files changed (57) hide show
  1. compass_api_sdk/_version.py +3 -3
  2. compass_api_sdk/aave_v3.py +8 -0
  3. compass_api_sdk/ethena.py +864 -0
  4. compass_api_sdk/models/__init__.py +140 -28
  5. compass_api_sdk/models/bundlertransactionresponse.py +17 -0
  6. compass_api_sdk/models/compass_api_backend_models_vaults_read_response_vault_userposition.py +8 -4
  7. compass_api_sdk/models/cooldownposition.py +35 -0
  8. compass_api_sdk/models/ethenadepositparams.py +82 -0
  9. compass_api_sdk/models/ethenadepositrequest.py +95 -0
  10. compass_api_sdk/models/ethenagetvaultresponse.py +109 -0
  11. compass_api_sdk/models/ethenarequesttowithdrawparams.py +28 -0
  12. compass_api_sdk/models/ethenarequesttowithdrawrequest.py +41 -0
  13. compass_api_sdk/models/ethenarequesttowithdrawtransactionresponse.py +37 -0
  14. compass_api_sdk/models/ethenaunstakeparams.py +65 -0
  15. compass_api_sdk/models/ethenaunstakerequest.py +78 -0
  16. compass_api_sdk/models/odostransactionresponse.py +37 -0
  17. compass_api_sdk/models/pendletxresponse.py +2 -11
  18. compass_api_sdk/models/setallowanceparams.py +1 -0
  19. compass_api_sdk/models/setallowancerequest.py +1 -0
  20. compass_api_sdk/models/token_enum.py +31 -25
  21. compass_api_sdk/models/tokentransferparams.py +21 -21
  22. compass_api_sdk/models/tokentransferrequest.py +21 -21
  23. compass_api_sdk/models/transactionresponse.py +2 -11
  24. compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_asset.py → underlyingtoken.py} +2 -2
  25. compass_api_sdk/models/uniswapbuyexactlytransactionresponse.py +2 -10
  26. compass_api_sdk/models/uniswapsellexactlytransactionresponse.py +2 -10
  27. compass_api_sdk/models/unsignedmulticalltransaction.py +12 -12
  28. compass_api_sdk/models/unsignedtransaction.py +12 -12
  29. compass_api_sdk/models/useroperation.py +29 -23
  30. compass_api_sdk/models/useroperationresponse.py +2 -2
  31. compass_api_sdk/models/v1_aave_avg_rateop.py +31 -25
  32. compass_api_sdk/models/v1_aave_liquidity_changeop.py +31 -25
  33. compass_api_sdk/models/v1_aave_rateop.py +31 -25
  34. compass_api_sdk/models/v1_aave_reserve_overviewop.py +31 -25
  35. compass_api_sdk/models/v1_aave_std_rateop.py +31 -25
  36. compass_api_sdk/models/v1_aave_token_priceop.py +31 -25
  37. compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +31 -25
  38. compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +62 -50
  39. compass_api_sdk/models/v1_ethena_vaultop.py +75 -0
  40. compass_api_sdk/models/v1_generic_allowanceop.py +1 -0
  41. compass_api_sdk/models/v1_sky_positionop.py +2 -2
  42. compass_api_sdk/models/v1_token_addressop.py +31 -25
  43. compass_api_sdk/models/v1_token_priceop.py +4 -16
  44. compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +6 -3
  45. compass_api_sdk/models/v1_uniswap_pool_priceop.py +62 -50
  46. compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +62 -50
  47. compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +62 -50
  48. compass_api_sdk/models/vaultgetvaultresponse.py +3 -6
  49. compass_api_sdk/sdk.py +3 -0
  50. compass_api_sdk/sky.py +2 -2
  51. compass_api_sdk/swap.py +4 -4
  52. compass_api_sdk/token_sdk.py +20 -20
  53. compass_api_sdk/transaction_bundler.py +4 -4
  54. {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.2.dist-info}/METADATA +150 -135
  55. {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.2.dist-info}/RECORD +56 -44
  56. compass_api_sdk/models/tokentransfererc20params.py +0 -63
  57. {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,864 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from compass_api_sdk import errors, models, utils
5
+ from compass_api_sdk._hooks import HookContext
6
+ from compass_api_sdk.types import OptionalNullable, UNSET
7
+ from compass_api_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
+ from typing import Any, Mapping, Optional, Union
9
+
10
+
11
+ class Ethena(BaseSDK):
12
+ def ethena_vault(
13
+ self,
14
+ *,
15
+ chain: models.V1EthenaVaultChain = models.V1EthenaVaultChain.ETHEREUM,
16
+ block: OptionalNullable[int] = UNSET,
17
+ user_address: OptionalNullable[str] = UNSET,
18
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
+ server_url: Optional[str] = None,
20
+ timeout_ms: Optional[int] = None,
21
+ http_headers: Optional[Mapping[str, str]] = None,
22
+ ) -> models.EthenaGetVaultResponse:
23
+ r"""Get Vault & User Position
24
+
25
+ Get data & user Position for the Ethena vault on Ethereum.
26
+
27
+ Vault address: 0x9d39a5de30e57443bff2a8307a4256c8797a3497
28
+
29
+ The user position is only included in the response if 'user_address' parameter is included in the request.
30
+
31
+ :param chain:
32
+ :param block: Optional block number (defaults to latest).
33
+ :param user_address: The user address of the desired vault position. Only include if you would like the user position included in the response. Defaults to `None`.
34
+ :param retries: Override the default retry configuration for this method
35
+ :param server_url: Override the default server URL for this method
36
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
37
+ :param http_headers: Additional headers to set or replace on requests.
38
+ """
39
+ base_url = None
40
+ url_variables = None
41
+ if timeout_ms is None:
42
+ timeout_ms = self.sdk_configuration.timeout_ms
43
+
44
+ if server_url is not None:
45
+ base_url = server_url
46
+ else:
47
+ base_url = self._get_url(base_url, url_variables)
48
+
49
+ request = models.V1EthenaVaultRequest(
50
+ chain=chain,
51
+ block=block,
52
+ user_address=user_address,
53
+ )
54
+
55
+ req = self._build_request(
56
+ method="GET",
57
+ path="/v1/ethena/vault",
58
+ base_url=base_url,
59
+ url_variables=url_variables,
60
+ request=request,
61
+ request_body_required=False,
62
+ request_has_path_params=False,
63
+ request_has_query_params=True,
64
+ user_agent_header="user-agent",
65
+ accept_header_value="application/json",
66
+ http_headers=http_headers,
67
+ security=self.sdk_configuration.security,
68
+ timeout_ms=timeout_ms,
69
+ )
70
+
71
+ if retries == UNSET:
72
+ if self.sdk_configuration.retry_config is not UNSET:
73
+ retries = self.sdk_configuration.retry_config
74
+
75
+ retry_config = None
76
+ if isinstance(retries, utils.RetryConfig):
77
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
78
+
79
+ http_res = self.do_request(
80
+ hook_ctx=HookContext(
81
+ config=self.sdk_configuration,
82
+ base_url=base_url or "",
83
+ operation_id="v1_ethena_vault",
84
+ oauth2_scopes=[],
85
+ security_source=self.sdk_configuration.security,
86
+ ),
87
+ request=req,
88
+ error_status_codes=["422", "4XX", "5XX"],
89
+ retry_config=retry_config,
90
+ )
91
+
92
+ response_data: Any = None
93
+ if utils.match_response(http_res, "200", "application/json"):
94
+ return unmarshal_json_response(models.EthenaGetVaultResponse, http_res)
95
+ if utils.match_response(http_res, "422", "application/json"):
96
+ response_data = unmarshal_json_response(
97
+ errors.HTTPValidationErrorData, http_res
98
+ )
99
+ raise errors.HTTPValidationError(response_data, http_res)
100
+ if utils.match_response(http_res, "4XX", "*"):
101
+ http_res_text = utils.stream_to_text(http_res)
102
+ raise errors.APIError("API error occurred", http_res, http_res_text)
103
+ if utils.match_response(http_res, "5XX", "*"):
104
+ http_res_text = utils.stream_to_text(http_res)
105
+ raise errors.APIError("API error occurred", http_res, http_res_text)
106
+
107
+ raise errors.APIError("Unexpected response received", http_res)
108
+
109
+ async def ethena_vault_async(
110
+ self,
111
+ *,
112
+ chain: models.V1EthenaVaultChain = models.V1EthenaVaultChain.ETHEREUM,
113
+ block: OptionalNullable[int] = UNSET,
114
+ user_address: OptionalNullable[str] = UNSET,
115
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
116
+ server_url: Optional[str] = None,
117
+ timeout_ms: Optional[int] = None,
118
+ http_headers: Optional[Mapping[str, str]] = None,
119
+ ) -> models.EthenaGetVaultResponse:
120
+ r"""Get Vault & User Position
121
+
122
+ Get data & user Position for the Ethena vault on Ethereum.
123
+
124
+ Vault address: 0x9d39a5de30e57443bff2a8307a4256c8797a3497
125
+
126
+ The user position is only included in the response if 'user_address' parameter is included in the request.
127
+
128
+ :param chain:
129
+ :param block: Optional block number (defaults to latest).
130
+ :param user_address: The user address of the desired vault position. Only include if you would like the user position included in the response. Defaults to `None`.
131
+ :param retries: Override the default retry configuration for this method
132
+ :param server_url: Override the default server URL for this method
133
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
134
+ :param http_headers: Additional headers to set or replace on requests.
135
+ """
136
+ base_url = None
137
+ url_variables = None
138
+ if timeout_ms is None:
139
+ timeout_ms = self.sdk_configuration.timeout_ms
140
+
141
+ if server_url is not None:
142
+ base_url = server_url
143
+ else:
144
+ base_url = self._get_url(base_url, url_variables)
145
+
146
+ request = models.V1EthenaVaultRequest(
147
+ chain=chain,
148
+ block=block,
149
+ user_address=user_address,
150
+ )
151
+
152
+ req = self._build_request_async(
153
+ method="GET",
154
+ path="/v1/ethena/vault",
155
+ base_url=base_url,
156
+ url_variables=url_variables,
157
+ request=request,
158
+ request_body_required=False,
159
+ request_has_path_params=False,
160
+ request_has_query_params=True,
161
+ user_agent_header="user-agent",
162
+ accept_header_value="application/json",
163
+ http_headers=http_headers,
164
+ security=self.sdk_configuration.security,
165
+ timeout_ms=timeout_ms,
166
+ )
167
+
168
+ if retries == UNSET:
169
+ if self.sdk_configuration.retry_config is not UNSET:
170
+ retries = self.sdk_configuration.retry_config
171
+
172
+ retry_config = None
173
+ if isinstance(retries, utils.RetryConfig):
174
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
175
+
176
+ http_res = await self.do_request_async(
177
+ hook_ctx=HookContext(
178
+ config=self.sdk_configuration,
179
+ base_url=base_url or "",
180
+ operation_id="v1_ethena_vault",
181
+ oauth2_scopes=[],
182
+ security_source=self.sdk_configuration.security,
183
+ ),
184
+ request=req,
185
+ error_status_codes=["422", "4XX", "5XX"],
186
+ retry_config=retry_config,
187
+ )
188
+
189
+ response_data: Any = None
190
+ if utils.match_response(http_res, "200", "application/json"):
191
+ return unmarshal_json_response(models.EthenaGetVaultResponse, http_res)
192
+ if utils.match_response(http_res, "422", "application/json"):
193
+ response_data = unmarshal_json_response(
194
+ errors.HTTPValidationErrorData, http_res
195
+ )
196
+ raise errors.HTTPValidationError(response_data, http_res)
197
+ if utils.match_response(http_res, "4XX", "*"):
198
+ http_res_text = await utils.stream_to_text_async(http_res)
199
+ raise errors.APIError("API error occurred", http_res, http_res_text)
200
+ if utils.match_response(http_res, "5XX", "*"):
201
+ http_res_text = await utils.stream_to_text_async(http_res)
202
+ raise errors.APIError("API error occurred", http_res, http_res_text)
203
+
204
+ raise errors.APIError("Unexpected response received", http_res)
205
+
206
+ def ethena_deposit(
207
+ self,
208
+ *,
209
+ amount: Union[
210
+ models.EthenaDepositRequestAmount,
211
+ models.EthenaDepositRequestAmountTypedDict,
212
+ ],
213
+ chain: models.EthenaDepositRequestChain,
214
+ sender: str,
215
+ receiver: OptionalNullable[str] = UNSET,
216
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
217
+ server_url: Optional[str] = None,
218
+ timeout_ms: Optional[int] = None,
219
+ http_headers: Optional[Mapping[str, str]] = None,
220
+ ) -> models.TransactionResponse:
221
+ r"""Deposit USDe
222
+
223
+ Deposit USDe into a Ethena's Vault to earn passive yield.
224
+
225
+ The shares of a deposit are respresented as sUSDe.
226
+ <Info>
227
+ **Required Allowances**
228
+
229
+ In order to make this transaction, token allowances need to be set for the following contracts.
230
+
231
+ - `EthenaVault`
232
+ </Info>
233
+
234
+
235
+ :param amount: The amount of USDe to deposit into Ethena's vault.
236
+ :param chain:
237
+ :param sender: The address of the transaction sender.
238
+ :param receiver: The address which will receive the shares (sUSDe) from Ethena's vault representing their proportional ownership of the vault's assets. Defaults to the sender.
239
+ :param retries: Override the default retry configuration for this method
240
+ :param server_url: Override the default server URL for this method
241
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
242
+ :param http_headers: Additional headers to set or replace on requests.
243
+ """
244
+ base_url = None
245
+ url_variables = None
246
+ if timeout_ms is None:
247
+ timeout_ms = self.sdk_configuration.timeout_ms
248
+
249
+ if server_url is not None:
250
+ base_url = server_url
251
+ else:
252
+ base_url = self._get_url(base_url, url_variables)
253
+
254
+ request = models.EthenaDepositRequest(
255
+ amount=amount,
256
+ receiver=receiver,
257
+ chain=chain,
258
+ sender=sender,
259
+ )
260
+
261
+ req = self._build_request(
262
+ method="POST",
263
+ path="/v1/ethena/deposit",
264
+ base_url=base_url,
265
+ url_variables=url_variables,
266
+ request=request,
267
+ request_body_required=True,
268
+ request_has_path_params=False,
269
+ request_has_query_params=True,
270
+ user_agent_header="user-agent",
271
+ accept_header_value="application/json",
272
+ http_headers=http_headers,
273
+ security=self.sdk_configuration.security,
274
+ get_serialized_body=lambda: utils.serialize_request_body(
275
+ request, False, False, "json", models.EthenaDepositRequest
276
+ ),
277
+ timeout_ms=timeout_ms,
278
+ )
279
+
280
+ if retries == UNSET:
281
+ if self.sdk_configuration.retry_config is not UNSET:
282
+ retries = self.sdk_configuration.retry_config
283
+
284
+ retry_config = None
285
+ if isinstance(retries, utils.RetryConfig):
286
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
287
+
288
+ http_res = self.do_request(
289
+ hook_ctx=HookContext(
290
+ config=self.sdk_configuration,
291
+ base_url=base_url or "",
292
+ operation_id="v1_ethena_deposit",
293
+ oauth2_scopes=[],
294
+ security_source=self.sdk_configuration.security,
295
+ ),
296
+ request=req,
297
+ error_status_codes=["422", "4XX", "5XX"],
298
+ retry_config=retry_config,
299
+ )
300
+
301
+ response_data: Any = None
302
+ if utils.match_response(http_res, "200", "application/json"):
303
+ return unmarshal_json_response(models.TransactionResponse, http_res)
304
+ if utils.match_response(http_res, "422", "application/json"):
305
+ response_data = unmarshal_json_response(
306
+ errors.HTTPValidationErrorData, http_res
307
+ )
308
+ raise errors.HTTPValidationError(response_data, http_res)
309
+ if utils.match_response(http_res, "4XX", "*"):
310
+ http_res_text = utils.stream_to_text(http_res)
311
+ raise errors.APIError("API error occurred", http_res, http_res_text)
312
+ if utils.match_response(http_res, "5XX", "*"):
313
+ http_res_text = utils.stream_to_text(http_res)
314
+ raise errors.APIError("API error occurred", http_res, http_res_text)
315
+
316
+ raise errors.APIError("Unexpected response received", http_res)
317
+
318
+ async def ethena_deposit_async(
319
+ self,
320
+ *,
321
+ amount: Union[
322
+ models.EthenaDepositRequestAmount,
323
+ models.EthenaDepositRequestAmountTypedDict,
324
+ ],
325
+ chain: models.EthenaDepositRequestChain,
326
+ sender: str,
327
+ receiver: OptionalNullable[str] = UNSET,
328
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
329
+ server_url: Optional[str] = None,
330
+ timeout_ms: Optional[int] = None,
331
+ http_headers: Optional[Mapping[str, str]] = None,
332
+ ) -> models.TransactionResponse:
333
+ r"""Deposit USDe
334
+
335
+ Deposit USDe into a Ethena's Vault to earn passive yield.
336
+
337
+ The shares of a deposit are respresented as sUSDe.
338
+ <Info>
339
+ **Required Allowances**
340
+
341
+ In order to make this transaction, token allowances need to be set for the following contracts.
342
+
343
+ - `EthenaVault`
344
+ </Info>
345
+
346
+
347
+ :param amount: The amount of USDe to deposit into Ethena's vault.
348
+ :param chain:
349
+ :param sender: The address of the transaction sender.
350
+ :param receiver: The address which will receive the shares (sUSDe) from Ethena's vault representing their proportional ownership of the vault's assets. Defaults to the sender.
351
+ :param retries: Override the default retry configuration for this method
352
+ :param server_url: Override the default server URL for this method
353
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
354
+ :param http_headers: Additional headers to set or replace on requests.
355
+ """
356
+ base_url = None
357
+ url_variables = None
358
+ if timeout_ms is None:
359
+ timeout_ms = self.sdk_configuration.timeout_ms
360
+
361
+ if server_url is not None:
362
+ base_url = server_url
363
+ else:
364
+ base_url = self._get_url(base_url, url_variables)
365
+
366
+ request = models.EthenaDepositRequest(
367
+ amount=amount,
368
+ receiver=receiver,
369
+ chain=chain,
370
+ sender=sender,
371
+ )
372
+
373
+ req = self._build_request_async(
374
+ method="POST",
375
+ path="/v1/ethena/deposit",
376
+ base_url=base_url,
377
+ url_variables=url_variables,
378
+ request=request,
379
+ request_body_required=True,
380
+ request_has_path_params=False,
381
+ request_has_query_params=True,
382
+ user_agent_header="user-agent",
383
+ accept_header_value="application/json",
384
+ http_headers=http_headers,
385
+ security=self.sdk_configuration.security,
386
+ get_serialized_body=lambda: utils.serialize_request_body(
387
+ request, False, False, "json", models.EthenaDepositRequest
388
+ ),
389
+ timeout_ms=timeout_ms,
390
+ )
391
+
392
+ if retries == UNSET:
393
+ if self.sdk_configuration.retry_config is not UNSET:
394
+ retries = self.sdk_configuration.retry_config
395
+
396
+ retry_config = None
397
+ if isinstance(retries, utils.RetryConfig):
398
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
399
+
400
+ http_res = await self.do_request_async(
401
+ hook_ctx=HookContext(
402
+ config=self.sdk_configuration,
403
+ base_url=base_url or "",
404
+ operation_id="v1_ethena_deposit",
405
+ oauth2_scopes=[],
406
+ security_source=self.sdk_configuration.security,
407
+ ),
408
+ request=req,
409
+ error_status_codes=["422", "4XX", "5XX"],
410
+ retry_config=retry_config,
411
+ )
412
+
413
+ response_data: Any = None
414
+ if utils.match_response(http_res, "200", "application/json"):
415
+ return unmarshal_json_response(models.TransactionResponse, http_res)
416
+ if utils.match_response(http_res, "422", "application/json"):
417
+ response_data = unmarshal_json_response(
418
+ errors.HTTPValidationErrorData, http_res
419
+ )
420
+ raise errors.HTTPValidationError(response_data, http_res)
421
+ if utils.match_response(http_res, "4XX", "*"):
422
+ http_res_text = await utils.stream_to_text_async(http_res)
423
+ raise errors.APIError("API error occurred", http_res, http_res_text)
424
+ if utils.match_response(http_res, "5XX", "*"):
425
+ http_res_text = await utils.stream_to_text_async(http_res)
426
+ raise errors.APIError("API error occurred", http_res, http_res_text)
427
+
428
+ raise errors.APIError("Unexpected response received", http_res)
429
+
430
+ def ethena_request(
431
+ self,
432
+ *,
433
+ amount: Any,
434
+ chain: models.EthenaRequestToWithdrawRequestChain,
435
+ sender: str,
436
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
437
+ server_url: Optional[str] = None,
438
+ timeout_ms: Optional[int] = None,
439
+ http_headers: Optional[Mapping[str, str]] = None,
440
+ ) -> models.EthenaRequestToWithdrawTransactionResponse:
441
+ r"""Request to Withdraw USDe
442
+
443
+ Request to withdraw deposited USDe from Ethena's vault.
444
+
445
+ The Ethena vault requires a cooldown period. Once a request to withdraw a specified
446
+ amount of USDe has been submitted, the alloted cooldown period must pass before the
447
+ withdraw USDe transaction can be submitted.
448
+
449
+ If an additional amount of USDe is requested to be withdrawn anytime before
450
+ withdrawing the originally requested amount, the cooldown period restarts.
451
+
452
+ Yield is not earned on USDe while in its cooldown period.
453
+
454
+ An allowance does not have to be set to initiate the cooldown period.
455
+
456
+ :param amount: The amount of USDe to request to withdraw from Ethena's vault. If set to 'ALL', your total deposited USDe amount will be requested to be withdrawn.
457
+ :param chain:
458
+ :param sender: The address of the transaction sender.
459
+ :param retries: Override the default retry configuration for this method
460
+ :param server_url: Override the default server URL for this method
461
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
462
+ :param http_headers: Additional headers to set or replace on requests.
463
+ """
464
+ base_url = None
465
+ url_variables = None
466
+ if timeout_ms is None:
467
+ timeout_ms = self.sdk_configuration.timeout_ms
468
+
469
+ if server_url is not None:
470
+ base_url = server_url
471
+ else:
472
+ base_url = self._get_url(base_url, url_variables)
473
+
474
+ request = models.EthenaRequestToWithdrawRequest(
475
+ amount=amount,
476
+ chain=chain,
477
+ sender=sender,
478
+ )
479
+
480
+ req = self._build_request(
481
+ method="POST",
482
+ path="/v1/ethena/request",
483
+ base_url=base_url,
484
+ url_variables=url_variables,
485
+ request=request,
486
+ request_body_required=True,
487
+ request_has_path_params=False,
488
+ request_has_query_params=True,
489
+ user_agent_header="user-agent",
490
+ accept_header_value="application/json",
491
+ http_headers=http_headers,
492
+ security=self.sdk_configuration.security,
493
+ get_serialized_body=lambda: utils.serialize_request_body(
494
+ request, False, False, "json", models.EthenaRequestToWithdrawRequest
495
+ ),
496
+ timeout_ms=timeout_ms,
497
+ )
498
+
499
+ if retries == UNSET:
500
+ if self.sdk_configuration.retry_config is not UNSET:
501
+ retries = self.sdk_configuration.retry_config
502
+
503
+ retry_config = None
504
+ if isinstance(retries, utils.RetryConfig):
505
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
506
+
507
+ http_res = self.do_request(
508
+ hook_ctx=HookContext(
509
+ config=self.sdk_configuration,
510
+ base_url=base_url or "",
511
+ operation_id="v1_ethena_request",
512
+ oauth2_scopes=[],
513
+ security_source=self.sdk_configuration.security,
514
+ ),
515
+ request=req,
516
+ error_status_codes=["422", "4XX", "5XX"],
517
+ retry_config=retry_config,
518
+ )
519
+
520
+ response_data: Any = None
521
+ if utils.match_response(http_res, "200", "application/json"):
522
+ return unmarshal_json_response(
523
+ models.EthenaRequestToWithdrawTransactionResponse, http_res
524
+ )
525
+ if utils.match_response(http_res, "422", "application/json"):
526
+ response_data = unmarshal_json_response(
527
+ errors.HTTPValidationErrorData, http_res
528
+ )
529
+ raise errors.HTTPValidationError(response_data, http_res)
530
+ if utils.match_response(http_res, "4XX", "*"):
531
+ http_res_text = utils.stream_to_text(http_res)
532
+ raise errors.APIError("API error occurred", http_res, http_res_text)
533
+ if utils.match_response(http_res, "5XX", "*"):
534
+ http_res_text = utils.stream_to_text(http_res)
535
+ raise errors.APIError("API error occurred", http_res, http_res_text)
536
+
537
+ raise errors.APIError("Unexpected response received", http_res)
538
+
539
+ async def ethena_request_async(
540
+ self,
541
+ *,
542
+ amount: Any,
543
+ chain: models.EthenaRequestToWithdrawRequestChain,
544
+ sender: str,
545
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
546
+ server_url: Optional[str] = None,
547
+ timeout_ms: Optional[int] = None,
548
+ http_headers: Optional[Mapping[str, str]] = None,
549
+ ) -> models.EthenaRequestToWithdrawTransactionResponse:
550
+ r"""Request to Withdraw USDe
551
+
552
+ Request to withdraw deposited USDe from Ethena's vault.
553
+
554
+ The Ethena vault requires a cooldown period. Once a request to withdraw a specified
555
+ amount of USDe has been submitted, the alloted cooldown period must pass before the
556
+ withdraw USDe transaction can be submitted.
557
+
558
+ If an additional amount of USDe is requested to be withdrawn anytime before
559
+ withdrawing the originally requested amount, the cooldown period restarts.
560
+
561
+ Yield is not earned on USDe while in its cooldown period.
562
+
563
+ An allowance does not have to be set to initiate the cooldown period.
564
+
565
+ :param amount: The amount of USDe to request to withdraw from Ethena's vault. If set to 'ALL', your total deposited USDe amount will be requested to be withdrawn.
566
+ :param chain:
567
+ :param sender: The address of the transaction sender.
568
+ :param retries: Override the default retry configuration for this method
569
+ :param server_url: Override the default server URL for this method
570
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
571
+ :param http_headers: Additional headers to set or replace on requests.
572
+ """
573
+ base_url = None
574
+ url_variables = None
575
+ if timeout_ms is None:
576
+ timeout_ms = self.sdk_configuration.timeout_ms
577
+
578
+ if server_url is not None:
579
+ base_url = server_url
580
+ else:
581
+ base_url = self._get_url(base_url, url_variables)
582
+
583
+ request = models.EthenaRequestToWithdrawRequest(
584
+ amount=amount,
585
+ chain=chain,
586
+ sender=sender,
587
+ )
588
+
589
+ req = self._build_request_async(
590
+ method="POST",
591
+ path="/v1/ethena/request",
592
+ base_url=base_url,
593
+ url_variables=url_variables,
594
+ request=request,
595
+ request_body_required=True,
596
+ request_has_path_params=False,
597
+ request_has_query_params=True,
598
+ user_agent_header="user-agent",
599
+ accept_header_value="application/json",
600
+ http_headers=http_headers,
601
+ security=self.sdk_configuration.security,
602
+ get_serialized_body=lambda: utils.serialize_request_body(
603
+ request, False, False, "json", models.EthenaRequestToWithdrawRequest
604
+ ),
605
+ timeout_ms=timeout_ms,
606
+ )
607
+
608
+ if retries == UNSET:
609
+ if self.sdk_configuration.retry_config is not UNSET:
610
+ retries = self.sdk_configuration.retry_config
611
+
612
+ retry_config = None
613
+ if isinstance(retries, utils.RetryConfig):
614
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
615
+
616
+ http_res = await self.do_request_async(
617
+ hook_ctx=HookContext(
618
+ config=self.sdk_configuration,
619
+ base_url=base_url or "",
620
+ operation_id="v1_ethena_request",
621
+ oauth2_scopes=[],
622
+ security_source=self.sdk_configuration.security,
623
+ ),
624
+ request=req,
625
+ error_status_codes=["422", "4XX", "5XX"],
626
+ retry_config=retry_config,
627
+ )
628
+
629
+ response_data: Any = None
630
+ if utils.match_response(http_res, "200", "application/json"):
631
+ return unmarshal_json_response(
632
+ models.EthenaRequestToWithdrawTransactionResponse, http_res
633
+ )
634
+ if utils.match_response(http_res, "422", "application/json"):
635
+ response_data = unmarshal_json_response(
636
+ errors.HTTPValidationErrorData, http_res
637
+ )
638
+ raise errors.HTTPValidationError(response_data, http_res)
639
+ if utils.match_response(http_res, "4XX", "*"):
640
+ http_res_text = await utils.stream_to_text_async(http_res)
641
+ raise errors.APIError("API error occurred", http_res, http_res_text)
642
+ if utils.match_response(http_res, "5XX", "*"):
643
+ http_res_text = await utils.stream_to_text_async(http_res)
644
+ raise errors.APIError("API error occurred", http_res, http_res_text)
645
+
646
+ raise errors.APIError("Unexpected response received", http_res)
647
+
648
+ def ethena_unstake(
649
+ self,
650
+ *,
651
+ chain: models.EthenaUnstakeRequestChain,
652
+ sender: str,
653
+ receiver: OptionalNullable[str] = UNSET,
654
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
655
+ server_url: Optional[str] = None,
656
+ timeout_ms: Optional[int] = None,
657
+ http_headers: Optional[Mapping[str, str]] = None,
658
+ ) -> models.TransactionResponse:
659
+ r"""Unstake USDe
660
+
661
+ Unstake deposited USDe from Ethena's vault.
662
+
663
+ Verify that the USDe being unstaked has completed its mandatory cooldown period
664
+ using the Ethena 'Get Vault & User Position' endpoint.
665
+
666
+ This is an all or nothing action. All of the USDe that has completed its cooldown
667
+ period must be withdrawn.
668
+
669
+ The passive yield earned on USDe deposits is represented by the increased value of
670
+ the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
671
+ for the intial USDe deposited and any accrued yield since depositing.
672
+
673
+ An allowance does not have to be set to unstake USDe that has completed its cooldown
674
+ period.
675
+
676
+ :param chain:
677
+ :param sender: The address of the transaction sender.
678
+ :param receiver: The address which will receive the unstaked USDe. Defaults to the sender.
679
+ :param retries: Override the default retry configuration for this method
680
+ :param server_url: Override the default server URL for this method
681
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
682
+ :param http_headers: Additional headers to set or replace on requests.
683
+ """
684
+ base_url = None
685
+ url_variables = None
686
+ if timeout_ms is None:
687
+ timeout_ms = self.sdk_configuration.timeout_ms
688
+
689
+ if server_url is not None:
690
+ base_url = server_url
691
+ else:
692
+ base_url = self._get_url(base_url, url_variables)
693
+
694
+ request = models.EthenaUnstakeRequest(
695
+ receiver=receiver,
696
+ chain=chain,
697
+ sender=sender,
698
+ )
699
+
700
+ req = self._build_request(
701
+ method="POST",
702
+ path="/v1/ethena/unstake",
703
+ base_url=base_url,
704
+ url_variables=url_variables,
705
+ request=request,
706
+ request_body_required=True,
707
+ request_has_path_params=False,
708
+ request_has_query_params=True,
709
+ user_agent_header="user-agent",
710
+ accept_header_value="application/json",
711
+ http_headers=http_headers,
712
+ security=self.sdk_configuration.security,
713
+ get_serialized_body=lambda: utils.serialize_request_body(
714
+ request, False, False, "json", models.EthenaUnstakeRequest
715
+ ),
716
+ timeout_ms=timeout_ms,
717
+ )
718
+
719
+ if retries == UNSET:
720
+ if self.sdk_configuration.retry_config is not UNSET:
721
+ retries = self.sdk_configuration.retry_config
722
+
723
+ retry_config = None
724
+ if isinstance(retries, utils.RetryConfig):
725
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
726
+
727
+ http_res = self.do_request(
728
+ hook_ctx=HookContext(
729
+ config=self.sdk_configuration,
730
+ base_url=base_url or "",
731
+ operation_id="v1_ethena_unstake",
732
+ oauth2_scopes=[],
733
+ security_source=self.sdk_configuration.security,
734
+ ),
735
+ request=req,
736
+ error_status_codes=["422", "4XX", "5XX"],
737
+ retry_config=retry_config,
738
+ )
739
+
740
+ response_data: Any = None
741
+ if utils.match_response(http_res, "200", "application/json"):
742
+ return unmarshal_json_response(models.TransactionResponse, http_res)
743
+ if utils.match_response(http_res, "422", "application/json"):
744
+ response_data = unmarshal_json_response(
745
+ errors.HTTPValidationErrorData, http_res
746
+ )
747
+ raise errors.HTTPValidationError(response_data, http_res)
748
+ if utils.match_response(http_res, "4XX", "*"):
749
+ http_res_text = utils.stream_to_text(http_res)
750
+ raise errors.APIError("API error occurred", http_res, http_res_text)
751
+ if utils.match_response(http_res, "5XX", "*"):
752
+ http_res_text = utils.stream_to_text(http_res)
753
+ raise errors.APIError("API error occurred", http_res, http_res_text)
754
+
755
+ raise errors.APIError("Unexpected response received", http_res)
756
+
757
+ async def ethena_unstake_async(
758
+ self,
759
+ *,
760
+ chain: models.EthenaUnstakeRequestChain,
761
+ sender: str,
762
+ receiver: OptionalNullable[str] = UNSET,
763
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
764
+ server_url: Optional[str] = None,
765
+ timeout_ms: Optional[int] = None,
766
+ http_headers: Optional[Mapping[str, str]] = None,
767
+ ) -> models.TransactionResponse:
768
+ r"""Unstake USDe
769
+
770
+ Unstake deposited USDe from Ethena's vault.
771
+
772
+ Verify that the USDe being unstaked has completed its mandatory cooldown period
773
+ using the Ethena 'Get Vault & User Position' endpoint.
774
+
775
+ This is an all or nothing action. All of the USDe that has completed its cooldown
776
+ period must be withdrawn.
777
+
778
+ The passive yield earned on USDe deposits is represented by the increased value of
779
+ the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
780
+ for the intial USDe deposited and any accrued yield since depositing.
781
+
782
+ An allowance does not have to be set to unstake USDe that has completed its cooldown
783
+ period.
784
+
785
+ :param chain:
786
+ :param sender: The address of the transaction sender.
787
+ :param receiver: The address which will receive the unstaked USDe. Defaults to the sender.
788
+ :param retries: Override the default retry configuration for this method
789
+ :param server_url: Override the default server URL for this method
790
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
791
+ :param http_headers: Additional headers to set or replace on requests.
792
+ """
793
+ base_url = None
794
+ url_variables = None
795
+ if timeout_ms is None:
796
+ timeout_ms = self.sdk_configuration.timeout_ms
797
+
798
+ if server_url is not None:
799
+ base_url = server_url
800
+ else:
801
+ base_url = self._get_url(base_url, url_variables)
802
+
803
+ request = models.EthenaUnstakeRequest(
804
+ receiver=receiver,
805
+ chain=chain,
806
+ sender=sender,
807
+ )
808
+
809
+ req = self._build_request_async(
810
+ method="POST",
811
+ path="/v1/ethena/unstake",
812
+ base_url=base_url,
813
+ url_variables=url_variables,
814
+ request=request,
815
+ request_body_required=True,
816
+ request_has_path_params=False,
817
+ request_has_query_params=True,
818
+ user_agent_header="user-agent",
819
+ accept_header_value="application/json",
820
+ http_headers=http_headers,
821
+ security=self.sdk_configuration.security,
822
+ get_serialized_body=lambda: utils.serialize_request_body(
823
+ request, False, False, "json", models.EthenaUnstakeRequest
824
+ ),
825
+ timeout_ms=timeout_ms,
826
+ )
827
+
828
+ if retries == UNSET:
829
+ if self.sdk_configuration.retry_config is not UNSET:
830
+ retries = self.sdk_configuration.retry_config
831
+
832
+ retry_config = None
833
+ if isinstance(retries, utils.RetryConfig):
834
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
835
+
836
+ http_res = await self.do_request_async(
837
+ hook_ctx=HookContext(
838
+ config=self.sdk_configuration,
839
+ base_url=base_url or "",
840
+ operation_id="v1_ethena_unstake",
841
+ oauth2_scopes=[],
842
+ security_source=self.sdk_configuration.security,
843
+ ),
844
+ request=req,
845
+ error_status_codes=["422", "4XX", "5XX"],
846
+ retry_config=retry_config,
847
+ )
848
+
849
+ response_data: Any = None
850
+ if utils.match_response(http_res, "200", "application/json"):
851
+ return unmarshal_json_response(models.TransactionResponse, http_res)
852
+ if utils.match_response(http_res, "422", "application/json"):
853
+ response_data = unmarshal_json_response(
854
+ errors.HTTPValidationErrorData, http_res
855
+ )
856
+ raise errors.HTTPValidationError(response_data, http_res)
857
+ if utils.match_response(http_res, "4XX", "*"):
858
+ http_res_text = await utils.stream_to_text_async(http_res)
859
+ raise errors.APIError("API error occurred", http_res, http_res_text)
860
+ if utils.match_response(http_res, "5XX", "*"):
861
+ http_res_text = await utils.stream_to_text_async(http_res)
862
+ raise errors.APIError("API error occurred", http_res, http_res_text)
863
+
864
+ raise errors.APIError("Unexpected response received", http_res)