compass_api_sdk 0.9.21__py3-none-any.whl → 0.9.22__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/models/__init__.py +89 -80
- 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 +17 -26
- 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.22.dist-info}/METADATA +6 -2
- {compass_api_sdk-0.9.21.dist-info → compass_api_sdk-0.9.22.dist-info}/RECORD +15 -14
- 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.22.dist-info}/WHEEL +0 -0
|
@@ -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__(
|
compass_api_sdk/universal.py
CHANGED
|
@@ -629,7 +629,10 @@ class Universal(BaseSDK):
|
|
|
629
629
|
token: Union[
|
|
630
630
|
models.GenericAllowanceToken, models.GenericAllowanceTokenTypedDict
|
|
631
631
|
],
|
|
632
|
-
|
|
632
|
+
contract: Union[
|
|
633
|
+
models.GenericAllowanceContractUnion,
|
|
634
|
+
models.GenericAllowanceContractUnionTypedDict,
|
|
635
|
+
],
|
|
633
636
|
user: Optional[str] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
634
637
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
635
638
|
server_url: Optional[str] = None,
|
|
@@ -648,7 +651,7 @@ class Universal(BaseSDK):
|
|
|
648
651
|
|
|
649
652
|
:param chain: The chain to use.
|
|
650
653
|
:param token: The symbol or address of the token for which the allowance is checked..
|
|
651
|
-
:param
|
|
654
|
+
:param contract: The name or address of the contract to check allowance for.
|
|
652
655
|
:param user: The user to get the ERC20 allowance of.
|
|
653
656
|
:param retries: Override the default retry configuration for this method
|
|
654
657
|
:param server_url: Override the default server URL for this method
|
|
@@ -669,7 +672,7 @@ class Universal(BaseSDK):
|
|
|
669
672
|
chain=chain,
|
|
670
673
|
user=user,
|
|
671
674
|
token=token,
|
|
672
|
-
|
|
675
|
+
contract=contract,
|
|
673
676
|
)
|
|
674
677
|
|
|
675
678
|
req = self._build_request(
|
|
@@ -744,7 +747,10 @@ class Universal(BaseSDK):
|
|
|
744
747
|
token: Union[
|
|
745
748
|
models.GenericAllowanceToken, models.GenericAllowanceTokenTypedDict
|
|
746
749
|
],
|
|
747
|
-
|
|
750
|
+
contract: Union[
|
|
751
|
+
models.GenericAllowanceContractUnion,
|
|
752
|
+
models.GenericAllowanceContractUnionTypedDict,
|
|
753
|
+
],
|
|
748
754
|
user: Optional[str] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
|
|
749
755
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
750
756
|
server_url: Optional[str] = None,
|
|
@@ -763,7 +769,7 @@ class Universal(BaseSDK):
|
|
|
763
769
|
|
|
764
770
|
:param chain: The chain to use.
|
|
765
771
|
:param token: The symbol or address of the token for which the allowance is checked..
|
|
766
|
-
:param
|
|
772
|
+
:param contract: The name or address of the contract to check allowance for.
|
|
767
773
|
:param user: The user to get the ERC20 allowance of.
|
|
768
774
|
:param retries: Override the default retry configuration for this method
|
|
769
775
|
:param server_url: Override the default server URL for this method
|
|
@@ -784,7 +790,7 @@ class Universal(BaseSDK):
|
|
|
784
790
|
chain=chain,
|
|
785
791
|
user=user,
|
|
786
792
|
token=token,
|
|
787
|
-
|
|
793
|
+
contract=contract,
|
|
788
794
|
)
|
|
789
795
|
|
|
790
796
|
req = self._build_request_async(
|
|
@@ -1504,13 +1510,14 @@ class Universal(BaseSDK):
|
|
|
1504
1510
|
self,
|
|
1505
1511
|
*,
|
|
1506
1512
|
token: Union[
|
|
1507
|
-
models.
|
|
1508
|
-
|
|
1513
|
+
models.SetAllowanceRequestToken, models.SetAllowanceRequestTokenTypedDict
|
|
1514
|
+
],
|
|
1515
|
+
contract: Union[
|
|
1516
|
+
models.SetAllowanceRequestContractUnion,
|
|
1517
|
+
models.SetAllowanceRequestContractUnionTypedDict,
|
|
1509
1518
|
],
|
|
1510
|
-
contract_name: models.IncreaseAllowanceRequestContractName,
|
|
1511
1519
|
amount: Union[
|
|
1512
|
-
models.
|
|
1513
|
-
models.IncreaseAllowanceRequestAmountTypedDict,
|
|
1520
|
+
models.SetAllowanceRequestAmount, models.SetAllowanceRequestAmountTypedDict
|
|
1514
1521
|
],
|
|
1515
1522
|
chain: models.Chain,
|
|
1516
1523
|
sender: str,
|
|
@@ -1530,9 +1537,9 @@ class Universal(BaseSDK):
|
|
|
1530
1537
|
tokens securely and efficiently, enabling seamless transactions and operations
|
|
1531
1538
|
within the DeFi ecosystem.
|
|
1532
1539
|
|
|
1533
|
-
:param token: The symbol or address of the token for which the allowance is
|
|
1534
|
-
:param
|
|
1535
|
-
:param amount: The amount to
|
|
1540
|
+
:param token: The symbol or address of the token for which the allowance is set..
|
|
1541
|
+
:param contract: The name or address of the contract to set spending allowance for.
|
|
1542
|
+
:param amount: The amount to set the allowance to.
|
|
1536
1543
|
:param chain: The chain to use.
|
|
1537
1544
|
:param sender: The address of the transaction sender.
|
|
1538
1545
|
:param retries: Override the default retry configuration for this method
|
|
@@ -1550,9 +1557,9 @@ class Universal(BaseSDK):
|
|
|
1550
1557
|
else:
|
|
1551
1558
|
base_url = self._get_url(base_url, url_variables)
|
|
1552
1559
|
|
|
1553
|
-
request = models.
|
|
1560
|
+
request = models.SetAllowanceRequest(
|
|
1554
1561
|
token=token,
|
|
1555
|
-
|
|
1562
|
+
contract=contract,
|
|
1556
1563
|
amount=amount,
|
|
1557
1564
|
chain=chain,
|
|
1558
1565
|
sender=sender,
|
|
@@ -1572,7 +1579,7 @@ class Universal(BaseSDK):
|
|
|
1572
1579
|
http_headers=http_headers,
|
|
1573
1580
|
security=self.sdk_configuration.security,
|
|
1574
1581
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1575
|
-
request, False, False, "json", models.
|
|
1582
|
+
request, False, False, "json", models.SetAllowanceRequest
|
|
1576
1583
|
),
|
|
1577
1584
|
timeout_ms=timeout_ms,
|
|
1578
1585
|
)
|
|
@@ -1630,13 +1637,14 @@ class Universal(BaseSDK):
|
|
|
1630
1637
|
self,
|
|
1631
1638
|
*,
|
|
1632
1639
|
token: Union[
|
|
1633
|
-
models.
|
|
1634
|
-
|
|
1640
|
+
models.SetAllowanceRequestToken, models.SetAllowanceRequestTokenTypedDict
|
|
1641
|
+
],
|
|
1642
|
+
contract: Union[
|
|
1643
|
+
models.SetAllowanceRequestContractUnion,
|
|
1644
|
+
models.SetAllowanceRequestContractUnionTypedDict,
|
|
1635
1645
|
],
|
|
1636
|
-
contract_name: models.IncreaseAllowanceRequestContractName,
|
|
1637
1646
|
amount: Union[
|
|
1638
|
-
models.
|
|
1639
|
-
models.IncreaseAllowanceRequestAmountTypedDict,
|
|
1647
|
+
models.SetAllowanceRequestAmount, models.SetAllowanceRequestAmountTypedDict
|
|
1640
1648
|
],
|
|
1641
1649
|
chain: models.Chain,
|
|
1642
1650
|
sender: str,
|
|
@@ -1656,9 +1664,9 @@ class Universal(BaseSDK):
|
|
|
1656
1664
|
tokens securely and efficiently, enabling seamless transactions and operations
|
|
1657
1665
|
within the DeFi ecosystem.
|
|
1658
1666
|
|
|
1659
|
-
:param token: The symbol or address of the token for which the allowance is
|
|
1660
|
-
:param
|
|
1661
|
-
:param amount: The amount to
|
|
1667
|
+
:param token: The symbol or address of the token for which the allowance is set..
|
|
1668
|
+
:param contract: The name or address of the contract to set spending allowance for.
|
|
1669
|
+
:param amount: The amount to set the allowance to.
|
|
1662
1670
|
:param chain: The chain to use.
|
|
1663
1671
|
:param sender: The address of the transaction sender.
|
|
1664
1672
|
:param retries: Override the default retry configuration for this method
|
|
@@ -1676,9 +1684,9 @@ class Universal(BaseSDK):
|
|
|
1676
1684
|
else:
|
|
1677
1685
|
base_url = self._get_url(base_url, url_variables)
|
|
1678
1686
|
|
|
1679
|
-
request = models.
|
|
1687
|
+
request = models.SetAllowanceRequest(
|
|
1680
1688
|
token=token,
|
|
1681
|
-
|
|
1689
|
+
contract=contract,
|
|
1682
1690
|
amount=amount,
|
|
1683
1691
|
chain=chain,
|
|
1684
1692
|
sender=sender,
|
|
@@ -1698,7 +1706,7 @@ class Universal(BaseSDK):
|
|
|
1698
1706
|
http_headers=http_headers,
|
|
1699
1707
|
security=self.sdk_configuration.security,
|
|
1700
1708
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1701
|
-
request, False, False, "json", models.
|
|
1709
|
+
request, False, False, "json", models.SetAllowanceRequest
|
|
1702
1710
|
),
|
|
1703
1711
|
timeout_ms=timeout_ms,
|
|
1704
1712
|
)
|