compass_api_sdk 0.6.0__py3-none-any.whl → 0.6.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of compass_api_sdk might be problematic. Click here for more details.
- compass_api_sdk/_version.py +2 -2
- compass_api_sdk/aave_v3.py +38 -104
- compass_api_sdk/aerodrome_slipstream.py +8 -28
- compass_api_sdk/models/__init__.py +107 -230
- compass_api_sdk/models/aave_avg_rateop.py +44 -16
- compass_api_sdk/models/aave_historical_transactionsop.py +45 -20
- compass_api_sdk/models/aave_liquidity_changeop.py +44 -18
- compass_api_sdk/models/aave_rateop.py +44 -16
- compass_api_sdk/models/aave_reserve_overviewop.py +44 -18
- compass_api_sdk/models/aave_std_rateop.py +44 -16
- compass_api_sdk/models/aave_token_priceop.py +44 -18
- compass_api_sdk/models/aave_user_position_per_tokenop.py +44 -20
- compass_api_sdk/models/aave_user_position_summaryop.py +44 -20
- compass_api_sdk/models/aerodrome_slipstream_liquidity_provision_positionsop.py +45 -20
- compass_api_sdk/models/aerodrome_slipstream_pool_priceop.py +45 -20
- compass_api_sdk/models/{tokenbalance.py → compass_api_backend_models_generic_read_response_portfolio_tokenbalance.py} +4 -2
- compass_api_sdk/models/compass_api_backend_models_pendle_read_response_positions_tokenbalance.py +18 -0
- compass_api_sdk/models/details.py +39 -0
- compass_api_sdk/models/generic_allowanceop.py +45 -18
- compass_api_sdk/models/generic_ensop.py +45 -16
- compass_api_sdk/models/generic_portfolioop.py +45 -18
- compass_api_sdk/models/generic_supported_tokensop.py +44 -20
- compass_api_sdk/models/generic_visualize_portfolioop.py +45 -20
- compass_api_sdk/models/increaseallowanceparams.py +20 -16
- compass_api_sdk/models/increaseallowancerequest.py +20 -16
- compass_api_sdk/models/lpbalance.py +20 -0
- compass_api_sdk/models/morpho_market_positionop.py +44 -18
- compass_api_sdk/models/morpho_marketop.py +44 -18
- compass_api_sdk/models/morpho_marketsop.py +7 -18
- compass_api_sdk/models/morpho_user_positionop.py +44 -18
- compass_api_sdk/models/morpho_vault_positionop.py +44 -18
- compass_api_sdk/models/morpho_vaultop.py +44 -16
- compass_api_sdk/models/morpho_vaultsop.py +7 -18
- compass_api_sdk/models/movement10percent.py +23 -0
- compass_api_sdk/models/multicallactiontype.py +0 -1
- compass_api_sdk/models/multicallauthorizationrequest.py +1 -15
- compass_api_sdk/models/openposition.py +28 -0
- compass_api_sdk/models/pendle_marketop.py +45 -19
- compass_api_sdk/models/pendle_marketsop.py +73 -0
- compass_api_sdk/models/pendle_positionop.py +45 -19
- compass_api_sdk/models/pendle_positionsop.py +80 -0
- compass_api_sdk/models/pendlelistmarketsresponse.py +17 -0
- compass_api_sdk/models/pendlelistuserpositionsresponse.py +17 -0
- compass_api_sdk/models/pendlemarket.py +46 -0
- compass_api_sdk/models/portfolio.py +10 -3
- compass_api_sdk/models/position.py +41 -0
- compass_api_sdk/models/sky_positionop.py +45 -16
- compass_api_sdk/models/syposition.py +17 -0
- compass_api_sdk/models/token_addressop.py +44 -18
- compass_api_sdk/models/token_balanceop.py +44 -17
- compass_api_sdk/models/uniswap_liquidity_provision_in_rangeop.py +44 -20
- compass_api_sdk/models/uniswap_liquidity_provision_positionsop.py +45 -20
- compass_api_sdk/models/uniswap_pool_priceop.py +44 -18
- compass_api_sdk/models/uniswap_quote_buy_exactlyop.py +44 -19
- compass_api_sdk/models/uniswap_quote_sell_exactlyop.py +44 -19
- compass_api_sdk/models/useroperation.py +20 -26
- compass_api_sdk/models/yieldrange.py +16 -0
- compass_api_sdk/morpho.py +28 -72
- compass_api_sdk/pendle.py +423 -21
- compass_api_sdk/sky.py +4 -8
- compass_api_sdk/token_sdk.py +8 -16
- compass_api_sdk/transaction_batching.py +0 -6
- compass_api_sdk/uniswap_v3.py +20 -64
- compass_api_sdk/universal.py +34 -60
- {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/METADATA +5 -3
- {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/RECORD +67 -56
- compass_api_sdk/models/contractname.py +0 -41
- compass_api_sdk/models/increaseallowanceanyparams.py +0 -58
- {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/WHEEL +0 -0
compass_api_sdk/pendle.py
CHANGED
|
@@ -4,7 +4,7 @@ from .basesdk import BaseSDK
|
|
|
4
4
|
from compass_api_sdk import errors, models, utils
|
|
5
5
|
from compass_api_sdk._hooks import HookContext
|
|
6
6
|
from compass_api_sdk.types import OptionalNullable, UNSET
|
|
7
|
-
from typing import Any, Mapping, Optional
|
|
7
|
+
from typing import Any, Mapping, Optional
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Pendle(BaseSDK):
|
|
@@ -13,10 +13,8 @@ class Pendle(BaseSDK):
|
|
|
13
13
|
*,
|
|
14
14
|
chain: models.PendlePositionChain = models.PendlePositionChain.ETHEREUM_MAINNET,
|
|
15
15
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
16
|
-
market_address: str = "
|
|
17
|
-
block:
|
|
18
|
-
Union[models.PendlePositionBlock, models.PendlePositionBlockTypedDict]
|
|
19
|
-
] = None,
|
|
16
|
+
market_address: str = "0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2",
|
|
17
|
+
block: OptionalNullable[int] = UNSET,
|
|
20
18
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
21
19
|
server_url: Optional[str] = None,
|
|
22
20
|
timeout_ms: Optional[int] = None,
|
|
@@ -29,7 +27,7 @@ class Pendle(BaseSDK):
|
|
|
29
27
|
:param chain: The chain to use.
|
|
30
28
|
:param user_address: The user address of the desired position.
|
|
31
29
|
:param market_address: The market address of the desired position.
|
|
32
|
-
:param block:
|
|
30
|
+
:param block: Optional block number (defaults to latest).
|
|
33
31
|
:param retries: Override the default retry configuration for this method
|
|
34
32
|
:param server_url: Override the default server URL for this method
|
|
35
33
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -123,10 +121,8 @@ class Pendle(BaseSDK):
|
|
|
123
121
|
*,
|
|
124
122
|
chain: models.PendlePositionChain = models.PendlePositionChain.ETHEREUM_MAINNET,
|
|
125
123
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
126
|
-
market_address: str = "
|
|
127
|
-
block:
|
|
128
|
-
Union[models.PendlePositionBlock, models.PendlePositionBlockTypedDict]
|
|
129
|
-
] = None,
|
|
124
|
+
market_address: str = "0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2",
|
|
125
|
+
block: OptionalNullable[int] = UNSET,
|
|
130
126
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
131
127
|
server_url: Optional[str] = None,
|
|
132
128
|
timeout_ms: Optional[int] = None,
|
|
@@ -139,7 +135,7 @@ class Pendle(BaseSDK):
|
|
|
139
135
|
:param chain: The chain to use.
|
|
140
136
|
:param user_address: The user address of the desired position.
|
|
141
137
|
:param market_address: The market address of the desired position.
|
|
142
|
-
:param block:
|
|
138
|
+
:param block: Optional block number (defaults to latest).
|
|
143
139
|
:param retries: Override the default retry configuration for this method
|
|
144
140
|
:param server_url: Override the default server URL for this method
|
|
145
141
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -228,15 +224,423 @@ class Pendle(BaseSDK):
|
|
|
228
224
|
http_res,
|
|
229
225
|
)
|
|
230
226
|
|
|
227
|
+
def positions(
|
|
228
|
+
self,
|
|
229
|
+
*,
|
|
230
|
+
chain: models.PendlePositionsChain = models.PendlePositionsChain.ETHEREUM_MAINNET,
|
|
231
|
+
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
232
|
+
block: OptionalNullable[int] = UNSET,
|
|
233
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
234
|
+
server_url: Optional[str] = None,
|
|
235
|
+
timeout_ms: Optional[int] = None,
|
|
236
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
237
|
+
) -> models.PendleListUserPositionsResponse:
|
|
238
|
+
r"""List User's Market Positions
|
|
239
|
+
|
|
240
|
+
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
241
|
+
|
|
242
|
+
:param chain: The chain to use.
|
|
243
|
+
:param user_address: The user address of the desired position.
|
|
244
|
+
:param block: Optional block number (defaults to latest).
|
|
245
|
+
:param retries: Override the default retry configuration for this method
|
|
246
|
+
:param server_url: Override the default server URL for this method
|
|
247
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
248
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
249
|
+
"""
|
|
250
|
+
base_url = None
|
|
251
|
+
url_variables = None
|
|
252
|
+
if timeout_ms is None:
|
|
253
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
254
|
+
|
|
255
|
+
if server_url is not None:
|
|
256
|
+
base_url = server_url
|
|
257
|
+
else:
|
|
258
|
+
base_url = self._get_url(base_url, url_variables)
|
|
259
|
+
|
|
260
|
+
request = models.PendlePositionsRequest(
|
|
261
|
+
chain=chain,
|
|
262
|
+
block=block,
|
|
263
|
+
user_address=user_address,
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
req = self._build_request(
|
|
267
|
+
method="GET",
|
|
268
|
+
path="/v0/pendle/positions",
|
|
269
|
+
base_url=base_url,
|
|
270
|
+
url_variables=url_variables,
|
|
271
|
+
request=request,
|
|
272
|
+
request_body_required=False,
|
|
273
|
+
request_has_path_params=False,
|
|
274
|
+
request_has_query_params=True,
|
|
275
|
+
user_agent_header="user-agent",
|
|
276
|
+
accept_header_value="application/json",
|
|
277
|
+
http_headers=http_headers,
|
|
278
|
+
security=self.sdk_configuration.security,
|
|
279
|
+
timeout_ms=timeout_ms,
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
if retries == UNSET:
|
|
283
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
284
|
+
retries = self.sdk_configuration.retry_config
|
|
285
|
+
|
|
286
|
+
retry_config = None
|
|
287
|
+
if isinstance(retries, utils.RetryConfig):
|
|
288
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
289
|
+
|
|
290
|
+
http_res = self.do_request(
|
|
291
|
+
hook_ctx=HookContext(
|
|
292
|
+
base_url=base_url or "",
|
|
293
|
+
operation_id="pendle_positions",
|
|
294
|
+
oauth2_scopes=[],
|
|
295
|
+
security_source=self.sdk_configuration.security,
|
|
296
|
+
),
|
|
297
|
+
request=req,
|
|
298
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
299
|
+
retry_config=retry_config,
|
|
300
|
+
)
|
|
301
|
+
|
|
302
|
+
response_data: Any = None
|
|
303
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
304
|
+
return utils.unmarshal_json(
|
|
305
|
+
http_res.text, models.PendleListUserPositionsResponse
|
|
306
|
+
)
|
|
307
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
308
|
+
response_data = utils.unmarshal_json(
|
|
309
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
310
|
+
)
|
|
311
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
312
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
313
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
314
|
+
raise errors.APIError(
|
|
315
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
316
|
+
)
|
|
317
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
318
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
319
|
+
raise errors.APIError(
|
|
320
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
content_type = http_res.headers.get("Content-Type")
|
|
324
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
325
|
+
raise errors.APIError(
|
|
326
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
327
|
+
http_res.status_code,
|
|
328
|
+
http_res_text,
|
|
329
|
+
http_res,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
async def positions_async(
|
|
333
|
+
self,
|
|
334
|
+
*,
|
|
335
|
+
chain: models.PendlePositionsChain = models.PendlePositionsChain.ETHEREUM_MAINNET,
|
|
336
|
+
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
337
|
+
block: OptionalNullable[int] = UNSET,
|
|
338
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
339
|
+
server_url: Optional[str] = None,
|
|
340
|
+
timeout_ms: Optional[int] = None,
|
|
341
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
342
|
+
) -> models.PendleListUserPositionsResponse:
|
|
343
|
+
r"""List User's Market Positions
|
|
344
|
+
|
|
345
|
+
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
346
|
+
|
|
347
|
+
:param chain: The chain to use.
|
|
348
|
+
:param user_address: The user address of the desired position.
|
|
349
|
+
:param block: Optional block number (defaults to latest).
|
|
350
|
+
:param retries: Override the default retry configuration for this method
|
|
351
|
+
:param server_url: Override the default server URL for this method
|
|
352
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
353
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
354
|
+
"""
|
|
355
|
+
base_url = None
|
|
356
|
+
url_variables = None
|
|
357
|
+
if timeout_ms is None:
|
|
358
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
359
|
+
|
|
360
|
+
if server_url is not None:
|
|
361
|
+
base_url = server_url
|
|
362
|
+
else:
|
|
363
|
+
base_url = self._get_url(base_url, url_variables)
|
|
364
|
+
|
|
365
|
+
request = models.PendlePositionsRequest(
|
|
366
|
+
chain=chain,
|
|
367
|
+
block=block,
|
|
368
|
+
user_address=user_address,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
req = self._build_request_async(
|
|
372
|
+
method="GET",
|
|
373
|
+
path="/v0/pendle/positions",
|
|
374
|
+
base_url=base_url,
|
|
375
|
+
url_variables=url_variables,
|
|
376
|
+
request=request,
|
|
377
|
+
request_body_required=False,
|
|
378
|
+
request_has_path_params=False,
|
|
379
|
+
request_has_query_params=True,
|
|
380
|
+
user_agent_header="user-agent",
|
|
381
|
+
accept_header_value="application/json",
|
|
382
|
+
http_headers=http_headers,
|
|
383
|
+
security=self.sdk_configuration.security,
|
|
384
|
+
timeout_ms=timeout_ms,
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
if retries == UNSET:
|
|
388
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
389
|
+
retries = self.sdk_configuration.retry_config
|
|
390
|
+
|
|
391
|
+
retry_config = None
|
|
392
|
+
if isinstance(retries, utils.RetryConfig):
|
|
393
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
394
|
+
|
|
395
|
+
http_res = await self.do_request_async(
|
|
396
|
+
hook_ctx=HookContext(
|
|
397
|
+
base_url=base_url or "",
|
|
398
|
+
operation_id="pendle_positions",
|
|
399
|
+
oauth2_scopes=[],
|
|
400
|
+
security_source=self.sdk_configuration.security,
|
|
401
|
+
),
|
|
402
|
+
request=req,
|
|
403
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
404
|
+
retry_config=retry_config,
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
response_data: Any = None
|
|
408
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
409
|
+
return utils.unmarshal_json(
|
|
410
|
+
http_res.text, models.PendleListUserPositionsResponse
|
|
411
|
+
)
|
|
412
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
413
|
+
response_data = utils.unmarshal_json(
|
|
414
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
415
|
+
)
|
|
416
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
417
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
418
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
419
|
+
raise errors.APIError(
|
|
420
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
421
|
+
)
|
|
422
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
423
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
424
|
+
raise errors.APIError(
|
|
425
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
content_type = http_res.headers.get("Content-Type")
|
|
429
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
430
|
+
raise errors.APIError(
|
|
431
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
432
|
+
http_res.status_code,
|
|
433
|
+
http_res_text,
|
|
434
|
+
http_res,
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
def markets(
|
|
438
|
+
self,
|
|
439
|
+
*,
|
|
440
|
+
chain: models.PendleMarketsChain = models.PendleMarketsChain.ETHEREUM_MAINNET,
|
|
441
|
+
block: OptionalNullable[int] = UNSET,
|
|
442
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
443
|
+
server_url: Optional[str] = None,
|
|
444
|
+
timeout_ms: Optional[int] = None,
|
|
445
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
446
|
+
) -> models.PendleListMarketsResponse:
|
|
447
|
+
r"""List Market Data
|
|
448
|
+
|
|
449
|
+
Get a list of active markets.
|
|
450
|
+
|
|
451
|
+
:param chain: The chain to use.
|
|
452
|
+
:param block: Optional block number (defaults to latest).
|
|
453
|
+
:param retries: Override the default retry configuration for this method
|
|
454
|
+
:param server_url: Override the default server URL for this method
|
|
455
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
456
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
457
|
+
"""
|
|
458
|
+
base_url = None
|
|
459
|
+
url_variables = None
|
|
460
|
+
if timeout_ms is None:
|
|
461
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
462
|
+
|
|
463
|
+
if server_url is not None:
|
|
464
|
+
base_url = server_url
|
|
465
|
+
else:
|
|
466
|
+
base_url = self._get_url(base_url, url_variables)
|
|
467
|
+
|
|
468
|
+
request = models.PendleMarketsRequest(
|
|
469
|
+
chain=chain,
|
|
470
|
+
block=block,
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
req = self._build_request(
|
|
474
|
+
method="GET",
|
|
475
|
+
path="/v0/pendle/markets",
|
|
476
|
+
base_url=base_url,
|
|
477
|
+
url_variables=url_variables,
|
|
478
|
+
request=request,
|
|
479
|
+
request_body_required=False,
|
|
480
|
+
request_has_path_params=False,
|
|
481
|
+
request_has_query_params=True,
|
|
482
|
+
user_agent_header="user-agent",
|
|
483
|
+
accept_header_value="application/json",
|
|
484
|
+
http_headers=http_headers,
|
|
485
|
+
security=self.sdk_configuration.security,
|
|
486
|
+
timeout_ms=timeout_ms,
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
if retries == UNSET:
|
|
490
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
491
|
+
retries = self.sdk_configuration.retry_config
|
|
492
|
+
|
|
493
|
+
retry_config = None
|
|
494
|
+
if isinstance(retries, utils.RetryConfig):
|
|
495
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
496
|
+
|
|
497
|
+
http_res = self.do_request(
|
|
498
|
+
hook_ctx=HookContext(
|
|
499
|
+
base_url=base_url or "",
|
|
500
|
+
operation_id="pendle_markets",
|
|
501
|
+
oauth2_scopes=[],
|
|
502
|
+
security_source=self.sdk_configuration.security,
|
|
503
|
+
),
|
|
504
|
+
request=req,
|
|
505
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
506
|
+
retry_config=retry_config,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
response_data: Any = None
|
|
510
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
511
|
+
return utils.unmarshal_json(http_res.text, models.PendleListMarketsResponse)
|
|
512
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
513
|
+
response_data = utils.unmarshal_json(
|
|
514
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
515
|
+
)
|
|
516
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
517
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
518
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
519
|
+
raise errors.APIError(
|
|
520
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
521
|
+
)
|
|
522
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
523
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
524
|
+
raise errors.APIError(
|
|
525
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
content_type = http_res.headers.get("Content-Type")
|
|
529
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
530
|
+
raise errors.APIError(
|
|
531
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
532
|
+
http_res.status_code,
|
|
533
|
+
http_res_text,
|
|
534
|
+
http_res,
|
|
535
|
+
)
|
|
536
|
+
|
|
537
|
+
async def markets_async(
|
|
538
|
+
self,
|
|
539
|
+
*,
|
|
540
|
+
chain: models.PendleMarketsChain = models.PendleMarketsChain.ETHEREUM_MAINNET,
|
|
541
|
+
block: OptionalNullable[int] = UNSET,
|
|
542
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
543
|
+
server_url: Optional[str] = None,
|
|
544
|
+
timeout_ms: Optional[int] = None,
|
|
545
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
546
|
+
) -> models.PendleListMarketsResponse:
|
|
547
|
+
r"""List Market Data
|
|
548
|
+
|
|
549
|
+
Get a list of active markets.
|
|
550
|
+
|
|
551
|
+
:param chain: The chain to use.
|
|
552
|
+
:param block: Optional block number (defaults to latest).
|
|
553
|
+
:param retries: Override the default retry configuration for this method
|
|
554
|
+
:param server_url: Override the default server URL for this method
|
|
555
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
556
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
557
|
+
"""
|
|
558
|
+
base_url = None
|
|
559
|
+
url_variables = None
|
|
560
|
+
if timeout_ms is None:
|
|
561
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
562
|
+
|
|
563
|
+
if server_url is not None:
|
|
564
|
+
base_url = server_url
|
|
565
|
+
else:
|
|
566
|
+
base_url = self._get_url(base_url, url_variables)
|
|
567
|
+
|
|
568
|
+
request = models.PendleMarketsRequest(
|
|
569
|
+
chain=chain,
|
|
570
|
+
block=block,
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
req = self._build_request_async(
|
|
574
|
+
method="GET",
|
|
575
|
+
path="/v0/pendle/markets",
|
|
576
|
+
base_url=base_url,
|
|
577
|
+
url_variables=url_variables,
|
|
578
|
+
request=request,
|
|
579
|
+
request_body_required=False,
|
|
580
|
+
request_has_path_params=False,
|
|
581
|
+
request_has_query_params=True,
|
|
582
|
+
user_agent_header="user-agent",
|
|
583
|
+
accept_header_value="application/json",
|
|
584
|
+
http_headers=http_headers,
|
|
585
|
+
security=self.sdk_configuration.security,
|
|
586
|
+
timeout_ms=timeout_ms,
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
if retries == UNSET:
|
|
590
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
591
|
+
retries = self.sdk_configuration.retry_config
|
|
592
|
+
|
|
593
|
+
retry_config = None
|
|
594
|
+
if isinstance(retries, utils.RetryConfig):
|
|
595
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
596
|
+
|
|
597
|
+
http_res = await self.do_request_async(
|
|
598
|
+
hook_ctx=HookContext(
|
|
599
|
+
base_url=base_url or "",
|
|
600
|
+
operation_id="pendle_markets",
|
|
601
|
+
oauth2_scopes=[],
|
|
602
|
+
security_source=self.sdk_configuration.security,
|
|
603
|
+
),
|
|
604
|
+
request=req,
|
|
605
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
606
|
+
retry_config=retry_config,
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
response_data: Any = None
|
|
610
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
611
|
+
return utils.unmarshal_json(http_res.text, models.PendleListMarketsResponse)
|
|
612
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
613
|
+
response_data = utils.unmarshal_json(
|
|
614
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
615
|
+
)
|
|
616
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
617
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
618
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
619
|
+
raise errors.APIError(
|
|
620
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
621
|
+
)
|
|
622
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
623
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
624
|
+
raise errors.APIError(
|
|
625
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
626
|
+
)
|
|
627
|
+
|
|
628
|
+
content_type = http_res.headers.get("Content-Type")
|
|
629
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
630
|
+
raise errors.APIError(
|
|
631
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
632
|
+
http_res.status_code,
|
|
633
|
+
http_res_text,
|
|
634
|
+
http_res,
|
|
635
|
+
)
|
|
636
|
+
|
|
231
637
|
def market(
|
|
232
638
|
self,
|
|
233
639
|
*,
|
|
234
640
|
chain: models.PendleMarketChain = models.PendleMarketChain.ETHEREUM_MAINNET,
|
|
235
641
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
236
|
-
market_address: str = "
|
|
237
|
-
block:
|
|
238
|
-
Union[models.PendleMarketBlock, models.PendleMarketBlockTypedDict]
|
|
239
|
-
] = None,
|
|
642
|
+
market_address: str = "0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2",
|
|
643
|
+
block: OptionalNullable[int] = UNSET,
|
|
240
644
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
241
645
|
server_url: Optional[str] = None,
|
|
242
646
|
timeout_ms: Optional[int] = None,
|
|
@@ -249,7 +653,7 @@ class Pendle(BaseSDK):
|
|
|
249
653
|
:param chain: The chain to use.
|
|
250
654
|
:param user_address: The user address of the desired position.
|
|
251
655
|
:param market_address: The market address of the desired position.
|
|
252
|
-
:param block:
|
|
656
|
+
:param block: Optional block number (defaults to latest).
|
|
253
657
|
:param retries: Override the default retry configuration for this method
|
|
254
658
|
:param server_url: Override the default server URL for this method
|
|
255
659
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -341,10 +745,8 @@ class Pendle(BaseSDK):
|
|
|
341
745
|
*,
|
|
342
746
|
chain: models.PendleMarketChain = models.PendleMarketChain.ETHEREUM_MAINNET,
|
|
343
747
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
344
|
-
market_address: str = "
|
|
345
|
-
block:
|
|
346
|
-
Union[models.PendleMarketBlock, models.PendleMarketBlockTypedDict]
|
|
347
|
-
] = None,
|
|
748
|
+
market_address: str = "0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2",
|
|
749
|
+
block: OptionalNullable[int] = UNSET,
|
|
348
750
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
349
751
|
server_url: Optional[str] = None,
|
|
350
752
|
timeout_ms: Optional[int] = None,
|
|
@@ -357,7 +759,7 @@ class Pendle(BaseSDK):
|
|
|
357
759
|
:param chain: The chain to use.
|
|
358
760
|
:param user_address: The user address of the desired position.
|
|
359
761
|
:param market_address: The market address of the desired position.
|
|
360
|
-
:param block:
|
|
762
|
+
:param block: Optional block number (defaults to latest).
|
|
361
763
|
:param retries: Override the default retry configuration for this method
|
|
362
764
|
:param server_url: Override the default server URL for this method
|
|
363
765
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
compass_api_sdk/sky.py
CHANGED
|
@@ -12,9 +12,7 @@ class Sky(BaseSDK):
|
|
|
12
12
|
self,
|
|
13
13
|
*,
|
|
14
14
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
15
|
-
block:
|
|
16
|
-
Union[models.SkyPositionBlock, models.SkyPositionBlockTypedDict]
|
|
17
|
-
] = None,
|
|
15
|
+
block: OptionalNullable[int] = UNSET,
|
|
18
16
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
17
|
server_url: Optional[str] = None,
|
|
20
18
|
timeout_ms: Optional[int] = None,
|
|
@@ -25,7 +23,7 @@ class Sky(BaseSDK):
|
|
|
25
23
|
Check the USDS overall position.
|
|
26
24
|
|
|
27
25
|
:param user_address: The user address of the desired position.
|
|
28
|
-
:param block:
|
|
26
|
+
:param block: Optional block number (defaults to latest).
|
|
29
27
|
:param retries: Override the default retry configuration for this method
|
|
30
28
|
:param server_url: Override the default server URL for this method
|
|
31
29
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -114,9 +112,7 @@ class Sky(BaseSDK):
|
|
|
114
112
|
self,
|
|
115
113
|
*,
|
|
116
114
|
user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
|
|
117
|
-
block:
|
|
118
|
-
Union[models.SkyPositionBlock, models.SkyPositionBlockTypedDict]
|
|
119
|
-
] = None,
|
|
115
|
+
block: OptionalNullable[int] = UNSET,
|
|
120
116
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
117
|
server_url: Optional[str] = None,
|
|
122
118
|
timeout_ms: Optional[int] = None,
|
|
@@ -127,7 +123,7 @@ class Sky(BaseSDK):
|
|
|
127
123
|
Check the USDS overall position.
|
|
128
124
|
|
|
129
125
|
:param user_address: The user address of the desired position.
|
|
130
|
-
:param block:
|
|
126
|
+
:param block: Optional block number (defaults to latest).
|
|
131
127
|
:param retries: Override the default retry configuration for this method
|
|
132
128
|
:param server_url: Override the default server URL for this method
|
|
133
129
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
compass_api_sdk/token_sdk.py
CHANGED
|
@@ -13,9 +13,7 @@ class TokenSDK(BaseSDK):
|
|
|
13
13
|
*,
|
|
14
14
|
chain: models.TokenAddressChain = models.TokenAddressChain.ARBITRUM_MAINNET,
|
|
15
15
|
token: models.TokenAddressToken = models.TokenAddressToken.WETH,
|
|
16
|
-
block:
|
|
17
|
-
Union[models.TokenAddressBlock, models.TokenAddressBlockTypedDict]
|
|
18
|
-
] = None,
|
|
16
|
+
block: OptionalNullable[int] = UNSET,
|
|
19
17
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
20
18
|
server_url: Optional[str] = None,
|
|
21
19
|
timeout_ms: Optional[int] = None,
|
|
@@ -27,7 +25,7 @@ class TokenSDK(BaseSDK):
|
|
|
27
25
|
|
|
28
26
|
:param chain: The chain to use.
|
|
29
27
|
:param token: The token symbol to get the address for..
|
|
30
|
-
:param block:
|
|
28
|
+
:param block: Optional block number (defaults to latest).
|
|
31
29
|
:param retries: Override the default retry configuration for this method
|
|
32
30
|
:param server_url: Override the default server URL for this method
|
|
33
31
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -118,9 +116,7 @@ class TokenSDK(BaseSDK):
|
|
|
118
116
|
*,
|
|
119
117
|
chain: models.TokenAddressChain = models.TokenAddressChain.ARBITRUM_MAINNET,
|
|
120
118
|
token: models.TokenAddressToken = models.TokenAddressToken.WETH,
|
|
121
|
-
block:
|
|
122
|
-
Union[models.TokenAddressBlock, models.TokenAddressBlockTypedDict]
|
|
123
|
-
] = None,
|
|
119
|
+
block: OptionalNullable[int] = UNSET,
|
|
124
120
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
125
121
|
server_url: Optional[str] = None,
|
|
126
122
|
timeout_ms: Optional[int] = None,
|
|
@@ -132,7 +128,7 @@ class TokenSDK(BaseSDK):
|
|
|
132
128
|
|
|
133
129
|
:param chain: The chain to use.
|
|
134
130
|
:param token: The token symbol to get the address for..
|
|
135
|
-
:param block:
|
|
131
|
+
:param block: Optional block number (defaults to latest).
|
|
136
132
|
:param retries: Override the default retry configuration for this method
|
|
137
133
|
:param server_url: Override the default server URL for this method
|
|
138
134
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -432,9 +428,7 @@ class TokenSDK(BaseSDK):
|
|
|
432
428
|
chain: models.TokenBalanceChain = models.TokenBalanceChain.ARBITRUM_MAINNET,
|
|
433
429
|
user: str = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
434
430
|
token: Union[models.TokenBalanceToken, models.TokenBalanceTokenTypedDict],
|
|
435
|
-
block:
|
|
436
|
-
Union[models.TokenBalanceBlock, models.TokenBalanceBlockTypedDict]
|
|
437
|
-
] = None,
|
|
431
|
+
block: OptionalNullable[int] = UNSET,
|
|
438
432
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
439
433
|
server_url: Optional[str] = None,
|
|
440
434
|
timeout_ms: Optional[int] = None,
|
|
@@ -447,7 +441,7 @@ class TokenSDK(BaseSDK):
|
|
|
447
441
|
:param chain: The chain to use.
|
|
448
442
|
:param user: The user to get the ERC20 balance of.
|
|
449
443
|
:param token: The symbol of the token for which the balance is checked..
|
|
450
|
-
:param block:
|
|
444
|
+
:param block: Optional block number (defaults to latest).
|
|
451
445
|
:param retries: Override the default retry configuration for this method
|
|
452
446
|
:param server_url: Override the default server URL for this method
|
|
453
447
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -540,9 +534,7 @@ class TokenSDK(BaseSDK):
|
|
|
540
534
|
chain: models.TokenBalanceChain = models.TokenBalanceChain.ARBITRUM_MAINNET,
|
|
541
535
|
user: str = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
542
536
|
token: Union[models.TokenBalanceToken, models.TokenBalanceTokenTypedDict],
|
|
543
|
-
block:
|
|
544
|
-
Union[models.TokenBalanceBlock, models.TokenBalanceBlockTypedDict]
|
|
545
|
-
] = None,
|
|
537
|
+
block: OptionalNullable[int] = UNSET,
|
|
546
538
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
547
539
|
server_url: Optional[str] = None,
|
|
548
540
|
timeout_ms: Optional[int] = None,
|
|
@@ -555,7 +547,7 @@ class TokenSDK(BaseSDK):
|
|
|
555
547
|
:param chain: The chain to use.
|
|
556
548
|
:param user: The user to get the ERC20 balance of.
|
|
557
549
|
:param token: The symbol of the token for which the balance is checked..
|
|
558
|
-
:param block:
|
|
550
|
+
:param block: Optional block number (defaults to latest).
|
|
559
551
|
:param retries: Override the default retry configuration for this method
|
|
560
552
|
:param server_url: Override the default server URL for this method
|
|
561
553
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -13,7 +13,6 @@ class TransactionBatching(BaseSDK):
|
|
|
13
13
|
*,
|
|
14
14
|
chain: models.Chain,
|
|
15
15
|
sender: str,
|
|
16
|
-
block: Optional[Union[models.Block, models.BlockTypedDict]] = None,
|
|
17
16
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
18
17
|
server_url: Optional[str] = None,
|
|
19
18
|
timeout_ms: Optional[int] = None,
|
|
@@ -30,7 +29,6 @@ class TransactionBatching(BaseSDK):
|
|
|
30
29
|
|
|
31
30
|
:param chain: The chain to use.
|
|
32
31
|
:param sender: The Ethereum address to use for authorization
|
|
33
|
-
:param block: The block number you want to get this data at.
|
|
34
32
|
:param retries: Override the default retry configuration for this method
|
|
35
33
|
:param server_url: Override the default server URL for this method
|
|
36
34
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -48,7 +46,6 @@ class TransactionBatching(BaseSDK):
|
|
|
48
46
|
|
|
49
47
|
request = models.MulticallAuthorizationRequest(
|
|
50
48
|
chain=chain,
|
|
51
|
-
block=block,
|
|
52
49
|
sender=sender,
|
|
53
50
|
)
|
|
54
51
|
|
|
@@ -126,7 +123,6 @@ class TransactionBatching(BaseSDK):
|
|
|
126
123
|
*,
|
|
127
124
|
chain: models.Chain,
|
|
128
125
|
sender: str,
|
|
129
|
-
block: Optional[Union[models.Block, models.BlockTypedDict]] = None,
|
|
130
126
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
131
127
|
server_url: Optional[str] = None,
|
|
132
128
|
timeout_ms: Optional[int] = None,
|
|
@@ -143,7 +139,6 @@ class TransactionBatching(BaseSDK):
|
|
|
143
139
|
|
|
144
140
|
:param chain: The chain to use.
|
|
145
141
|
:param sender: The Ethereum address to use for authorization
|
|
146
|
-
:param block: The block number you want to get this data at.
|
|
147
142
|
:param retries: Override the default retry configuration for this method
|
|
148
143
|
:param server_url: Override the default server URL for this method
|
|
149
144
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -161,7 +156,6 @@ class TransactionBatching(BaseSDK):
|
|
|
161
156
|
|
|
162
157
|
request = models.MulticallAuthorizationRequest(
|
|
163
158
|
chain=chain,
|
|
164
|
-
block=block,
|
|
165
159
|
sender=sender,
|
|
166
160
|
)
|
|
167
161
|
|