compass_api_sdk 0.9.52__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.

Files changed (138) hide show
  1. compass_api_sdk/_version.py +3 -3
  2. compass_api_sdk/aave_v3.py +78 -124
  3. compass_api_sdk/aerodrome_slipstream.py +86 -88
  4. compass_api_sdk/erc_4626_vaults.py +18 -42
  5. compass_api_sdk/ethena.py +880 -0
  6. compass_api_sdk/models/__init__.py +1050 -989
  7. compass_api_sdk/models/{compass_api_backend_models_aave_transact_request_borrow_aaveborrowrequest.py → aaveborrowrequest.py} +10 -18
  8. compass_api_sdk/models/aavehistoricaltransactionsresponse.py +65 -0
  9. compass_api_sdk/models/{compass_api_backend_models_multicall_transact_request_aave_loop_request_aavelooprequest.py → aavelooprequest.py} +5 -11
  10. compass_api_sdk/models/{compass_api_backend_models_aave_transact_request_repay_aaverepayrequest.py → aaverepayrequest.py} +10 -18
  11. compass_api_sdk/models/{compass_api_backend_models_aave_transact_request_supply_aavesupplyrequest.py → aavesupplyrequest.py} +10 -18
  12. compass_api_sdk/models/{compass_api_backend_models_aave_transact_request_withdraw_aavewithdrawrequest.py → aavewithdrawrequest.py} +11 -19
  13. compass_api_sdk/models/{compass_api_backend_models_aerodrome_slipstream_read_response_positions_aerodromelppositionsresponse.py → aerodromelppositionsresponse.py} +2 -6
  14. compass_api_sdk/models/{compass_api_backend_models_aerodrome_slipstream_transact_request_swap_buy_exactly_aerodromeslipstreambuyexactlyrequest.py → aerodromeslipstreambuyexactlyrequest.py} +17 -27
  15. compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +125 -0
  16. compass_api_sdk/models/{compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_mint_aerodromeslipstreammintliquidityprovisionrequest.py → aerodromeslipstreammintliquidityprovisionrequest.py} +33 -39
  17. compass_api_sdk/models/{compass_api_backend_models_aerodrome_slipstream_transact_request_swap_sell_exactly_aerodromeslipstreamsellexactlyrequest.py → aerodromeslipstreamsellexactlyrequest.py} +17 -27
  18. compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +66 -0
  19. compass_api_sdk/models/batcheduseroperationsrequest.py +36 -0
  20. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_borrow.py → borrow.py} +2 -4
  21. compass_api_sdk/models/bundlertransactionresponse.py +17 -0
  22. compass_api_sdk/models/{compass_api_backend_config_chain_chain.py → chain.py} +1 -1
  23. compass_api_sdk/models/compass_api_backend_models_vaults_read_response_vault_userposition.py +8 -4
  24. compass_api_sdk/models/cooldownposition.py +35 -0
  25. compass_api_sdk/models/ethenadepositparams.py +82 -0
  26. compass_api_sdk/models/ethenadepositrequest.py +95 -0
  27. compass_api_sdk/models/ethenagetvaultresponse.py +109 -0
  28. compass_api_sdk/models/ethenarequesttowithdrawparams.py +28 -0
  29. compass_api_sdk/models/ethenarequesttowithdrawrequest.py +41 -0
  30. compass_api_sdk/models/ethenarequesttowithdrawtransactionresponse.py +37 -0
  31. compass_api_sdk/models/ethenawithdrawparams.py +70 -0
  32. compass_api_sdk/models/ethenawithdrawrequest.py +83 -0
  33. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_liquidationcall.py → liquidationcall.py} +2 -6
  34. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_marketposition.py → marketposition.py} +2 -6
  35. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_borrow_morphoborrowrequest.py → morphoborrowrequest.py} +11 -19
  36. compass_api_sdk/models/morphocheckuserpositionresponse.py +32 -0
  37. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_deposit_morphodepositrequest.py → morphodepositrequest.py} +11 -23
  38. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_morphogetmarketresponse.py → morphogetmarketresponse.py} +2 -6
  39. compass_api_sdk/models/morphogetmarketsresponse.py +17 -0
  40. compass_api_sdk/models/morphogetvaultsresponse.py +17 -0
  41. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_markets_morphomarket.py → morphomarket.py} +2 -4
  42. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_repay_morphorepayrequest.py → morphorepayrequest.py} +5 -9
  43. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_supply_collateral_morphosupplycollateralrequest.py → morphosupplycollateralrequest.py} +11 -19
  44. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vaults_morphovault.py → morphovault.py} +2 -2
  45. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_withdraw_collateral_morphowithdrawcollateralrequest.py → morphowithdrawcollateralrequest.py} +11 -19
  46. compass_api_sdk/models/{compass_api_backend_models_morpho_transact_request_withdraw_morphowithdrawrequest.py → morphowithdrawrequest.py} +5 -15
  47. compass_api_sdk/models/{compass_api_backend_models_multicall_read_request_get_authorization_multicallauthorizationrequest.py → multicallauthorizationrequest.py} +5 -11
  48. compass_api_sdk/models/{compass_api_backend_models_multicall_transact_request_multicall_execution_request_multicallexecuterequest.py → multicallexecuterequest.py} +8 -21
  49. compass_api_sdk/models/odosswaprequest.py +90 -0
  50. compass_api_sdk/models/odostransactionresponse.py +37 -0
  51. compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_positions_openposition.py → openposition.py} +2 -4
  52. compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_market_pendlegetmarketresponse.py → pendlegetmarketresponse.py} +2 -4
  53. compass_api_sdk/models/pendlelistmarketsresponse.py +17 -0
  54. compass_api_sdk/models/pendlelistuserpositionsresponse.py +17 -0
  55. compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_markets_pendlemarket.py → pendlemarket.py} +2 -2
  56. compass_api_sdk/models/{compass_api_backend_models_pendle_transact_request_redeem_yield_pendleredeemyieldrequest.py → pendleredeemyieldrequest.py} +5 -11
  57. compass_api_sdk/models/pendletxresponse.py +2 -11
  58. compass_api_sdk/models/{compass_api_backend_models_generic_read_response_portfolio_portfolio.py → portfolio.py} +2 -2
  59. compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_positions_position.py → position.py} +7 -18
  60. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_redeemunderlying.py → redeemunderlying.py} +2 -6
  61. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_repay.py → repay.py} +2 -4
  62. compass_api_sdk/models/setallowanceparams.py +1 -0
  63. compass_api_sdk/models/setallowancerequest.py +113 -0
  64. compass_api_sdk/models/{compass_api_backend_models_sky_transact_request_buy_skybuyrequest.py → skybuyrequest.py} +13 -18
  65. compass_api_sdk/models/{compass_api_backend_models_sky_transact_request_deposit_skydepositrequest.py → skydepositrequest.py} +10 -22
  66. compass_api_sdk/models/{compass_api_backend_models_sky_transact_request_sell_skysellrequest.py → skysellrequest.py} +13 -21
  67. compass_api_sdk/models/{compass_api_backend_models_sky_transact_request_withdraw_skywithdrawrequest.py → skywithdrawrequest.py} +5 -13
  68. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_supply.py → supply.py} +2 -4
  69. compass_api_sdk/models/supportedchaininfo.py +19 -0
  70. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_swapborrowrate.py → swapborrowrate.py} +2 -6
  71. compass_api_sdk/models/token_enum.py +31 -25
  72. compass_api_sdk/models/tokentransferparams.py +21 -21
  73. compass_api_sdk/models/tokentransferrequest.py +82 -0
  74. compass_api_sdk/models/transactionresponse.py +2 -11
  75. compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_asset.py → underlyingtoken.py} +2 -2
  76. compass_api_sdk/models/uniswapbuyexactlyrequest.py +111 -0
  77. compass_api_sdk/models/uniswapbuyexactlytransactionresponse.py +2 -10
  78. compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +115 -0
  79. compass_api_sdk/models/{compass_api_backend_models_uniswap_transact_liquidity_provision_request_mint_uniswapmintliquidityprovisionrequest.py → uniswapmintliquidityprovisionrequest.py} +29 -43
  80. compass_api_sdk/models/uniswapsellexactlyrequest.py +111 -0
  81. compass_api_sdk/models/uniswapsellexactlytransactionresponse.py +2 -10
  82. compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +67 -0
  83. compass_api_sdk/models/{compass_api_backend_models_generic_transact_request_unwrap_weth_unwrapwethrequest.py → unwrapwethrequest.py} +10 -22
  84. compass_api_sdk/models/{compass_api_backend_models_aave_read_response_historical_transactions_usageascollateral.py → usageascollateral.py} +2 -6
  85. compass_api_sdk/models/{compass_api_backend_models_multicall_transact_request_multicall_execution_request_useroperation.py → useroperation.py} +27 -25
  86. compass_api_sdk/models/v1_aave_avg_rateop.py +31 -25
  87. compass_api_sdk/models/v1_aave_liquidity_changeop.py +31 -25
  88. compass_api_sdk/models/v1_aave_rateop.py +31 -25
  89. compass_api_sdk/models/v1_aave_reserve_overviewop.py +31 -25
  90. compass_api_sdk/models/v1_aave_std_rateop.py +31 -25
  91. compass_api_sdk/models/v1_aave_token_priceop.py +31 -25
  92. compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +31 -25
  93. compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +62 -50
  94. compass_api_sdk/models/v1_ethena_vaultop.py +75 -0
  95. compass_api_sdk/models/v1_generic_allowanceop.py +1 -0
  96. compass_api_sdk/models/v1_token_addressop.py +31 -25
  97. compass_api_sdk/models/v1_token_priceop.py +4 -16
  98. compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +6 -3
  99. compass_api_sdk/models/v1_uniswap_pool_priceop.py +62 -50
  100. compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +62 -50
  101. compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +62 -50
  102. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_vault.py → vault.py} +2 -4
  103. compass_api_sdk/models/{compass_api_backend_models_vaults_transact_request_deposit_vaultdepositrequest.py → vaultdepositrequest.py} +11 -19
  104. compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_vaultgetvaultresponse.py → vaultgetvaultresponse.py} +5 -10
  105. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_vaultposition.py → vaultposition.py} +5 -12
  106. compass_api_sdk/models/{compass_api_backend_models_vaults_transact_request_withdraw_vaultwithdrawrequest.py → vaultwithdrawrequest.py} +5 -11
  107. compass_api_sdk/models/{compass_api_backend_models_generic_transact_request_wrap_eth_wrapethrequest.py → wrapethrequest.py} +10 -20
  108. compass_api_sdk/morpho.py +82 -170
  109. compass_api_sdk/pendle.py +18 -56
  110. compass_api_sdk/sdk.py +3 -0
  111. compass_api_sdk/sky.py +56 -106
  112. compass_api_sdk/smart_account.py +10 -38
  113. compass_api_sdk/swap.py +16 -30
  114. compass_api_sdk/token_sdk.py +30 -40
  115. compass_api_sdk/transaction_bundler.py +26 -74
  116. compass_api_sdk/uniswap_v3.py +90 -106
  117. compass_api_sdk/universal.py +44 -92
  118. {compass_api_sdk-0.9.52.dist-info → compass_api_sdk-1.0.1.dist-info}/METADATA +150 -135
  119. {compass_api_sdk-0.9.52.dist-info → compass_api_sdk-1.0.1.dist-info}/RECORD +120 -108
  120. compass_api_sdk/models/compass_api_backend_models_aave_read_response_historical_transactions_aavehistoricaltransactionsresponse.py +0 -115
  121. compass_api_sdk/models/compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_increase_aerodromeslipstreamincreaseliquidityprovisionrequest.py +0 -125
  122. compass_api_sdk/models/compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_withdraw_aerodromeslipstreamwithdrawliquidityprovisionrequest.py +0 -68
  123. compass_api_sdk/models/compass_api_backend_models_generic_read_response_chains_supportedchaininfo.py +0 -21
  124. compass_api_sdk/models/compass_api_backend_models_generic_transact_request_allowance_setallowancerequest.py +0 -139
  125. compass_api_sdk/models/compass_api_backend_models_morpho_read_response_check_user_position_morphocheckuserpositionresponse.py +0 -48
  126. compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_markets_morphogetmarketsresponse.py +0 -26
  127. compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vaults_morphogetvaultsresponse.py +0 -24
  128. compass_api_sdk/models/compass_api_backend_models_pendle_read_response_markets_pendlelistmarketsresponse.py +0 -24
  129. compass_api_sdk/models/compass_api_backend_models_pendle_read_response_positions_pendlelistuserpositionsresponse.py +0 -24
  130. compass_api_sdk/models/compass_api_backend_models_smart_account_transact_request_user_operations_batcheduseroperationsrequest.py +0 -49
  131. compass_api_sdk/models/compass_api_backend_models_swap_transact_request_odos_odosswaprequest.py +0 -108
  132. compass_api_sdk/models/compass_api_backend_models_token_transact_request_transfer_tokentransferrequest.py +0 -98
  133. compass_api_sdk/models/compass_api_backend_models_uniswap_transact_liquidity_provision_request_increase_uniswapincreaseliquidityprovisionrequest.py +0 -129
  134. compass_api_sdk/models/compass_api_backend_models_uniswap_transact_liquidity_provision_request_withdraw_uniswapwithdrawliquidityprovisionrequest.py +0 -68
  135. compass_api_sdk/models/compass_api_backend_models_uniswap_transact_swap_request_buy_exactly_uniswapbuyexactlyrequest.py +0 -123
  136. compass_api_sdk/models/compass_api_backend_models_uniswap_transact_swap_request_sell_exactly_uniswapsellexactlyrequest.py +0 -123
  137. compass_api_sdk/models/tokentransfererc20params.py +0 -63
  138. {compass_api_sdk-0.9.52.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)