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
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
|
)
|
|
@@ -0,0 +1,477 @@
|
|
|
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, Union
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VaultsERC4626(BaseSDK):
|
|
11
|
+
def deposit(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
vault_address: str,
|
|
15
|
+
amount: Union[
|
|
16
|
+
models.VaultDepositRequestAmount, models.VaultDepositRequestAmountTypedDict
|
|
17
|
+
],
|
|
18
|
+
chain: models.Chain,
|
|
19
|
+
sender: str,
|
|
20
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
21
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
22
|
+
server_url: Optional[str] = None,
|
|
23
|
+
timeout_ms: Optional[int] = None,
|
|
24
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
25
|
+
) -> models.TxResponse:
|
|
26
|
+
r"""Deposit to Vault
|
|
27
|
+
|
|
28
|
+
Deposit tokens into a Vault (ERC-4626 Standard) to earn passive yield.
|
|
29
|
+
|
|
30
|
+
Each vault accepts one unique token that can be deposited.
|
|
31
|
+
|
|
32
|
+
:param vault_address: The vault address you are depositing to.
|
|
33
|
+
:param amount: The amount of tokens to deposit into the vault.
|
|
34
|
+
:param chain: The chain to use.
|
|
35
|
+
:param sender: The address of the transaction sender.
|
|
36
|
+
:param receiver: The address which will receive the shares from the vault representing their proportional ownership of the vault's assets. Defaults to the sender.
|
|
37
|
+
:param retries: Override the default retry configuration for this method
|
|
38
|
+
:param server_url: Override the default server URL for this method
|
|
39
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
40
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
41
|
+
"""
|
|
42
|
+
base_url = None
|
|
43
|
+
url_variables = None
|
|
44
|
+
if timeout_ms is None:
|
|
45
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
46
|
+
|
|
47
|
+
if server_url is not None:
|
|
48
|
+
base_url = server_url
|
|
49
|
+
else:
|
|
50
|
+
base_url = self._get_url(base_url, url_variables)
|
|
51
|
+
|
|
52
|
+
request = models.VaultDepositRequest(
|
|
53
|
+
vault_address=vault_address,
|
|
54
|
+
amount=amount,
|
|
55
|
+
receiver=receiver,
|
|
56
|
+
chain=chain,
|
|
57
|
+
sender=sender,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
req = self._build_request(
|
|
61
|
+
method="POST",
|
|
62
|
+
path="/v0/vaults/deposit",
|
|
63
|
+
base_url=base_url,
|
|
64
|
+
url_variables=url_variables,
|
|
65
|
+
request=request,
|
|
66
|
+
request_body_required=True,
|
|
67
|
+
request_has_path_params=False,
|
|
68
|
+
request_has_query_params=True,
|
|
69
|
+
user_agent_header="user-agent",
|
|
70
|
+
accept_header_value="application/json",
|
|
71
|
+
http_headers=http_headers,
|
|
72
|
+
security=self.sdk_configuration.security,
|
|
73
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
74
|
+
request, False, False, "json", models.VaultDepositRequest
|
|
75
|
+
),
|
|
76
|
+
timeout_ms=timeout_ms,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
if retries == UNSET:
|
|
80
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
81
|
+
retries = self.sdk_configuration.retry_config
|
|
82
|
+
|
|
83
|
+
retry_config = None
|
|
84
|
+
if isinstance(retries, utils.RetryConfig):
|
|
85
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
86
|
+
|
|
87
|
+
http_res = self.do_request(
|
|
88
|
+
hook_ctx=HookContext(
|
|
89
|
+
config=self.sdk_configuration,
|
|
90
|
+
base_url=base_url or "",
|
|
91
|
+
operation_id="vaults_deposit",
|
|
92
|
+
oauth2_scopes=[],
|
|
93
|
+
security_source=self.sdk_configuration.security,
|
|
94
|
+
),
|
|
95
|
+
request=req,
|
|
96
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
97
|
+
retry_config=retry_config,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
response_data: Any = None
|
|
101
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
102
|
+
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
103
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
104
|
+
response_data = utils.unmarshal_json(
|
|
105
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
106
|
+
)
|
|
107
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
108
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
109
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
110
|
+
raise errors.APIError(
|
|
111
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
112
|
+
)
|
|
113
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
114
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
115
|
+
raise errors.APIError(
|
|
116
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
content_type = http_res.headers.get("Content-Type")
|
|
120
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
121
|
+
raise errors.APIError(
|
|
122
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
123
|
+
http_res.status_code,
|
|
124
|
+
http_res_text,
|
|
125
|
+
http_res,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def deposit_async(
|
|
129
|
+
self,
|
|
130
|
+
*,
|
|
131
|
+
vault_address: str,
|
|
132
|
+
amount: Union[
|
|
133
|
+
models.VaultDepositRequestAmount, models.VaultDepositRequestAmountTypedDict
|
|
134
|
+
],
|
|
135
|
+
chain: models.Chain,
|
|
136
|
+
sender: str,
|
|
137
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
138
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
139
|
+
server_url: Optional[str] = None,
|
|
140
|
+
timeout_ms: Optional[int] = None,
|
|
141
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
142
|
+
) -> models.TxResponse:
|
|
143
|
+
r"""Deposit to Vault
|
|
144
|
+
|
|
145
|
+
Deposit tokens into a Vault (ERC-4626 Standard) to earn passive yield.
|
|
146
|
+
|
|
147
|
+
Each vault accepts one unique token that can be deposited.
|
|
148
|
+
|
|
149
|
+
:param vault_address: The vault address you are depositing to.
|
|
150
|
+
:param amount: The amount of tokens to deposit into the vault.
|
|
151
|
+
:param chain: The chain to use.
|
|
152
|
+
:param sender: The address of the transaction sender.
|
|
153
|
+
:param receiver: The address which will receive the shares from the vault representing their proportional ownership of the vault's assets. Defaults to the sender.
|
|
154
|
+
:param retries: Override the default retry configuration for this method
|
|
155
|
+
:param server_url: Override the default server URL for this method
|
|
156
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
157
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
158
|
+
"""
|
|
159
|
+
base_url = None
|
|
160
|
+
url_variables = None
|
|
161
|
+
if timeout_ms is None:
|
|
162
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
163
|
+
|
|
164
|
+
if server_url is not None:
|
|
165
|
+
base_url = server_url
|
|
166
|
+
else:
|
|
167
|
+
base_url = self._get_url(base_url, url_variables)
|
|
168
|
+
|
|
169
|
+
request = models.VaultDepositRequest(
|
|
170
|
+
vault_address=vault_address,
|
|
171
|
+
amount=amount,
|
|
172
|
+
receiver=receiver,
|
|
173
|
+
chain=chain,
|
|
174
|
+
sender=sender,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
req = self._build_request_async(
|
|
178
|
+
method="POST",
|
|
179
|
+
path="/v0/vaults/deposit",
|
|
180
|
+
base_url=base_url,
|
|
181
|
+
url_variables=url_variables,
|
|
182
|
+
request=request,
|
|
183
|
+
request_body_required=True,
|
|
184
|
+
request_has_path_params=False,
|
|
185
|
+
request_has_query_params=True,
|
|
186
|
+
user_agent_header="user-agent",
|
|
187
|
+
accept_header_value="application/json",
|
|
188
|
+
http_headers=http_headers,
|
|
189
|
+
security=self.sdk_configuration.security,
|
|
190
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
191
|
+
request, False, False, "json", models.VaultDepositRequest
|
|
192
|
+
),
|
|
193
|
+
timeout_ms=timeout_ms,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
if retries == UNSET:
|
|
197
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
198
|
+
retries = self.sdk_configuration.retry_config
|
|
199
|
+
|
|
200
|
+
retry_config = None
|
|
201
|
+
if isinstance(retries, utils.RetryConfig):
|
|
202
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
203
|
+
|
|
204
|
+
http_res = await self.do_request_async(
|
|
205
|
+
hook_ctx=HookContext(
|
|
206
|
+
config=self.sdk_configuration,
|
|
207
|
+
base_url=base_url or "",
|
|
208
|
+
operation_id="vaults_deposit",
|
|
209
|
+
oauth2_scopes=[],
|
|
210
|
+
security_source=self.sdk_configuration.security,
|
|
211
|
+
),
|
|
212
|
+
request=req,
|
|
213
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
214
|
+
retry_config=retry_config,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
response_data: Any = None
|
|
218
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
219
|
+
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
220
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
221
|
+
response_data = utils.unmarshal_json(
|
|
222
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
223
|
+
)
|
|
224
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
225
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
226
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
227
|
+
raise errors.APIError(
|
|
228
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
229
|
+
)
|
|
230
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
231
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
232
|
+
raise errors.APIError(
|
|
233
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
content_type = http_res.headers.get("Content-Type")
|
|
237
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
238
|
+
raise errors.APIError(
|
|
239
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
240
|
+
http_res.status_code,
|
|
241
|
+
http_res_text,
|
|
242
|
+
http_res,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
def withdraw(
|
|
246
|
+
self,
|
|
247
|
+
*,
|
|
248
|
+
vault_address: str,
|
|
249
|
+
amount: Any,
|
|
250
|
+
chain: models.Chain,
|
|
251
|
+
sender: str,
|
|
252
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
253
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
254
|
+
server_url: Optional[str] = None,
|
|
255
|
+
timeout_ms: Optional[int] = None,
|
|
256
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
257
|
+
) -> models.TxResponse:
|
|
258
|
+
r"""Withdraw from Vault
|
|
259
|
+
|
|
260
|
+
Withdraw deposited tokens from a Vault (ERC-4626 Standard).
|
|
261
|
+
|
|
262
|
+
The passive yield earned on token deposits is represented by the increased value of
|
|
263
|
+
the shares received upon depositing tokens. Trade in these shares for the tokens you
|
|
264
|
+
deposited plus any accrued yield.
|
|
265
|
+
|
|
266
|
+
:param vault_address: The vault address you are withdrawing from.
|
|
267
|
+
:param amount: The amount of tokens to withdraw from the vault. If set to 'ALL', your total deposited token amount will be withdrawn.
|
|
268
|
+
:param chain: The chain to use.
|
|
269
|
+
:param sender: The address of the transaction sender.
|
|
270
|
+
:param receiver: The address which will receive the tokens withdrawn. Defaults to the sender.
|
|
271
|
+
:param retries: Override the default retry configuration for this method
|
|
272
|
+
:param server_url: Override the default server URL for this method
|
|
273
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
274
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
275
|
+
"""
|
|
276
|
+
base_url = None
|
|
277
|
+
url_variables = None
|
|
278
|
+
if timeout_ms is None:
|
|
279
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
280
|
+
|
|
281
|
+
if server_url is not None:
|
|
282
|
+
base_url = server_url
|
|
283
|
+
else:
|
|
284
|
+
base_url = self._get_url(base_url, url_variables)
|
|
285
|
+
|
|
286
|
+
request = models.VaultWithdrawRequest(
|
|
287
|
+
vault_address=vault_address,
|
|
288
|
+
amount=amount,
|
|
289
|
+
receiver=receiver,
|
|
290
|
+
chain=chain,
|
|
291
|
+
sender=sender,
|
|
292
|
+
)
|
|
293
|
+
|
|
294
|
+
req = self._build_request(
|
|
295
|
+
method="POST",
|
|
296
|
+
path="/v0/vaults/withdraw",
|
|
297
|
+
base_url=base_url,
|
|
298
|
+
url_variables=url_variables,
|
|
299
|
+
request=request,
|
|
300
|
+
request_body_required=True,
|
|
301
|
+
request_has_path_params=False,
|
|
302
|
+
request_has_query_params=True,
|
|
303
|
+
user_agent_header="user-agent",
|
|
304
|
+
accept_header_value="application/json",
|
|
305
|
+
http_headers=http_headers,
|
|
306
|
+
security=self.sdk_configuration.security,
|
|
307
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
308
|
+
request, False, False, "json", models.VaultWithdrawRequest
|
|
309
|
+
),
|
|
310
|
+
timeout_ms=timeout_ms,
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
if retries == UNSET:
|
|
314
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
315
|
+
retries = self.sdk_configuration.retry_config
|
|
316
|
+
|
|
317
|
+
retry_config = None
|
|
318
|
+
if isinstance(retries, utils.RetryConfig):
|
|
319
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
320
|
+
|
|
321
|
+
http_res = self.do_request(
|
|
322
|
+
hook_ctx=HookContext(
|
|
323
|
+
config=self.sdk_configuration,
|
|
324
|
+
base_url=base_url or "",
|
|
325
|
+
operation_id="vaults_withdraw",
|
|
326
|
+
oauth2_scopes=[],
|
|
327
|
+
security_source=self.sdk_configuration.security,
|
|
328
|
+
),
|
|
329
|
+
request=req,
|
|
330
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
331
|
+
retry_config=retry_config,
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
response_data: Any = None
|
|
335
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
336
|
+
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
337
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
338
|
+
response_data = utils.unmarshal_json(
|
|
339
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
340
|
+
)
|
|
341
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
342
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
343
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
344
|
+
raise errors.APIError(
|
|
345
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
346
|
+
)
|
|
347
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
348
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
349
|
+
raise errors.APIError(
|
|
350
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
content_type = http_res.headers.get("Content-Type")
|
|
354
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
355
|
+
raise errors.APIError(
|
|
356
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
357
|
+
http_res.status_code,
|
|
358
|
+
http_res_text,
|
|
359
|
+
http_res,
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
async def withdraw_async(
|
|
363
|
+
self,
|
|
364
|
+
*,
|
|
365
|
+
vault_address: str,
|
|
366
|
+
amount: Any,
|
|
367
|
+
chain: models.Chain,
|
|
368
|
+
sender: str,
|
|
369
|
+
receiver: OptionalNullable[str] = UNSET,
|
|
370
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
371
|
+
server_url: Optional[str] = None,
|
|
372
|
+
timeout_ms: Optional[int] = None,
|
|
373
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
374
|
+
) -> models.TxResponse:
|
|
375
|
+
r"""Withdraw from Vault
|
|
376
|
+
|
|
377
|
+
Withdraw deposited tokens from a Vault (ERC-4626 Standard).
|
|
378
|
+
|
|
379
|
+
The passive yield earned on token deposits is represented by the increased value of
|
|
380
|
+
the shares received upon depositing tokens. Trade in these shares for the tokens you
|
|
381
|
+
deposited plus any accrued yield.
|
|
382
|
+
|
|
383
|
+
:param vault_address: The vault address you are withdrawing from.
|
|
384
|
+
:param amount: The amount of tokens to withdraw from the vault. If set to 'ALL', your total deposited token amount will be withdrawn.
|
|
385
|
+
:param chain: The chain to use.
|
|
386
|
+
:param sender: The address of the transaction sender.
|
|
387
|
+
:param receiver: The address which will receive the tokens withdrawn. Defaults to the sender.
|
|
388
|
+
:param retries: Override the default retry configuration for this method
|
|
389
|
+
:param server_url: Override the default server URL for this method
|
|
390
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
391
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
392
|
+
"""
|
|
393
|
+
base_url = None
|
|
394
|
+
url_variables = None
|
|
395
|
+
if timeout_ms is None:
|
|
396
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
397
|
+
|
|
398
|
+
if server_url is not None:
|
|
399
|
+
base_url = server_url
|
|
400
|
+
else:
|
|
401
|
+
base_url = self._get_url(base_url, url_variables)
|
|
402
|
+
|
|
403
|
+
request = models.VaultWithdrawRequest(
|
|
404
|
+
vault_address=vault_address,
|
|
405
|
+
amount=amount,
|
|
406
|
+
receiver=receiver,
|
|
407
|
+
chain=chain,
|
|
408
|
+
sender=sender,
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
req = self._build_request_async(
|
|
412
|
+
method="POST",
|
|
413
|
+
path="/v0/vaults/withdraw",
|
|
414
|
+
base_url=base_url,
|
|
415
|
+
url_variables=url_variables,
|
|
416
|
+
request=request,
|
|
417
|
+
request_body_required=True,
|
|
418
|
+
request_has_path_params=False,
|
|
419
|
+
request_has_query_params=True,
|
|
420
|
+
user_agent_header="user-agent",
|
|
421
|
+
accept_header_value="application/json",
|
|
422
|
+
http_headers=http_headers,
|
|
423
|
+
security=self.sdk_configuration.security,
|
|
424
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
425
|
+
request, False, False, "json", models.VaultWithdrawRequest
|
|
426
|
+
),
|
|
427
|
+
timeout_ms=timeout_ms,
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
if retries == UNSET:
|
|
431
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
432
|
+
retries = self.sdk_configuration.retry_config
|
|
433
|
+
|
|
434
|
+
retry_config = None
|
|
435
|
+
if isinstance(retries, utils.RetryConfig):
|
|
436
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
437
|
+
|
|
438
|
+
http_res = await self.do_request_async(
|
|
439
|
+
hook_ctx=HookContext(
|
|
440
|
+
config=self.sdk_configuration,
|
|
441
|
+
base_url=base_url or "",
|
|
442
|
+
operation_id="vaults_withdraw",
|
|
443
|
+
oauth2_scopes=[],
|
|
444
|
+
security_source=self.sdk_configuration.security,
|
|
445
|
+
),
|
|
446
|
+
request=req,
|
|
447
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
448
|
+
retry_config=retry_config,
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
response_data: Any = None
|
|
452
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
453
|
+
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
454
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
455
|
+
response_data = utils.unmarshal_json(
|
|
456
|
+
http_res.text, errors.HTTPValidationErrorData
|
|
457
|
+
)
|
|
458
|
+
raise errors.HTTPValidationError(data=response_data)
|
|
459
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
460
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
461
|
+
raise errors.APIError(
|
|
462
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
463
|
+
)
|
|
464
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
465
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
466
|
+
raise errors.APIError(
|
|
467
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
468
|
+
)
|
|
469
|
+
|
|
470
|
+
content_type = http_res.headers.get("Content-Type")
|
|
471
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
472
|
+
raise errors.APIError(
|
|
473
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
474
|
+
http_res.status_code,
|
|
475
|
+
http_res_text,
|
|
476
|
+
http_res,
|
|
477
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: compass_api_sdk
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.23
|
|
4
4
|
Summary: Compass API SDK.
|
|
5
5
|
Author: royalnine
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -227,7 +227,6 @@ with CompassAPI(
|
|
|
227
227
|
* [market](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#market) - Get Market
|
|
228
228
|
* [market_position](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#market_position) - Check Market Position
|
|
229
229
|
* [user_position](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#user_position) - Check User Position
|
|
230
|
-
* [allowance](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#allowance) - Set Allowance for Vault
|
|
231
230
|
* [deposit](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#deposit) - Deposit to Vault
|
|
232
231
|
* [withdraw](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#withdraw) - Withdraw from Vault
|
|
233
232
|
* [supply_collateral](https://github.com/CompassLabs/mono/blob/master/docs/sdks/morpho/README.md#supply_collateral) - Supply Collateral to Market
|
|
@@ -298,6 +297,11 @@ with CompassAPI(
|
|
|
298
297
|
* [unwrap_weth](https://github.com/CompassLabs/mono/blob/master/docs/sdks/universal/README.md#unwrap_weth) - Unwrap WETH
|
|
299
298
|
* [allowance_set](https://github.com/CompassLabs/mono/blob/master/docs/sdks/universal/README.md#allowance_set) - Set Allowance
|
|
300
299
|
|
|
300
|
+
### [vaults_erc_4626](https://github.com/CompassLabs/mono/blob/master/docs/sdks/vaultserc4626/README.md)
|
|
301
|
+
|
|
302
|
+
* [deposit](https://github.com/CompassLabs/mono/blob/master/docs/sdks/vaultserc4626/README.md#deposit) - Deposit to Vault
|
|
303
|
+
* [withdraw](https://github.com/CompassLabs/mono/blob/master/docs/sdks/vaultserc4626/README.md#withdraw) - Withdraw from Vault
|
|
304
|
+
|
|
301
305
|
</details>
|
|
302
306
|
<!-- End Available Resources and Operations [operations] -->
|
|
303
307
|
|