compass_api_sdk 0.4.4__py3-none-any.whl → 0.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of compass_api_sdk might be problematic. Click here for more details.
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/errors/__init__.py +37 -2
- compass_api_sdk/models/__init__.py +1491 -820
- compass_api_sdk/models/contractname.py +2 -0
- compass_api_sdk/models/pendle_accrued_interestop.py +42 -0
- compass_api_sdk/models/pendleaccruedinterestresponse.py +17 -0
- compass_api_sdk/models/txresponse.py +11 -2
- compass_api_sdk/pendle.py +215 -0
- compass_api_sdk/sdk.py +68 -31
- compass_api_sdk/utils/__init__.py +130 -46
- {compass_api_sdk-0.4.4.dist-info → compass_api_sdk-0.5.1.dist-info}/METADATA +5 -1
- {compass_api_sdk-0.4.4.dist-info → compass_api_sdk-0.5.1.dist-info}/RECORD +13 -10
- {compass_api_sdk-0.4.4.dist-info → compass_api_sdk-0.5.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from compass_api_sdk.types import BaseModel
|
|
5
|
+
from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
|
|
6
|
+
from enum import Enum
|
|
7
|
+
from typing_extensions import Annotated, TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PendleAccruedInterestChain(str, Enum):
|
|
11
|
+
r"""The chain to use."""
|
|
12
|
+
|
|
13
|
+
BASE_MAINNET = "base:mainnet"
|
|
14
|
+
ETHEREUM_MAINNET = "ethereum:mainnet"
|
|
15
|
+
ARBITRUM_MAINNET = "arbitrum:mainnet"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PendleAccruedInterestRequestTypedDict(TypedDict):
|
|
19
|
+
chain: PendleAccruedInterestChain
|
|
20
|
+
r"""The chain to use."""
|
|
21
|
+
market_address: str
|
|
22
|
+
r"""The address of the market to get the accrued interest for."""
|
|
23
|
+
user_address: str
|
|
24
|
+
r"""The address of the user to get the accrued interest for."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PendleAccruedInterestRequest(BaseModel):
|
|
28
|
+
chain: Annotated[
|
|
29
|
+
PendleAccruedInterestChain,
|
|
30
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
31
|
+
] = PendleAccruedInterestChain.ARBITRUM_MAINNET
|
|
32
|
+
r"""The chain to use."""
|
|
33
|
+
|
|
34
|
+
market_address: Annotated[
|
|
35
|
+
str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
|
|
36
|
+
] = "0xff4d6991658c5844856faef5da9232c252896fca"
|
|
37
|
+
r"""The address of the market to get the accrued interest for."""
|
|
38
|
+
|
|
39
|
+
user_address: Annotated[
|
|
40
|
+
str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
|
|
41
|
+
] = "0xebdddbafc3fc3742fe2a3cfec17a20a50e84d598"
|
|
42
|
+
r"""The address of the user to get the accrued interest for."""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from compass_api_sdk.types import BaseModel
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PendleAccruedInterestResponseTypedDict(TypedDict):
|
|
9
|
+
r"""Response model for accrued interest."""
|
|
10
|
+
|
|
11
|
+
accrued_interest: int
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PendleAccruedInterestResponse(BaseModel):
|
|
15
|
+
r"""Response model for accrued interest."""
|
|
16
|
+
|
|
17
|
+
accrued_interest: int
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
|
+
from .unsignedmulticalltransaction import (
|
|
5
|
+
UnsignedMulticallTransaction,
|
|
6
|
+
UnsignedMulticallTransactionTypedDict,
|
|
7
|
+
)
|
|
4
8
|
from .unsignedtransaction import UnsignedTransaction, UnsignedTransactionTypedDict
|
|
5
9
|
from .useroperationresponse import UserOperationResponse, UserOperationResponseTypedDict
|
|
6
10
|
from typing import Union
|
|
@@ -9,10 +13,15 @@ from typing_extensions import TypeAliasType
|
|
|
9
13
|
|
|
10
14
|
TxResponseTypedDict = TypeAliasType(
|
|
11
15
|
"TxResponseTypedDict",
|
|
12
|
-
Union[
|
|
16
|
+
Union[
|
|
17
|
+
UserOperationResponseTypedDict,
|
|
18
|
+
UnsignedTransactionTypedDict,
|
|
19
|
+
UnsignedMulticallTransactionTypedDict,
|
|
20
|
+
],
|
|
13
21
|
)
|
|
14
22
|
|
|
15
23
|
|
|
16
24
|
TxResponse = TypeAliasType(
|
|
17
|
-
"TxResponse",
|
|
25
|
+
"TxResponse",
|
|
26
|
+
Union[UserOperationResponse, UnsignedTransaction, UnsignedMulticallTransaction],
|
|
18
27
|
)
|
|
@@ -0,0 +1,215 @@
|
|
|
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
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Pendle(BaseSDK):
|
|
11
|
+
def accrued_interest(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
chain: models.PendleAccruedInterestChain = models.PendleAccruedInterestChain.ARBITRUM_MAINNET,
|
|
15
|
+
market_address: str = "0xff4d6991658c5844856faef5da9232c252896fca",
|
|
16
|
+
user_address: str = "0xebdddbafc3fc3742fe2a3cfec17a20a50e84d598",
|
|
17
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
18
|
+
server_url: Optional[str] = None,
|
|
19
|
+
timeout_ms: Optional[int] = None,
|
|
20
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
21
|
+
) -> models.PendleAccruedInterestResponse:
|
|
22
|
+
r"""Get Accrued Interest
|
|
23
|
+
|
|
24
|
+
:param chain: The chain to use.
|
|
25
|
+
:param market_address: The address of the market to get the accrued interest for.
|
|
26
|
+
:param user_address: The address of the user to get the accrued interest for.
|
|
27
|
+
:param retries: Override the default retry configuration for this method
|
|
28
|
+
:param server_url: Override the default server URL for this method
|
|
29
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
30
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
31
|
+
"""
|
|
32
|
+
base_url = None
|
|
33
|
+
url_variables = None
|
|
34
|
+
if timeout_ms is None:
|
|
35
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
36
|
+
|
|
37
|
+
if server_url is not None:
|
|
38
|
+
base_url = server_url
|
|
39
|
+
else:
|
|
40
|
+
base_url = self._get_url(base_url, url_variables)
|
|
41
|
+
|
|
42
|
+
request = models.PendleAccruedInterestRequest(
|
|
43
|
+
chain=chain,
|
|
44
|
+
market_address=market_address,
|
|
45
|
+
user_address=user_address,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
req = self._build_request(
|
|
49
|
+
method="GET",
|
|
50
|
+
path="/v0/pendle/accrued_interest",
|
|
51
|
+
base_url=base_url,
|
|
52
|
+
url_variables=url_variables,
|
|
53
|
+
request=request,
|
|
54
|
+
request_body_required=False,
|
|
55
|
+
request_has_path_params=False,
|
|
56
|
+
request_has_query_params=True,
|
|
57
|
+
user_agent_header="user-agent",
|
|
58
|
+
accept_header_value="application/json",
|
|
59
|
+
http_headers=http_headers,
|
|
60
|
+
security=self.sdk_configuration.security,
|
|
61
|
+
timeout_ms=timeout_ms,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
if retries == UNSET:
|
|
65
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
66
|
+
retries = self.sdk_configuration.retry_config
|
|
67
|
+
|
|
68
|
+
retry_config = None
|
|
69
|
+
if isinstance(retries, utils.RetryConfig):
|
|
70
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
71
|
+
|
|
72
|
+
http_res = self.do_request(
|
|
73
|
+
hook_ctx=HookContext(
|
|
74
|
+
base_url=base_url or "",
|
|
75
|
+
operation_id="pendle_accrued_interest",
|
|
76
|
+
oauth2_scopes=[],
|
|
77
|
+
security_source=self.sdk_configuration.security,
|
|
78
|
+
),
|
|
79
|
+
request=req,
|
|
80
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
81
|
+
retry_config=retry_config,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
response_data: Any = None
|
|
85
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
86
|
+
return utils.unmarshal_json(
|
|
87
|
+
http_res.text, models.PendleAccruedInterestResponse
|
|
88
|
+
)
|
|
89
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
90
|
+
response_data = utils.unmarshal_json(
|
|
91
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
92
|
+
)
|
|
93
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
94
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
95
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
96
|
+
raise errors.APIError(
|
|
97
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
98
|
+
)
|
|
99
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
100
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
101
|
+
raise errors.APIError(
|
|
102
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
content_type = http_res.headers.get("Content-Type")
|
|
106
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
107
|
+
raise errors.APIError(
|
|
108
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
109
|
+
http_res.status_code,
|
|
110
|
+
http_res_text,
|
|
111
|
+
http_res,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
async def accrued_interest_async(
|
|
115
|
+
self,
|
|
116
|
+
*,
|
|
117
|
+
chain: models.PendleAccruedInterestChain = models.PendleAccruedInterestChain.ARBITRUM_MAINNET,
|
|
118
|
+
market_address: str = "0xff4d6991658c5844856faef5da9232c252896fca",
|
|
119
|
+
user_address: str = "0xebdddbafc3fc3742fe2a3cfec17a20a50e84d598",
|
|
120
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
|
+
server_url: Optional[str] = None,
|
|
122
|
+
timeout_ms: Optional[int] = None,
|
|
123
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
124
|
+
) -> models.PendleAccruedInterestResponse:
|
|
125
|
+
r"""Get Accrued Interest
|
|
126
|
+
|
|
127
|
+
:param chain: The chain to use.
|
|
128
|
+
:param market_address: The address of the market to get the accrued interest for.
|
|
129
|
+
:param user_address: The address of the user to get the accrued interest for.
|
|
130
|
+
:param retries: Override the default retry configuration for this method
|
|
131
|
+
:param server_url: Override the default server URL for this method
|
|
132
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
133
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
134
|
+
"""
|
|
135
|
+
base_url = None
|
|
136
|
+
url_variables = None
|
|
137
|
+
if timeout_ms is None:
|
|
138
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
139
|
+
|
|
140
|
+
if server_url is not None:
|
|
141
|
+
base_url = server_url
|
|
142
|
+
else:
|
|
143
|
+
base_url = self._get_url(base_url, url_variables)
|
|
144
|
+
|
|
145
|
+
request = models.PendleAccruedInterestRequest(
|
|
146
|
+
chain=chain,
|
|
147
|
+
market_address=market_address,
|
|
148
|
+
user_address=user_address,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
req = self._build_request_async(
|
|
152
|
+
method="GET",
|
|
153
|
+
path="/v0/pendle/accrued_interest",
|
|
154
|
+
base_url=base_url,
|
|
155
|
+
url_variables=url_variables,
|
|
156
|
+
request=request,
|
|
157
|
+
request_body_required=False,
|
|
158
|
+
request_has_path_params=False,
|
|
159
|
+
request_has_query_params=True,
|
|
160
|
+
user_agent_header="user-agent",
|
|
161
|
+
accept_header_value="application/json",
|
|
162
|
+
http_headers=http_headers,
|
|
163
|
+
security=self.sdk_configuration.security,
|
|
164
|
+
timeout_ms=timeout_ms,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
if retries == UNSET:
|
|
168
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
169
|
+
retries = self.sdk_configuration.retry_config
|
|
170
|
+
|
|
171
|
+
retry_config = None
|
|
172
|
+
if isinstance(retries, utils.RetryConfig):
|
|
173
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
174
|
+
|
|
175
|
+
http_res = await self.do_request_async(
|
|
176
|
+
hook_ctx=HookContext(
|
|
177
|
+
base_url=base_url or "",
|
|
178
|
+
operation_id="pendle_accrued_interest",
|
|
179
|
+
oauth2_scopes=[],
|
|
180
|
+
security_source=self.sdk_configuration.security,
|
|
181
|
+
),
|
|
182
|
+
request=req,
|
|
183
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
184
|
+
retry_config=retry_config,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
response_data: Any = None
|
|
188
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
189
|
+
return utils.unmarshal_json(
|
|
190
|
+
http_res.text, models.PendleAccruedInterestResponse
|
|
191
|
+
)
|
|
192
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
193
|
+
response_data = utils.unmarshal_json(
|
|
194
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
195
|
+
)
|
|
196
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
197
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
199
|
+
raise errors.APIError(
|
|
200
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
201
|
+
)
|
|
202
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
203
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
204
|
+
raise errors.APIError(
|
|
205
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
content_type = http_res.headers.get("Content-Type")
|
|
209
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
210
|
+
raise errors.APIError(
|
|
211
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
212
|
+
http_res.status_code,
|
|
213
|
+
http_res_text,
|
|
214
|
+
http_res,
|
|
215
|
+
)
|
compass_api_sdk/sdk.py
CHANGED
|
@@ -7,33 +7,56 @@ from .utils.logger import Logger, get_default_logger
|
|
|
7
7
|
from .utils.retries import RetryConfig
|
|
8
8
|
from compass_api_sdk import models, utils
|
|
9
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.sky import Sky
|
|
14
|
-
from compass_api_sdk.smart_account import SmartAccount
|
|
15
|
-
from compass_api_sdk.token_sdk import TokenSDK
|
|
16
|
-
from compass_api_sdk.transaction_batching import TransactionBatching
|
|
17
10
|
from compass_api_sdk.types import OptionalNullable, UNSET
|
|
18
|
-
from compass_api_sdk.uniswap_v3 import UniswapV3
|
|
19
|
-
from compass_api_sdk.universal import Universal
|
|
20
11
|
import httpx
|
|
21
|
-
|
|
12
|
+
import importlib
|
|
13
|
+
from typing import Any, Callable, Dict, Optional, TYPE_CHECKING, Union, cast
|
|
22
14
|
import weakref
|
|
23
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from compass_api_sdk.aave_v3 import AaveV3
|
|
18
|
+
from compass_api_sdk.aerodrome_slipstream import AerodromeSlipstream
|
|
19
|
+
from compass_api_sdk.morpho import Morpho
|
|
20
|
+
from compass_api_sdk.pendle import Pendle
|
|
21
|
+
from compass_api_sdk.sky import Sky
|
|
22
|
+
from compass_api_sdk.smart_account import SmartAccount
|
|
23
|
+
from compass_api_sdk.token_sdk import TokenSDK
|
|
24
|
+
from compass_api_sdk.transaction_batching import TransactionBatching
|
|
25
|
+
from compass_api_sdk.uniswap_v3 import UniswapV3
|
|
26
|
+
from compass_api_sdk.universal import Universal
|
|
27
|
+
|
|
24
28
|
|
|
25
29
|
class CompassAPI(BaseSDK):
|
|
26
30
|
r"""Compass API: Compass Labs DeFi API"""
|
|
27
31
|
|
|
28
|
-
aave_v3: AaveV3
|
|
29
|
-
aerodrome_slipstream: AerodromeSlipstream
|
|
30
|
-
morpho: Morpho
|
|
31
|
-
sky: Sky
|
|
32
|
-
token: TokenSDK
|
|
33
|
-
uniswap_v3: UniswapV3
|
|
34
|
-
universal: Universal
|
|
35
|
-
transaction_batching: TransactionBatching
|
|
36
|
-
smart_account: SmartAccount
|
|
32
|
+
aave_v3: "AaveV3"
|
|
33
|
+
aerodrome_slipstream: "AerodromeSlipstream"
|
|
34
|
+
morpho: "Morpho"
|
|
35
|
+
sky: "Sky"
|
|
36
|
+
token: "TokenSDK"
|
|
37
|
+
uniswap_v3: "UniswapV3"
|
|
38
|
+
universal: "Universal"
|
|
39
|
+
transaction_batching: "TransactionBatching"
|
|
40
|
+
smart_account: "SmartAccount"
|
|
41
|
+
pendle: "Pendle"
|
|
42
|
+
_sub_sdk_map = {
|
|
43
|
+
"aave_v3": ("compass_api_sdk.aave_v3", "AaveV3"),
|
|
44
|
+
"aerodrome_slipstream": (
|
|
45
|
+
"compass_api_sdk.aerodrome_slipstream",
|
|
46
|
+
"AerodromeSlipstream",
|
|
47
|
+
),
|
|
48
|
+
"morpho": ("compass_api_sdk.morpho", "Morpho"),
|
|
49
|
+
"sky": ("compass_api_sdk.sky", "Sky"),
|
|
50
|
+
"token": ("compass_api_sdk.token_sdk", "TokenSDK"),
|
|
51
|
+
"uniswap_v3": ("compass_api_sdk.uniswap_v3", "UniswapV3"),
|
|
52
|
+
"universal": ("compass_api_sdk.universal", "Universal"),
|
|
53
|
+
"transaction_batching": (
|
|
54
|
+
"compass_api_sdk.transaction_batching",
|
|
55
|
+
"TransactionBatching",
|
|
56
|
+
),
|
|
57
|
+
"smart_account": ("compass_api_sdk.smart_account", "SmartAccount"),
|
|
58
|
+
"pendle": ("compass_api_sdk.pendle", "Pendle"),
|
|
59
|
+
}
|
|
37
60
|
|
|
38
61
|
def __init__(
|
|
39
62
|
self,
|
|
@@ -128,18 +151,32 @@ class CompassAPI(BaseSDK):
|
|
|
128
151
|
self.sdk_configuration.async_client_supplied,
|
|
129
152
|
)
|
|
130
153
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
154
|
+
def __getattr__(self, name: str):
|
|
155
|
+
if name in self._sub_sdk_map:
|
|
156
|
+
module_path, class_name = self._sub_sdk_map[name]
|
|
157
|
+
try:
|
|
158
|
+
module = importlib.import_module(module_path)
|
|
159
|
+
klass = getattr(module, class_name)
|
|
160
|
+
instance = klass(self.sdk_configuration)
|
|
161
|
+
setattr(self, name, instance)
|
|
162
|
+
return instance
|
|
163
|
+
except ImportError as e:
|
|
164
|
+
raise AttributeError(
|
|
165
|
+
f"Failed to import module {module_path} for attribute {name}: {e}"
|
|
166
|
+
) from e
|
|
167
|
+
except AttributeError as e:
|
|
168
|
+
raise AttributeError(
|
|
169
|
+
f"Failed to find class {class_name} in module {module_path} for attribute {name}: {e}"
|
|
170
|
+
) from e
|
|
171
|
+
|
|
172
|
+
raise AttributeError(
|
|
173
|
+
f"'{type(self).__name__}' object has no attribute '{name}'"
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def __dir__(self):
|
|
177
|
+
default_attrs = list(super().__dir__())
|
|
178
|
+
lazy_attrs = list(self._sub_sdk_map.keys())
|
|
179
|
+
return sorted(list(set(default_attrs + lazy_attrs)))
|
|
143
180
|
|
|
144
181
|
def __enter__(self):
|
|
145
182
|
return self
|
|
@@ -1,51 +1,55 @@
|
|
|
1
1
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
from .
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from .
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
from importlib import import_module
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from .annotations import get_discriminator
|
|
8
|
+
from .datetimes import parse_datetime
|
|
9
|
+
from .enums import OpenEnumMeta
|
|
10
|
+
from .headers import get_headers, get_response_headers
|
|
11
|
+
from .metadata import (
|
|
12
|
+
FieldMetadata,
|
|
13
|
+
find_metadata,
|
|
14
|
+
FormMetadata,
|
|
15
|
+
HeaderMetadata,
|
|
16
|
+
MultipartFormMetadata,
|
|
17
|
+
PathParamMetadata,
|
|
18
|
+
QueryParamMetadata,
|
|
19
|
+
RequestMetadata,
|
|
20
|
+
SecurityMetadata,
|
|
21
|
+
)
|
|
22
|
+
from .queryparams import get_query_params
|
|
23
|
+
from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
|
|
24
|
+
from .requestbodies import serialize_request_body, SerializedRequestBody
|
|
25
|
+
from .security import get_security
|
|
26
|
+
from .serializers import (
|
|
27
|
+
get_pydantic_model,
|
|
28
|
+
marshal_json,
|
|
29
|
+
unmarshal,
|
|
30
|
+
unmarshal_json,
|
|
31
|
+
serialize_decimal,
|
|
32
|
+
serialize_float,
|
|
33
|
+
serialize_int,
|
|
34
|
+
stream_to_text,
|
|
35
|
+
stream_to_text_async,
|
|
36
|
+
stream_to_bytes,
|
|
37
|
+
stream_to_bytes_async,
|
|
38
|
+
validate_const,
|
|
39
|
+
validate_decimal,
|
|
40
|
+
validate_float,
|
|
41
|
+
validate_int,
|
|
42
|
+
validate_open_enum,
|
|
43
|
+
)
|
|
44
|
+
from .url import generate_url, template_url, remove_suffix
|
|
45
|
+
from .values import (
|
|
46
|
+
get_global_from_env,
|
|
47
|
+
match_content_type,
|
|
48
|
+
match_status_codes,
|
|
49
|
+
match_response,
|
|
50
|
+
cast_partial,
|
|
51
|
+
)
|
|
52
|
+
from .logger import Logger, get_body_content, get_default_logger
|
|
49
53
|
|
|
50
54
|
__all__ = [
|
|
51
55
|
"BackoffStrategy",
|
|
@@ -56,6 +60,7 @@ __all__ = [
|
|
|
56
60
|
"get_body_content",
|
|
57
61
|
"get_default_logger",
|
|
58
62
|
"get_discriminator",
|
|
63
|
+
"parse_datetime",
|
|
59
64
|
"get_global_from_env",
|
|
60
65
|
"get_headers",
|
|
61
66
|
"get_pydantic_model",
|
|
@@ -98,3 +103,82 @@ __all__ = [
|
|
|
98
103
|
"validate_open_enum",
|
|
99
104
|
"cast_partial",
|
|
100
105
|
]
|
|
106
|
+
|
|
107
|
+
_dynamic_imports: dict[str, str] = {
|
|
108
|
+
"BackoffStrategy": ".retries",
|
|
109
|
+
"FieldMetadata": ".metadata",
|
|
110
|
+
"find_metadata": ".metadata",
|
|
111
|
+
"FormMetadata": ".metadata",
|
|
112
|
+
"generate_url": ".url",
|
|
113
|
+
"get_body_content": ".logger",
|
|
114
|
+
"get_default_logger": ".logger",
|
|
115
|
+
"get_discriminator": ".annotations",
|
|
116
|
+
"parse_datetime": ".datetimes",
|
|
117
|
+
"get_global_from_env": ".values",
|
|
118
|
+
"get_headers": ".headers",
|
|
119
|
+
"get_pydantic_model": ".serializers",
|
|
120
|
+
"get_query_params": ".queryparams",
|
|
121
|
+
"get_response_headers": ".headers",
|
|
122
|
+
"get_security": ".security",
|
|
123
|
+
"HeaderMetadata": ".metadata",
|
|
124
|
+
"Logger": ".logger",
|
|
125
|
+
"marshal_json": ".serializers",
|
|
126
|
+
"match_content_type": ".values",
|
|
127
|
+
"match_status_codes": ".values",
|
|
128
|
+
"match_response": ".values",
|
|
129
|
+
"MultipartFormMetadata": ".metadata",
|
|
130
|
+
"OpenEnumMeta": ".enums",
|
|
131
|
+
"PathParamMetadata": ".metadata",
|
|
132
|
+
"QueryParamMetadata": ".metadata",
|
|
133
|
+
"remove_suffix": ".url",
|
|
134
|
+
"Retries": ".retries",
|
|
135
|
+
"retry": ".retries",
|
|
136
|
+
"retry_async": ".retries",
|
|
137
|
+
"RetryConfig": ".retries",
|
|
138
|
+
"RequestMetadata": ".metadata",
|
|
139
|
+
"SecurityMetadata": ".metadata",
|
|
140
|
+
"serialize_decimal": ".serializers",
|
|
141
|
+
"serialize_float": ".serializers",
|
|
142
|
+
"serialize_int": ".serializers",
|
|
143
|
+
"serialize_request_body": ".requestbodies",
|
|
144
|
+
"SerializedRequestBody": ".requestbodies",
|
|
145
|
+
"stream_to_text": ".serializers",
|
|
146
|
+
"stream_to_text_async": ".serializers",
|
|
147
|
+
"stream_to_bytes": ".serializers",
|
|
148
|
+
"stream_to_bytes_async": ".serializers",
|
|
149
|
+
"template_url": ".url",
|
|
150
|
+
"unmarshal": ".serializers",
|
|
151
|
+
"unmarshal_json": ".serializers",
|
|
152
|
+
"validate_decimal": ".serializers",
|
|
153
|
+
"validate_const": ".serializers",
|
|
154
|
+
"validate_float": ".serializers",
|
|
155
|
+
"validate_int": ".serializers",
|
|
156
|
+
"validate_open_enum": ".serializers",
|
|
157
|
+
"cast_partial": ".values",
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def __getattr__(attr_name: str) -> object:
|
|
162
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
163
|
+
if module_name is None:
|
|
164
|
+
raise AttributeError(
|
|
165
|
+
f"no {attr_name} found in _dynamic_imports, module name -> {__name__} "
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
try:
|
|
169
|
+
module = import_module(module_name, __package__)
|
|
170
|
+
result = getattr(module, attr_name)
|
|
171
|
+
return result
|
|
172
|
+
except ImportError as e:
|
|
173
|
+
raise ImportError(
|
|
174
|
+
f"Failed to import {attr_name} from {module_name}: {e}"
|
|
175
|
+
) from e
|
|
176
|
+
except AttributeError as e:
|
|
177
|
+
raise AttributeError(
|
|
178
|
+
f"Failed to get {attr_name} from {module_name}: {e}"
|
|
179
|
+
) from e
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def __dir__():
|
|
183
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
184
|
+
return sorted(lazy_attrs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: compass_api_sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Compass API SDK.
|
|
5
5
|
Author: royalnine
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -234,6 +234,10 @@ with CompassAPI(
|
|
|
234
234
|
* [borrow](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#borrow) - Borrow from Market
|
|
235
235
|
* [repay](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#repay) - Repay to Market
|
|
236
236
|
|
|
237
|
+
### [pendle](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md)
|
|
238
|
+
|
|
239
|
+
* [accrued_interest](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#accrued_interest) - Get Accrued Interest
|
|
240
|
+
|
|
237
241
|
### [sky](https://github.com/CompassLabs/mono/blob/master/docs/sdks/sky/README.md)
|
|
238
242
|
|
|
239
243
|
* [position](https://github.com/CompassLabs/mono/blob/master/docs/sdks/sky/README.md#position) - Check USDS Position
|