compass_api_sdk 2.0.21rc1__py3-none-any.whl → 2.2.1rc3__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.
- compass_api_sdk/_version.py +2 -2
- compass_api_sdk/earn.py +360 -114
- compass_api_sdk/gas_sponsorship.py +38 -26
- compass_api_sdk/models/__init__.py +65 -9
- compass_api_sdk/models/aaveposition.py +80 -25
- compass_api_sdk/models/approvetransferrequest.py +2 -2
- compass_api_sdk/models/batchedsafeoperationsresponse_input.py +4 -4
- compass_api_sdk/models/batchedsafeoperationsresponse_output.py +4 -4
- compass_api_sdk/models/compass_api_backend_v2_models_earn_read_response_positions_vaultposition.py +72 -18
- compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712domain.py +6 -6
- compass_api_sdk/models/depositevent.py +61 -0
- compass_api_sdk/models/earnmanageparams.py +8 -6
- compass_api_sdk/models/earnmanagerequest.py +6 -4
- compass_api_sdk/models/earnpositionsresponse.py +31 -22
- compass_api_sdk/models/fee.py +8 -7
- compass_api_sdk/models/pendledepositevent.py +49 -0
- compass_api_sdk/models/pendlemarketinfo.py +138 -0
- compass_api_sdk/models/pendlemarketsresponse.py +30 -0
- compass_api_sdk/models/pendleptposition.py +111 -0
- compass_api_sdk/models/pendleptvenue.py +78 -0
- compass_api_sdk/models/pendlewithdrawalevent.py +54 -0
- compass_api_sdk/models/positionpnl.py +52 -0
- compass_api_sdk/models/safetxmessage.py +6 -6
- compass_api_sdk/models/sponsorgasrequest.py +2 -2
- compass_api_sdk/models/v2_earn_pendle_marketsop.py +105 -0
- compass_api_sdk/models/v2_earn_positionsop.py +5 -30
- compass_api_sdk/models/v2_earn_vaultsop.py +3 -3
- compass_api_sdk/models/withdrawalevent.py +61 -0
- compass_api_sdk/types/basemodel.py +41 -3
- compass_api_sdk/utils/__init__.py +0 -3
- compass_api_sdk/utils/enums.py +60 -0
- compass_api_sdk/utils/requestbodies.py +3 -3
- compass_api_sdk/utils/serializers.py +0 -20
- {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/METADATA +3 -2
- {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/RECORD +36 -26
- {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/WHEEL +0 -0
compass_api_sdk/earn.py
CHANGED
|
@@ -13,10 +13,7 @@ class Earn(BaseSDK):
|
|
|
13
13
|
self,
|
|
14
14
|
*,
|
|
15
15
|
chain: models.V2EarnPositionsChain,
|
|
16
|
-
|
|
17
|
-
offset: Optional[int] = None,
|
|
18
|
-
limit: Optional[int] = None,
|
|
19
|
-
days: Optional[int] = None,
|
|
16
|
+
owner: str,
|
|
20
17
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
21
18
|
server_url: Optional[str] = None,
|
|
22
19
|
timeout_ms: Optional[int] = None,
|
|
@@ -24,13 +21,17 @@ class Earn(BaseSDK):
|
|
|
24
21
|
) -> models.EarnPositionsResponse:
|
|
25
22
|
r"""List earn positions
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
List all Earn positions for a given owner with PnL tracking.
|
|
25
|
+
|
|
26
|
+
Returns position data including current balance, cost basis, and profit and loss.
|
|
27
|
+
Use this endpoint to display portfolio performance, track yields over time, or build
|
|
28
|
+
position management interfaces.
|
|
29
|
+
|
|
30
|
+
Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
31
|
+
position includes the venue address, deposited amount, and performance metrics.
|
|
28
32
|
|
|
29
33
|
:param chain:
|
|
30
|
-
:param
|
|
31
|
-
:param offset: The offset of the first item to return.
|
|
32
|
-
:param limit: The number of items to return.
|
|
33
|
-
:param days: How many days back from the current time to include in the blockchain scan.
|
|
34
|
+
:param owner: The address of the owner of the earn account to get positions for.
|
|
34
35
|
:param retries: Override the default retry configuration for this method
|
|
35
36
|
:param server_url: Override the default server URL for this method
|
|
36
37
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -47,11 +48,8 @@ class Earn(BaseSDK):
|
|
|
47
48
|
base_url = self._get_url(base_url, url_variables)
|
|
48
49
|
|
|
49
50
|
request = models.V2EarnPositionsRequest(
|
|
50
|
-
offset=offset,
|
|
51
|
-
limit=limit,
|
|
52
51
|
chain=chain,
|
|
53
|
-
|
|
54
|
-
days=days,
|
|
52
|
+
owner=owner,
|
|
55
53
|
)
|
|
56
54
|
|
|
57
55
|
req = self._build_request(
|
|
@@ -113,10 +111,7 @@ class Earn(BaseSDK):
|
|
|
113
111
|
self,
|
|
114
112
|
*,
|
|
115
113
|
chain: models.V2EarnPositionsChain,
|
|
116
|
-
|
|
117
|
-
offset: Optional[int] = None,
|
|
118
|
-
limit: Optional[int] = None,
|
|
119
|
-
days: Optional[int] = None,
|
|
114
|
+
owner: str,
|
|
120
115
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
116
|
server_url: Optional[str] = None,
|
|
122
117
|
timeout_ms: Optional[int] = None,
|
|
@@ -124,13 +119,17 @@ class Earn(BaseSDK):
|
|
|
124
119
|
) -> models.EarnPositionsResponse:
|
|
125
120
|
r"""List earn positions
|
|
126
121
|
|
|
127
|
-
|
|
122
|
+
List all Earn positions for a given owner with PnL tracking.
|
|
123
|
+
|
|
124
|
+
Returns position data including current balance, cost basis, and profit and loss.
|
|
125
|
+
Use this endpoint to display portfolio performance, track yields over time, or build
|
|
126
|
+
position management interfaces.
|
|
127
|
+
|
|
128
|
+
Positions are tracked across all venue types (vaults and Aave markets). Each
|
|
129
|
+
position includes the venue address, deposited amount, and performance metrics.
|
|
128
130
|
|
|
129
131
|
:param chain:
|
|
130
|
-
:param
|
|
131
|
-
:param offset: The offset of the first item to return.
|
|
132
|
-
:param limit: The number of items to return.
|
|
133
|
-
:param days: How many days back from the current time to include in the blockchain scan.
|
|
132
|
+
:param owner: The address of the owner of the earn account to get positions for.
|
|
134
133
|
:param retries: Override the default retry configuration for this method
|
|
135
134
|
:param server_url: Override the default server URL for this method
|
|
136
135
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -147,11 +146,8 @@ class Earn(BaseSDK):
|
|
|
147
146
|
base_url = self._get_url(base_url, url_variables)
|
|
148
147
|
|
|
149
148
|
request = models.V2EarnPositionsRequest(
|
|
150
|
-
offset=offset,
|
|
151
|
-
limit=limit,
|
|
152
149
|
chain=chain,
|
|
153
|
-
|
|
154
|
-
days=days,
|
|
150
|
+
owner=owner,
|
|
155
151
|
)
|
|
156
152
|
|
|
157
153
|
req = self._build_request_async(
|
|
@@ -213,7 +209,7 @@ class Earn(BaseSDK):
|
|
|
213
209
|
self,
|
|
214
210
|
*,
|
|
215
211
|
order_by: str,
|
|
216
|
-
direction: Optional[models.
|
|
212
|
+
direction: Optional[models.V2EarnVaultsDirection] = None,
|
|
217
213
|
offset: Optional[int] = None,
|
|
218
214
|
limit: Optional[int] = None,
|
|
219
215
|
chain: OptionalNullable[models.Chain] = UNSET,
|
|
@@ -225,9 +221,13 @@ class Earn(BaseSDK):
|
|
|
225
221
|
) -> models.VaultsResponse:
|
|
226
222
|
r"""List vaults
|
|
227
223
|
|
|
228
|
-
List
|
|
224
|
+
List ERC-4626 yield vaults across DeFi venues.
|
|
225
|
+
|
|
226
|
+
Returns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.
|
|
227
|
+
|
|
228
|
+
Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
231
231
|
|
|
232
232
|
:param order_by: The field to order the results by.
|
|
233
233
|
:param direction: The direction to order the results by.
|
|
@@ -318,7 +318,7 @@ class Earn(BaseSDK):
|
|
|
318
318
|
self,
|
|
319
319
|
*,
|
|
320
320
|
order_by: str,
|
|
321
|
-
direction: Optional[models.
|
|
321
|
+
direction: Optional[models.V2EarnVaultsDirection] = None,
|
|
322
322
|
offset: Optional[int] = None,
|
|
323
323
|
limit: Optional[int] = None,
|
|
324
324
|
chain: OptionalNullable[models.Chain] = UNSET,
|
|
@@ -330,9 +330,13 @@ class Earn(BaseSDK):
|
|
|
330
330
|
) -> models.VaultsResponse:
|
|
331
331
|
r"""List vaults
|
|
332
332
|
|
|
333
|
-
List
|
|
333
|
+
List ERC-4626 yield vaults across DeFi venues.
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
Returns vault data including APY, TVL, and underlying asset information. Use this endpoint to discover yield opportunities, compare rates across venues, or build vault selection interfaces.
|
|
336
|
+
|
|
337
|
+
Supports dozens of vaults and markets like Morpho and other ERC-4626 compatible yield venues.
|
|
338
|
+
|
|
339
|
+
To deposit into a vault, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=VAULTS`.
|
|
336
340
|
|
|
337
341
|
:param order_by: The field to order the results by.
|
|
338
342
|
:param direction: The direction to order the results by.
|
|
@@ -430,16 +434,13 @@ class Earn(BaseSDK):
|
|
|
430
434
|
) -> models.ListAaveMarketsResponse:
|
|
431
435
|
r"""List aave markets
|
|
432
436
|
|
|
433
|
-
List
|
|
437
|
+
List Aave lending markets with supply and borrow rates.
|
|
434
438
|
|
|
435
|
-
Returns rates organized by token symbol, with chain-specific data for each token.
|
|
436
|
-
Each token includes rates for all chains where it's available, plus information
|
|
437
|
-
about which chain offers the highest supply APY.
|
|
439
|
+
Returns rates organized by token symbol, with chain-specific data for each token. Each token includes rates for all chains where it's available, plus information about which chain offers the highest supply APY.
|
|
438
440
|
|
|
439
|
-
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
440
|
-
zero APY on both supply and borrow are excluded.
|
|
441
|
+
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with zero APY on both supply and borrow are excluded.
|
|
441
442
|
|
|
442
|
-
|
|
443
|
+
To deposit into an Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=AAVE`.
|
|
443
444
|
|
|
444
445
|
:param chain: Optional chain filter. If not provided, returns rates for all chains.
|
|
445
446
|
:param retries: Override the default retry configuration for this method
|
|
@@ -527,16 +528,13 @@ class Earn(BaseSDK):
|
|
|
527
528
|
) -> models.ListAaveMarketsResponse:
|
|
528
529
|
r"""List aave markets
|
|
529
530
|
|
|
530
|
-
List
|
|
531
|
+
List Aave lending markets with supply and borrow rates.
|
|
531
532
|
|
|
532
|
-
Returns rates organized by token symbol, with chain-specific data for each token.
|
|
533
|
-
Each token includes rates for all chains where it's available, plus information
|
|
534
|
-
about which chain offers the highest supply APY.
|
|
533
|
+
Returns rates organized by token symbol, with chain-specific data for each token. Each token includes rates for all chains where it's available, plus information about which chain offers the highest supply APY.
|
|
535
534
|
|
|
536
|
-
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with
|
|
537
|
-
zero APY on both supply and borrow are excluded.
|
|
535
|
+
APY values are returned in percentage format (e.g., 4.5 means 4.5%). Tokens with zero APY on both supply and borrow are excluded.
|
|
538
536
|
|
|
539
|
-
|
|
537
|
+
To deposit into an Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position) with `venue_type=AAVE`.
|
|
540
538
|
|
|
541
539
|
:param chain: Optional chain filter. If not provided, returns rates for all chains.
|
|
542
540
|
:param retries: Override the default retry configuration for this method
|
|
@@ -613,6 +611,230 @@ class Earn(BaseSDK):
|
|
|
613
611
|
|
|
614
612
|
raise errors.APIError("Unexpected response received", http_res)
|
|
615
613
|
|
|
614
|
+
def earn_pendle_markets(
|
|
615
|
+
self,
|
|
616
|
+
*,
|
|
617
|
+
order_by: str,
|
|
618
|
+
direction: Optional[models.V2EarnPendleMarketsDirection] = None,
|
|
619
|
+
offset: Optional[int] = None,
|
|
620
|
+
limit: Optional[int] = None,
|
|
621
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
622
|
+
underlying_symbol: OptionalNullable[str] = UNSET,
|
|
623
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
624
|
+
server_url: Optional[str] = None,
|
|
625
|
+
timeout_ms: Optional[int] = None,
|
|
626
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
627
|
+
) -> models.PendleMarketsResponse:
|
|
628
|
+
r"""List pendle markets
|
|
629
|
+
|
|
630
|
+
List Pendle yield trading markets with TVL and implied APY.
|
|
631
|
+
|
|
632
|
+
Returns Pendle market data including Principal Token (PT), Standardized Yield (SY),
|
|
633
|
+
and Yield Token (YT) addresses, along with market expiry, TVL, and implied APY.
|
|
634
|
+
|
|
635
|
+
Use this endpoint to discover yield trading opportunities, compare rates across
|
|
636
|
+
Pendle markets, or build market selection interfaces.
|
|
637
|
+
|
|
638
|
+
APY values are returned in percentage format (e.g., 5.25 means 5.25%). Markets
|
|
639
|
+
without complete metadata or statistics are excluded.
|
|
640
|
+
|
|
641
|
+
:param order_by: The field to order the results by.
|
|
642
|
+
:param direction: The direction to order the results by.
|
|
643
|
+
:param offset: The offset of the first item to return.
|
|
644
|
+
:param limit: The number of items to return.
|
|
645
|
+
:param chain: Optional chain filter. If not provided, returns markets for all chains.
|
|
646
|
+
:param underlying_symbol: Filter markets by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
647
|
+
:param retries: Override the default retry configuration for this method
|
|
648
|
+
:param server_url: Override the default server URL for this method
|
|
649
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
650
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
651
|
+
"""
|
|
652
|
+
base_url = None
|
|
653
|
+
url_variables = None
|
|
654
|
+
if timeout_ms is None:
|
|
655
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
656
|
+
|
|
657
|
+
if server_url is not None:
|
|
658
|
+
base_url = server_url
|
|
659
|
+
else:
|
|
660
|
+
base_url = self._get_url(base_url, url_variables)
|
|
661
|
+
|
|
662
|
+
request = models.V2EarnPendleMarketsRequest(
|
|
663
|
+
order_by=order_by,
|
|
664
|
+
direction=direction,
|
|
665
|
+
offset=offset,
|
|
666
|
+
limit=limit,
|
|
667
|
+
chain=chain,
|
|
668
|
+
underlying_symbol=underlying_symbol,
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
req = self._build_request(
|
|
672
|
+
method="GET",
|
|
673
|
+
path="/v2/earn/pendle_markets",
|
|
674
|
+
base_url=base_url,
|
|
675
|
+
url_variables=url_variables,
|
|
676
|
+
request=request,
|
|
677
|
+
request_body_required=False,
|
|
678
|
+
request_has_path_params=False,
|
|
679
|
+
request_has_query_params=True,
|
|
680
|
+
user_agent_header="user-agent",
|
|
681
|
+
accept_header_value="application/json",
|
|
682
|
+
http_headers=http_headers,
|
|
683
|
+
security=self.sdk_configuration.security,
|
|
684
|
+
allow_empty_value=None,
|
|
685
|
+
timeout_ms=timeout_ms,
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
if retries == UNSET:
|
|
689
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
690
|
+
retries = self.sdk_configuration.retry_config
|
|
691
|
+
|
|
692
|
+
retry_config = None
|
|
693
|
+
if isinstance(retries, utils.RetryConfig):
|
|
694
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
695
|
+
|
|
696
|
+
http_res = self.do_request(
|
|
697
|
+
hook_ctx=HookContext(
|
|
698
|
+
config=self.sdk_configuration,
|
|
699
|
+
base_url=base_url or "",
|
|
700
|
+
operation_id="v2_earn_pendle_markets",
|
|
701
|
+
oauth2_scopes=None,
|
|
702
|
+
security_source=self.sdk_configuration.security,
|
|
703
|
+
),
|
|
704
|
+
request=req,
|
|
705
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
706
|
+
retry_config=retry_config,
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
response_data: Any = None
|
|
710
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
711
|
+
return unmarshal_json_response(models.PendleMarketsResponse, http_res)
|
|
712
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
713
|
+
response_data = unmarshal_json_response(
|
|
714
|
+
errors.HTTPValidationErrorData, http_res
|
|
715
|
+
)
|
|
716
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
717
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
718
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
719
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
720
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
721
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
722
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
723
|
+
|
|
724
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
725
|
+
|
|
726
|
+
async def earn_pendle_markets_async(
|
|
727
|
+
self,
|
|
728
|
+
*,
|
|
729
|
+
order_by: str,
|
|
730
|
+
direction: Optional[models.V2EarnPendleMarketsDirection] = None,
|
|
731
|
+
offset: Optional[int] = None,
|
|
732
|
+
limit: Optional[int] = None,
|
|
733
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
734
|
+
underlying_symbol: OptionalNullable[str] = UNSET,
|
|
735
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
736
|
+
server_url: Optional[str] = None,
|
|
737
|
+
timeout_ms: Optional[int] = None,
|
|
738
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
739
|
+
) -> models.PendleMarketsResponse:
|
|
740
|
+
r"""List pendle markets
|
|
741
|
+
|
|
742
|
+
List Pendle yield trading markets with TVL and implied APY.
|
|
743
|
+
|
|
744
|
+
Returns Pendle market data including Principal Token (PT), Standardized Yield (SY),
|
|
745
|
+
and Yield Token (YT) addresses, along with market expiry, TVL, and implied APY.
|
|
746
|
+
|
|
747
|
+
Use this endpoint to discover yield trading opportunities, compare rates across
|
|
748
|
+
Pendle markets, or build market selection interfaces.
|
|
749
|
+
|
|
750
|
+
APY values are returned in percentage format (e.g., 5.25 means 5.25%). Markets
|
|
751
|
+
without complete metadata or statistics are excluded.
|
|
752
|
+
|
|
753
|
+
:param order_by: The field to order the results by.
|
|
754
|
+
:param direction: The direction to order the results by.
|
|
755
|
+
:param offset: The offset of the first item to return.
|
|
756
|
+
:param limit: The number of items to return.
|
|
757
|
+
:param chain: Optional chain filter. If not provided, returns markets for all chains.
|
|
758
|
+
:param underlying_symbol: Filter markets by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
759
|
+
:param retries: Override the default retry configuration for this method
|
|
760
|
+
:param server_url: Override the default server URL for this method
|
|
761
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
762
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
763
|
+
"""
|
|
764
|
+
base_url = None
|
|
765
|
+
url_variables = None
|
|
766
|
+
if timeout_ms is None:
|
|
767
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
768
|
+
|
|
769
|
+
if server_url is not None:
|
|
770
|
+
base_url = server_url
|
|
771
|
+
else:
|
|
772
|
+
base_url = self._get_url(base_url, url_variables)
|
|
773
|
+
|
|
774
|
+
request = models.V2EarnPendleMarketsRequest(
|
|
775
|
+
order_by=order_by,
|
|
776
|
+
direction=direction,
|
|
777
|
+
offset=offset,
|
|
778
|
+
limit=limit,
|
|
779
|
+
chain=chain,
|
|
780
|
+
underlying_symbol=underlying_symbol,
|
|
781
|
+
)
|
|
782
|
+
|
|
783
|
+
req = self._build_request_async(
|
|
784
|
+
method="GET",
|
|
785
|
+
path="/v2/earn/pendle_markets",
|
|
786
|
+
base_url=base_url,
|
|
787
|
+
url_variables=url_variables,
|
|
788
|
+
request=request,
|
|
789
|
+
request_body_required=False,
|
|
790
|
+
request_has_path_params=False,
|
|
791
|
+
request_has_query_params=True,
|
|
792
|
+
user_agent_header="user-agent",
|
|
793
|
+
accept_header_value="application/json",
|
|
794
|
+
http_headers=http_headers,
|
|
795
|
+
security=self.sdk_configuration.security,
|
|
796
|
+
allow_empty_value=None,
|
|
797
|
+
timeout_ms=timeout_ms,
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
if retries == UNSET:
|
|
801
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
802
|
+
retries = self.sdk_configuration.retry_config
|
|
803
|
+
|
|
804
|
+
retry_config = None
|
|
805
|
+
if isinstance(retries, utils.RetryConfig):
|
|
806
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
807
|
+
|
|
808
|
+
http_res = await self.do_request_async(
|
|
809
|
+
hook_ctx=HookContext(
|
|
810
|
+
config=self.sdk_configuration,
|
|
811
|
+
base_url=base_url or "",
|
|
812
|
+
operation_id="v2_earn_pendle_markets",
|
|
813
|
+
oauth2_scopes=None,
|
|
814
|
+
security_source=self.sdk_configuration.security,
|
|
815
|
+
),
|
|
816
|
+
request=req,
|
|
817
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
818
|
+
retry_config=retry_config,
|
|
819
|
+
)
|
|
820
|
+
|
|
821
|
+
response_data: Any = None
|
|
822
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
823
|
+
return unmarshal_json_response(models.PendleMarketsResponse, http_res)
|
|
824
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
825
|
+
response_data = unmarshal_json_response(
|
|
826
|
+
errors.HTTPValidationErrorData, http_res
|
|
827
|
+
)
|
|
828
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
829
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
830
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
831
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
832
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
833
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
834
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
835
|
+
|
|
836
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
837
|
+
|
|
616
838
|
def earn_create_account(
|
|
617
839
|
self,
|
|
618
840
|
*,
|
|
@@ -627,17 +849,15 @@ class Earn(BaseSDK):
|
|
|
627
849
|
) -> models.CreateAccountResponse:
|
|
628
850
|
r"""Create earn account
|
|
629
851
|
|
|
630
|
-
Create an Earn Account.
|
|
631
|
-
|
|
632
|
-
Before creating Earn positions, the `owner` must create an Earn Account associated with their wallet address.
|
|
852
|
+
Create an Earn Account for a wallet address.
|
|
633
853
|
|
|
634
|
-
|
|
854
|
+
Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
635
855
|
|
|
636
|
-
|
|
856
|
+
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
637
857
|
|
|
638
|
-
|
|
858
|
+
**If owner pays gas:** Set `sender` to the owner's address.
|
|
639
859
|
|
|
640
|
-
|
|
860
|
+
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
641
861
|
|
|
642
862
|
:param chain:
|
|
643
863
|
:param sender: The address of the transaction sender.
|
|
@@ -737,17 +957,15 @@ class Earn(BaseSDK):
|
|
|
737
957
|
) -> models.CreateAccountResponse:
|
|
738
958
|
r"""Create earn account
|
|
739
959
|
|
|
740
|
-
Create an Earn Account.
|
|
960
|
+
Create an Earn Account for a wallet address.
|
|
741
961
|
|
|
742
|
-
Before
|
|
962
|
+
Before depositing into venues or managing positions, the owner must create an Earn Account. Each wallet address has one Earn Account per chain.
|
|
743
963
|
|
|
744
|
-
|
|
964
|
+
Returns an unsigned transaction to create the account. The `sender` signs and broadcasts this transaction.
|
|
745
965
|
|
|
746
|
-
|
|
966
|
+
**If owner pays gas:** Set `sender` to the owner's address.
|
|
747
967
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
The creation of an Earn Account itself can be a gas-sponsored transaction by setting the `sender` to the wallet which will sign and send the transaction.
|
|
968
|
+
**If someone else pays gas:** Set `sender` to the wallet that will sign and broadcast the transaction on behalf of the owner.
|
|
751
969
|
|
|
752
970
|
:param chain:
|
|
753
971
|
:param sender: The address of the transaction sender.
|
|
@@ -852,14 +1070,23 @@ class Earn(BaseSDK):
|
|
|
852
1070
|
) -> models.EarnTransferResponse:
|
|
853
1071
|
r"""Transfer tokens to/from account
|
|
854
1072
|
|
|
855
|
-
Transfer tokens
|
|
1073
|
+
Transfer tokens between an owner's wallet and their Earn Account.
|
|
1074
|
+
|
|
1075
|
+
Use `DEPOSIT` to move tokens from the owner's wallet into their Earn Account. Use `WITHDRAW` to move tokens from the Earn Account back to the owner's wallet.
|
|
1076
|
+
|
|
1077
|
+
**Gas-sponsored deposits** require two steps:
|
|
856
1078
|
|
|
857
|
-
|
|
1079
|
+
**Step 1 (once per token):** Set up Permit2 allowance
|
|
1080
|
+
1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
1081
|
+
2. Owner signs the typed data
|
|
1082
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
858
1083
|
|
|
859
|
-
|
|
1084
|
+
**Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
1085
|
+
1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
1086
|
+
2. Owner signs the typed data
|
|
1087
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
860
1088
|
|
|
861
|
-
|
|
862
|
-
Once the one-time allowance is set for a given token and `gas_sponsorship` is set to 'true', EIP-712 typed data will be returned and can be signed off-chain by the user. This signature can then be submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where a `sender` can be set for the transaction.
|
|
1089
|
+
**Note:** This endpoint moves tokens to/from the Earn Account itself—not into yield venues. To deposit into a vault or Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position).
|
|
863
1090
|
|
|
864
1091
|
:param owner: The owner's wallet address.
|
|
865
1092
|
:param chain: The chain to use.
|
|
@@ -970,14 +1197,23 @@ class Earn(BaseSDK):
|
|
|
970
1197
|
) -> models.EarnTransferResponse:
|
|
971
1198
|
r"""Transfer tokens to/from account
|
|
972
1199
|
|
|
973
|
-
Transfer tokens
|
|
1200
|
+
Transfer tokens between an owner's wallet and their Earn Account.
|
|
974
1201
|
|
|
975
|
-
|
|
1202
|
+
Use `DEPOSIT` to move tokens from the owner's wallet into their Earn Account. Use `WITHDRAW` to move tokens from the Earn Account back to the owner's wallet.
|
|
976
1203
|
|
|
977
|
-
|
|
1204
|
+
**Gas-sponsored deposits** require two steps:
|
|
978
1205
|
|
|
979
|
-
|
|
980
|
-
|
|
1206
|
+
**Step 1 (once per token):** Set up Permit2 allowance
|
|
1207
|
+
1. Call [/gas_sponsorship/approve_transfer](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/approve-token-transfer) to get EIP-712 typed data
|
|
1208
|
+
2. Owner signs the typed data
|
|
1209
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
1210
|
+
|
|
1211
|
+
**Step 2 (each transfer):** Execute the gas-sponsored transfer
|
|
1212
|
+
1. Call this endpoint with `gas_sponsorship=true` to get EIP-712 typed data
|
|
1213
|
+
2. Owner signs the typed data
|
|
1214
|
+
3. Submit signature + typed data to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction)
|
|
1215
|
+
|
|
1216
|
+
**Note:** This endpoint moves tokens to/from the Earn Account itself—not into yield venues. To deposit into a vault or Aave market, use the [manage endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/manage-earn-position).
|
|
981
1217
|
|
|
982
1218
|
:param owner: The owner's wallet address.
|
|
983
1219
|
:param chain: The chain to use.
|
|
@@ -1088,25 +1324,25 @@ class Earn(BaseSDK):
|
|
|
1088
1324
|
) -> models.EarnManageResponse:
|
|
1089
1325
|
r"""Manage earn position
|
|
1090
1326
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
The `owner` is the main wallet address that owns and controls the Earn Account. It is not the Earn Account address itself.
|
|
1094
|
-
|
|
1095
|
-
Venue Types:
|
|
1096
|
-
- VAULTS
|
|
1097
|
-
- AAVE
|
|
1327
|
+
Deposit into or withdraw from a yield venue.
|
|
1098
1328
|
|
|
1099
|
-
|
|
1329
|
+
Use `DEPOSIT` to move tokens from the Earn Account into a vault, Aave market, or Pendle PT position. Use `WITHDRAW` to move tokens back from a venue into the Earn Account.
|
|
1100
1330
|
|
|
1101
|
-
|
|
1331
|
+
**Venue types:**
|
|
1332
|
+
- `VAULT`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
1333
|
+
- `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
1334
|
+
- `PENDLE_PT`: Pendle Principal Tokens (see [/pendle_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-pendle-markets) for available options)
|
|
1102
1335
|
|
|
1103
|
-
A fee can be configured
|
|
1336
|
+
**Fees:** A fee can be configured and deducted from the transaction amount (not supported for PENDLE_PT):
|
|
1337
|
+
- `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
1338
|
+
- `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
1339
|
+
- `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
1104
1340
|
|
|
1105
|
-
|
|
1341
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
1106
1342
|
|
|
1107
1343
|
:param venue: The earn venue.
|
|
1108
1344
|
:param action: Whether you are depositing into or withdrawing from the given Earn `venue`.
|
|
1109
|
-
:param amount: Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0.
|
|
1345
|
+
:param amount: Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.
|
|
1110
1346
|
:param owner: The primary wallet address that owns and controls the Earn Account.
|
|
1111
1347
|
:param chain: The chain to use.
|
|
1112
1348
|
:param gas_sponsorship: Optionally request gas sponsorship. If set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
@@ -1213,25 +1449,25 @@ class Earn(BaseSDK):
|
|
|
1213
1449
|
) -> models.EarnManageResponse:
|
|
1214
1450
|
r"""Manage earn position
|
|
1215
1451
|
|
|
1216
|
-
|
|
1452
|
+
Deposit into or withdraw from a yield venue.
|
|
1217
1453
|
|
|
1218
|
-
|
|
1454
|
+
Use `DEPOSIT` to move tokens from the Earn Account into a vault, Aave market, or Pendle PT position. Use `WITHDRAW` to move tokens back from a venue into the Earn Account.
|
|
1219
1455
|
|
|
1220
|
-
Venue
|
|
1221
|
-
-
|
|
1222
|
-
- AAVE
|
|
1456
|
+
**Venue types:**
|
|
1457
|
+
- `VAULT`: ERC-4626 vaults (see [/vaults](https://docs.compasslabs.ai/v2/api-reference/earn/list-vaults) for available options)
|
|
1458
|
+
- `AAVE`: Aave lending pools (see [/aave_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-aave-markets) for available options)
|
|
1459
|
+
- `PENDLE_PT`: Pendle Principal Tokens (see [/pendle_markets](https://docs.compasslabs.ai/v2/api-reference/earn/list-pendle-markets) for available options)
|
|
1223
1460
|
|
|
1224
|
-
|
|
1461
|
+
**Fees:** A fee can be configured and deducted from the transaction amount (not supported for PENDLE_PT):
|
|
1462
|
+
- `FIXED`: A fixed token amount (e.g., 0.1 means 0.1 tokens)
|
|
1463
|
+
- `PERCENTAGE`: A percentage of the amount (e.g., 1.5 means 1.5%)
|
|
1464
|
+
- `PERFORMANCE`: A percentage of realized profit (withdrawals only)
|
|
1225
1465
|
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as a `FIXED` amount or a `PERCENTAGE` of `amount`.
|
|
1229
|
-
|
|
1230
|
-
The transaction can be gas-sponsored by an arbitrary wallet address which will sign, submit and pay the required gas for the transaction. If `gas_sponsorship` is set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where the `sender` of the transaction can be set.
|
|
1466
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
1231
1467
|
|
|
1232
1468
|
:param venue: The earn venue.
|
|
1233
1469
|
:param action: Whether you are depositing into or withdrawing from the given Earn `venue`.
|
|
1234
|
-
:param amount: Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0.
|
|
1470
|
+
:param amount: Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0.
|
|
1235
1471
|
:param owner: The primary wallet address that owns and controls the Earn Account.
|
|
1236
1472
|
:param chain: The chain to use.
|
|
1237
1473
|
:param gas_sponsorship: Optionally request gas sponsorship. If set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
|
|
@@ -1344,6 +1580,12 @@ class Earn(BaseSDK):
|
|
|
1344
1580
|
|
|
1345
1581
|
Swap tokens within an Earn Account.
|
|
1346
1582
|
|
|
1583
|
+
Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
1584
|
+
|
|
1585
|
+
The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
|
|
1586
|
+
|
|
1587
|
+
Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
|
|
1588
|
+
|
|
1347
1589
|
:param token_in: Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
|
|
1348
1590
|
:param token_out: Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
|
|
1349
1591
|
:param amount_in: Human-readable amount of `token_in` to swap (token units, not wei).
|
|
@@ -1459,6 +1701,12 @@ class Earn(BaseSDK):
|
|
|
1459
1701
|
|
|
1460
1702
|
Swap tokens within an Earn Account.
|
|
1461
1703
|
|
|
1704
|
+
Use this endpoint to exchange one token for another without transferring funds out of the Earn Account.
|
|
1705
|
+
|
|
1706
|
+
The swap executes atomically within the Earn Account and can be combined with other actions using the [bundle endpoint](https://docs.compasslabs.ai/v2/api-reference/earn/execute-multiple-earn-actions). For example, swap ETH to USDC, then deposit USDC into a vault—all in one transaction.
|
|
1707
|
+
|
|
1708
|
+
Returns either an unsigned transaction (when `gas_sponsorship=false`) or EIP-712 typed data for off-chain signing (when `gas_sponsorship=true`). For gas-sponsored swaps, submit the signed typed data to `/gas_sponsorship/prepare`.
|
|
1709
|
+
|
|
1462
1710
|
:param token_in: Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
|
|
1463
1711
|
:param token_out: Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
|
|
1464
1712
|
:param amount_in: Human-readable amount of `token_in` to swap (token units, not wei).
|
|
@@ -1565,20 +1813,19 @@ class Earn(BaseSDK):
|
|
|
1565
1813
|
) -> models.V2BundleResponse:
|
|
1566
1814
|
r"""Execute multiple earn actions
|
|
1567
1815
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
executed
|
|
1816
|
+
Combine multiple actions into a single atomic transaction.
|
|
1817
|
+
|
|
1818
|
+
Bundle swaps and venue deposits/withdrawals into one transaction executed through the Earn Account. This saves gas compared to executing actions separately and ensures all actions succeed or fail together.
|
|
1571
1819
|
|
|
1572
|
-
**Example
|
|
1820
|
+
**Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
1573
1821
|
|
|
1574
|
-
|
|
1822
|
+
**Action types:**
|
|
1823
|
+
- `V2_SWAP`: Swap tokens within the Earn Account
|
|
1824
|
+
- `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
1575
1825
|
|
|
1576
|
-
|
|
1577
|
-
- **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
1826
|
+
Actions execute in the order provided.
|
|
1578
1827
|
|
|
1579
|
-
|
|
1580
|
-
This returns EIP-712 typed data that the owner must sign and submit to
|
|
1581
|
-
`/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
1828
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
1582
1829
|
|
|
1583
1830
|
:param owner: The owner's wallet address that controls the Earn Account.
|
|
1584
1831
|
:param chain: The chain to use.
|
|
@@ -1680,20 +1927,19 @@ class Earn(BaseSDK):
|
|
|
1680
1927
|
) -> models.V2BundleResponse:
|
|
1681
1928
|
r"""Execute multiple earn actions
|
|
1682
1929
|
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
executed
|
|
1930
|
+
Combine multiple actions into a single atomic transaction.
|
|
1931
|
+
|
|
1932
|
+
Bundle swaps and venue deposits/withdrawals into one transaction executed through the Earn Account. This saves gas compared to executing actions separately and ensures all actions succeed or fail together.
|
|
1686
1933
|
|
|
1687
|
-
**Example
|
|
1934
|
+
**Example:** Swap AUSD to USDC, then deposit USDC into a vault - all in one transaction.
|
|
1688
1935
|
|
|
1689
|
-
|
|
1936
|
+
**Action types:**
|
|
1937
|
+
- `V2_SWAP`: Swap tokens within the Earn Account
|
|
1938
|
+
- `V2_MANAGE`: Deposit/withdraw to ERC-4626 vaults or Aave markets
|
|
1690
1939
|
|
|
1691
|
-
|
|
1692
|
-
- **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
1940
|
+
Actions execute in the order provided.
|
|
1693
1941
|
|
|
1694
|
-
|
|
1695
|
-
This returns EIP-712 typed data that the owner must sign and submit to
|
|
1696
|
-
`/gas_sponsorship/prepare` for execution by a gas sponsor.
|
|
1942
|
+
**Gas sponsorship:** Set `gas_sponsorship=true` to receive EIP-712 typed data. Owner signs the typed data, then submit to [/gas_sponsorship/prepare](https://docs.compasslabs.ai/v2/api-reference/gas-sponsorship/prepare-gas-sponsored-transaction).
|
|
1697
1943
|
|
|
1698
1944
|
:param owner: The owner's wallet address that controls the Earn Account.
|
|
1699
1945
|
:param chain: The chain to use.
|