compass_api_sdk 0.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 (137) hide show
  1. compass_api_sdk/__init__.py +17 -0
  2. compass_api_sdk/_hooks/__init__.py +5 -0
  3. compass_api_sdk/_hooks/registration.py +13 -0
  4. compass_api_sdk/_hooks/sdkhooks.py +76 -0
  5. compass_api_sdk/_hooks/types.py +106 -0
  6. compass_api_sdk/_version.py +15 -0
  7. compass_api_sdk/aave_v3.py +1903 -0
  8. compass_api_sdk/aerodrome_slipstream.py +1875 -0
  9. compass_api_sdk/basesdk.py +362 -0
  10. compass_api_sdk/errors/__init__.py +7 -0
  11. compass_api_sdk/errors/apierror.py +22 -0
  12. compass_api_sdk/errors/httpvalidationerror.py +21 -0
  13. compass_api_sdk/httpclient.py +136 -0
  14. compass_api_sdk/models/__init__.py +777 -0
  15. compass_api_sdk/models/aave_liquidity_changeop.py +108 -0
  16. compass_api_sdk/models/aave_token_priceop.py +98 -0
  17. compass_api_sdk/models/aave_user_position_per_tokenop.py +104 -0
  18. compass_api_sdk/models/aave_user_position_summaryop.py +35 -0
  19. compass_api_sdk/models/aaveborrowrequest.py +105 -0
  20. compass_api_sdk/models/aaveliquiditychangeresponse.py +26 -0
  21. compass_api_sdk/models/aaverepayrequest.py +105 -0
  22. compass_api_sdk/models/aavesupplyrequest.py +93 -0
  23. compass_api_sdk/models/aavetokenpriceresponse.py +15 -0
  24. compass_api_sdk/models/aaveuserpositionpertokenresponse.py +73 -0
  25. compass_api_sdk/models/aaveuserpositionsummaryresponse.py +50 -0
  26. compass_api_sdk/models/aavewithdrawrequest.py +58 -0
  27. compass_api_sdk/models/aerodrome_slipstream_liquidity_provision_positionsop.py +35 -0
  28. compass_api_sdk/models/aerodrome_slipstream_pool_priceop.py +173 -0
  29. compass_api_sdk/models/aerodromelppositionsresponse.py +21 -0
  30. compass_api_sdk/models/aerodromeposition.py +70 -0
  31. compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +92 -0
  32. compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +109 -0
  33. compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionrequest.py +186 -0
  34. compass_api_sdk/models/aerodromeslipstreampoolpriceresponse.py +57 -0
  35. compass_api_sdk/models/aerodromeslipstreamsellexactlyrequest.py +96 -0
  36. compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +50 -0
  37. compass_api_sdk/models/allowanceinforesponse.py +48 -0
  38. compass_api_sdk/models/balanceinforesponse.py +43 -0
  39. compass_api_sdk/models/chain.py +12 -0
  40. compass_api_sdk/models/chaininfo.py +53 -0
  41. compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_markets_asset.py +22 -0
  42. compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vaults_asset.py +23 -0
  43. compass_api_sdk/models/ensnameinforesponse.py +24 -0
  44. compass_api_sdk/models/feeenum.py +16 -0
  45. compass_api_sdk/models/generic_allowanceop.py +121 -0
  46. compass_api_sdk/models/generic_balanceop.py +104 -0
  47. compass_api_sdk/models/generic_ensop.py +35 -0
  48. compass_api_sdk/models/generic_portfolioop.py +35 -0
  49. compass_api_sdk/models/generic_price_usdop.py +98 -0
  50. compass_api_sdk/models/generic_supported_tokensop.py +29 -0
  51. compass_api_sdk/models/generic_visualize_portfolioop.py +35 -0
  52. compass_api_sdk/models/image.py +15 -0
  53. compass_api_sdk/models/increaseallowancerequest.py +77 -0
  54. compass_api_sdk/models/interestratemode.py +14 -0
  55. compass_api_sdk/models/marketstate.py +35 -0
  56. compass_api_sdk/models/morpho_market_positionop.py +39 -0
  57. compass_api_sdk/models/morpho_marketsop.py +78 -0
  58. compass_api_sdk/models/morpho_vault_positionop.py +39 -0
  59. compass_api_sdk/models/morpho_vaultsop.py +72 -0
  60. compass_api_sdk/models/morphoborrowrequest.py +91 -0
  61. compass_api_sdk/models/morphocheckmarketpositionresponse.py +23 -0
  62. compass_api_sdk/models/morphocheckvaultpositionresponse.py +20 -0
  63. compass_api_sdk/models/morphodepositrequest.py +86 -0
  64. compass_api_sdk/models/morphogetmarketsresponse.py +17 -0
  65. compass_api_sdk/models/morphogetvaultsresponse.py +17 -0
  66. compass_api_sdk/models/morphomarket.py +80 -0
  67. compass_api_sdk/models/morphorepayrequest.py +79 -0
  68. compass_api_sdk/models/morphosetvaultallowancerequest.py +44 -0
  69. compass_api_sdk/models/morphosupplycollateralrequest.py +91 -0
  70. compass_api_sdk/models/morphovault.py +47 -0
  71. compass_api_sdk/models/morphowithdrawcollateralrequest.py +91 -0
  72. compass_api_sdk/models/morphowithdrawrequest.py +74 -0
  73. compass_api_sdk/models/portfolio.py +22 -0
  74. compass_api_sdk/models/priceresponse.py +15 -0
  75. compass_api_sdk/models/security.py +24 -0
  76. compass_api_sdk/models/token_addressop.py +98 -0
  77. compass_api_sdk/models/token_balanceop.py +49 -0
  78. compass_api_sdk/models/token_enum.py +57 -0
  79. compass_api_sdk/models/token_priceop.py +97 -0
  80. compass_api_sdk/models/tokenaddressresponse.py +15 -0
  81. compass_api_sdk/models/tokenbalance.py +49 -0
  82. compass_api_sdk/models/tokenbalanceresponse.py +44 -0
  83. compass_api_sdk/models/tokeninfo.py +17 -0
  84. compass_api_sdk/models/tokenpriceresponse.py +15 -0
  85. compass_api_sdk/models/tokentransferrequest.py +66 -0
  86. compass_api_sdk/models/transfererc20request.py +62 -0
  87. compass_api_sdk/models/transferethrequest.py +46 -0
  88. compass_api_sdk/models/uniswap_liquidity_provision_in_rangeop.py +34 -0
  89. compass_api_sdk/models/uniswap_liquidity_provision_positionsop.py +35 -0
  90. compass_api_sdk/models/uniswap_pool_priceop.py +193 -0
  91. compass_api_sdk/models/uniswap_quote_buy_exactlyop.py +209 -0
  92. compass_api_sdk/models/uniswap_quote_sell_exactlyop.py +209 -0
  93. compass_api_sdk/models/uniswapbuyexactlyrequest.py +104 -0
  94. compass_api_sdk/models/uniswapbuyquoteinforesponse.py +20 -0
  95. compass_api_sdk/models/uniswapcheckinrangeresponse.py +15 -0
  96. compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +99 -0
  97. compass_api_sdk/models/uniswaplppositionsinforesponse.py +24 -0
  98. compass_api_sdk/models/uniswapmintliquidityprovisionrequest.py +185 -0
  99. compass_api_sdk/models/uniswappoolpriceresponse.py +47 -0
  100. compass_api_sdk/models/uniswappositionssolidityresponse.py +46 -0
  101. compass_api_sdk/models/uniswapsellexactlyrequest.py +104 -0
  102. compass_api_sdk/models/uniswapsellquoteinforesponse.py +20 -0
  103. compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +51 -0
  104. compass_api_sdk/models/unsignedtransaction.py +58 -0
  105. compass_api_sdk/models/unwrapwethrequest.py +41 -0
  106. compass_api_sdk/models/validationerror.py +26 -0
  107. compass_api_sdk/models/vaultstate.py +32 -0
  108. compass_api_sdk/models/weeklyapys.py +23 -0
  109. compass_api_sdk/models/wrapethrequest.py +41 -0
  110. compass_api_sdk/morpho.py +2577 -0
  111. compass_api_sdk/py.typed +1 -0
  112. compass_api_sdk/sdk.py +155 -0
  113. compass_api_sdk/sdkconfiguration.py +56 -0
  114. compass_api_sdk/token_sdk.py +861 -0
  115. compass_api_sdk/types/__init__.py +21 -0
  116. compass_api_sdk/types/basemodel.py +39 -0
  117. compass_api_sdk/uniswap_v3.py +2551 -0
  118. compass_api_sdk/universal.py +2625 -0
  119. compass_api_sdk/utils/__init__.py +100 -0
  120. compass_api_sdk/utils/annotations.py +55 -0
  121. compass_api_sdk/utils/datetimes.py +23 -0
  122. compass_api_sdk/utils/enums.py +74 -0
  123. compass_api_sdk/utils/eventstreaming.py +238 -0
  124. compass_api_sdk/utils/forms.py +202 -0
  125. compass_api_sdk/utils/headers.py +136 -0
  126. compass_api_sdk/utils/logger.py +22 -0
  127. compass_api_sdk/utils/metadata.py +118 -0
  128. compass_api_sdk/utils/queryparams.py +205 -0
  129. compass_api_sdk/utils/requestbodies.py +66 -0
  130. compass_api_sdk/utils/retries.py +217 -0
  131. compass_api_sdk/utils/security.py +174 -0
  132. compass_api_sdk/utils/serializers.py +248 -0
  133. compass_api_sdk/utils/url.py +155 -0
  134. compass_api_sdk/utils/values.py +137 -0
  135. compass_api_sdk-0.0.1.dist-info/METADATA +534 -0
  136. compass_api_sdk-0.0.1.dist-info/RECORD +137 -0
  137. compass_api_sdk-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,1875 @@
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 typing import Any, Mapping, Optional, Union
8
+
9
+
10
+ class AerodromeSlipstream(BaseSDK):
11
+ def slipstream_liquidity_provision_positions(
12
+ self,
13
+ *,
14
+ chain: Optional[
15
+ models.AerodromeSlipstreamLiquidityProvisionPositionsChain
16
+ ] = models.AerodromeSlipstreamLiquidityProvisionPositionsChain.BASE_MAINNET,
17
+ user: Optional[str] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
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.AerodromeLPPositionsResponse:
23
+ r"""List LP positions
24
+
25
+ Retrieve the total number of Liquidity Provider (LP) positions associated with a
26
+ specific sender.
27
+
28
+ This endpoint allows users to query and obtain detailed information about their LP
29
+ positions, including the number of active positions they hold. The response model,
30
+ AerodromeLPPositionsInfo, provides a structured representation of the LP positions
31
+ data, ensuring clarity and ease of use. This functionality is essential for users
32
+ managing their liquidity provision activities, enabling them to make informed
33
+ decisions based on their current positions.
34
+
35
+ :param chain: The chain to use.
36
+ :param user:
37
+ :param retries: Override the default retry configuration for this method
38
+ :param server_url: Override the default server URL for this method
39
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
40
+ :param http_headers: Additional headers to set or replace on requests.
41
+ """
42
+ base_url = None
43
+ url_variables = None
44
+ if timeout_ms is None:
45
+ timeout_ms = self.sdk_configuration.timeout_ms
46
+
47
+ if server_url is not None:
48
+ base_url = server_url
49
+ else:
50
+ base_url = self._get_url(base_url, url_variables)
51
+
52
+ request = models.AerodromeSlipstreamLiquidityProvisionPositionsRequest(
53
+ chain=chain,
54
+ user=user,
55
+ )
56
+
57
+ req = self._build_request(
58
+ method="GET",
59
+ path="/v0/aerodrome_slipstream/liquidity_provision/positions/get",
60
+ base_url=base_url,
61
+ url_variables=url_variables,
62
+ request=request,
63
+ request_body_required=False,
64
+ request_has_path_params=False,
65
+ request_has_query_params=True,
66
+ user_agent_header="user-agent",
67
+ accept_header_value="application/json",
68
+ http_headers=http_headers,
69
+ security=self.sdk_configuration.security,
70
+ timeout_ms=timeout_ms,
71
+ )
72
+
73
+ if retries == UNSET:
74
+ if self.sdk_configuration.retry_config is not UNSET:
75
+ retries = self.sdk_configuration.retry_config
76
+
77
+ retry_config = None
78
+ if isinstance(retries, utils.RetryConfig):
79
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
80
+
81
+ http_res = self.do_request(
82
+ hook_ctx=HookContext(
83
+ base_url=base_url or "",
84
+ operation_id="aerodrome_slipstream_liquidity_provision_positions",
85
+ oauth2_scopes=[],
86
+ security_source=self.sdk_configuration.security,
87
+ ),
88
+ request=req,
89
+ error_status_codes=["422", "4XX", "5XX"],
90
+ retry_config=retry_config,
91
+ )
92
+
93
+ response_data: Any = None
94
+ if utils.match_response(http_res, "200", "application/json"):
95
+ return utils.unmarshal_json(
96
+ http_res.text, models.AerodromeLPPositionsResponse
97
+ )
98
+ if utils.match_response(http_res, "422", "application/json"):
99
+ response_data = utils.unmarshal_json(
100
+ http_res.text, errors.HTTPValidationErrorData
101
+ )
102
+ raise errors.HTTPValidationError(data=response_data)
103
+ if utils.match_response(http_res, "4XX", "*"):
104
+ http_res_text = utils.stream_to_text(http_res)
105
+ raise errors.APIError(
106
+ "API error occurred", http_res.status_code, http_res_text, http_res
107
+ )
108
+ if utils.match_response(http_res, "5XX", "*"):
109
+ http_res_text = utils.stream_to_text(http_res)
110
+ raise errors.APIError(
111
+ "API error occurred", http_res.status_code, http_res_text, http_res
112
+ )
113
+
114
+ content_type = http_res.headers.get("Content-Type")
115
+ http_res_text = utils.stream_to_text(http_res)
116
+ raise errors.APIError(
117
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
118
+ http_res.status_code,
119
+ http_res_text,
120
+ http_res,
121
+ )
122
+
123
+ async def slipstream_liquidity_provision_positions_async(
124
+ self,
125
+ *,
126
+ chain: Optional[
127
+ models.AerodromeSlipstreamLiquidityProvisionPositionsChain
128
+ ] = models.AerodromeSlipstreamLiquidityProvisionPositionsChain.BASE_MAINNET,
129
+ user: Optional[str] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
130
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
131
+ server_url: Optional[str] = None,
132
+ timeout_ms: Optional[int] = None,
133
+ http_headers: Optional[Mapping[str, str]] = None,
134
+ ) -> models.AerodromeLPPositionsResponse:
135
+ r"""List LP positions
136
+
137
+ Retrieve the total number of Liquidity Provider (LP) positions associated with a
138
+ specific sender.
139
+
140
+ This endpoint allows users to query and obtain detailed information about their LP
141
+ positions, including the number of active positions they hold. The response model,
142
+ AerodromeLPPositionsInfo, provides a structured representation of the LP positions
143
+ data, ensuring clarity and ease of use. This functionality is essential for users
144
+ managing their liquidity provision activities, enabling them to make informed
145
+ decisions based on their current positions.
146
+
147
+ :param chain: The chain to use.
148
+ :param user:
149
+ :param retries: Override the default retry configuration for this method
150
+ :param server_url: Override the default server URL for this method
151
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
152
+ :param http_headers: Additional headers to set or replace on requests.
153
+ """
154
+ base_url = None
155
+ url_variables = None
156
+ if timeout_ms is None:
157
+ timeout_ms = self.sdk_configuration.timeout_ms
158
+
159
+ if server_url is not None:
160
+ base_url = server_url
161
+ else:
162
+ base_url = self._get_url(base_url, url_variables)
163
+
164
+ request = models.AerodromeSlipstreamLiquidityProvisionPositionsRequest(
165
+ chain=chain,
166
+ user=user,
167
+ )
168
+
169
+ req = self._build_request_async(
170
+ method="GET",
171
+ path="/v0/aerodrome_slipstream/liquidity_provision/positions/get",
172
+ base_url=base_url,
173
+ url_variables=url_variables,
174
+ request=request,
175
+ request_body_required=False,
176
+ request_has_path_params=False,
177
+ request_has_query_params=True,
178
+ user_agent_header="user-agent",
179
+ accept_header_value="application/json",
180
+ http_headers=http_headers,
181
+ security=self.sdk_configuration.security,
182
+ timeout_ms=timeout_ms,
183
+ )
184
+
185
+ if retries == UNSET:
186
+ if self.sdk_configuration.retry_config is not UNSET:
187
+ retries = self.sdk_configuration.retry_config
188
+
189
+ retry_config = None
190
+ if isinstance(retries, utils.RetryConfig):
191
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
192
+
193
+ http_res = await self.do_request_async(
194
+ hook_ctx=HookContext(
195
+ base_url=base_url or "",
196
+ operation_id="aerodrome_slipstream_liquidity_provision_positions",
197
+ oauth2_scopes=[],
198
+ security_source=self.sdk_configuration.security,
199
+ ),
200
+ request=req,
201
+ error_status_codes=["422", "4XX", "5XX"],
202
+ retry_config=retry_config,
203
+ )
204
+
205
+ response_data: Any = None
206
+ if utils.match_response(http_res, "200", "application/json"):
207
+ return utils.unmarshal_json(
208
+ http_res.text, models.AerodromeLPPositionsResponse
209
+ )
210
+ if utils.match_response(http_res, "422", "application/json"):
211
+ response_data = utils.unmarshal_json(
212
+ http_res.text, errors.HTTPValidationErrorData
213
+ )
214
+ raise errors.HTTPValidationError(data=response_data)
215
+ if utils.match_response(http_res, "4XX", "*"):
216
+ http_res_text = await utils.stream_to_text_async(http_res)
217
+ raise errors.APIError(
218
+ "API error occurred", http_res.status_code, http_res_text, http_res
219
+ )
220
+ if utils.match_response(http_res, "5XX", "*"):
221
+ http_res_text = await utils.stream_to_text_async(http_res)
222
+ raise errors.APIError(
223
+ "API error occurred", http_res.status_code, http_res_text, http_res
224
+ )
225
+
226
+ content_type = http_res.headers.get("Content-Type")
227
+ http_res_text = await utils.stream_to_text_async(http_res)
228
+ raise errors.APIError(
229
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
230
+ http_res.status_code,
231
+ http_res_text,
232
+ http_res,
233
+ )
234
+
235
+ def slipstream_pool_price(
236
+ self,
237
+ *,
238
+ chain: Optional[
239
+ models.AerodromeSlipstreamPoolPriceChain
240
+ ] = models.AerodromeSlipstreamPoolPriceChain.BASE_MAINNET,
241
+ token_in: Optional[
242
+ models.AerodromeSlipstreamPoolPriceTokenInToken
243
+ ] = models.AerodromeSlipstreamPoolPriceTokenInToken.USDC,
244
+ token_out: Optional[
245
+ models.AerodromeSlipstreamPoolPriceTokenOutToken
246
+ ] = models.AerodromeSlipstreamPoolPriceTokenOutToken.WETH,
247
+ tick_spacing: Optional[int] = 100,
248
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
249
+ server_url: Optional[str] = None,
250
+ timeout_ms: Optional[int] = None,
251
+ http_headers: Optional[Mapping[str, str]] = None,
252
+ ) -> models.AerodromeSlipstreamPoolPriceResponse:
253
+ r"""Pool price
254
+
255
+ This endpoint retrieves the current price of a pool, indicating how many token0
256
+ you can purchase for 1 token1.
257
+
258
+ Note that this is an instantaneous price and may change during any trade. For a more
259
+ accurate representation of the trade ratios between the two assets, consider using
260
+ the quote endpoint.
261
+
262
+ :param chain: The chain to use.
263
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
264
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
265
+ :param tick_spacing:
266
+ :param retries: Override the default retry configuration for this method
267
+ :param server_url: Override the default server URL for this method
268
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
269
+ :param http_headers: Additional headers to set or replace on requests.
270
+ """
271
+ base_url = None
272
+ url_variables = None
273
+ if timeout_ms is None:
274
+ timeout_ms = self.sdk_configuration.timeout_ms
275
+
276
+ if server_url is not None:
277
+ base_url = server_url
278
+ else:
279
+ base_url = self._get_url(base_url, url_variables)
280
+
281
+ request = models.AerodromeSlipstreamPoolPriceRequest(
282
+ chain=chain,
283
+ token_in=token_in,
284
+ token_out=token_out,
285
+ tick_spacing=tick_spacing,
286
+ )
287
+
288
+ req = self._build_request(
289
+ method="GET",
290
+ path="/v0/aerodrome_slipstream/pool_price/get",
291
+ base_url=base_url,
292
+ url_variables=url_variables,
293
+ request=request,
294
+ request_body_required=False,
295
+ request_has_path_params=False,
296
+ request_has_query_params=True,
297
+ user_agent_header="user-agent",
298
+ accept_header_value="application/json",
299
+ http_headers=http_headers,
300
+ security=self.sdk_configuration.security,
301
+ timeout_ms=timeout_ms,
302
+ )
303
+
304
+ if retries == UNSET:
305
+ if self.sdk_configuration.retry_config is not UNSET:
306
+ retries = self.sdk_configuration.retry_config
307
+
308
+ retry_config = None
309
+ if isinstance(retries, utils.RetryConfig):
310
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
311
+
312
+ http_res = self.do_request(
313
+ hook_ctx=HookContext(
314
+ base_url=base_url or "",
315
+ operation_id="aerodrome_slipstream_pool_price",
316
+ oauth2_scopes=[],
317
+ security_source=self.sdk_configuration.security,
318
+ ),
319
+ request=req,
320
+ error_status_codes=["422", "4XX", "5XX"],
321
+ retry_config=retry_config,
322
+ )
323
+
324
+ response_data: Any = None
325
+ if utils.match_response(http_res, "200", "application/json"):
326
+ return utils.unmarshal_json(
327
+ http_res.text, models.AerodromeSlipstreamPoolPriceResponse
328
+ )
329
+ if utils.match_response(http_res, "422", "application/json"):
330
+ response_data = utils.unmarshal_json(
331
+ http_res.text, errors.HTTPValidationErrorData
332
+ )
333
+ raise errors.HTTPValidationError(data=response_data)
334
+ if utils.match_response(http_res, "4XX", "*"):
335
+ http_res_text = utils.stream_to_text(http_res)
336
+ raise errors.APIError(
337
+ "API error occurred", http_res.status_code, http_res_text, http_res
338
+ )
339
+ if utils.match_response(http_res, "5XX", "*"):
340
+ http_res_text = utils.stream_to_text(http_res)
341
+ raise errors.APIError(
342
+ "API error occurred", http_res.status_code, http_res_text, http_res
343
+ )
344
+
345
+ content_type = http_res.headers.get("Content-Type")
346
+ http_res_text = utils.stream_to_text(http_res)
347
+ raise errors.APIError(
348
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
349
+ http_res.status_code,
350
+ http_res_text,
351
+ http_res,
352
+ )
353
+
354
+ async def slipstream_pool_price_async(
355
+ self,
356
+ *,
357
+ chain: Optional[
358
+ models.AerodromeSlipstreamPoolPriceChain
359
+ ] = models.AerodromeSlipstreamPoolPriceChain.BASE_MAINNET,
360
+ token_in: Optional[
361
+ models.AerodromeSlipstreamPoolPriceTokenInToken
362
+ ] = models.AerodromeSlipstreamPoolPriceTokenInToken.USDC,
363
+ token_out: Optional[
364
+ models.AerodromeSlipstreamPoolPriceTokenOutToken
365
+ ] = models.AerodromeSlipstreamPoolPriceTokenOutToken.WETH,
366
+ tick_spacing: Optional[int] = 100,
367
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
368
+ server_url: Optional[str] = None,
369
+ timeout_ms: Optional[int] = None,
370
+ http_headers: Optional[Mapping[str, str]] = None,
371
+ ) -> models.AerodromeSlipstreamPoolPriceResponse:
372
+ r"""Pool price
373
+
374
+ This endpoint retrieves the current price of a pool, indicating how many token0
375
+ you can purchase for 1 token1.
376
+
377
+ Note that this is an instantaneous price and may change during any trade. For a more
378
+ accurate representation of the trade ratios between the two assets, consider using
379
+ the quote endpoint.
380
+
381
+ :param chain: The chain to use.
382
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
383
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
384
+ :param tick_spacing:
385
+ :param retries: Override the default retry configuration for this method
386
+ :param server_url: Override the default server URL for this method
387
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
388
+ :param http_headers: Additional headers to set or replace on requests.
389
+ """
390
+ base_url = None
391
+ url_variables = None
392
+ if timeout_ms is None:
393
+ timeout_ms = self.sdk_configuration.timeout_ms
394
+
395
+ if server_url is not None:
396
+ base_url = server_url
397
+ else:
398
+ base_url = self._get_url(base_url, url_variables)
399
+
400
+ request = models.AerodromeSlipstreamPoolPriceRequest(
401
+ chain=chain,
402
+ token_in=token_in,
403
+ token_out=token_out,
404
+ tick_spacing=tick_spacing,
405
+ )
406
+
407
+ req = self._build_request_async(
408
+ method="GET",
409
+ path="/v0/aerodrome_slipstream/pool_price/get",
410
+ base_url=base_url,
411
+ url_variables=url_variables,
412
+ request=request,
413
+ request_body_required=False,
414
+ request_has_path_params=False,
415
+ request_has_query_params=True,
416
+ user_agent_header="user-agent",
417
+ accept_header_value="application/json",
418
+ http_headers=http_headers,
419
+ security=self.sdk_configuration.security,
420
+ timeout_ms=timeout_ms,
421
+ )
422
+
423
+ if retries == UNSET:
424
+ if self.sdk_configuration.retry_config is not UNSET:
425
+ retries = self.sdk_configuration.retry_config
426
+
427
+ retry_config = None
428
+ if isinstance(retries, utils.RetryConfig):
429
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
430
+
431
+ http_res = await self.do_request_async(
432
+ hook_ctx=HookContext(
433
+ base_url=base_url or "",
434
+ operation_id="aerodrome_slipstream_pool_price",
435
+ oauth2_scopes=[],
436
+ security_source=self.sdk_configuration.security,
437
+ ),
438
+ request=req,
439
+ error_status_codes=["422", "4XX", "5XX"],
440
+ retry_config=retry_config,
441
+ )
442
+
443
+ response_data: Any = None
444
+ if utils.match_response(http_res, "200", "application/json"):
445
+ return utils.unmarshal_json(
446
+ http_res.text, models.AerodromeSlipstreamPoolPriceResponse
447
+ )
448
+ if utils.match_response(http_res, "422", "application/json"):
449
+ response_data = utils.unmarshal_json(
450
+ http_res.text, errors.HTTPValidationErrorData
451
+ )
452
+ raise errors.HTTPValidationError(data=response_data)
453
+ if utils.match_response(http_res, "4XX", "*"):
454
+ http_res_text = await utils.stream_to_text_async(http_res)
455
+ raise errors.APIError(
456
+ "API error occurred", http_res.status_code, http_res_text, http_res
457
+ )
458
+ if utils.match_response(http_res, "5XX", "*"):
459
+ http_res_text = await utils.stream_to_text_async(http_res)
460
+ raise errors.APIError(
461
+ "API error occurred", http_res.status_code, http_res_text, http_res
462
+ )
463
+
464
+ content_type = http_res.headers.get("Content-Type")
465
+ http_res_text = await utils.stream_to_text_async(http_res)
466
+ raise errors.APIError(
467
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
468
+ http_res.status_code,
469
+ http_res_text,
470
+ http_res,
471
+ )
472
+
473
+ def slipstream_swap_sell_exactly(
474
+ self,
475
+ *,
476
+ token_in: models.TokenEnum,
477
+ token_out: models.TokenEnum,
478
+ tick_spacing: int,
479
+ amount_in: Union[
480
+ models.AerodromeSlipstreamSellExactlyRequestAmountIn,
481
+ models.AerodromeSlipstreamSellExactlyRequestAmountInTypedDict,
482
+ ],
483
+ chain: models.Chain,
484
+ sender: str,
485
+ amount_out_minimum: Optional[
486
+ Union[
487
+ models.AerodromeSlipstreamSellExactlyRequestAmountOutMinimum,
488
+ models.AerodromeSlipstreamSellExactlyRequestAmountOutMinimumTypedDict,
489
+ ]
490
+ ] = None,
491
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
492
+ server_url: Optional[str] = None,
493
+ timeout_ms: Optional[int] = None,
494
+ http_headers: Optional[Mapping[str, str]] = None,
495
+ ) -> models.UnsignedTransaction:
496
+ r"""Swap - from specified amount
497
+
498
+ This endpoint allows users to trade a specific amount of one token into another
499
+ token using the Aerodrome Slipstream protocol.
500
+
501
+ The transaction is executed by specifying the exact amount of the input token to be
502
+ sold, and the system calculates the amount of the output token that will be
503
+ received. The operation ensures that the trade is conducted within the constraints
504
+ of the current market conditions, taking into account the liquidity and price
505
+ impact. This endpoint is suitable for users who want to sell a precise quantity of a
506
+ token and are willing to accept the resulting amount of the other token.
507
+
508
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
509
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
510
+ :param tick_spacing: The tick spacing of the pool
511
+ :param amount_in: The amount of the token to swap from
512
+ :param chain: The chain to use.
513
+ :param sender: The address of the transaction sender.
514
+ :param amount_out_minimum: The minimum amount of the token to swap to, defaults to 0
515
+ :param retries: Override the default retry configuration for this method
516
+ :param server_url: Override the default server URL for this method
517
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
518
+ :param http_headers: Additional headers to set or replace on requests.
519
+ """
520
+ base_url = None
521
+ url_variables = None
522
+ if timeout_ms is None:
523
+ timeout_ms = self.sdk_configuration.timeout_ms
524
+
525
+ if server_url is not None:
526
+ base_url = server_url
527
+ else:
528
+ base_url = self._get_url(base_url, url_variables)
529
+
530
+ request = models.AerodromeSlipstreamSellExactlyRequest(
531
+ token_in=token_in,
532
+ token_out=token_out,
533
+ tick_spacing=tick_spacing,
534
+ amount_in=amount_in,
535
+ amount_out_minimum=amount_out_minimum,
536
+ chain=chain,
537
+ sender=sender,
538
+ )
539
+
540
+ req = self._build_request(
541
+ method="POST",
542
+ path="/v0/aerodrome_slipstream/swap/sell_exactly",
543
+ base_url=base_url,
544
+ url_variables=url_variables,
545
+ request=request,
546
+ request_body_required=True,
547
+ request_has_path_params=False,
548
+ request_has_query_params=True,
549
+ user_agent_header="user-agent",
550
+ accept_header_value="application/json",
551
+ http_headers=http_headers,
552
+ security=self.sdk_configuration.security,
553
+ get_serialized_body=lambda: utils.serialize_request_body(
554
+ request,
555
+ False,
556
+ False,
557
+ "json",
558
+ models.AerodromeSlipstreamSellExactlyRequest,
559
+ ),
560
+ timeout_ms=timeout_ms,
561
+ )
562
+
563
+ if retries == UNSET:
564
+ if self.sdk_configuration.retry_config is not UNSET:
565
+ retries = self.sdk_configuration.retry_config
566
+
567
+ retry_config = None
568
+ if isinstance(retries, utils.RetryConfig):
569
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
570
+
571
+ http_res = self.do_request(
572
+ hook_ctx=HookContext(
573
+ base_url=base_url or "",
574
+ operation_id="aerodrome_slipstream_swap_sell_exactly",
575
+ oauth2_scopes=[],
576
+ security_source=self.sdk_configuration.security,
577
+ ),
578
+ request=req,
579
+ error_status_codes=["422", "4XX", "5XX"],
580
+ retry_config=retry_config,
581
+ )
582
+
583
+ response_data: Any = None
584
+ if utils.match_response(http_res, "200", "application/json"):
585
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
586
+ if utils.match_response(http_res, "422", "application/json"):
587
+ response_data = utils.unmarshal_json(
588
+ http_res.text, errors.HTTPValidationErrorData
589
+ )
590
+ raise errors.HTTPValidationError(data=response_data)
591
+ if utils.match_response(http_res, "4XX", "*"):
592
+ http_res_text = utils.stream_to_text(http_res)
593
+ raise errors.APIError(
594
+ "API error occurred", http_res.status_code, http_res_text, http_res
595
+ )
596
+ if utils.match_response(http_res, "5XX", "*"):
597
+ http_res_text = utils.stream_to_text(http_res)
598
+ raise errors.APIError(
599
+ "API error occurred", http_res.status_code, http_res_text, http_res
600
+ )
601
+
602
+ content_type = http_res.headers.get("Content-Type")
603
+ http_res_text = utils.stream_to_text(http_res)
604
+ raise errors.APIError(
605
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
606
+ http_res.status_code,
607
+ http_res_text,
608
+ http_res,
609
+ )
610
+
611
+ async def slipstream_swap_sell_exactly_async(
612
+ self,
613
+ *,
614
+ token_in: models.TokenEnum,
615
+ token_out: models.TokenEnum,
616
+ tick_spacing: int,
617
+ amount_in: Union[
618
+ models.AerodromeSlipstreamSellExactlyRequestAmountIn,
619
+ models.AerodromeSlipstreamSellExactlyRequestAmountInTypedDict,
620
+ ],
621
+ chain: models.Chain,
622
+ sender: str,
623
+ amount_out_minimum: Optional[
624
+ Union[
625
+ models.AerodromeSlipstreamSellExactlyRequestAmountOutMinimum,
626
+ models.AerodromeSlipstreamSellExactlyRequestAmountOutMinimumTypedDict,
627
+ ]
628
+ ] = None,
629
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
630
+ server_url: Optional[str] = None,
631
+ timeout_ms: Optional[int] = None,
632
+ http_headers: Optional[Mapping[str, str]] = None,
633
+ ) -> models.UnsignedTransaction:
634
+ r"""Swap - from specified amount
635
+
636
+ This endpoint allows users to trade a specific amount of one token into another
637
+ token using the Aerodrome Slipstream protocol.
638
+
639
+ The transaction is executed by specifying the exact amount of the input token to be
640
+ sold, and the system calculates the amount of the output token that will be
641
+ received. The operation ensures that the trade is conducted within the constraints
642
+ of the current market conditions, taking into account the liquidity and price
643
+ impact. This endpoint is suitable for users who want to sell a precise quantity of a
644
+ token and are willing to accept the resulting amount of the other token.
645
+
646
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
647
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
648
+ :param tick_spacing: The tick spacing of the pool
649
+ :param amount_in: The amount of the token to swap from
650
+ :param chain: The chain to use.
651
+ :param sender: The address of the transaction sender.
652
+ :param amount_out_minimum: The minimum amount of the token to swap to, defaults to 0
653
+ :param retries: Override the default retry configuration for this method
654
+ :param server_url: Override the default server URL for this method
655
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
656
+ :param http_headers: Additional headers to set or replace on requests.
657
+ """
658
+ base_url = None
659
+ url_variables = None
660
+ if timeout_ms is None:
661
+ timeout_ms = self.sdk_configuration.timeout_ms
662
+
663
+ if server_url is not None:
664
+ base_url = server_url
665
+ else:
666
+ base_url = self._get_url(base_url, url_variables)
667
+
668
+ request = models.AerodromeSlipstreamSellExactlyRequest(
669
+ token_in=token_in,
670
+ token_out=token_out,
671
+ tick_spacing=tick_spacing,
672
+ amount_in=amount_in,
673
+ amount_out_minimum=amount_out_minimum,
674
+ chain=chain,
675
+ sender=sender,
676
+ )
677
+
678
+ req = self._build_request_async(
679
+ method="POST",
680
+ path="/v0/aerodrome_slipstream/swap/sell_exactly",
681
+ base_url=base_url,
682
+ url_variables=url_variables,
683
+ request=request,
684
+ request_body_required=True,
685
+ request_has_path_params=False,
686
+ request_has_query_params=True,
687
+ user_agent_header="user-agent",
688
+ accept_header_value="application/json",
689
+ http_headers=http_headers,
690
+ security=self.sdk_configuration.security,
691
+ get_serialized_body=lambda: utils.serialize_request_body(
692
+ request,
693
+ False,
694
+ False,
695
+ "json",
696
+ models.AerodromeSlipstreamSellExactlyRequest,
697
+ ),
698
+ timeout_ms=timeout_ms,
699
+ )
700
+
701
+ if retries == UNSET:
702
+ if self.sdk_configuration.retry_config is not UNSET:
703
+ retries = self.sdk_configuration.retry_config
704
+
705
+ retry_config = None
706
+ if isinstance(retries, utils.RetryConfig):
707
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
708
+
709
+ http_res = await self.do_request_async(
710
+ hook_ctx=HookContext(
711
+ base_url=base_url or "",
712
+ operation_id="aerodrome_slipstream_swap_sell_exactly",
713
+ oauth2_scopes=[],
714
+ security_source=self.sdk_configuration.security,
715
+ ),
716
+ request=req,
717
+ error_status_codes=["422", "4XX", "5XX"],
718
+ retry_config=retry_config,
719
+ )
720
+
721
+ response_data: Any = None
722
+ if utils.match_response(http_res, "200", "application/json"):
723
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
724
+ if utils.match_response(http_res, "422", "application/json"):
725
+ response_data = utils.unmarshal_json(
726
+ http_res.text, errors.HTTPValidationErrorData
727
+ )
728
+ raise errors.HTTPValidationError(data=response_data)
729
+ if utils.match_response(http_res, "4XX", "*"):
730
+ http_res_text = await utils.stream_to_text_async(http_res)
731
+ raise errors.APIError(
732
+ "API error occurred", http_res.status_code, http_res_text, http_res
733
+ )
734
+ if utils.match_response(http_res, "5XX", "*"):
735
+ http_res_text = await utils.stream_to_text_async(http_res)
736
+ raise errors.APIError(
737
+ "API error occurred", http_res.status_code, http_res_text, http_res
738
+ )
739
+
740
+ content_type = http_res.headers.get("Content-Type")
741
+ http_res_text = await utils.stream_to_text_async(http_res)
742
+ raise errors.APIError(
743
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
744
+ http_res.status_code,
745
+ http_res_text,
746
+ http_res,
747
+ )
748
+
749
+ def slipstream_swap_buy_exactly(
750
+ self,
751
+ *,
752
+ token_in: models.TokenEnum,
753
+ token_out: models.TokenEnum,
754
+ tick_spacing: int,
755
+ amount_out: Union[
756
+ models.AerodromeSlipstreamBuyExactlyRequestAmountOut,
757
+ models.AerodromeSlipstreamBuyExactlyRequestAmountOutTypedDict,
758
+ ],
759
+ amount_in_maximum: Union[
760
+ models.AerodromeSlipstreamBuyExactlyRequestAmountInMaximum,
761
+ models.AerodromeSlipstreamBuyExactlyRequestAmountInMaximumTypedDict,
762
+ ],
763
+ chain: models.Chain,
764
+ sender: str,
765
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
766
+ server_url: Optional[str] = None,
767
+ timeout_ms: Optional[int] = None,
768
+ http_headers: Optional[Mapping[str, str]] = None,
769
+ ) -> models.UnsignedTransaction:
770
+ r"""Swap - into specified amount
771
+
772
+ This endpoint facilitates the trading of tokens by allowing users to specify the
773
+ exact amount of the output token they wish to receive.
774
+
775
+ Utilizing the Aerodrome Slipstream protocol, the system calculates the necessary
776
+ amount of the input token required to achieve the desired output. This operation is
777
+ particularly useful for users who have a specific target amount of the output token
778
+ in mind and are willing to provide the corresponding input token amount. The
779
+ transaction is executed with consideration of current market conditions, including
780
+ liquidity and price impact, ensuring that the trade is completed efficiently and
781
+ effectively.
782
+
783
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
784
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
785
+ :param tick_spacing: The tick spacing of the pool
786
+ :param amount_out: The amount of the token to swap to
787
+ :param amount_in_maximum: The maximum amount of the token to swap from
788
+ :param chain: The chain to use.
789
+ :param sender: The address of the transaction sender.
790
+ :param retries: Override the default retry configuration for this method
791
+ :param server_url: Override the default server URL for this method
792
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
793
+ :param http_headers: Additional headers to set or replace on requests.
794
+ """
795
+ base_url = None
796
+ url_variables = None
797
+ if timeout_ms is None:
798
+ timeout_ms = self.sdk_configuration.timeout_ms
799
+
800
+ if server_url is not None:
801
+ base_url = server_url
802
+ else:
803
+ base_url = self._get_url(base_url, url_variables)
804
+
805
+ request = models.AerodromeSlipstreamBuyExactlyRequest(
806
+ token_in=token_in,
807
+ token_out=token_out,
808
+ tick_spacing=tick_spacing,
809
+ amount_out=amount_out,
810
+ amount_in_maximum=amount_in_maximum,
811
+ chain=chain,
812
+ sender=sender,
813
+ )
814
+
815
+ req = self._build_request(
816
+ method="POST",
817
+ path="/v0/aerodrome_slipstream/swap/buy_exactly",
818
+ base_url=base_url,
819
+ url_variables=url_variables,
820
+ request=request,
821
+ request_body_required=True,
822
+ request_has_path_params=False,
823
+ request_has_query_params=True,
824
+ user_agent_header="user-agent",
825
+ accept_header_value="application/json",
826
+ http_headers=http_headers,
827
+ security=self.sdk_configuration.security,
828
+ get_serialized_body=lambda: utils.serialize_request_body(
829
+ request,
830
+ False,
831
+ False,
832
+ "json",
833
+ models.AerodromeSlipstreamBuyExactlyRequest,
834
+ ),
835
+ timeout_ms=timeout_ms,
836
+ )
837
+
838
+ if retries == UNSET:
839
+ if self.sdk_configuration.retry_config is not UNSET:
840
+ retries = self.sdk_configuration.retry_config
841
+
842
+ retry_config = None
843
+ if isinstance(retries, utils.RetryConfig):
844
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
845
+
846
+ http_res = self.do_request(
847
+ hook_ctx=HookContext(
848
+ base_url=base_url or "",
849
+ operation_id="aerodrome_slipstream_swap_buy_exactly",
850
+ oauth2_scopes=[],
851
+ security_source=self.sdk_configuration.security,
852
+ ),
853
+ request=req,
854
+ error_status_codes=["422", "4XX", "5XX"],
855
+ retry_config=retry_config,
856
+ )
857
+
858
+ response_data: Any = None
859
+ if utils.match_response(http_res, "200", "application/json"):
860
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
861
+ if utils.match_response(http_res, "422", "application/json"):
862
+ response_data = utils.unmarshal_json(
863
+ http_res.text, errors.HTTPValidationErrorData
864
+ )
865
+ raise errors.HTTPValidationError(data=response_data)
866
+ if utils.match_response(http_res, "4XX", "*"):
867
+ http_res_text = utils.stream_to_text(http_res)
868
+ raise errors.APIError(
869
+ "API error occurred", http_res.status_code, http_res_text, http_res
870
+ )
871
+ if utils.match_response(http_res, "5XX", "*"):
872
+ http_res_text = utils.stream_to_text(http_res)
873
+ raise errors.APIError(
874
+ "API error occurred", http_res.status_code, http_res_text, http_res
875
+ )
876
+
877
+ content_type = http_res.headers.get("Content-Type")
878
+ http_res_text = utils.stream_to_text(http_res)
879
+ raise errors.APIError(
880
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
881
+ http_res.status_code,
882
+ http_res_text,
883
+ http_res,
884
+ )
885
+
886
+ async def slipstream_swap_buy_exactly_async(
887
+ self,
888
+ *,
889
+ token_in: models.TokenEnum,
890
+ token_out: models.TokenEnum,
891
+ tick_spacing: int,
892
+ amount_out: Union[
893
+ models.AerodromeSlipstreamBuyExactlyRequestAmountOut,
894
+ models.AerodromeSlipstreamBuyExactlyRequestAmountOutTypedDict,
895
+ ],
896
+ amount_in_maximum: Union[
897
+ models.AerodromeSlipstreamBuyExactlyRequestAmountInMaximum,
898
+ models.AerodromeSlipstreamBuyExactlyRequestAmountInMaximumTypedDict,
899
+ ],
900
+ chain: models.Chain,
901
+ sender: str,
902
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
903
+ server_url: Optional[str] = None,
904
+ timeout_ms: Optional[int] = None,
905
+ http_headers: Optional[Mapping[str, str]] = None,
906
+ ) -> models.UnsignedTransaction:
907
+ r"""Swap - into specified amount
908
+
909
+ This endpoint facilitates the trading of tokens by allowing users to specify the
910
+ exact amount of the output token they wish to receive.
911
+
912
+ Utilizing the Aerodrome Slipstream protocol, the system calculates the necessary
913
+ amount of the input token required to achieve the desired output. This operation is
914
+ particularly useful for users who have a specific target amount of the output token
915
+ in mind and are willing to provide the corresponding input token amount. The
916
+ transaction is executed with consideration of current market conditions, including
917
+ liquidity and price impact, ensuring that the trade is completed efficiently and
918
+ effectively.
919
+
920
+ :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
921
+ :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
922
+ :param tick_spacing: The tick spacing of the pool
923
+ :param amount_out: The amount of the token to swap to
924
+ :param amount_in_maximum: The maximum amount of the token to swap from
925
+ :param chain: The chain to use.
926
+ :param sender: The address of the transaction sender.
927
+ :param retries: Override the default retry configuration for this method
928
+ :param server_url: Override the default server URL for this method
929
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
930
+ :param http_headers: Additional headers to set or replace on requests.
931
+ """
932
+ base_url = None
933
+ url_variables = None
934
+ if timeout_ms is None:
935
+ timeout_ms = self.sdk_configuration.timeout_ms
936
+
937
+ if server_url is not None:
938
+ base_url = server_url
939
+ else:
940
+ base_url = self._get_url(base_url, url_variables)
941
+
942
+ request = models.AerodromeSlipstreamBuyExactlyRequest(
943
+ token_in=token_in,
944
+ token_out=token_out,
945
+ tick_spacing=tick_spacing,
946
+ amount_out=amount_out,
947
+ amount_in_maximum=amount_in_maximum,
948
+ chain=chain,
949
+ sender=sender,
950
+ )
951
+
952
+ req = self._build_request_async(
953
+ method="POST",
954
+ path="/v0/aerodrome_slipstream/swap/buy_exactly",
955
+ base_url=base_url,
956
+ url_variables=url_variables,
957
+ request=request,
958
+ request_body_required=True,
959
+ request_has_path_params=False,
960
+ request_has_query_params=True,
961
+ user_agent_header="user-agent",
962
+ accept_header_value="application/json",
963
+ http_headers=http_headers,
964
+ security=self.sdk_configuration.security,
965
+ get_serialized_body=lambda: utils.serialize_request_body(
966
+ request,
967
+ False,
968
+ False,
969
+ "json",
970
+ models.AerodromeSlipstreamBuyExactlyRequest,
971
+ ),
972
+ timeout_ms=timeout_ms,
973
+ )
974
+
975
+ if retries == UNSET:
976
+ if self.sdk_configuration.retry_config is not UNSET:
977
+ retries = self.sdk_configuration.retry_config
978
+
979
+ retry_config = None
980
+ if isinstance(retries, utils.RetryConfig):
981
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
982
+
983
+ http_res = await self.do_request_async(
984
+ hook_ctx=HookContext(
985
+ base_url=base_url or "",
986
+ operation_id="aerodrome_slipstream_swap_buy_exactly",
987
+ oauth2_scopes=[],
988
+ security_source=self.sdk_configuration.security,
989
+ ),
990
+ request=req,
991
+ error_status_codes=["422", "4XX", "5XX"],
992
+ retry_config=retry_config,
993
+ )
994
+
995
+ response_data: Any = None
996
+ if utils.match_response(http_res, "200", "application/json"):
997
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
998
+ if utils.match_response(http_res, "422", "application/json"):
999
+ response_data = utils.unmarshal_json(
1000
+ http_res.text, errors.HTTPValidationErrorData
1001
+ )
1002
+ raise errors.HTTPValidationError(data=response_data)
1003
+ if utils.match_response(http_res, "4XX", "*"):
1004
+ http_res_text = await utils.stream_to_text_async(http_res)
1005
+ raise errors.APIError(
1006
+ "API error occurred", http_res.status_code, http_res_text, http_res
1007
+ )
1008
+ if utils.match_response(http_res, "5XX", "*"):
1009
+ http_res_text = await utils.stream_to_text_async(http_res)
1010
+ raise errors.APIError(
1011
+ "API error occurred", http_res.status_code, http_res_text, http_res
1012
+ )
1013
+
1014
+ content_type = http_res.headers.get("Content-Type")
1015
+ http_res_text = await utils.stream_to_text_async(http_res)
1016
+ raise errors.APIError(
1017
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1018
+ http_res.status_code,
1019
+ http_res_text,
1020
+ http_res,
1021
+ )
1022
+
1023
+ def slipstream_liquidity_provision_mint(
1024
+ self,
1025
+ *,
1026
+ token0: models.TokenEnum,
1027
+ token1: models.TokenEnum,
1028
+ tick_spacing: int,
1029
+ tick_lower: int,
1030
+ tick_upper: int,
1031
+ amount0_desired: Union[
1032
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0Desired,
1033
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0DesiredTypedDict,
1034
+ ],
1035
+ amount1_desired: Union[
1036
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1Desired,
1037
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1DesiredTypedDict,
1038
+ ],
1039
+ amount0_min: Union[
1040
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0Min,
1041
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0MinTypedDict,
1042
+ ],
1043
+ amount1_min: Union[
1044
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1Min,
1045
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1MinTypedDict,
1046
+ ],
1047
+ chain: models.Chain,
1048
+ sender: str,
1049
+ recipient: OptionalNullable[str] = UNSET,
1050
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1051
+ server_url: Optional[str] = None,
1052
+ timeout_ms: Optional[int] = None,
1053
+ http_headers: Optional[Mapping[str, str]] = None,
1054
+ ) -> models.UnsignedTransaction:
1055
+ r"""Open a new LP position
1056
+
1057
+ Initiate a new Liquidity Provider (LP) position by minting tokens.
1058
+
1059
+ This endpoint allows users to open a new LP position, enabling them to participate
1060
+ in liquidity provision. The minting process involves creating a new position with
1061
+ specified parameters, such as token amounts and pool details. The response will
1062
+ confirm the successful creation of the LP position, providing users with the
1063
+ necessary information to manage their newly minted position. This functionality is
1064
+ crucial for users looking to expand their liquidity provision activities, offering
1065
+ them the opportunity to engage in decentralized finance (DeFi) markets effectively.
1066
+
1067
+ :param token0: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1068
+ :param token1: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1069
+ :param tick_spacing: The tick spacing of the pool
1070
+ :param tick_lower: The lower tick of the range to mint the position in
1071
+ :param tick_upper: The upper tick of the range to mint the position in
1072
+ :param amount0_desired: The desired amount of the first token to deposit
1073
+ :param amount1_desired: The desired amount of the second token to deposit
1074
+ :param amount0_min: The minimum amount of the first token to deposit
1075
+ :param amount1_min: The minimum amount of the second token to deposit
1076
+ :param chain: The chain to use.
1077
+ :param sender: The address of the transaction sender.
1078
+ :param recipient: The address that will receive the LP tokens
1079
+ :param retries: Override the default retry configuration for this method
1080
+ :param server_url: Override the default server URL for this method
1081
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1082
+ :param http_headers: Additional headers to set or replace on requests.
1083
+ """
1084
+ base_url = None
1085
+ url_variables = None
1086
+ if timeout_ms is None:
1087
+ timeout_ms = self.sdk_configuration.timeout_ms
1088
+
1089
+ if server_url is not None:
1090
+ base_url = server_url
1091
+ else:
1092
+ base_url = self._get_url(base_url, url_variables)
1093
+
1094
+ request = models.AerodromeSlipstreamMintLiquidityProvisionRequest(
1095
+ token0=token0,
1096
+ token1=token1,
1097
+ tick_spacing=tick_spacing,
1098
+ tick_lower=tick_lower,
1099
+ tick_upper=tick_upper,
1100
+ amount0_desired=amount0_desired,
1101
+ amount1_desired=amount1_desired,
1102
+ amount0_min=amount0_min,
1103
+ amount1_min=amount1_min,
1104
+ recipient=recipient,
1105
+ chain=chain,
1106
+ sender=sender,
1107
+ )
1108
+
1109
+ req = self._build_request(
1110
+ method="POST",
1111
+ path="/v0/aerodrome_slipstream/liquidity_provision/mint",
1112
+ base_url=base_url,
1113
+ url_variables=url_variables,
1114
+ request=request,
1115
+ request_body_required=True,
1116
+ request_has_path_params=False,
1117
+ request_has_query_params=True,
1118
+ user_agent_header="user-agent",
1119
+ accept_header_value="application/json",
1120
+ http_headers=http_headers,
1121
+ security=self.sdk_configuration.security,
1122
+ get_serialized_body=lambda: utils.serialize_request_body(
1123
+ request,
1124
+ False,
1125
+ False,
1126
+ "json",
1127
+ models.AerodromeSlipstreamMintLiquidityProvisionRequest,
1128
+ ),
1129
+ timeout_ms=timeout_ms,
1130
+ )
1131
+
1132
+ if retries == UNSET:
1133
+ if self.sdk_configuration.retry_config is not UNSET:
1134
+ retries = self.sdk_configuration.retry_config
1135
+
1136
+ retry_config = None
1137
+ if isinstance(retries, utils.RetryConfig):
1138
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1139
+
1140
+ http_res = self.do_request(
1141
+ hook_ctx=HookContext(
1142
+ base_url=base_url or "",
1143
+ operation_id="aerodrome_slipstream_liquidity_provision_mint",
1144
+ oauth2_scopes=[],
1145
+ security_source=self.sdk_configuration.security,
1146
+ ),
1147
+ request=req,
1148
+ error_status_codes=["422", "4XX", "5XX"],
1149
+ retry_config=retry_config,
1150
+ )
1151
+
1152
+ response_data: Any = None
1153
+ if utils.match_response(http_res, "200", "application/json"):
1154
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1155
+ if utils.match_response(http_res, "422", "application/json"):
1156
+ response_data = utils.unmarshal_json(
1157
+ http_res.text, errors.HTTPValidationErrorData
1158
+ )
1159
+ raise errors.HTTPValidationError(data=response_data)
1160
+ if utils.match_response(http_res, "4XX", "*"):
1161
+ http_res_text = utils.stream_to_text(http_res)
1162
+ raise errors.APIError(
1163
+ "API error occurred", http_res.status_code, http_res_text, http_res
1164
+ )
1165
+ if utils.match_response(http_res, "5XX", "*"):
1166
+ http_res_text = utils.stream_to_text(http_res)
1167
+ raise errors.APIError(
1168
+ "API error occurred", http_res.status_code, http_res_text, http_res
1169
+ )
1170
+
1171
+ content_type = http_res.headers.get("Content-Type")
1172
+ http_res_text = utils.stream_to_text(http_res)
1173
+ raise errors.APIError(
1174
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1175
+ http_res.status_code,
1176
+ http_res_text,
1177
+ http_res,
1178
+ )
1179
+
1180
+ async def slipstream_liquidity_provision_mint_async(
1181
+ self,
1182
+ *,
1183
+ token0: models.TokenEnum,
1184
+ token1: models.TokenEnum,
1185
+ tick_spacing: int,
1186
+ tick_lower: int,
1187
+ tick_upper: int,
1188
+ amount0_desired: Union[
1189
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0Desired,
1190
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0DesiredTypedDict,
1191
+ ],
1192
+ amount1_desired: Union[
1193
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1Desired,
1194
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1DesiredTypedDict,
1195
+ ],
1196
+ amount0_min: Union[
1197
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0Min,
1198
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount0MinTypedDict,
1199
+ ],
1200
+ amount1_min: Union[
1201
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1Min,
1202
+ models.AerodromeSlipstreamMintLiquidityProvisionRequestAmount1MinTypedDict,
1203
+ ],
1204
+ chain: models.Chain,
1205
+ sender: str,
1206
+ recipient: OptionalNullable[str] = UNSET,
1207
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1208
+ server_url: Optional[str] = None,
1209
+ timeout_ms: Optional[int] = None,
1210
+ http_headers: Optional[Mapping[str, str]] = None,
1211
+ ) -> models.UnsignedTransaction:
1212
+ r"""Open a new LP position
1213
+
1214
+ Initiate a new Liquidity Provider (LP) position by minting tokens.
1215
+
1216
+ This endpoint allows users to open a new LP position, enabling them to participate
1217
+ in liquidity provision. The minting process involves creating a new position with
1218
+ specified parameters, such as token amounts and pool details. The response will
1219
+ confirm the successful creation of the LP position, providing users with the
1220
+ necessary information to manage their newly minted position. This functionality is
1221
+ crucial for users looking to expand their liquidity provision activities, offering
1222
+ them the opportunity to engage in decentralized finance (DeFi) markets effectively.
1223
+
1224
+ :param token0: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1225
+ :param token1: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1226
+ :param tick_spacing: The tick spacing of the pool
1227
+ :param tick_lower: The lower tick of the range to mint the position in
1228
+ :param tick_upper: The upper tick of the range to mint the position in
1229
+ :param amount0_desired: The desired amount of the first token to deposit
1230
+ :param amount1_desired: The desired amount of the second token to deposit
1231
+ :param amount0_min: The minimum amount of the first token to deposit
1232
+ :param amount1_min: The minimum amount of the second token to deposit
1233
+ :param chain: The chain to use.
1234
+ :param sender: The address of the transaction sender.
1235
+ :param recipient: The address that will receive the LP tokens
1236
+ :param retries: Override the default retry configuration for this method
1237
+ :param server_url: Override the default server URL for this method
1238
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1239
+ :param http_headers: Additional headers to set or replace on requests.
1240
+ """
1241
+ base_url = None
1242
+ url_variables = None
1243
+ if timeout_ms is None:
1244
+ timeout_ms = self.sdk_configuration.timeout_ms
1245
+
1246
+ if server_url is not None:
1247
+ base_url = server_url
1248
+ else:
1249
+ base_url = self._get_url(base_url, url_variables)
1250
+
1251
+ request = models.AerodromeSlipstreamMintLiquidityProvisionRequest(
1252
+ token0=token0,
1253
+ token1=token1,
1254
+ tick_spacing=tick_spacing,
1255
+ tick_lower=tick_lower,
1256
+ tick_upper=tick_upper,
1257
+ amount0_desired=amount0_desired,
1258
+ amount1_desired=amount1_desired,
1259
+ amount0_min=amount0_min,
1260
+ amount1_min=amount1_min,
1261
+ recipient=recipient,
1262
+ chain=chain,
1263
+ sender=sender,
1264
+ )
1265
+
1266
+ req = self._build_request_async(
1267
+ method="POST",
1268
+ path="/v0/aerodrome_slipstream/liquidity_provision/mint",
1269
+ base_url=base_url,
1270
+ url_variables=url_variables,
1271
+ request=request,
1272
+ request_body_required=True,
1273
+ request_has_path_params=False,
1274
+ request_has_query_params=True,
1275
+ user_agent_header="user-agent",
1276
+ accept_header_value="application/json",
1277
+ http_headers=http_headers,
1278
+ security=self.sdk_configuration.security,
1279
+ get_serialized_body=lambda: utils.serialize_request_body(
1280
+ request,
1281
+ False,
1282
+ False,
1283
+ "json",
1284
+ models.AerodromeSlipstreamMintLiquidityProvisionRequest,
1285
+ ),
1286
+ timeout_ms=timeout_ms,
1287
+ )
1288
+
1289
+ if retries == UNSET:
1290
+ if self.sdk_configuration.retry_config is not UNSET:
1291
+ retries = self.sdk_configuration.retry_config
1292
+
1293
+ retry_config = None
1294
+ if isinstance(retries, utils.RetryConfig):
1295
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1296
+
1297
+ http_res = await self.do_request_async(
1298
+ hook_ctx=HookContext(
1299
+ base_url=base_url or "",
1300
+ operation_id="aerodrome_slipstream_liquidity_provision_mint",
1301
+ oauth2_scopes=[],
1302
+ security_source=self.sdk_configuration.security,
1303
+ ),
1304
+ request=req,
1305
+ error_status_codes=["422", "4XX", "5XX"],
1306
+ retry_config=retry_config,
1307
+ )
1308
+
1309
+ response_data: Any = None
1310
+ if utils.match_response(http_res, "200", "application/json"):
1311
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1312
+ if utils.match_response(http_res, "422", "application/json"):
1313
+ response_data = utils.unmarshal_json(
1314
+ http_res.text, errors.HTTPValidationErrorData
1315
+ )
1316
+ raise errors.HTTPValidationError(data=response_data)
1317
+ if utils.match_response(http_res, "4XX", "*"):
1318
+ http_res_text = await utils.stream_to_text_async(http_res)
1319
+ raise errors.APIError(
1320
+ "API error occurred", http_res.status_code, http_res_text, http_res
1321
+ )
1322
+ if utils.match_response(http_res, "5XX", "*"):
1323
+ http_res_text = await utils.stream_to_text_async(http_res)
1324
+ raise errors.APIError(
1325
+ "API error occurred", http_res.status_code, http_res_text, http_res
1326
+ )
1327
+
1328
+ content_type = http_res.headers.get("Content-Type")
1329
+ http_res_text = await utils.stream_to_text_async(http_res)
1330
+ raise errors.APIError(
1331
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1332
+ http_res.status_code,
1333
+ http_res_text,
1334
+ http_res,
1335
+ )
1336
+
1337
+ def slipstream_liquidity_provision_increase(
1338
+ self,
1339
+ *,
1340
+ token_id: int,
1341
+ amount0_desired: Union[
1342
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0Desired,
1343
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0DesiredTypedDict,
1344
+ ],
1345
+ amount1_desired: Union[
1346
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1Desired,
1347
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1DesiredTypedDict,
1348
+ ],
1349
+ amount0_min: Union[
1350
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0Min,
1351
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0MinTypedDict,
1352
+ ],
1353
+ amount1_min: Union[
1354
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1Min,
1355
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1MinTypedDict,
1356
+ ],
1357
+ chain: models.Chain,
1358
+ sender: str,
1359
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1360
+ server_url: Optional[str] = None,
1361
+ timeout_ms: Optional[int] = None,
1362
+ http_headers: Optional[Mapping[str, str]] = None,
1363
+ ) -> models.UnsignedTransaction:
1364
+ r"""Increase an LP position
1365
+
1366
+ Increase the liquidity of an existing Liquidity Provider (LP) position.
1367
+
1368
+ This endpoint allows users to add more tokens to their current LP position,
1369
+ enhancing their participation in liquidity provision. By increasing liquidity, users
1370
+ can potentially earn more rewards and improve their position in the pool. The
1371
+ process involves specifying additional token amounts and updating the pool details.
1372
+ The response will confirm the successful increase of the LP position, providing
1373
+ users with updated information about their enhanced position. This functionality is
1374
+ vital for users aiming to optimize their liquidity provision strategy, enabling them
1375
+ to adapt to market conditions and maximize their returns in decentralized finance
1376
+ (DeFi) markets.
1377
+
1378
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
1379
+ :param amount0_desired: The desired amount of the first token to deposit
1380
+ :param amount1_desired: The desired amount of the second token to deposit
1381
+ :param amount0_min: The minimum amount of the first token to deposit
1382
+ :param amount1_min: The minimum amount of the second token to deposit
1383
+ :param chain: The chain to use.
1384
+ :param sender: The address of the transaction sender.
1385
+ :param retries: Override the default retry configuration for this method
1386
+ :param server_url: Override the default server URL for this method
1387
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1388
+ :param http_headers: Additional headers to set or replace on requests.
1389
+ """
1390
+ base_url = None
1391
+ url_variables = None
1392
+ if timeout_ms is None:
1393
+ timeout_ms = self.sdk_configuration.timeout_ms
1394
+
1395
+ if server_url is not None:
1396
+ base_url = server_url
1397
+ else:
1398
+ base_url = self._get_url(base_url, url_variables)
1399
+
1400
+ request = models.AerodromeSlipstreamIncreaseLiquidityProvisionRequest(
1401
+ token_id=token_id,
1402
+ amount0_desired=amount0_desired,
1403
+ amount1_desired=amount1_desired,
1404
+ amount0_min=amount0_min,
1405
+ amount1_min=amount1_min,
1406
+ chain=chain,
1407
+ sender=sender,
1408
+ )
1409
+
1410
+ req = self._build_request(
1411
+ method="POST",
1412
+ path="/v0/aerodrome_slipstream/liquidity_provision/increase",
1413
+ base_url=base_url,
1414
+ url_variables=url_variables,
1415
+ request=request,
1416
+ request_body_required=True,
1417
+ request_has_path_params=False,
1418
+ request_has_query_params=True,
1419
+ user_agent_header="user-agent",
1420
+ accept_header_value="application/json",
1421
+ http_headers=http_headers,
1422
+ security=self.sdk_configuration.security,
1423
+ get_serialized_body=lambda: utils.serialize_request_body(
1424
+ request,
1425
+ False,
1426
+ False,
1427
+ "json",
1428
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequest,
1429
+ ),
1430
+ timeout_ms=timeout_ms,
1431
+ )
1432
+
1433
+ if retries == UNSET:
1434
+ if self.sdk_configuration.retry_config is not UNSET:
1435
+ retries = self.sdk_configuration.retry_config
1436
+
1437
+ retry_config = None
1438
+ if isinstance(retries, utils.RetryConfig):
1439
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1440
+
1441
+ http_res = self.do_request(
1442
+ hook_ctx=HookContext(
1443
+ base_url=base_url or "",
1444
+ operation_id="aerodrome_slipstream_liquidity_provision_increase",
1445
+ oauth2_scopes=[],
1446
+ security_source=self.sdk_configuration.security,
1447
+ ),
1448
+ request=req,
1449
+ error_status_codes=["422", "4XX", "5XX"],
1450
+ retry_config=retry_config,
1451
+ )
1452
+
1453
+ response_data: Any = None
1454
+ if utils.match_response(http_res, "200", "application/json"):
1455
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1456
+ if utils.match_response(http_res, "422", "application/json"):
1457
+ response_data = utils.unmarshal_json(
1458
+ http_res.text, errors.HTTPValidationErrorData
1459
+ )
1460
+ raise errors.HTTPValidationError(data=response_data)
1461
+ if utils.match_response(http_res, "4XX", "*"):
1462
+ http_res_text = utils.stream_to_text(http_res)
1463
+ raise errors.APIError(
1464
+ "API error occurred", http_res.status_code, http_res_text, http_res
1465
+ )
1466
+ if utils.match_response(http_res, "5XX", "*"):
1467
+ http_res_text = utils.stream_to_text(http_res)
1468
+ raise errors.APIError(
1469
+ "API error occurred", http_res.status_code, http_res_text, http_res
1470
+ )
1471
+
1472
+ content_type = http_res.headers.get("Content-Type")
1473
+ http_res_text = utils.stream_to_text(http_res)
1474
+ raise errors.APIError(
1475
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1476
+ http_res.status_code,
1477
+ http_res_text,
1478
+ http_res,
1479
+ )
1480
+
1481
+ async def slipstream_liquidity_provision_increase_async(
1482
+ self,
1483
+ *,
1484
+ token_id: int,
1485
+ amount0_desired: Union[
1486
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0Desired,
1487
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0DesiredTypedDict,
1488
+ ],
1489
+ amount1_desired: Union[
1490
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1Desired,
1491
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1DesiredTypedDict,
1492
+ ],
1493
+ amount0_min: Union[
1494
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0Min,
1495
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount0MinTypedDict,
1496
+ ],
1497
+ amount1_min: Union[
1498
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1Min,
1499
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequestAmount1MinTypedDict,
1500
+ ],
1501
+ chain: models.Chain,
1502
+ sender: str,
1503
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1504
+ server_url: Optional[str] = None,
1505
+ timeout_ms: Optional[int] = None,
1506
+ http_headers: Optional[Mapping[str, str]] = None,
1507
+ ) -> models.UnsignedTransaction:
1508
+ r"""Increase an LP position
1509
+
1510
+ Increase the liquidity of an existing Liquidity Provider (LP) position.
1511
+
1512
+ This endpoint allows users to add more tokens to their current LP position,
1513
+ enhancing their participation in liquidity provision. By increasing liquidity, users
1514
+ can potentially earn more rewards and improve their position in the pool. The
1515
+ process involves specifying additional token amounts and updating the pool details.
1516
+ The response will confirm the successful increase of the LP position, providing
1517
+ users with updated information about their enhanced position. This functionality is
1518
+ vital for users aiming to optimize their liquidity provision strategy, enabling them
1519
+ to adapt to market conditions and maximize their returns in decentralized finance
1520
+ (DeFi) markets.
1521
+
1522
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
1523
+ :param amount0_desired: The desired amount of the first token to deposit
1524
+ :param amount1_desired: The desired amount of the second token to deposit
1525
+ :param amount0_min: The minimum amount of the first token to deposit
1526
+ :param amount1_min: The minimum amount of the second token to deposit
1527
+ :param chain: The chain to use.
1528
+ :param sender: The address of the transaction sender.
1529
+ :param retries: Override the default retry configuration for this method
1530
+ :param server_url: Override the default server URL for this method
1531
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1532
+ :param http_headers: Additional headers to set or replace on requests.
1533
+ """
1534
+ base_url = None
1535
+ url_variables = None
1536
+ if timeout_ms is None:
1537
+ timeout_ms = self.sdk_configuration.timeout_ms
1538
+
1539
+ if server_url is not None:
1540
+ base_url = server_url
1541
+ else:
1542
+ base_url = self._get_url(base_url, url_variables)
1543
+
1544
+ request = models.AerodromeSlipstreamIncreaseLiquidityProvisionRequest(
1545
+ token_id=token_id,
1546
+ amount0_desired=amount0_desired,
1547
+ amount1_desired=amount1_desired,
1548
+ amount0_min=amount0_min,
1549
+ amount1_min=amount1_min,
1550
+ chain=chain,
1551
+ sender=sender,
1552
+ )
1553
+
1554
+ req = self._build_request_async(
1555
+ method="POST",
1556
+ path="/v0/aerodrome_slipstream/liquidity_provision/increase",
1557
+ base_url=base_url,
1558
+ url_variables=url_variables,
1559
+ request=request,
1560
+ request_body_required=True,
1561
+ request_has_path_params=False,
1562
+ request_has_query_params=True,
1563
+ user_agent_header="user-agent",
1564
+ accept_header_value="application/json",
1565
+ http_headers=http_headers,
1566
+ security=self.sdk_configuration.security,
1567
+ get_serialized_body=lambda: utils.serialize_request_body(
1568
+ request,
1569
+ False,
1570
+ False,
1571
+ "json",
1572
+ models.AerodromeSlipstreamIncreaseLiquidityProvisionRequest,
1573
+ ),
1574
+ timeout_ms=timeout_ms,
1575
+ )
1576
+
1577
+ if retries == UNSET:
1578
+ if self.sdk_configuration.retry_config is not UNSET:
1579
+ retries = self.sdk_configuration.retry_config
1580
+
1581
+ retry_config = None
1582
+ if isinstance(retries, utils.RetryConfig):
1583
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1584
+
1585
+ http_res = await self.do_request_async(
1586
+ hook_ctx=HookContext(
1587
+ base_url=base_url or "",
1588
+ operation_id="aerodrome_slipstream_liquidity_provision_increase",
1589
+ oauth2_scopes=[],
1590
+ security_source=self.sdk_configuration.security,
1591
+ ),
1592
+ request=req,
1593
+ error_status_codes=["422", "4XX", "5XX"],
1594
+ retry_config=retry_config,
1595
+ )
1596
+
1597
+ response_data: Any = None
1598
+ if utils.match_response(http_res, "200", "application/json"):
1599
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1600
+ if utils.match_response(http_res, "422", "application/json"):
1601
+ response_data = utils.unmarshal_json(
1602
+ http_res.text, errors.HTTPValidationErrorData
1603
+ )
1604
+ raise errors.HTTPValidationError(data=response_data)
1605
+ if utils.match_response(http_res, "4XX", "*"):
1606
+ http_res_text = await utils.stream_to_text_async(http_res)
1607
+ raise errors.APIError(
1608
+ "API error occurred", http_res.status_code, http_res_text, http_res
1609
+ )
1610
+ if utils.match_response(http_res, "5XX", "*"):
1611
+ http_res_text = await utils.stream_to_text_async(http_res)
1612
+ raise errors.APIError(
1613
+ "API error occurred", http_res.status_code, http_res_text, http_res
1614
+ )
1615
+
1616
+ content_type = http_res.headers.get("Content-Type")
1617
+ http_res_text = await utils.stream_to_text_async(http_res)
1618
+ raise errors.APIError(
1619
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1620
+ http_res.status_code,
1621
+ http_res_text,
1622
+ http_res,
1623
+ )
1624
+
1625
+ def slipstream_liquidity_provision_withdraw(
1626
+ self,
1627
+ *,
1628
+ token_id: int,
1629
+ percentage_for_withdrawal: Union[
1630
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequestPercentageForWithdrawal,
1631
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequestPercentageForWithdrawalTypedDict,
1632
+ ],
1633
+ chain: models.Chain,
1634
+ sender: str,
1635
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1636
+ server_url: Optional[str] = None,
1637
+ timeout_ms: Optional[int] = None,
1638
+ http_headers: Optional[Mapping[str, str]] = None,
1639
+ ) -> models.UnsignedTransaction:
1640
+ r"""Withdraw an LP position
1641
+
1642
+ Withdraw an existing Liquidity Provider (LP) position.
1643
+
1644
+ This endpoint allows users to remove their tokens from an LP position, effectively
1645
+ closing their participation in the liquidity pool. The withdrawal process involves
1646
+ specifying the LP position to be closed, and the response will confirm the
1647
+ successful removal of liquidity, providing users with details about the withdrawn
1648
+ tokens and any remaining balances. This functionality is essential for users who
1649
+ wish to exit their liquidity provision activities, enabling them to reclaim their
1650
+ assets and potentially reallocate them to other investment opportunities. The
1651
+ endpoint ensures a smooth and secure withdrawal process, facilitating users'
1652
+ strategic management of their decentralized finance (DeFi) portfolios.
1653
+
1654
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
1655
+ :param percentage_for_withdrawal: How much liquidity to take out in percentage.
1656
+ :param chain: The chain to use.
1657
+ :param sender: The address of the transaction sender.
1658
+ :param retries: Override the default retry configuration for this method
1659
+ :param server_url: Override the default server URL for this method
1660
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1661
+ :param http_headers: Additional headers to set or replace on requests.
1662
+ """
1663
+ base_url = None
1664
+ url_variables = None
1665
+ if timeout_ms is None:
1666
+ timeout_ms = self.sdk_configuration.timeout_ms
1667
+
1668
+ if server_url is not None:
1669
+ base_url = server_url
1670
+ else:
1671
+ base_url = self._get_url(base_url, url_variables)
1672
+
1673
+ request = models.AerodromeSlipstreamWithdrawLiquidityProvisionRequest(
1674
+ token_id=token_id,
1675
+ percentage_for_withdrawal=percentage_for_withdrawal,
1676
+ chain=chain,
1677
+ sender=sender,
1678
+ )
1679
+
1680
+ req = self._build_request(
1681
+ method="POST",
1682
+ path="/v0/aerodrome_slipstream/liquidity_provision/withdraw",
1683
+ base_url=base_url,
1684
+ url_variables=url_variables,
1685
+ request=request,
1686
+ request_body_required=True,
1687
+ request_has_path_params=False,
1688
+ request_has_query_params=True,
1689
+ user_agent_header="user-agent",
1690
+ accept_header_value="application/json",
1691
+ http_headers=http_headers,
1692
+ security=self.sdk_configuration.security,
1693
+ get_serialized_body=lambda: utils.serialize_request_body(
1694
+ request,
1695
+ False,
1696
+ False,
1697
+ "json",
1698
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequest,
1699
+ ),
1700
+ timeout_ms=timeout_ms,
1701
+ )
1702
+
1703
+ if retries == UNSET:
1704
+ if self.sdk_configuration.retry_config is not UNSET:
1705
+ retries = self.sdk_configuration.retry_config
1706
+
1707
+ retry_config = None
1708
+ if isinstance(retries, utils.RetryConfig):
1709
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1710
+
1711
+ http_res = self.do_request(
1712
+ hook_ctx=HookContext(
1713
+ base_url=base_url or "",
1714
+ operation_id="aerodrome_slipstream_liquidity_provision_withdraw",
1715
+ oauth2_scopes=[],
1716
+ security_source=self.sdk_configuration.security,
1717
+ ),
1718
+ request=req,
1719
+ error_status_codes=["422", "4XX", "5XX"],
1720
+ retry_config=retry_config,
1721
+ )
1722
+
1723
+ response_data: Any = None
1724
+ if utils.match_response(http_res, "200", "application/json"):
1725
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1726
+ if utils.match_response(http_res, "422", "application/json"):
1727
+ response_data = utils.unmarshal_json(
1728
+ http_res.text, errors.HTTPValidationErrorData
1729
+ )
1730
+ raise errors.HTTPValidationError(data=response_data)
1731
+ if utils.match_response(http_res, "4XX", "*"):
1732
+ http_res_text = utils.stream_to_text(http_res)
1733
+ raise errors.APIError(
1734
+ "API error occurred", http_res.status_code, http_res_text, http_res
1735
+ )
1736
+ if utils.match_response(http_res, "5XX", "*"):
1737
+ http_res_text = utils.stream_to_text(http_res)
1738
+ raise errors.APIError(
1739
+ "API error occurred", http_res.status_code, http_res_text, http_res
1740
+ )
1741
+
1742
+ content_type = http_res.headers.get("Content-Type")
1743
+ http_res_text = utils.stream_to_text(http_res)
1744
+ raise errors.APIError(
1745
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1746
+ http_res.status_code,
1747
+ http_res_text,
1748
+ http_res,
1749
+ )
1750
+
1751
+ async def slipstream_liquidity_provision_withdraw_async(
1752
+ self,
1753
+ *,
1754
+ token_id: int,
1755
+ percentage_for_withdrawal: Union[
1756
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequestPercentageForWithdrawal,
1757
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequestPercentageForWithdrawalTypedDict,
1758
+ ],
1759
+ chain: models.Chain,
1760
+ sender: str,
1761
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1762
+ server_url: Optional[str] = None,
1763
+ timeout_ms: Optional[int] = None,
1764
+ http_headers: Optional[Mapping[str, str]] = None,
1765
+ ) -> models.UnsignedTransaction:
1766
+ r"""Withdraw an LP position
1767
+
1768
+ Withdraw an existing Liquidity Provider (LP) position.
1769
+
1770
+ This endpoint allows users to remove their tokens from an LP position, effectively
1771
+ closing their participation in the liquidity pool. The withdrawal process involves
1772
+ specifying the LP position to be closed, and the response will confirm the
1773
+ successful removal of liquidity, providing users with details about the withdrawn
1774
+ tokens and any remaining balances. This functionality is essential for users who
1775
+ wish to exit their liquidity provision activities, enabling them to reclaim their
1776
+ assets and potentially reallocate them to other investment opportunities. The
1777
+ endpoint ensures a smooth and secure withdrawal process, facilitating users'
1778
+ strategic management of their decentralized finance (DeFi) portfolios.
1779
+
1780
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
1781
+ :param percentage_for_withdrawal: How much liquidity to take out in percentage.
1782
+ :param chain: The chain to use.
1783
+ :param sender: The address of the transaction sender.
1784
+ :param retries: Override the default retry configuration for this method
1785
+ :param server_url: Override the default server URL for this method
1786
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1787
+ :param http_headers: Additional headers to set or replace on requests.
1788
+ """
1789
+ base_url = None
1790
+ url_variables = None
1791
+ if timeout_ms is None:
1792
+ timeout_ms = self.sdk_configuration.timeout_ms
1793
+
1794
+ if server_url is not None:
1795
+ base_url = server_url
1796
+ else:
1797
+ base_url = self._get_url(base_url, url_variables)
1798
+
1799
+ request = models.AerodromeSlipstreamWithdrawLiquidityProvisionRequest(
1800
+ token_id=token_id,
1801
+ percentage_for_withdrawal=percentage_for_withdrawal,
1802
+ chain=chain,
1803
+ sender=sender,
1804
+ )
1805
+
1806
+ req = self._build_request_async(
1807
+ method="POST",
1808
+ path="/v0/aerodrome_slipstream/liquidity_provision/withdraw",
1809
+ base_url=base_url,
1810
+ url_variables=url_variables,
1811
+ request=request,
1812
+ request_body_required=True,
1813
+ request_has_path_params=False,
1814
+ request_has_query_params=True,
1815
+ user_agent_header="user-agent",
1816
+ accept_header_value="application/json",
1817
+ http_headers=http_headers,
1818
+ security=self.sdk_configuration.security,
1819
+ get_serialized_body=lambda: utils.serialize_request_body(
1820
+ request,
1821
+ False,
1822
+ False,
1823
+ "json",
1824
+ models.AerodromeSlipstreamWithdrawLiquidityProvisionRequest,
1825
+ ),
1826
+ timeout_ms=timeout_ms,
1827
+ )
1828
+
1829
+ if retries == UNSET:
1830
+ if self.sdk_configuration.retry_config is not UNSET:
1831
+ retries = self.sdk_configuration.retry_config
1832
+
1833
+ retry_config = None
1834
+ if isinstance(retries, utils.RetryConfig):
1835
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1836
+
1837
+ http_res = await self.do_request_async(
1838
+ hook_ctx=HookContext(
1839
+ base_url=base_url or "",
1840
+ operation_id="aerodrome_slipstream_liquidity_provision_withdraw",
1841
+ oauth2_scopes=[],
1842
+ security_source=self.sdk_configuration.security,
1843
+ ),
1844
+ request=req,
1845
+ error_status_codes=["422", "4XX", "5XX"],
1846
+ retry_config=retry_config,
1847
+ )
1848
+
1849
+ response_data: Any = None
1850
+ if utils.match_response(http_res, "200", "application/json"):
1851
+ return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1852
+ if utils.match_response(http_res, "422", "application/json"):
1853
+ response_data = utils.unmarshal_json(
1854
+ http_res.text, errors.HTTPValidationErrorData
1855
+ )
1856
+ raise errors.HTTPValidationError(data=response_data)
1857
+ if utils.match_response(http_res, "4XX", "*"):
1858
+ http_res_text = await utils.stream_to_text_async(http_res)
1859
+ raise errors.APIError(
1860
+ "API error occurred", http_res.status_code, http_res_text, http_res
1861
+ )
1862
+ if utils.match_response(http_res, "5XX", "*"):
1863
+ http_res_text = await utils.stream_to_text_async(http_res)
1864
+ raise errors.APIError(
1865
+ "API error occurred", http_res.status_code, http_res_text, http_res
1866
+ )
1867
+
1868
+ content_type = http_res.headers.get("Content-Type")
1869
+ http_res_text = await utils.stream_to_text_async(http_res)
1870
+ raise errors.APIError(
1871
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1872
+ http_res.status_code,
1873
+ http_res_text,
1874
+ http_res,
1875
+ )