compass_api_sdk 1.0.0__py3-none-any.whl → 1.0.1__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.
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/aave_v3.py +8 -0
- compass_api_sdk/ethena.py +880 -0
- compass_api_sdk/models/__init__.py +143 -28
- compass_api_sdk/models/bundlertransactionresponse.py +17 -0
- compass_api_sdk/models/compass_api_backend_models_vaults_read_response_vault_userposition.py +8 -4
- compass_api_sdk/models/cooldownposition.py +35 -0
- compass_api_sdk/models/ethenadepositparams.py +82 -0
- compass_api_sdk/models/ethenadepositrequest.py +95 -0
- compass_api_sdk/models/ethenagetvaultresponse.py +109 -0
- compass_api_sdk/models/ethenarequesttowithdrawparams.py +28 -0
- compass_api_sdk/models/ethenarequesttowithdrawrequest.py +41 -0
- compass_api_sdk/models/ethenarequesttowithdrawtransactionresponse.py +37 -0
- compass_api_sdk/models/ethenawithdrawparams.py +70 -0
- compass_api_sdk/models/ethenawithdrawrequest.py +83 -0
- compass_api_sdk/models/odostransactionresponse.py +37 -0
- compass_api_sdk/models/pendletxresponse.py +2 -11
- compass_api_sdk/models/setallowanceparams.py +1 -0
- compass_api_sdk/models/setallowancerequest.py +1 -0
- compass_api_sdk/models/token_enum.py +31 -25
- compass_api_sdk/models/tokentransferparams.py +21 -21
- compass_api_sdk/models/tokentransferrequest.py +21 -21
- compass_api_sdk/models/transactionresponse.py +2 -11
- compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_asset.py → underlyingtoken.py} +2 -2
- compass_api_sdk/models/uniswapbuyexactlytransactionresponse.py +2 -10
- compass_api_sdk/models/uniswapsellexactlytransactionresponse.py +2 -10
- compass_api_sdk/models/useroperation.py +25 -19
- compass_api_sdk/models/v1_aave_avg_rateop.py +31 -25
- compass_api_sdk/models/v1_aave_liquidity_changeop.py +31 -25
- compass_api_sdk/models/v1_aave_rateop.py +31 -25
- compass_api_sdk/models/v1_aave_reserve_overviewop.py +31 -25
- compass_api_sdk/models/v1_aave_std_rateop.py +31 -25
- compass_api_sdk/models/v1_aave_token_priceop.py +31 -25
- compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +31 -25
- compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +62 -50
- compass_api_sdk/models/v1_ethena_vaultop.py +75 -0
- compass_api_sdk/models/v1_generic_allowanceop.py +1 -0
- compass_api_sdk/models/v1_token_addressop.py +31 -25
- compass_api_sdk/models/v1_token_priceop.py +4 -16
- compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +6 -3
- compass_api_sdk/models/v1_uniswap_pool_priceop.py +62 -50
- compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +62 -50
- compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +62 -50
- compass_api_sdk/models/vaultgetvaultresponse.py +3 -6
- compass_api_sdk/sdk.py +3 -0
- compass_api_sdk/swap.py +4 -4
- compass_api_sdk/token_sdk.py +20 -20
- compass_api_sdk/transaction_bundler.py +4 -4
- {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.1.dist-info}/METADATA +150 -135
- {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.1.dist-info}/RECORD +51 -39
- compass_api_sdk/models/tokentransfererc20params.py +0 -63
- {compass_api_sdk-1.0.0.dist-info → compass_api_sdk-1.0.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,880 @@
|
|
|
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_withdraw(
|
|
431
|
+
self,
|
|
432
|
+
*,
|
|
433
|
+
amount: Any,
|
|
434
|
+
chain: models.EthenaWithdrawRequestChain,
|
|
435
|
+
sender: str,
|
|
436
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
437
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
438
|
+
server_url: Optional[str] = None,
|
|
439
|
+
timeout_ms: Optional[int] = None,
|
|
440
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
441
|
+
) -> models.TransactionResponse:
|
|
442
|
+
r"""Withdraw USDe
|
|
443
|
+
|
|
444
|
+
Withdraw deposited USDe from Ethena's vault and cease earning passive yield.
|
|
445
|
+
|
|
446
|
+
The passive yield earned on USDe deposits is represented by the increased value of
|
|
447
|
+
the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
448
|
+
for the intial USDe deposited and any accrued yield since depositing.
|
|
449
|
+
<Info>
|
|
450
|
+
**Required Allowances**
|
|
451
|
+
|
|
452
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
453
|
+
|
|
454
|
+
- `EthenaVault`
|
|
455
|
+
</Info>
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
:param amount: The amount of USDe to withdraw from Ethena's vault. If set to 'ALL', your total deposited USDe amount will be withdrawn.
|
|
459
|
+
:param chain:
|
|
460
|
+
:param sender: The address of the transaction sender.
|
|
461
|
+
:param receiver: The address which will receive the USDe withdrawn. Defaults to the sender.
|
|
462
|
+
:param retries: Override the default retry configuration for this method
|
|
463
|
+
:param server_url: Override the default server URL for this method
|
|
464
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
465
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
466
|
+
"""
|
|
467
|
+
base_url = None
|
|
468
|
+
url_variables = None
|
|
469
|
+
if timeout_ms is None:
|
|
470
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
471
|
+
|
|
472
|
+
if server_url is not None:
|
|
473
|
+
base_url = server_url
|
|
474
|
+
else:
|
|
475
|
+
base_url = self._get_url(base_url, url_variables)
|
|
476
|
+
|
|
477
|
+
request = models.EthenaWithdrawRequest(
|
|
478
|
+
amount=amount,
|
|
479
|
+
receiver=receiver,
|
|
480
|
+
chain=chain,
|
|
481
|
+
sender=sender,
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
req = self._build_request(
|
|
485
|
+
method="POST",
|
|
486
|
+
path="/v1/ethena/withdraw",
|
|
487
|
+
base_url=base_url,
|
|
488
|
+
url_variables=url_variables,
|
|
489
|
+
request=request,
|
|
490
|
+
request_body_required=True,
|
|
491
|
+
request_has_path_params=False,
|
|
492
|
+
request_has_query_params=True,
|
|
493
|
+
user_agent_header="user-agent",
|
|
494
|
+
accept_header_value="application/json",
|
|
495
|
+
http_headers=http_headers,
|
|
496
|
+
security=self.sdk_configuration.security,
|
|
497
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
498
|
+
request, False, False, "json", models.EthenaWithdrawRequest
|
|
499
|
+
),
|
|
500
|
+
timeout_ms=timeout_ms,
|
|
501
|
+
)
|
|
502
|
+
|
|
503
|
+
if retries == UNSET:
|
|
504
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
505
|
+
retries = self.sdk_configuration.retry_config
|
|
506
|
+
|
|
507
|
+
retry_config = None
|
|
508
|
+
if isinstance(retries, utils.RetryConfig):
|
|
509
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
510
|
+
|
|
511
|
+
http_res = self.do_request(
|
|
512
|
+
hook_ctx=HookContext(
|
|
513
|
+
config=self.sdk_configuration,
|
|
514
|
+
base_url=base_url or "",
|
|
515
|
+
operation_id="v1_ethena_withdraw",
|
|
516
|
+
oauth2_scopes=[],
|
|
517
|
+
security_source=self.sdk_configuration.security,
|
|
518
|
+
),
|
|
519
|
+
request=req,
|
|
520
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
521
|
+
retry_config=retry_config,
|
|
522
|
+
)
|
|
523
|
+
|
|
524
|
+
response_data: Any = None
|
|
525
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
526
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
527
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
528
|
+
response_data = unmarshal_json_response(
|
|
529
|
+
errors.HTTPValidationErrorData, http_res
|
|
530
|
+
)
|
|
531
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
532
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
533
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
534
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
535
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
536
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
537
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
538
|
+
|
|
539
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
540
|
+
|
|
541
|
+
async def ethena_withdraw_async(
|
|
542
|
+
self,
|
|
543
|
+
*,
|
|
544
|
+
amount: Any,
|
|
545
|
+
chain: models.EthenaWithdrawRequestChain,
|
|
546
|
+
sender: str,
|
|
547
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
548
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
549
|
+
server_url: Optional[str] = None,
|
|
550
|
+
timeout_ms: Optional[int] = None,
|
|
551
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
552
|
+
) -> models.TransactionResponse:
|
|
553
|
+
r"""Withdraw USDe
|
|
554
|
+
|
|
555
|
+
Withdraw deposited USDe from Ethena's vault and cease earning passive yield.
|
|
556
|
+
|
|
557
|
+
The passive yield earned on USDe deposits is represented by the increased value of
|
|
558
|
+
the shares received (sUSDe) upon depositing USDe. Trade in these shares in exchange
|
|
559
|
+
for the intial USDe deposited and any accrued yield since depositing.
|
|
560
|
+
<Info>
|
|
561
|
+
**Required Allowances**
|
|
562
|
+
|
|
563
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
564
|
+
|
|
565
|
+
- `EthenaVault`
|
|
566
|
+
</Info>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
:param amount: The amount of USDe to withdraw from Ethena's vault. If set to 'ALL', your total deposited USDe amount will be withdrawn.
|
|
570
|
+
:param chain:
|
|
571
|
+
:param sender: The address of the transaction sender.
|
|
572
|
+
:param receiver: The address which will receive the USDe withdrawn. Defaults to the sender.
|
|
573
|
+
:param retries: Override the default retry configuration for this method
|
|
574
|
+
:param server_url: Override the default server URL for this method
|
|
575
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
576
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
577
|
+
"""
|
|
578
|
+
base_url = None
|
|
579
|
+
url_variables = None
|
|
580
|
+
if timeout_ms is None:
|
|
581
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
582
|
+
|
|
583
|
+
if server_url is not None:
|
|
584
|
+
base_url = server_url
|
|
585
|
+
else:
|
|
586
|
+
base_url = self._get_url(base_url, url_variables)
|
|
587
|
+
|
|
588
|
+
request = models.EthenaWithdrawRequest(
|
|
589
|
+
amount=amount,
|
|
590
|
+
receiver=receiver,
|
|
591
|
+
chain=chain,
|
|
592
|
+
sender=sender,
|
|
593
|
+
)
|
|
594
|
+
|
|
595
|
+
req = self._build_request_async(
|
|
596
|
+
method="POST",
|
|
597
|
+
path="/v1/ethena/withdraw",
|
|
598
|
+
base_url=base_url,
|
|
599
|
+
url_variables=url_variables,
|
|
600
|
+
request=request,
|
|
601
|
+
request_body_required=True,
|
|
602
|
+
request_has_path_params=False,
|
|
603
|
+
request_has_query_params=True,
|
|
604
|
+
user_agent_header="user-agent",
|
|
605
|
+
accept_header_value="application/json",
|
|
606
|
+
http_headers=http_headers,
|
|
607
|
+
security=self.sdk_configuration.security,
|
|
608
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
609
|
+
request, False, False, "json", models.EthenaWithdrawRequest
|
|
610
|
+
),
|
|
611
|
+
timeout_ms=timeout_ms,
|
|
612
|
+
)
|
|
613
|
+
|
|
614
|
+
if retries == UNSET:
|
|
615
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
616
|
+
retries = self.sdk_configuration.retry_config
|
|
617
|
+
|
|
618
|
+
retry_config = None
|
|
619
|
+
if isinstance(retries, utils.RetryConfig):
|
|
620
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
621
|
+
|
|
622
|
+
http_res = await self.do_request_async(
|
|
623
|
+
hook_ctx=HookContext(
|
|
624
|
+
config=self.sdk_configuration,
|
|
625
|
+
base_url=base_url or "",
|
|
626
|
+
operation_id="v1_ethena_withdraw",
|
|
627
|
+
oauth2_scopes=[],
|
|
628
|
+
security_source=self.sdk_configuration.security,
|
|
629
|
+
),
|
|
630
|
+
request=req,
|
|
631
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
632
|
+
retry_config=retry_config,
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
response_data: Any = None
|
|
636
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
637
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
638
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
639
|
+
response_data = unmarshal_json_response(
|
|
640
|
+
errors.HTTPValidationErrorData, http_res
|
|
641
|
+
)
|
|
642
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
643
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
644
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
645
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
646
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
647
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
648
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
649
|
+
|
|
650
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
651
|
+
|
|
652
|
+
def ethena_request(
|
|
653
|
+
self,
|
|
654
|
+
*,
|
|
655
|
+
amount: Any,
|
|
656
|
+
chain: models.EthenaRequestToWithdrawRequestChain,
|
|
657
|
+
sender: str,
|
|
658
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
659
|
+
server_url: Optional[str] = None,
|
|
660
|
+
timeout_ms: Optional[int] = None,
|
|
661
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
662
|
+
) -> models.EthenaRequestToWithdrawTransactionResponse:
|
|
663
|
+
r"""Request to Withdraw USDe
|
|
664
|
+
|
|
665
|
+
Request to withdraw deposited USDe from Ethena's vault.
|
|
666
|
+
|
|
667
|
+
The Ethena vault requires a cooldown period. Once a request to withdraw a specified
|
|
668
|
+
amount of USDe has been submitted, the alloted cooldown period must pass before the
|
|
669
|
+
withdraw USDe transaction can be submitted.
|
|
670
|
+
|
|
671
|
+
If an additional amount of USDe is requested to be withdrawn anytime before
|
|
672
|
+
withdrawing the originally requested amount, the cooldown period restarts.
|
|
673
|
+
|
|
674
|
+
Yield is not earned on USDe while in its cooldown period.
|
|
675
|
+
<Info>
|
|
676
|
+
**Required Allowances**
|
|
677
|
+
|
|
678
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
679
|
+
|
|
680
|
+
- `EthenaVault`
|
|
681
|
+
</Info>
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
: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.
|
|
685
|
+
:param chain:
|
|
686
|
+
:param sender: The address of the transaction sender.
|
|
687
|
+
:param retries: Override the default retry configuration for this method
|
|
688
|
+
:param server_url: Override the default server URL for this method
|
|
689
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
690
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
691
|
+
"""
|
|
692
|
+
base_url = None
|
|
693
|
+
url_variables = None
|
|
694
|
+
if timeout_ms is None:
|
|
695
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
696
|
+
|
|
697
|
+
if server_url is not None:
|
|
698
|
+
base_url = server_url
|
|
699
|
+
else:
|
|
700
|
+
base_url = self._get_url(base_url, url_variables)
|
|
701
|
+
|
|
702
|
+
request = models.EthenaRequestToWithdrawRequest(
|
|
703
|
+
amount=amount,
|
|
704
|
+
chain=chain,
|
|
705
|
+
sender=sender,
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
req = self._build_request(
|
|
709
|
+
method="POST",
|
|
710
|
+
path="/v1/ethena/request",
|
|
711
|
+
base_url=base_url,
|
|
712
|
+
url_variables=url_variables,
|
|
713
|
+
request=request,
|
|
714
|
+
request_body_required=True,
|
|
715
|
+
request_has_path_params=False,
|
|
716
|
+
request_has_query_params=True,
|
|
717
|
+
user_agent_header="user-agent",
|
|
718
|
+
accept_header_value="application/json",
|
|
719
|
+
http_headers=http_headers,
|
|
720
|
+
security=self.sdk_configuration.security,
|
|
721
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
722
|
+
request, False, False, "json", models.EthenaRequestToWithdrawRequest
|
|
723
|
+
),
|
|
724
|
+
timeout_ms=timeout_ms,
|
|
725
|
+
)
|
|
726
|
+
|
|
727
|
+
if retries == UNSET:
|
|
728
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
729
|
+
retries = self.sdk_configuration.retry_config
|
|
730
|
+
|
|
731
|
+
retry_config = None
|
|
732
|
+
if isinstance(retries, utils.RetryConfig):
|
|
733
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
734
|
+
|
|
735
|
+
http_res = self.do_request(
|
|
736
|
+
hook_ctx=HookContext(
|
|
737
|
+
config=self.sdk_configuration,
|
|
738
|
+
base_url=base_url or "",
|
|
739
|
+
operation_id="v1_ethena_request",
|
|
740
|
+
oauth2_scopes=[],
|
|
741
|
+
security_source=self.sdk_configuration.security,
|
|
742
|
+
),
|
|
743
|
+
request=req,
|
|
744
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
745
|
+
retry_config=retry_config,
|
|
746
|
+
)
|
|
747
|
+
|
|
748
|
+
response_data: Any = None
|
|
749
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
750
|
+
return unmarshal_json_response(
|
|
751
|
+
models.EthenaRequestToWithdrawTransactionResponse, http_res
|
|
752
|
+
)
|
|
753
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
754
|
+
response_data = unmarshal_json_response(
|
|
755
|
+
errors.HTTPValidationErrorData, http_res
|
|
756
|
+
)
|
|
757
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
758
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
759
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
760
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
761
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
762
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
763
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
764
|
+
|
|
765
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
766
|
+
|
|
767
|
+
async def ethena_request_async(
|
|
768
|
+
self,
|
|
769
|
+
*,
|
|
770
|
+
amount: Any,
|
|
771
|
+
chain: models.EthenaRequestToWithdrawRequestChain,
|
|
772
|
+
sender: str,
|
|
773
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
774
|
+
server_url: Optional[str] = None,
|
|
775
|
+
timeout_ms: Optional[int] = None,
|
|
776
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
777
|
+
) -> models.EthenaRequestToWithdrawTransactionResponse:
|
|
778
|
+
r"""Request to Withdraw USDe
|
|
779
|
+
|
|
780
|
+
Request to withdraw deposited USDe from Ethena's vault.
|
|
781
|
+
|
|
782
|
+
The Ethena vault requires a cooldown period. Once a request to withdraw a specified
|
|
783
|
+
amount of USDe has been submitted, the alloted cooldown period must pass before the
|
|
784
|
+
withdraw USDe transaction can be submitted.
|
|
785
|
+
|
|
786
|
+
If an additional amount of USDe is requested to be withdrawn anytime before
|
|
787
|
+
withdrawing the originally requested amount, the cooldown period restarts.
|
|
788
|
+
|
|
789
|
+
Yield is not earned on USDe while in its cooldown period.
|
|
790
|
+
<Info>
|
|
791
|
+
**Required Allowances**
|
|
792
|
+
|
|
793
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
794
|
+
|
|
795
|
+
- `EthenaVault`
|
|
796
|
+
</Info>
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
: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.
|
|
800
|
+
:param chain:
|
|
801
|
+
:param sender: The address of the transaction sender.
|
|
802
|
+
:param retries: Override the default retry configuration for this method
|
|
803
|
+
:param server_url: Override the default server URL for this method
|
|
804
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
805
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
806
|
+
"""
|
|
807
|
+
base_url = None
|
|
808
|
+
url_variables = None
|
|
809
|
+
if timeout_ms is None:
|
|
810
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
811
|
+
|
|
812
|
+
if server_url is not None:
|
|
813
|
+
base_url = server_url
|
|
814
|
+
else:
|
|
815
|
+
base_url = self._get_url(base_url, url_variables)
|
|
816
|
+
|
|
817
|
+
request = models.EthenaRequestToWithdrawRequest(
|
|
818
|
+
amount=amount,
|
|
819
|
+
chain=chain,
|
|
820
|
+
sender=sender,
|
|
821
|
+
)
|
|
822
|
+
|
|
823
|
+
req = self._build_request_async(
|
|
824
|
+
method="POST",
|
|
825
|
+
path="/v1/ethena/request",
|
|
826
|
+
base_url=base_url,
|
|
827
|
+
url_variables=url_variables,
|
|
828
|
+
request=request,
|
|
829
|
+
request_body_required=True,
|
|
830
|
+
request_has_path_params=False,
|
|
831
|
+
request_has_query_params=True,
|
|
832
|
+
user_agent_header="user-agent",
|
|
833
|
+
accept_header_value="application/json",
|
|
834
|
+
http_headers=http_headers,
|
|
835
|
+
security=self.sdk_configuration.security,
|
|
836
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
837
|
+
request, False, False, "json", models.EthenaRequestToWithdrawRequest
|
|
838
|
+
),
|
|
839
|
+
timeout_ms=timeout_ms,
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
if retries == UNSET:
|
|
843
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
844
|
+
retries = self.sdk_configuration.retry_config
|
|
845
|
+
|
|
846
|
+
retry_config = None
|
|
847
|
+
if isinstance(retries, utils.RetryConfig):
|
|
848
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
849
|
+
|
|
850
|
+
http_res = await self.do_request_async(
|
|
851
|
+
hook_ctx=HookContext(
|
|
852
|
+
config=self.sdk_configuration,
|
|
853
|
+
base_url=base_url or "",
|
|
854
|
+
operation_id="v1_ethena_request",
|
|
855
|
+
oauth2_scopes=[],
|
|
856
|
+
security_source=self.sdk_configuration.security,
|
|
857
|
+
),
|
|
858
|
+
request=req,
|
|
859
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
860
|
+
retry_config=retry_config,
|
|
861
|
+
)
|
|
862
|
+
|
|
863
|
+
response_data: Any = None
|
|
864
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
865
|
+
return unmarshal_json_response(
|
|
866
|
+
models.EthenaRequestToWithdrawTransactionResponse, http_res
|
|
867
|
+
)
|
|
868
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
869
|
+
response_data = unmarshal_json_response(
|
|
870
|
+
errors.HTTPValidationErrorData, http_res
|
|
871
|
+
)
|
|
872
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
873
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
874
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
875
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
876
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
877
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
878
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
879
|
+
|
|
880
|
+
raise errors.APIError("Unexpected response received", http_res)
|