compass_api_sdk 0.9.21__py3-none-any.whl → 0.9.23__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 +12 -12
- compass_api_sdk/models/__init__.py +89 -80
- compass_api_sdk/models/aave_historical_transactionsop.py +2 -2
- compass_api_sdk/models/aave_user_position_per_tokenop.py +2 -2
- compass_api_sdk/models/aave_user_position_summaryop.py +2 -2
- compass_api_sdk/models/generic_allowanceop.py +21 -11
- compass_api_sdk/models/setallowanceparams.py +95 -0
- compass_api_sdk/models/setallowancerequest.py +108 -0
- compass_api_sdk/models/useroperation.py +19 -25
- compass_api_sdk/models/vaultdepositrequest.py +98 -0
- compass_api_sdk/models/vaultwithdrawrequest.py +86 -0
- compass_api_sdk/morpho.py +0 -234
- compass_api_sdk/sdk.py +3 -0
- compass_api_sdk/universal.py +36 -28
- compass_api_sdk/vaults_erc_4626_.py +477 -0
- {compass_api_sdk-0.9.21.dist-info → compass_api_sdk-0.9.23.dist-info}/METADATA +6 -2
- {compass_api_sdk-0.9.21.dist-info → compass_api_sdk-0.9.23.dist-info}/RECORD +19 -18
- compass_api_sdk/models/increaseallowanceparams.py +0 -86
- compass_api_sdk/models/increaseallowancerequest.py +0 -97
- compass_api_sdk/models/morphosetvaultallowanceparams.py +0 -45
- compass_api_sdk/models/morphosetvaultallowancerequest.py +0 -59
- {compass_api_sdk-0.9.21.dist-info → compass_api_sdk-0.9.23.dist-info}/WHEEL +0 -0
|
@@ -25,17 +25,9 @@ from .aerodromeslipstreamwithdrawliquidityprovisionparams import (
|
|
|
25
25
|
AerodromeSlipstreamWithdrawLiquidityProvisionParams,
|
|
26
26
|
AerodromeSlipstreamWithdrawLiquidityProvisionParamsTypedDict,
|
|
27
27
|
)
|
|
28
|
-
from .increaseallowanceparams import (
|
|
29
|
-
IncreaseAllowanceParams,
|
|
30
|
-
IncreaseAllowanceParamsTypedDict,
|
|
31
|
-
)
|
|
32
28
|
from .morphoborrowparams import MorphoBorrowParams, MorphoBorrowParamsTypedDict
|
|
33
29
|
from .morphodepositparams import MorphoDepositParams, MorphoDepositParamsTypedDict
|
|
34
30
|
from .morphorepayparams import MorphoRepayParams, MorphoRepayParamsTypedDict
|
|
35
|
-
from .morphosetvaultallowanceparams import (
|
|
36
|
-
MorphoSetVaultAllowanceParams,
|
|
37
|
-
MorphoSetVaultAllowanceParamsTypedDict,
|
|
38
|
-
)
|
|
39
31
|
from .morphosupplycollateralparams import (
|
|
40
32
|
MorphoSupplyCollateralParams,
|
|
41
33
|
MorphoSupplyCollateralParamsTypedDict,
|
|
@@ -61,6 +53,7 @@ from .pendleremoveliquidityparams import (
|
|
|
61
53
|
)
|
|
62
54
|
from .pendlesellptparams import PendleSellPtParams, PendleSellPtParamsTypedDict
|
|
63
55
|
from .pendlesellytparams import PendleSellYtParams, PendleSellYtParamsTypedDict
|
|
56
|
+
from .setallowanceparams import SetAllowanceParams, SetAllowanceParamsTypedDict
|
|
64
57
|
from .skybuyparams import SkyBuyParams, SkyBuyParamsTypedDict
|
|
65
58
|
from .skydepositparams import SkyDepositParams, SkyDepositParamsTypedDict
|
|
66
59
|
from .skysellparams import SkySellParams, SkySellParamsTypedDict
|
|
@@ -69,6 +62,7 @@ from .tokentransfererc20params import (
|
|
|
69
62
|
TokenTransferErc20Params,
|
|
70
63
|
TokenTransferErc20ParamsTypedDict,
|
|
71
64
|
)
|
|
65
|
+
from .tokentransferrequest import TokenTransferRequest, TokenTransferRequestTypedDict
|
|
72
66
|
from .uniswapbuyexactlyparams import (
|
|
73
67
|
UniswapBuyExactlyParams,
|
|
74
68
|
UniswapBuyExactlyParamsTypedDict,
|
|
@@ -102,37 +96,37 @@ BodyTypedDict = TypeAliasType(
|
|
|
102
96
|
"BodyTypedDict",
|
|
103
97
|
Union[
|
|
104
98
|
WrapEthParamsTypedDict,
|
|
105
|
-
UnwrapWethParamsTypedDict,
|
|
106
99
|
PendleRedeemYieldParamsTypedDict,
|
|
107
|
-
|
|
108
|
-
UniswapWithdrawLiquidityProvisionParamsTypedDict,
|
|
109
|
-
SkyWithdrawParamsTypedDict,
|
|
100
|
+
UnwrapWethParamsTypedDict,
|
|
110
101
|
SkySellParamsTypedDict,
|
|
111
|
-
SkyDepositParamsTypedDict,
|
|
112
102
|
SkyBuyParamsTypedDict,
|
|
103
|
+
UniswapWithdrawLiquidityProvisionParamsTypedDict,
|
|
104
|
+
SkyDepositParamsTypedDict,
|
|
105
|
+
SkyWithdrawParamsTypedDict,
|
|
113
106
|
AerodromeSlipstreamWithdrawLiquidityProvisionParamsTypedDict,
|
|
114
|
-
|
|
107
|
+
MorphoDepositParamsTypedDict,
|
|
115
108
|
PendleSellYtParamsTypedDict,
|
|
116
|
-
AaveSupplyParamsTypedDict,
|
|
117
|
-
AaveWithdrawParamsTypedDict,
|
|
118
109
|
TokenTransferErc20ParamsTypedDict,
|
|
110
|
+
AaveWithdrawParamsTypedDict,
|
|
119
111
|
MorphoWithdrawParamsTypedDict,
|
|
120
|
-
|
|
112
|
+
SetAllowanceParamsTypedDict,
|
|
121
113
|
PendleAddLiquidityParamsTypedDict,
|
|
122
114
|
PendleBuyPtParamsTypedDict,
|
|
123
115
|
PendleBuyYtParamsTypedDict,
|
|
124
|
-
|
|
116
|
+
AaveSupplyParamsTypedDict,
|
|
125
117
|
PendleRemoveLiquidityParamsTypedDict,
|
|
118
|
+
PendleSellPtParamsTypedDict,
|
|
119
|
+
MorphoBorrowParamsTypedDict,
|
|
120
|
+
MorphoSupplyCollateralParamsTypedDict,
|
|
126
121
|
MorphoRepayParamsTypedDict,
|
|
127
|
-
MorphoWithdrawCollateralParamsTypedDict,
|
|
128
122
|
AaveBorrowParamsTypedDict,
|
|
129
|
-
|
|
123
|
+
MorphoWithdrawCollateralParamsTypedDict,
|
|
130
124
|
AaveRepayParamsTypedDict,
|
|
131
|
-
MorphoBorrowParamsTypedDict,
|
|
132
|
-
AerodromeSlipstreamSellExactlyParamsTypedDict,
|
|
133
|
-
AerodromeSlipstreamIncreaseLiquidityProvisionParamsTypedDict,
|
|
134
125
|
AerodromeSlipstreamBuyExactlyParamsTypedDict,
|
|
126
|
+
AerodromeSlipstreamSellExactlyParamsTypedDict,
|
|
127
|
+
TokenTransferRequestTypedDict,
|
|
135
128
|
UniswapIncreaseLiquidityProvisionParamsTypedDict,
|
|
129
|
+
AerodromeSlipstreamIncreaseLiquidityProvisionParamsTypedDict,
|
|
136
130
|
UniswapBuyExactlyParamsTypedDict,
|
|
137
131
|
UniswapSellExactlyParamsTypedDict,
|
|
138
132
|
AerodromeSlipstreamMintLiquidityProvisionParamsTypedDict,
|
|
@@ -166,11 +160,9 @@ Body = Annotated[
|
|
|
166
160
|
AerodromeSlipstreamWithdrawLiquidityProvisionParams,
|
|
167
161
|
Tag("AERODROME_SLIPSTREAM_WITHDRAW_LIQUIDITY_PROVISION"),
|
|
168
162
|
],
|
|
169
|
-
Annotated[IncreaseAllowanceParams, Tag("ALLOWANCE_INCREASE")],
|
|
170
163
|
Annotated[MorphoBorrowParams, Tag("MORPHO_BORROW")],
|
|
171
164
|
Annotated[MorphoDepositParams, Tag("MORPHO_DEPOSIT")],
|
|
172
165
|
Annotated[MorphoRepayParams, Tag("MORPHO_REPAY")],
|
|
173
|
-
Annotated[MorphoSetVaultAllowanceParams, Tag("MORPHO_SET_VAULT_ALLOWANCE")],
|
|
174
166
|
Annotated[MorphoSupplyCollateralParams, Tag("MORPHO_SUPPLY_COLLATERAL")],
|
|
175
167
|
Annotated[MorphoWithdrawParams, Tag("MORPHO_WITHDRAW")],
|
|
176
168
|
Annotated[MorphoWithdrawCollateralParams, Tag("MORPHO_WITHDRAW_COLLATERAL")],
|
|
@@ -181,10 +173,12 @@ Body = Annotated[
|
|
|
181
173
|
Annotated[PendleRemoveLiquidityParams, Tag("PENDLE_REMOVE_LIQUIDITY")],
|
|
182
174
|
Annotated[PendleSellPtParams, Tag("PENDLE_SELL_PT")],
|
|
183
175
|
Annotated[PendleSellYtParams, Tag("PENDLE_SELL_YT")],
|
|
176
|
+
Annotated[SetAllowanceParams, Tag("SET_ALLOWANCE")],
|
|
184
177
|
Annotated[SkyBuyParams, Tag("SKY_BUY")],
|
|
185
178
|
Annotated[SkyDepositParams, Tag("SKY_DEPOSIT")],
|
|
186
179
|
Annotated[SkySellParams, Tag("SKY_SELL")],
|
|
187
180
|
Annotated[SkyWithdrawParams, Tag("SKY_WITHDRAW")],
|
|
181
|
+
Annotated[TokenTransferRequest, Tag("TOKEN_TRANSFER")],
|
|
188
182
|
Annotated[TokenTransferErc20Params, Tag("TOKEN_TRANSFER_ERC20")],
|
|
189
183
|
Annotated[
|
|
190
184
|
UniswapIncreaseLiquidityProvisionParams, Tag("UNISWAP_ADD_LIQUIDITY")
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .chain import Chain
|
|
5
|
+
from compass_api_sdk.types import (
|
|
6
|
+
BaseModel,
|
|
7
|
+
Nullable,
|
|
8
|
+
OptionalNullable,
|
|
9
|
+
UNSET,
|
|
10
|
+
UNSET_SENTINEL,
|
|
11
|
+
)
|
|
12
|
+
from compass_api_sdk.utils import validate_const
|
|
13
|
+
import pydantic
|
|
14
|
+
from pydantic import model_serializer
|
|
15
|
+
from pydantic.functional_validators import AfterValidator
|
|
16
|
+
from typing import Literal, Optional, Union
|
|
17
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
VaultDepositRequestAmountTypedDict = TypeAliasType(
|
|
21
|
+
"VaultDepositRequestAmountTypedDict", Union[float, str]
|
|
22
|
+
)
|
|
23
|
+
r"""The amount of tokens to deposit into the vault."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
VaultDepositRequestAmount = TypeAliasType(
|
|
27
|
+
"VaultDepositRequestAmount", Union[float, str]
|
|
28
|
+
)
|
|
29
|
+
r"""The amount of tokens to deposit into the vault."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class VaultDepositRequestTypedDict(TypedDict):
|
|
33
|
+
vault_address: str
|
|
34
|
+
r"""The vault address you are depositing to."""
|
|
35
|
+
amount: VaultDepositRequestAmountTypedDict
|
|
36
|
+
r"""The amount of tokens to deposit into the vault."""
|
|
37
|
+
chain: Chain
|
|
38
|
+
r"""The chain to use."""
|
|
39
|
+
sender: str
|
|
40
|
+
r"""The address of the transaction sender."""
|
|
41
|
+
action_type: Literal["VAULT_DEPOSIT"]
|
|
42
|
+
receiver: NotRequired[Nullable[str]]
|
|
43
|
+
r"""The address which will receive the shares from the vault representing their proportional ownership of the vault's assets. Defaults to the sender."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class VaultDepositRequest(BaseModel):
|
|
47
|
+
vault_address: str
|
|
48
|
+
r"""The vault address you are depositing to."""
|
|
49
|
+
|
|
50
|
+
amount: VaultDepositRequestAmount
|
|
51
|
+
r"""The amount of tokens to deposit into the vault."""
|
|
52
|
+
|
|
53
|
+
chain: Chain
|
|
54
|
+
r"""The chain to use."""
|
|
55
|
+
|
|
56
|
+
sender: str
|
|
57
|
+
r"""The address of the transaction sender."""
|
|
58
|
+
|
|
59
|
+
ACTION_TYPE: Annotated[
|
|
60
|
+
Annotated[
|
|
61
|
+
Optional[Literal["VAULT_DEPOSIT"]],
|
|
62
|
+
AfterValidator(validate_const("VAULT_DEPOSIT")),
|
|
63
|
+
],
|
|
64
|
+
pydantic.Field(alias="action_type"),
|
|
65
|
+
] = "VAULT_DEPOSIT"
|
|
66
|
+
|
|
67
|
+
receiver: OptionalNullable[str] = UNSET
|
|
68
|
+
r"""The address which will receive the shares from the vault representing their proportional ownership of the vault's assets. Defaults to the sender."""
|
|
69
|
+
|
|
70
|
+
@model_serializer(mode="wrap")
|
|
71
|
+
def serialize_model(self, handler):
|
|
72
|
+
optional_fields = ["action_type", "receiver"]
|
|
73
|
+
nullable_fields = ["receiver"]
|
|
74
|
+
null_default_fields = []
|
|
75
|
+
|
|
76
|
+
serialized = handler(self)
|
|
77
|
+
|
|
78
|
+
m = {}
|
|
79
|
+
|
|
80
|
+
for n, f in type(self).model_fields.items():
|
|
81
|
+
k = f.alias or n
|
|
82
|
+
val = serialized.get(k)
|
|
83
|
+
serialized.pop(k, None)
|
|
84
|
+
|
|
85
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
86
|
+
is_set = (
|
|
87
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
88
|
+
or k in null_default_fields
|
|
89
|
+
) # pylint: disable=no-member
|
|
90
|
+
|
|
91
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
92
|
+
m[k] = val
|
|
93
|
+
elif val != UNSET_SENTINEL and (
|
|
94
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
95
|
+
):
|
|
96
|
+
m[k] = val
|
|
97
|
+
|
|
98
|
+
return m
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from .chain import Chain
|
|
5
|
+
from compass_api_sdk.types import (
|
|
6
|
+
BaseModel,
|
|
7
|
+
Nullable,
|
|
8
|
+
OptionalNullable,
|
|
9
|
+
UNSET,
|
|
10
|
+
UNSET_SENTINEL,
|
|
11
|
+
)
|
|
12
|
+
from compass_api_sdk.utils import validate_const
|
|
13
|
+
import pydantic
|
|
14
|
+
from pydantic import model_serializer
|
|
15
|
+
from pydantic.functional_validators import AfterValidator
|
|
16
|
+
from typing import Any, Literal, Optional
|
|
17
|
+
from typing_extensions import Annotated, NotRequired, TypedDict
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class VaultWithdrawRequestTypedDict(TypedDict):
|
|
21
|
+
vault_address: str
|
|
22
|
+
r"""The vault address you are withdrawing from."""
|
|
23
|
+
amount: Any
|
|
24
|
+
r"""The amount of tokens to withdraw from the vault. If set to 'ALL', your total deposited token amount will be withdrawn."""
|
|
25
|
+
chain: Chain
|
|
26
|
+
r"""The chain to use."""
|
|
27
|
+
sender: str
|
|
28
|
+
r"""The address of the transaction sender."""
|
|
29
|
+
action_type: Literal["VAULT_WITHDRAW"]
|
|
30
|
+
receiver: NotRequired[Nullable[str]]
|
|
31
|
+
r"""The address which will receive the tokens withdrawn. Defaults to the sender."""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class VaultWithdrawRequest(BaseModel):
|
|
35
|
+
vault_address: str
|
|
36
|
+
r"""The vault address you are withdrawing from."""
|
|
37
|
+
|
|
38
|
+
amount: Any
|
|
39
|
+
r"""The amount of tokens to withdraw from the vault. If set to 'ALL', your total deposited token amount will be withdrawn."""
|
|
40
|
+
|
|
41
|
+
chain: Chain
|
|
42
|
+
r"""The chain to use."""
|
|
43
|
+
|
|
44
|
+
sender: str
|
|
45
|
+
r"""The address of the transaction sender."""
|
|
46
|
+
|
|
47
|
+
ACTION_TYPE: Annotated[
|
|
48
|
+
Annotated[
|
|
49
|
+
Optional[Literal["VAULT_WITHDRAW"]],
|
|
50
|
+
AfterValidator(validate_const("VAULT_WITHDRAW")),
|
|
51
|
+
],
|
|
52
|
+
pydantic.Field(alias="action_type"),
|
|
53
|
+
] = "VAULT_WITHDRAW"
|
|
54
|
+
|
|
55
|
+
receiver: OptionalNullable[str] = UNSET
|
|
56
|
+
r"""The address which will receive the tokens withdrawn. Defaults to the sender."""
|
|
57
|
+
|
|
58
|
+
@model_serializer(mode="wrap")
|
|
59
|
+
def serialize_model(self, handler):
|
|
60
|
+
optional_fields = ["action_type", "receiver"]
|
|
61
|
+
nullable_fields = ["receiver"]
|
|
62
|
+
null_default_fields = []
|
|
63
|
+
|
|
64
|
+
serialized = handler(self)
|
|
65
|
+
|
|
66
|
+
m = {}
|
|
67
|
+
|
|
68
|
+
for n, f in type(self).model_fields.items():
|
|
69
|
+
k = f.alias or n
|
|
70
|
+
val = serialized.get(k)
|
|
71
|
+
serialized.pop(k, None)
|
|
72
|
+
|
|
73
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
74
|
+
is_set = (
|
|
75
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
76
|
+
or k in null_default_fields
|
|
77
|
+
) # pylint: disable=no-member
|
|
78
|
+
|
|
79
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
80
|
+
m[k] = val
|
|
81
|
+
elif val != UNSET_SENTINEL and (
|
|
82
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
83
|
+
):
|
|
84
|
+
m[k] = val
|
|
85
|
+
|
|
86
|
+
return m
|
compass_api_sdk/morpho.py
CHANGED
|
@@ -1508,240 +1508,6 @@ class Morpho(BaseSDK):
|
|
|
1508
1508
|
http_res,
|
|
1509
1509
|
)
|
|
1510
1510
|
|
|
1511
|
-
def allowance(
|
|
1512
|
-
self,
|
|
1513
|
-
*,
|
|
1514
|
-
vault_address: str,
|
|
1515
|
-
amount: Union[
|
|
1516
|
-
models.MorphoSetVaultAllowanceRequestAmount,
|
|
1517
|
-
models.MorphoSetVaultAllowanceRequestAmountTypedDict,
|
|
1518
|
-
],
|
|
1519
|
-
chain: models.MorphoSetVaultAllowanceRequestChain,
|
|
1520
|
-
sender: str,
|
|
1521
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1522
|
-
server_url: Optional[str] = None,
|
|
1523
|
-
timeout_ms: Optional[int] = None,
|
|
1524
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1525
|
-
) -> models.TxResponse:
|
|
1526
|
-
r"""Set Allowance for Vault
|
|
1527
|
-
|
|
1528
|
-
Set an allowance for a Morpho vault. You must set this for at least the amount you wish to deposit - before depositing.
|
|
1529
|
-
|
|
1530
|
-
Each vault has only one associated token that can be deposited.
|
|
1531
|
-
|
|
1532
|
-
Use the 'Get Vaults' endpoint to query a list of vaults you can deposit into.
|
|
1533
|
-
|
|
1534
|
-
:param vault_address: The vault address you are increasing the allowance for.
|
|
1535
|
-
:param amount: The amount of tokens to increase the allowance by.
|
|
1536
|
-
:param chain:
|
|
1537
|
-
:param sender: The address of the transaction sender.
|
|
1538
|
-
:param retries: Override the default retry configuration for this method
|
|
1539
|
-
:param server_url: Override the default server URL for this method
|
|
1540
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1541
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1542
|
-
"""
|
|
1543
|
-
base_url = None
|
|
1544
|
-
url_variables = None
|
|
1545
|
-
if timeout_ms is None:
|
|
1546
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1547
|
-
|
|
1548
|
-
if server_url is not None:
|
|
1549
|
-
base_url = server_url
|
|
1550
|
-
else:
|
|
1551
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1552
|
-
|
|
1553
|
-
request = models.MorphoSetVaultAllowanceRequest(
|
|
1554
|
-
vault_address=vault_address,
|
|
1555
|
-
amount=amount,
|
|
1556
|
-
chain=chain,
|
|
1557
|
-
sender=sender,
|
|
1558
|
-
)
|
|
1559
|
-
|
|
1560
|
-
req = self._build_request(
|
|
1561
|
-
method="POST",
|
|
1562
|
-
path="/v0/morpho/allowance",
|
|
1563
|
-
base_url=base_url,
|
|
1564
|
-
url_variables=url_variables,
|
|
1565
|
-
request=request,
|
|
1566
|
-
request_body_required=True,
|
|
1567
|
-
request_has_path_params=False,
|
|
1568
|
-
request_has_query_params=True,
|
|
1569
|
-
user_agent_header="user-agent",
|
|
1570
|
-
accept_header_value="application/json",
|
|
1571
|
-
http_headers=http_headers,
|
|
1572
|
-
security=self.sdk_configuration.security,
|
|
1573
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1574
|
-
request, False, False, "json", models.MorphoSetVaultAllowanceRequest
|
|
1575
|
-
),
|
|
1576
|
-
timeout_ms=timeout_ms,
|
|
1577
|
-
)
|
|
1578
|
-
|
|
1579
|
-
if retries == UNSET:
|
|
1580
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1581
|
-
retries = self.sdk_configuration.retry_config
|
|
1582
|
-
|
|
1583
|
-
retry_config = None
|
|
1584
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1585
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1586
|
-
|
|
1587
|
-
http_res = self.do_request(
|
|
1588
|
-
hook_ctx=HookContext(
|
|
1589
|
-
config=self.sdk_configuration,
|
|
1590
|
-
base_url=base_url or "",
|
|
1591
|
-
operation_id="morpho_allowance",
|
|
1592
|
-
oauth2_scopes=[],
|
|
1593
|
-
security_source=self.sdk_configuration.security,
|
|
1594
|
-
),
|
|
1595
|
-
request=req,
|
|
1596
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1597
|
-
retry_config=retry_config,
|
|
1598
|
-
)
|
|
1599
|
-
|
|
1600
|
-
response_data: Any = None
|
|
1601
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1602
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1603
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1604
|
-
response_data = utils.unmarshal_json(
|
|
1605
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1606
|
-
)
|
|
1607
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1608
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1609
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1610
|
-
raise errors.APIError(
|
|
1611
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1612
|
-
)
|
|
1613
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1614
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1615
|
-
raise errors.APIError(
|
|
1616
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1617
|
-
)
|
|
1618
|
-
|
|
1619
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1620
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1621
|
-
raise errors.APIError(
|
|
1622
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1623
|
-
http_res.status_code,
|
|
1624
|
-
http_res_text,
|
|
1625
|
-
http_res,
|
|
1626
|
-
)
|
|
1627
|
-
|
|
1628
|
-
async def allowance_async(
|
|
1629
|
-
self,
|
|
1630
|
-
*,
|
|
1631
|
-
vault_address: str,
|
|
1632
|
-
amount: Union[
|
|
1633
|
-
models.MorphoSetVaultAllowanceRequestAmount,
|
|
1634
|
-
models.MorphoSetVaultAllowanceRequestAmountTypedDict,
|
|
1635
|
-
],
|
|
1636
|
-
chain: models.MorphoSetVaultAllowanceRequestChain,
|
|
1637
|
-
sender: str,
|
|
1638
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1639
|
-
server_url: Optional[str] = None,
|
|
1640
|
-
timeout_ms: Optional[int] = None,
|
|
1641
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1642
|
-
) -> models.TxResponse:
|
|
1643
|
-
r"""Set Allowance for Vault
|
|
1644
|
-
|
|
1645
|
-
Set an allowance for a Morpho vault. You must set this for at least the amount you wish to deposit - before depositing.
|
|
1646
|
-
|
|
1647
|
-
Each vault has only one associated token that can be deposited.
|
|
1648
|
-
|
|
1649
|
-
Use the 'Get Vaults' endpoint to query a list of vaults you can deposit into.
|
|
1650
|
-
|
|
1651
|
-
:param vault_address: The vault address you are increasing the allowance for.
|
|
1652
|
-
:param amount: The amount of tokens to increase the allowance by.
|
|
1653
|
-
:param chain:
|
|
1654
|
-
:param sender: The address of the transaction sender.
|
|
1655
|
-
:param retries: Override the default retry configuration for this method
|
|
1656
|
-
:param server_url: Override the default server URL for this method
|
|
1657
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1658
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1659
|
-
"""
|
|
1660
|
-
base_url = None
|
|
1661
|
-
url_variables = None
|
|
1662
|
-
if timeout_ms is None:
|
|
1663
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1664
|
-
|
|
1665
|
-
if server_url is not None:
|
|
1666
|
-
base_url = server_url
|
|
1667
|
-
else:
|
|
1668
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1669
|
-
|
|
1670
|
-
request = models.MorphoSetVaultAllowanceRequest(
|
|
1671
|
-
vault_address=vault_address,
|
|
1672
|
-
amount=amount,
|
|
1673
|
-
chain=chain,
|
|
1674
|
-
sender=sender,
|
|
1675
|
-
)
|
|
1676
|
-
|
|
1677
|
-
req = self._build_request_async(
|
|
1678
|
-
method="POST",
|
|
1679
|
-
path="/v0/morpho/allowance",
|
|
1680
|
-
base_url=base_url,
|
|
1681
|
-
url_variables=url_variables,
|
|
1682
|
-
request=request,
|
|
1683
|
-
request_body_required=True,
|
|
1684
|
-
request_has_path_params=False,
|
|
1685
|
-
request_has_query_params=True,
|
|
1686
|
-
user_agent_header="user-agent",
|
|
1687
|
-
accept_header_value="application/json",
|
|
1688
|
-
http_headers=http_headers,
|
|
1689
|
-
security=self.sdk_configuration.security,
|
|
1690
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1691
|
-
request, False, False, "json", models.MorphoSetVaultAllowanceRequest
|
|
1692
|
-
),
|
|
1693
|
-
timeout_ms=timeout_ms,
|
|
1694
|
-
)
|
|
1695
|
-
|
|
1696
|
-
if retries == UNSET:
|
|
1697
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1698
|
-
retries = self.sdk_configuration.retry_config
|
|
1699
|
-
|
|
1700
|
-
retry_config = None
|
|
1701
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1702
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1703
|
-
|
|
1704
|
-
http_res = await self.do_request_async(
|
|
1705
|
-
hook_ctx=HookContext(
|
|
1706
|
-
config=self.sdk_configuration,
|
|
1707
|
-
base_url=base_url or "",
|
|
1708
|
-
operation_id="morpho_allowance",
|
|
1709
|
-
oauth2_scopes=[],
|
|
1710
|
-
security_source=self.sdk_configuration.security,
|
|
1711
|
-
),
|
|
1712
|
-
request=req,
|
|
1713
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1714
|
-
retry_config=retry_config,
|
|
1715
|
-
)
|
|
1716
|
-
|
|
1717
|
-
response_data: Any = None
|
|
1718
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1719
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1720
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1721
|
-
response_data = utils.unmarshal_json(
|
|
1722
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1723
|
-
)
|
|
1724
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1725
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1726
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1727
|
-
raise errors.APIError(
|
|
1728
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1729
|
-
)
|
|
1730
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1731
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1732
|
-
raise errors.APIError(
|
|
1733
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1734
|
-
)
|
|
1735
|
-
|
|
1736
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1737
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1738
|
-
raise errors.APIError(
|
|
1739
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1740
|
-
http_res.status_code,
|
|
1741
|
-
http_res_text,
|
|
1742
|
-
http_res,
|
|
1743
|
-
)
|
|
1744
|
-
|
|
1745
1511
|
def deposit(
|
|
1746
1512
|
self,
|
|
1747
1513
|
*,
|
compass_api_sdk/sdk.py
CHANGED
|
@@ -24,6 +24,7 @@ if TYPE_CHECKING:
|
|
|
24
24
|
from compass_api_sdk.transaction_bundler import TransactionBundler
|
|
25
25
|
from compass_api_sdk.uniswap_v3 import UniswapV3
|
|
26
26
|
from compass_api_sdk.universal import Universal
|
|
27
|
+
from compass_api_sdk.vaults_erc_4626_ import VaultsERC4626
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
class CompassAPI(BaseSDK):
|
|
@@ -39,6 +40,7 @@ class CompassAPI(BaseSDK):
|
|
|
39
40
|
pendle: "Pendle"
|
|
40
41
|
transaction_bundler: "TransactionBundler"
|
|
41
42
|
smart_account: "SmartAccount"
|
|
43
|
+
vaults_erc_4626: "VaultsERC4626"
|
|
42
44
|
_sub_sdk_map = {
|
|
43
45
|
"aave_v3": ("compass_api_sdk.aave_v3", "AaveV3"),
|
|
44
46
|
"aerodrome_slipstream": (
|
|
@@ -56,6 +58,7 @@ class CompassAPI(BaseSDK):
|
|
|
56
58
|
"TransactionBundler",
|
|
57
59
|
),
|
|
58
60
|
"smart_account": ("compass_api_sdk.smart_account", "SmartAccount"),
|
|
61
|
+
"vaults_erc_4626": ("compass_api_sdk.vaults_erc_4626_", "VaultsERC4626"),
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
def __init__(
|