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.
- compass_api_sdk/__init__.py +17 -0
- compass_api_sdk/_hooks/__init__.py +5 -0
- compass_api_sdk/_hooks/registration.py +13 -0
- compass_api_sdk/_hooks/sdkhooks.py +76 -0
- compass_api_sdk/_hooks/types.py +106 -0
- compass_api_sdk/_version.py +15 -0
- compass_api_sdk/aave_v3.py +1903 -0
- compass_api_sdk/aerodrome_slipstream.py +1875 -0
- compass_api_sdk/basesdk.py +362 -0
- compass_api_sdk/errors/__init__.py +7 -0
- compass_api_sdk/errors/apierror.py +22 -0
- compass_api_sdk/errors/httpvalidationerror.py +21 -0
- compass_api_sdk/httpclient.py +136 -0
- compass_api_sdk/models/__init__.py +777 -0
- compass_api_sdk/models/aave_liquidity_changeop.py +108 -0
- compass_api_sdk/models/aave_token_priceop.py +98 -0
- compass_api_sdk/models/aave_user_position_per_tokenop.py +104 -0
- compass_api_sdk/models/aave_user_position_summaryop.py +35 -0
- compass_api_sdk/models/aaveborrowrequest.py +105 -0
- compass_api_sdk/models/aaveliquiditychangeresponse.py +26 -0
- compass_api_sdk/models/aaverepayrequest.py +105 -0
- compass_api_sdk/models/aavesupplyrequest.py +93 -0
- compass_api_sdk/models/aavetokenpriceresponse.py +15 -0
- compass_api_sdk/models/aaveuserpositionpertokenresponse.py +73 -0
- compass_api_sdk/models/aaveuserpositionsummaryresponse.py +50 -0
- compass_api_sdk/models/aavewithdrawrequest.py +58 -0
- compass_api_sdk/models/aerodrome_slipstream_liquidity_provision_positionsop.py +35 -0
- compass_api_sdk/models/aerodrome_slipstream_pool_priceop.py +173 -0
- compass_api_sdk/models/aerodromelppositionsresponse.py +21 -0
- compass_api_sdk/models/aerodromeposition.py +70 -0
- compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +92 -0
- compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +109 -0
- compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionrequest.py +186 -0
- compass_api_sdk/models/aerodromeslipstreampoolpriceresponse.py +57 -0
- compass_api_sdk/models/aerodromeslipstreamsellexactlyrequest.py +96 -0
- compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +50 -0
- compass_api_sdk/models/allowanceinforesponse.py +48 -0
- compass_api_sdk/models/balanceinforesponse.py +43 -0
- compass_api_sdk/models/chain.py +12 -0
- compass_api_sdk/models/chaininfo.py +53 -0
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_markets_asset.py +22 -0
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vaults_asset.py +23 -0
- compass_api_sdk/models/ensnameinforesponse.py +24 -0
- compass_api_sdk/models/feeenum.py +16 -0
- compass_api_sdk/models/generic_allowanceop.py +121 -0
- compass_api_sdk/models/generic_balanceop.py +104 -0
- compass_api_sdk/models/generic_ensop.py +35 -0
- compass_api_sdk/models/generic_portfolioop.py +35 -0
- compass_api_sdk/models/generic_price_usdop.py +98 -0
- compass_api_sdk/models/generic_supported_tokensop.py +29 -0
- compass_api_sdk/models/generic_visualize_portfolioop.py +35 -0
- compass_api_sdk/models/image.py +15 -0
- compass_api_sdk/models/increaseallowancerequest.py +77 -0
- compass_api_sdk/models/interestratemode.py +14 -0
- compass_api_sdk/models/marketstate.py +35 -0
- compass_api_sdk/models/morpho_market_positionop.py +39 -0
- compass_api_sdk/models/morpho_marketsop.py +78 -0
- compass_api_sdk/models/morpho_vault_positionop.py +39 -0
- compass_api_sdk/models/morpho_vaultsop.py +72 -0
- compass_api_sdk/models/morphoborrowrequest.py +91 -0
- compass_api_sdk/models/morphocheckmarketpositionresponse.py +23 -0
- compass_api_sdk/models/morphocheckvaultpositionresponse.py +20 -0
- compass_api_sdk/models/morphodepositrequest.py +86 -0
- compass_api_sdk/models/morphogetmarketsresponse.py +17 -0
- compass_api_sdk/models/morphogetvaultsresponse.py +17 -0
- compass_api_sdk/models/morphomarket.py +80 -0
- compass_api_sdk/models/morphorepayrequest.py +79 -0
- compass_api_sdk/models/morphosetvaultallowancerequest.py +44 -0
- compass_api_sdk/models/morphosupplycollateralrequest.py +91 -0
- compass_api_sdk/models/morphovault.py +47 -0
- compass_api_sdk/models/morphowithdrawcollateralrequest.py +91 -0
- compass_api_sdk/models/morphowithdrawrequest.py +74 -0
- compass_api_sdk/models/portfolio.py +22 -0
- compass_api_sdk/models/priceresponse.py +15 -0
- compass_api_sdk/models/security.py +24 -0
- compass_api_sdk/models/token_addressop.py +98 -0
- compass_api_sdk/models/token_balanceop.py +49 -0
- compass_api_sdk/models/token_enum.py +57 -0
- compass_api_sdk/models/token_priceop.py +97 -0
- compass_api_sdk/models/tokenaddressresponse.py +15 -0
- compass_api_sdk/models/tokenbalance.py +49 -0
- compass_api_sdk/models/tokenbalanceresponse.py +44 -0
- compass_api_sdk/models/tokeninfo.py +17 -0
- compass_api_sdk/models/tokenpriceresponse.py +15 -0
- compass_api_sdk/models/tokentransferrequest.py +66 -0
- compass_api_sdk/models/transfererc20request.py +62 -0
- compass_api_sdk/models/transferethrequest.py +46 -0
- compass_api_sdk/models/uniswap_liquidity_provision_in_rangeop.py +34 -0
- compass_api_sdk/models/uniswap_liquidity_provision_positionsop.py +35 -0
- compass_api_sdk/models/uniswap_pool_priceop.py +193 -0
- compass_api_sdk/models/uniswap_quote_buy_exactlyop.py +209 -0
- compass_api_sdk/models/uniswap_quote_sell_exactlyop.py +209 -0
- compass_api_sdk/models/uniswapbuyexactlyrequest.py +104 -0
- compass_api_sdk/models/uniswapbuyquoteinforesponse.py +20 -0
- compass_api_sdk/models/uniswapcheckinrangeresponse.py +15 -0
- compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +99 -0
- compass_api_sdk/models/uniswaplppositionsinforesponse.py +24 -0
- compass_api_sdk/models/uniswapmintliquidityprovisionrequest.py +185 -0
- compass_api_sdk/models/uniswappoolpriceresponse.py +47 -0
- compass_api_sdk/models/uniswappositionssolidityresponse.py +46 -0
- compass_api_sdk/models/uniswapsellexactlyrequest.py +104 -0
- compass_api_sdk/models/uniswapsellquoteinforesponse.py +20 -0
- compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +51 -0
- compass_api_sdk/models/unsignedtransaction.py +58 -0
- compass_api_sdk/models/unwrapwethrequest.py +41 -0
- compass_api_sdk/models/validationerror.py +26 -0
- compass_api_sdk/models/vaultstate.py +32 -0
- compass_api_sdk/models/weeklyapys.py +23 -0
- compass_api_sdk/models/wrapethrequest.py +41 -0
- compass_api_sdk/morpho.py +2577 -0
- compass_api_sdk/py.typed +1 -0
- compass_api_sdk/sdk.py +155 -0
- compass_api_sdk/sdkconfiguration.py +56 -0
- compass_api_sdk/token_sdk.py +861 -0
- compass_api_sdk/types/__init__.py +21 -0
- compass_api_sdk/types/basemodel.py +39 -0
- compass_api_sdk/uniswap_v3.py +2551 -0
- compass_api_sdk/universal.py +2625 -0
- compass_api_sdk/utils/__init__.py +100 -0
- compass_api_sdk/utils/annotations.py +55 -0
- compass_api_sdk/utils/datetimes.py +23 -0
- compass_api_sdk/utils/enums.py +74 -0
- compass_api_sdk/utils/eventstreaming.py +238 -0
- compass_api_sdk/utils/forms.py +202 -0
- compass_api_sdk/utils/headers.py +136 -0
- compass_api_sdk/utils/logger.py +22 -0
- compass_api_sdk/utils/metadata.py +118 -0
- compass_api_sdk/utils/queryparams.py +205 -0
- compass_api_sdk/utils/requestbodies.py +66 -0
- compass_api_sdk/utils/retries.py +217 -0
- compass_api_sdk/utils/security.py +174 -0
- compass_api_sdk/utils/serializers.py +248 -0
- compass_api_sdk/utils/url.py +155 -0
- compass_api_sdk/utils/values.py +137 -0
- compass_api_sdk-0.0.1.dist-info/METADATA +534 -0
- compass_api_sdk-0.0.1.dist-info/RECORD +137 -0
- compass_api_sdk-0.0.1.dist-info/WHEEL +4 -0
compass_api_sdk/py.typed
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Marker file for PEP 561. The package enables type hints.
|
compass_api_sdk/sdk.py
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from .basesdk import BaseSDK
|
|
4
|
+
from .httpclient import AsyncHttpClient, ClientOwner, HttpClient, close_clients
|
|
5
|
+
from .sdkconfiguration import SDKConfiguration
|
|
6
|
+
from .utils.logger import Logger, get_default_logger
|
|
7
|
+
from .utils.retries import RetryConfig
|
|
8
|
+
from compass_api_sdk import models, utils
|
|
9
|
+
from compass_api_sdk._hooks import SDKHooks
|
|
10
|
+
from compass_api_sdk.aave_v3 import AaveV3
|
|
11
|
+
from compass_api_sdk.aerodrome_slipstream import AerodromeSlipstream
|
|
12
|
+
from compass_api_sdk.morpho import Morpho
|
|
13
|
+
from compass_api_sdk.token_sdk import TokenSDK
|
|
14
|
+
from compass_api_sdk.types import OptionalNullable, UNSET
|
|
15
|
+
from compass_api_sdk.uniswap_v3 import UniswapV3
|
|
16
|
+
from compass_api_sdk.universal import Universal
|
|
17
|
+
import httpx
|
|
18
|
+
from typing import Any, Callable, Dict, Optional, Union, cast
|
|
19
|
+
import weakref
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CompassAPISDK(BaseSDK):
|
|
23
|
+
r"""Compass API: Compass Labs DeFi API"""
|
|
24
|
+
|
|
25
|
+
aave_v3: AaveV3
|
|
26
|
+
aerodrome_slipstream: AerodromeSlipstream
|
|
27
|
+
morpho: Morpho
|
|
28
|
+
token: TokenSDK
|
|
29
|
+
uniswap_v3: UniswapV3
|
|
30
|
+
universal: Universal
|
|
31
|
+
|
|
32
|
+
def __init__(
|
|
33
|
+
self,
|
|
34
|
+
api_key_auth: Union[str, Callable[[], str]],
|
|
35
|
+
server_idx: Optional[int] = None,
|
|
36
|
+
server_url: Optional[str] = None,
|
|
37
|
+
url_params: Optional[Dict[str, str]] = None,
|
|
38
|
+
client: Optional[HttpClient] = None,
|
|
39
|
+
async_client: Optional[AsyncHttpClient] = None,
|
|
40
|
+
retry_config: OptionalNullable[RetryConfig] = UNSET,
|
|
41
|
+
timeout_ms: Optional[int] = None,
|
|
42
|
+
debug_logger: Optional[Logger] = None,
|
|
43
|
+
) -> None:
|
|
44
|
+
r"""Instantiates the SDK configuring it with the provided parameters.
|
|
45
|
+
|
|
46
|
+
:param api_key_auth: The api_key_auth required for authentication
|
|
47
|
+
:param server_idx: The index of the server to use for all methods
|
|
48
|
+
:param server_url: The server URL to use for all methods
|
|
49
|
+
:param url_params: Parameters to optionally template the server URL with
|
|
50
|
+
:param client: The HTTP client to use for all synchronous methods
|
|
51
|
+
:param async_client: The Async HTTP client to use for all asynchronous methods
|
|
52
|
+
:param retry_config: The retry configuration to use for all supported methods
|
|
53
|
+
:param timeout_ms: Optional request timeout applied to each operation in milliseconds
|
|
54
|
+
"""
|
|
55
|
+
client_supplied = True
|
|
56
|
+
if client is None:
|
|
57
|
+
client = httpx.Client()
|
|
58
|
+
client_supplied = False
|
|
59
|
+
|
|
60
|
+
assert issubclass(
|
|
61
|
+
type(client), HttpClient
|
|
62
|
+
), "The provided client must implement the HttpClient protocol."
|
|
63
|
+
|
|
64
|
+
async_client_supplied = True
|
|
65
|
+
if async_client is None:
|
|
66
|
+
async_client = httpx.AsyncClient()
|
|
67
|
+
async_client_supplied = False
|
|
68
|
+
|
|
69
|
+
if debug_logger is None:
|
|
70
|
+
debug_logger = get_default_logger()
|
|
71
|
+
|
|
72
|
+
assert issubclass(
|
|
73
|
+
type(async_client), AsyncHttpClient
|
|
74
|
+
), "The provided async_client must implement the AsyncHttpClient protocol."
|
|
75
|
+
|
|
76
|
+
security: Any = None
|
|
77
|
+
if callable(api_key_auth):
|
|
78
|
+
# pylint: disable=unnecessary-lambda-assignment
|
|
79
|
+
security = lambda: models.Security(api_key_auth=api_key_auth())
|
|
80
|
+
else:
|
|
81
|
+
security = models.Security(api_key_auth=api_key_auth)
|
|
82
|
+
|
|
83
|
+
if server_url is not None:
|
|
84
|
+
if url_params is not None:
|
|
85
|
+
server_url = utils.template_url(server_url, url_params)
|
|
86
|
+
|
|
87
|
+
BaseSDK.__init__(
|
|
88
|
+
self,
|
|
89
|
+
SDKConfiguration(
|
|
90
|
+
client=client,
|
|
91
|
+
client_supplied=client_supplied,
|
|
92
|
+
async_client=async_client,
|
|
93
|
+
async_client_supplied=async_client_supplied,
|
|
94
|
+
security=security,
|
|
95
|
+
server_url=server_url,
|
|
96
|
+
server_idx=server_idx,
|
|
97
|
+
retry_config=retry_config,
|
|
98
|
+
timeout_ms=timeout_ms,
|
|
99
|
+
debug_logger=debug_logger,
|
|
100
|
+
),
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
hooks = SDKHooks()
|
|
104
|
+
|
|
105
|
+
current_server_url, *_ = self.sdk_configuration.get_server_details()
|
|
106
|
+
server_url, self.sdk_configuration.client = hooks.sdk_init(
|
|
107
|
+
current_server_url, client
|
|
108
|
+
)
|
|
109
|
+
if current_server_url != server_url:
|
|
110
|
+
self.sdk_configuration.server_url = server_url
|
|
111
|
+
|
|
112
|
+
# pylint: disable=protected-access
|
|
113
|
+
self.sdk_configuration.__dict__["_hooks"] = hooks
|
|
114
|
+
|
|
115
|
+
weakref.finalize(
|
|
116
|
+
self,
|
|
117
|
+
close_clients,
|
|
118
|
+
cast(ClientOwner, self.sdk_configuration),
|
|
119
|
+
self.sdk_configuration.client,
|
|
120
|
+
self.sdk_configuration.client_supplied,
|
|
121
|
+
self.sdk_configuration.async_client,
|
|
122
|
+
self.sdk_configuration.async_client_supplied,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
self._init_sdks()
|
|
126
|
+
|
|
127
|
+
def _init_sdks(self):
|
|
128
|
+
self.aave_v3 = AaveV3(self.sdk_configuration)
|
|
129
|
+
self.aerodrome_slipstream = AerodromeSlipstream(self.sdk_configuration)
|
|
130
|
+
self.morpho = Morpho(self.sdk_configuration)
|
|
131
|
+
self.token = TokenSDK(self.sdk_configuration)
|
|
132
|
+
self.uniswap_v3 = UniswapV3(self.sdk_configuration)
|
|
133
|
+
self.universal = Universal(self.sdk_configuration)
|
|
134
|
+
|
|
135
|
+
def __enter__(self):
|
|
136
|
+
return self
|
|
137
|
+
|
|
138
|
+
async def __aenter__(self):
|
|
139
|
+
return self
|
|
140
|
+
|
|
141
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
142
|
+
if (
|
|
143
|
+
self.sdk_configuration.client is not None
|
|
144
|
+
and not self.sdk_configuration.client_supplied
|
|
145
|
+
):
|
|
146
|
+
self.sdk_configuration.client.close()
|
|
147
|
+
self.sdk_configuration.client = None
|
|
148
|
+
|
|
149
|
+
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
150
|
+
if (
|
|
151
|
+
self.sdk_configuration.async_client is not None
|
|
152
|
+
and not self.sdk_configuration.async_client_supplied
|
|
153
|
+
):
|
|
154
|
+
await self.sdk_configuration.async_client.aclose()
|
|
155
|
+
self.sdk_configuration.async_client = None
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from ._hooks import SDKHooks
|
|
4
|
+
from ._version import (
|
|
5
|
+
__gen_version__,
|
|
6
|
+
__openapi_doc_version__,
|
|
7
|
+
__user_agent__,
|
|
8
|
+
__version__,
|
|
9
|
+
)
|
|
10
|
+
from .httpclient import AsyncHttpClient, HttpClient
|
|
11
|
+
from .utils import Logger, RetryConfig, remove_suffix
|
|
12
|
+
from compass_api_sdk import models
|
|
13
|
+
from compass_api_sdk.types import OptionalNullable, UNSET
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from pydantic import Field
|
|
16
|
+
from typing import Callable, Dict, Optional, Tuple, Union
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
SERVERS = [
|
|
20
|
+
"https://api.compasslabs.ai",
|
|
21
|
+
# Production server
|
|
22
|
+
]
|
|
23
|
+
"""Contains the list of servers available to the SDK"""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass
|
|
27
|
+
class SDKConfiguration:
|
|
28
|
+
client: Union[HttpClient, None]
|
|
29
|
+
client_supplied: bool
|
|
30
|
+
async_client: Union[AsyncHttpClient, None]
|
|
31
|
+
async_client_supplied: bool
|
|
32
|
+
debug_logger: Logger
|
|
33
|
+
security: Optional[Union[models.Security, Callable[[], models.Security]]] = None
|
|
34
|
+
server_url: Optional[str] = ""
|
|
35
|
+
server_idx: Optional[int] = 0
|
|
36
|
+
language: str = "python"
|
|
37
|
+
openapi_doc_version: str = __openapi_doc_version__
|
|
38
|
+
sdk_version: str = __version__
|
|
39
|
+
gen_version: str = __gen_version__
|
|
40
|
+
user_agent: str = __user_agent__
|
|
41
|
+
retry_config: OptionalNullable[RetryConfig] = Field(default_factory=lambda: UNSET)
|
|
42
|
+
timeout_ms: Optional[int] = None
|
|
43
|
+
|
|
44
|
+
def __post_init__(self):
|
|
45
|
+
self._hooks = SDKHooks()
|
|
46
|
+
|
|
47
|
+
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
|
48
|
+
if self.server_url is not None and self.server_url:
|
|
49
|
+
return remove_suffix(self.server_url, "/"), {}
|
|
50
|
+
if self.server_idx is None:
|
|
51
|
+
self.server_idx = 0
|
|
52
|
+
|
|
53
|
+
return SERVERS[self.server_idx], {}
|
|
54
|
+
|
|
55
|
+
def get_hooks(self) -> SDKHooks:
|
|
56
|
+
return self._hooks
|