compass_api_sdk 1.1.1__py3-none-any.whl → 2.0.21rc1__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/_hooks/sdkhooks.py +4 -4
- compass_api_sdk/_hooks/types.py +1 -2
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/aave_v3.py +386 -114
- compass_api_sdk/aerodrome_slipstream.py +104 -54
- compass_api_sdk/basesdk.py +6 -0
- compass_api_sdk/bridge.py +536 -0
- compass_api_sdk/earn.py +1780 -0
- compass_api_sdk/erc_4626_vaults.py +28 -10
- compass_api_sdk/errors/__init__.py +8 -0
- compass_api_sdk/errors/apierror.py +1 -1
- compass_api_sdk/errors/compassapierror.py +1 -1
- compass_api_sdk/errors/httpvalidationerror.py +1 -1
- compass_api_sdk/errors/mintpreparenotfoundresponse_error.py +49 -0
- compass_api_sdk/errors/no_response_error.py +1 -1
- compass_api_sdk/errors/responsevalidationerror.py +1 -1
- compass_api_sdk/ethena.py +36 -10
- compass_api_sdk/gas_sponsorship.py +446 -0
- compass_api_sdk/httpclient.py +0 -1
- compass_api_sdk/models/__init__.py +764 -392
- compass_api_sdk/models/aaveborrowparams.py +4 -13
- compass_api_sdk/models/aaveborrowrequest.py +10 -14
- compass_api_sdk/models/aavehistoricaltransactionsresponse.py +3 -3
- compass_api_sdk/models/aavelooprequest.py +32 -28
- compass_api_sdk/models/aaveposition.py +49 -0
- compass_api_sdk/models/aaverepayparams.py +4 -13
- compass_api_sdk/models/aaverepayrequest.py +10 -14
- compass_api_sdk/models/aavesetuseremodeparams.py +28 -0
- compass_api_sdk/models/aavesetuseremoderequest.py +48 -0
- compass_api_sdk/models/aavesupplyparams.py +4 -13
- compass_api_sdk/models/aavesupplyrequest.py +10 -14
- compass_api_sdk/models/aavevenue.py +27 -0
- compass_api_sdk/models/aavewithdrawparams.py +4 -13
- compass_api_sdk/models/aavewithdrawrequest.py +10 -14
- compass_api_sdk/models/aerodromeenrichedposition.py +109 -0
- compass_api_sdk/models/aerodromelppositionsresponse.py +10 -7
- compass_api_sdk/models/aerodromeslipstreambuyexactlyparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +14 -26
- compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +6 -1
- compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionrequest.py +14 -26
- compass_api_sdk/models/aerodromeslipstreampoolpriceresponse.py +8 -25
- compass_api_sdk/models/aerodromeslipstreamsellexactlyparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreamsellexactlyrequest.py +13 -25
- compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +6 -1
- compass_api_sdk/models/approvetransferrequest.py +32 -0
- compass_api_sdk/models/approvetransferresponse.py +52 -0
- compass_api_sdk/models/batchedsafeoperationsresponse_input.py +52 -0
- compass_api_sdk/models/batchedsafeoperationsresponse_output.py +52 -0
- compass_api_sdk/models/batcheduseroperationsrequest.py +15 -4
- compass_api_sdk/models/chainmarketinfo.py +29 -0
- compass_api_sdk/models/{compass_api_backend_models_generic_read_response_portfolio_tokenbalance.py → compass_api_backend_v1_models_generic_read_response_portfolio_tokenbalance.py} +6 -15
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_apydata.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_apydata.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_asset.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_asset.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_marketstate.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_marketstate.py} +4 -2
- compass_api_sdk/models/compass_api_backend_v1_models_morpho_read_response_check_user_position_vaultposition.py +30 -0
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_vaultstate.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_vaultstate.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_apydata.py → compass_api_backend_v1_models_morpho_read_response_get_market_apydata.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_asset.py → compass_api_backend_v1_models_morpho_read_response_get_market_asset.py} +5 -5
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_marketstate.py → compass_api_backend_v1_models_morpho_read_response_get_market_marketstate.py} +4 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_markets_asset.py → compass_api_backend_v1_models_morpho_read_response_get_markets_asset.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_markets_marketstate.py → compass_api_backend_v1_models_morpho_read_response_get_markets_marketstate.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vaults_asset.py → compass_api_backend_v1_models_morpho_read_response_get_vaults_asset.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vaults_vaultstate.py → compass_api_backend_v1_models_morpho_read_response_get_vaults_vaultstate.py} +4 -2
- compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_market_userposition.py → compass_api_backend_v1_models_pendle_read_response_market_userposition.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_positions_tokenbalance.py → compass_api_backend_v1_models_pendle_read_response_positions_tokenbalance.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_userposition.py → compass_api_backend_v1_models_vaults_read_response_vault_userposition.py} +2 -2
- compass_api_sdk/models/compass_api_backend_v1_models_wildcat_read_response_market_userposition.py +22 -0
- compass_api_sdk/models/compass_api_backend_v2_models_earn_read_response_positions_vaultposition.py +49 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712domain.py +36 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712types.py +36 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712domain.py +37 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712types.py +32 -0
- compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712domain.py +29 -0
- compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712types.py +34 -0
- compass_api_sdk/models/createaccountrequest.py +40 -0
- compass_api_sdk/models/createaccountresponse.py +56 -0
- compass_api_sdk/models/depositforburnrequest.py +77 -0
- compass_api_sdk/models/depositforburnresponse.py +100 -0
- compass_api_sdk/models/earnmanageparams.py +74 -0
- compass_api_sdk/models/earnmanagerequest.py +130 -0
- compass_api_sdk/models/earnmanageresponse.py +52 -0
- compass_api_sdk/models/earnpositionsresponse.py +39 -0
- compass_api_sdk/models/earnswapparams.py +74 -0
- compass_api_sdk/models/earnswaprequest.py +90 -0
- compass_api_sdk/models/earnswapresponse.py +55 -0
- compass_api_sdk/models/earntransferrequest.py +104 -0
- compass_api_sdk/models/earntransferresponse.py +71 -0
- compass_api_sdk/models/eip712domainfield.py +20 -0
- compass_api_sdk/models/eip712field.py +20 -0
- compass_api_sdk/models/ethenadepositrequest.py +6 -1
- compass_api_sdk/models/ethenagetvaultresponse.py +5 -5
- compass_api_sdk/models/ethenarequesttowithdrawrequest.py +6 -1
- compass_api_sdk/models/ethenaunstakerequest.py +6 -1
- compass_api_sdk/models/fee.py +42 -0
- compass_api_sdk/models/listaavemarketsresponse.py +21 -0
- compass_api_sdk/models/marketposition.py +5 -5
- compass_api_sdk/models/maxsupplyapyinfo.py +34 -0
- compass_api_sdk/models/mintpreparecompletedresponse.py +46 -0
- compass_api_sdk/models/mintpreparependingresponse.py +65 -0
- compass_api_sdk/models/mintpreparereadyresponse.py +43 -0
- compass_api_sdk/models/mintpreparerequest.py +25 -0
- compass_api_sdk/models/morphoborrowrequest.py +6 -1
- compass_api_sdk/models/morphocheckuserpositionresponse.py +9 -3
- compass_api_sdk/models/morphodepositrequest.py +6 -1
- compass_api_sdk/models/morphogetmarketresponse.py +72 -31
- compass_api_sdk/models/morphomarket.py +26 -20
- compass_api_sdk/models/morphorepayrequest.py +11 -1
- compass_api_sdk/models/morphosupplycollateralrequest.py +11 -1
- compass_api_sdk/models/morphovault.py +10 -10
- compass_api_sdk/models/morphowithdrawcollateralrequest.py +6 -1
- compass_api_sdk/models/morphowithdrawrequest.py +6 -1
- compass_api_sdk/models/multicallexecuterequest.py +7 -2
- compass_api_sdk/models/odosswapparams.py +9 -30
- compass_api_sdk/models/odosswaprequest.py +15 -33
- compass_api_sdk/models/oneinchswapparams.py +59 -0
- compass_api_sdk/models/openposition.py +7 -7
- compass_api_sdk/models/operationtype.py +11 -0
- compass_api_sdk/models/pendlegetmarketresponse.py +5 -5
- compass_api_sdk/models/pendlemanageliquidityparams.py +2 -15
- compass_api_sdk/models/pendlemanageliquidityrequest.py +8 -16
- compass_api_sdk/models/pendleredeemyieldrequest.py +6 -1
- compass_api_sdk/models/pendletradeptparams.py +2 -15
- compass_api_sdk/models/pendletradeptrequest.py +8 -16
- compass_api_sdk/models/pendletradeytparams.py +2 -15
- compass_api_sdk/models/pendletradeytrequest.py +8 -16
- compass_api_sdk/models/permit2typeddata_input.py +46 -0
- compass_api_sdk/models/permit2typeddata_output.py +46 -0
- compass_api_sdk/models/permitfield.py +20 -0
- compass_api_sdk/models/permitmessage.py +39 -0
- compass_api_sdk/models/permittransferfrommessage.py +29 -0
- compass_api_sdk/models/permittypeddataresponse_input.py +50 -0
- compass_api_sdk/models/permittypeddataresponse_output.py +50 -0
- compass_api_sdk/models/portfolio.py +5 -5
- compass_api_sdk/models/reserve.py +6 -15
- compass_api_sdk/models/safetransactionparams.py +78 -0
- compass_api_sdk/models/safetransactionresponse.py +28 -0
- compass_api_sdk/models/safetxfield.py +20 -0
- compass_api_sdk/models/safetxmessage.py +66 -0
- compass_api_sdk/models/setallowanceparams.py +3 -16
- compass_api_sdk/models/setallowancerequest.py +9 -17
- compass_api_sdk/models/skybuyrequest.py +6 -1
- compass_api_sdk/models/skydepositrequest.py +7 -2
- compass_api_sdk/models/skysellrequest.py +7 -2
- compass_api_sdk/models/skywithdrawrequest.py +7 -2
- compass_api_sdk/models/sponsorgasrequest.py +71 -0
- compass_api_sdk/models/sponsorgasresponse.py +14 -0
- compass_api_sdk/models/tokenbalanceresponse.py +5 -15
- compass_api_sdk/models/tokenconfig.py +30 -0
- compass_api_sdk/models/tokenlistresponse.py +21 -0
- compass_api_sdk/models/tokenmarketdata.py +27 -0
- compass_api_sdk/models/tokenpermissions.py +20 -0
- compass_api_sdk/models/tokentransferparams.py +2 -15
- compass_api_sdk/models/tokentransferrequest.py +8 -16
- compass_api_sdk/models/uniswapbuyexactlyparams.py +8 -33
- compass_api_sdk/models/uniswapbuyexactlyrequest.py +14 -34
- compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +6 -1
- compass_api_sdk/models/uniswapmintliquidityprovisionparams.py +8 -25
- compass_api_sdk/models/uniswapmintliquidityprovisionrequest.py +14 -26
- compass_api_sdk/models/uniswappoolpriceresponse.py +8 -25
- compass_api_sdk/models/uniswapsellexactlyparams.py +4 -29
- compass_api_sdk/models/uniswapsellexactlyrequest.py +10 -30
- compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +6 -1
- compass_api_sdk/models/unsignedmulticalltransaction.py +34 -3
- compass_api_sdk/models/unsignedtransaction.py +34 -3
- compass_api_sdk/models/unwrapwethrequest.py +6 -1
- compass_api_sdk/models/useroperation.py +33 -24
- compass_api_sdk/models/v1_aave_aave_supported_tokensop.py +1 -1
- compass_api_sdk/models/v1_aave_avg_rateop.py +15 -93
- compass_api_sdk/models/v1_aave_historical_transactionsop.py +15 -15
- compass_api_sdk/models/v1_aave_liquidity_changeop.py +8 -86
- compass_api_sdk/models/v1_aave_rateop.py +8 -86
- compass_api_sdk/models/v1_aave_reserve_overviewop.py +8 -86
- compass_api_sdk/models/v1_aave_std_rateop.py +15 -93
- compass_api_sdk/models/v1_aave_token_priceop.py +8 -86
- compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +14 -92
- compass_api_sdk/models/v1_aave_user_position_summaryop.py +8 -8
- compass_api_sdk/models/v1_aerodrome_slipstream_liquidity_provision_positionsop.py +48 -3
- compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +12 -168
- compass_api_sdk/models/v1_ethena_vaultop.py +1 -1
- compass_api_sdk/models/v1_generic_allowanceop.py +12 -26
- compass_api_sdk/models/v1_generic_ensop.py +2 -2
- compass_api_sdk/models/v1_generic_portfolioop.py +2 -2
- compass_api_sdk/models/v1_morpho_market_positionop.py +3 -3
- compass_api_sdk/models/v1_morpho_marketop.py +2 -2
- compass_api_sdk/models/v1_morpho_marketsop.py +10 -30
- compass_api_sdk/models/v1_morpho_user_positionop.py +2 -2
- compass_api_sdk/models/v1_morpho_vaultop.py +8 -8
- compass_api_sdk/models/v1_morpho_vaultsop.py +6 -16
- compass_api_sdk/models/v1_pendle_marketop.py +8 -8
- compass_api_sdk/models/v1_pendle_marketsop.py +1 -1
- compass_api_sdk/models/v1_pendle_positionsop.py +2 -2
- compass_api_sdk/models/v1_sky_positionop.py +5 -6
- compass_api_sdk/models/v1_token_balanceop.py +12 -25
- compass_api_sdk/models/{v1_generic_supported_tokensop.py → v1_token_listop.py} +6 -6
- compass_api_sdk/models/v1_token_priceop.py +8 -9
- compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +6 -6
- compass_api_sdk/models/v1_uniswap_liquidity_provision_in_rangeop.py +2 -2
- compass_api_sdk/models/v1_uniswap_liquidity_provision_positionsop.py +2 -2
- compass_api_sdk/models/v1_uniswap_pool_priceop.py +12 -168
- compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +20 -176
- compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +20 -176
- compass_api_sdk/models/v1_vaults_vaultop.py +8 -8
- compass_api_sdk/models/v1_wildcat_marketop.py +82 -0
- compass_api_sdk/models/v2_cctp_mintop.py +47 -0
- compass_api_sdk/models/v2_earn_aave_marketsop.py +57 -0
- compass_api_sdk/models/v2_earn_positionsop.py +56 -0
- compass_api_sdk/models/v2_earn_vaultsop.py +105 -0
- compass_api_sdk/models/v2bundlerequest.py +33 -0
- compass_api_sdk/models/v2bundleresponse.py +67 -0
- compass_api_sdk/models/v2useroperation.py +37 -0
- compass_api_sdk/models/vault.py +14 -14
- compass_api_sdk/models/vaultdepositrequest.py +6 -1
- compass_api_sdk/models/vaultgetvaultresponse.py +5 -5
- compass_api_sdk/models/vaultinfo.py +129 -0
- compass_api_sdk/models/vaultsresponse.py +30 -0
- compass_api_sdk/models/vaultvenue.py +27 -0
- compass_api_sdk/models/vaultwithdrawrequest.py +6 -1
- compass_api_sdk/models/wildcatgetmarketresponse.py +151 -0
- compass_api_sdk/models/{redeemunderlying.py → withdraw.py} +2 -2
- compass_api_sdk/models/wrapethrequest.py +6 -1
- compass_api_sdk/morpho.py +126 -78
- compass_api_sdk/pendle.py +68 -44
- compass_api_sdk/sdk.py +18 -11
- compass_api_sdk/sky.py +62 -38
- compass_api_sdk/smart_account.py +10 -2
- compass_api_sdk/swap.py +22 -22
- compass_api_sdk/{token_sdk.py → token.py} +511 -103
- compass_api_sdk/transaction_bundler.py +46 -16
- compass_api_sdk/uniswap_v3.py +152 -114
- compass_api_sdk/universal.py +44 -606
- compass_api_sdk/utils/annotations.py +32 -8
- compass_api_sdk/utils/forms.py +21 -10
- compass_api_sdk/utils/queryparams.py +14 -2
- compass_api_sdk/utils/retries.py +69 -5
- compass_api_sdk/utils/unmarshal_json_response.py +15 -1
- compass_api_sdk/wildcat.py +208 -0
- compass_api_sdk-2.0.21rc1.dist-info/METADATA +623 -0
- compass_api_sdk-2.0.21rc1.dist-info/RECORD +346 -0
- {compass_api_sdk-1.1.1.dist-info → compass_api_sdk-2.0.21rc1.dist-info}/WHEEL +1 -1
- compass_api_sdk/models/aerodromeposition.py +0 -70
- compass_api_sdk/models/token_enum.py +0 -81
- compass_api_sdk/models/tokenaddressresponse.py +0 -15
- compass_api_sdk/models/tokeninfo.py +0 -17
- compass_api_sdk/models/v1_token_addressop.py +0 -109
- compass_api_sdk/models/vaultposition.py +0 -24
- compass_api_sdk-1.1.1.dist-info/METADATA +0 -592
- compass_api_sdk-1.1.1.dist-info/RECORD +0 -275
compass_api_sdk/earn.py
ADDED
|
@@ -0,0 +1,1780 @@
|
|
|
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 compass_api_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
|
+
from typing import Any, List, Mapping, Optional, Union
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Earn(BaseSDK):
|
|
12
|
+
def earn_positions(
|
|
13
|
+
self,
|
|
14
|
+
*,
|
|
15
|
+
chain: models.V2EarnPositionsChain,
|
|
16
|
+
user_address: str,
|
|
17
|
+
offset: Optional[int] = None,
|
|
18
|
+
limit: Optional[int] = None,
|
|
19
|
+
days: Optional[int] = None,
|
|
20
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
21
|
+
server_url: Optional[str] = None,
|
|
22
|
+
timeout_ms: Optional[int] = None,
|
|
23
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
24
|
+
) -> models.EarnPositionsResponse:
|
|
25
|
+
r"""List earn positions
|
|
26
|
+
|
|
27
|
+
This endpoint fetches all Compass Earn positions.
|
|
28
|
+
|
|
29
|
+
:param chain:
|
|
30
|
+
:param user_address: The address of the user to get vault positions for.
|
|
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 retries: Override the default retry configuration for this method
|
|
35
|
+
:param server_url: Override the default server URL for this method
|
|
36
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
37
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
38
|
+
"""
|
|
39
|
+
base_url = None
|
|
40
|
+
url_variables = None
|
|
41
|
+
if timeout_ms is None:
|
|
42
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
43
|
+
|
|
44
|
+
if server_url is not None:
|
|
45
|
+
base_url = server_url
|
|
46
|
+
else:
|
|
47
|
+
base_url = self._get_url(base_url, url_variables)
|
|
48
|
+
|
|
49
|
+
request = models.V2EarnPositionsRequest(
|
|
50
|
+
offset=offset,
|
|
51
|
+
limit=limit,
|
|
52
|
+
chain=chain,
|
|
53
|
+
user_address=user_address,
|
|
54
|
+
days=days,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
req = self._build_request(
|
|
58
|
+
method="GET",
|
|
59
|
+
path="/v2/earn/positions",
|
|
60
|
+
base_url=base_url,
|
|
61
|
+
url_variables=url_variables,
|
|
62
|
+
request=request,
|
|
63
|
+
request_body_required=False,
|
|
64
|
+
request_has_path_params=False,
|
|
65
|
+
request_has_query_params=True,
|
|
66
|
+
user_agent_header="user-agent",
|
|
67
|
+
accept_header_value="application/json",
|
|
68
|
+
http_headers=http_headers,
|
|
69
|
+
security=self.sdk_configuration.security,
|
|
70
|
+
allow_empty_value=None,
|
|
71
|
+
timeout_ms=timeout_ms,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
if retries == UNSET:
|
|
75
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
76
|
+
retries = self.sdk_configuration.retry_config
|
|
77
|
+
|
|
78
|
+
retry_config = None
|
|
79
|
+
if isinstance(retries, utils.RetryConfig):
|
|
80
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
81
|
+
|
|
82
|
+
http_res = self.do_request(
|
|
83
|
+
hook_ctx=HookContext(
|
|
84
|
+
config=self.sdk_configuration,
|
|
85
|
+
base_url=base_url or "",
|
|
86
|
+
operation_id="v2_earn_positions",
|
|
87
|
+
oauth2_scopes=None,
|
|
88
|
+
security_source=self.sdk_configuration.security,
|
|
89
|
+
),
|
|
90
|
+
request=req,
|
|
91
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
92
|
+
retry_config=retry_config,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
response_data: Any = None
|
|
96
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
97
|
+
return unmarshal_json_response(models.EarnPositionsResponse, http_res)
|
|
98
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
99
|
+
response_data = unmarshal_json_response(
|
|
100
|
+
errors.HTTPValidationErrorData, http_res
|
|
101
|
+
)
|
|
102
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
103
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
104
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
105
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
106
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
107
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
108
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
109
|
+
|
|
110
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
111
|
+
|
|
112
|
+
async def earn_positions_async(
|
|
113
|
+
self,
|
|
114
|
+
*,
|
|
115
|
+
chain: models.V2EarnPositionsChain,
|
|
116
|
+
user_address: str,
|
|
117
|
+
offset: Optional[int] = None,
|
|
118
|
+
limit: Optional[int] = None,
|
|
119
|
+
days: Optional[int] = None,
|
|
120
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
121
|
+
server_url: Optional[str] = None,
|
|
122
|
+
timeout_ms: Optional[int] = None,
|
|
123
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
124
|
+
) -> models.EarnPositionsResponse:
|
|
125
|
+
r"""List earn positions
|
|
126
|
+
|
|
127
|
+
This endpoint fetches all Compass Earn positions.
|
|
128
|
+
|
|
129
|
+
:param chain:
|
|
130
|
+
:param user_address: The address of the user to get vault positions for.
|
|
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.
|
|
134
|
+
:param retries: Override the default retry configuration for this method
|
|
135
|
+
:param server_url: Override the default server URL for this method
|
|
136
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
137
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
138
|
+
"""
|
|
139
|
+
base_url = None
|
|
140
|
+
url_variables = None
|
|
141
|
+
if timeout_ms is None:
|
|
142
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
143
|
+
|
|
144
|
+
if server_url is not None:
|
|
145
|
+
base_url = server_url
|
|
146
|
+
else:
|
|
147
|
+
base_url = self._get_url(base_url, url_variables)
|
|
148
|
+
|
|
149
|
+
request = models.V2EarnPositionsRequest(
|
|
150
|
+
offset=offset,
|
|
151
|
+
limit=limit,
|
|
152
|
+
chain=chain,
|
|
153
|
+
user_address=user_address,
|
|
154
|
+
days=days,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
req = self._build_request_async(
|
|
158
|
+
method="GET",
|
|
159
|
+
path="/v2/earn/positions",
|
|
160
|
+
base_url=base_url,
|
|
161
|
+
url_variables=url_variables,
|
|
162
|
+
request=request,
|
|
163
|
+
request_body_required=False,
|
|
164
|
+
request_has_path_params=False,
|
|
165
|
+
request_has_query_params=True,
|
|
166
|
+
user_agent_header="user-agent",
|
|
167
|
+
accept_header_value="application/json",
|
|
168
|
+
http_headers=http_headers,
|
|
169
|
+
security=self.sdk_configuration.security,
|
|
170
|
+
allow_empty_value=None,
|
|
171
|
+
timeout_ms=timeout_ms,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
if retries == UNSET:
|
|
175
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
176
|
+
retries = self.sdk_configuration.retry_config
|
|
177
|
+
|
|
178
|
+
retry_config = None
|
|
179
|
+
if isinstance(retries, utils.RetryConfig):
|
|
180
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
181
|
+
|
|
182
|
+
http_res = await self.do_request_async(
|
|
183
|
+
hook_ctx=HookContext(
|
|
184
|
+
config=self.sdk_configuration,
|
|
185
|
+
base_url=base_url or "",
|
|
186
|
+
operation_id="v2_earn_positions",
|
|
187
|
+
oauth2_scopes=None,
|
|
188
|
+
security_source=self.sdk_configuration.security,
|
|
189
|
+
),
|
|
190
|
+
request=req,
|
|
191
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
192
|
+
retry_config=retry_config,
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
response_data: Any = None
|
|
196
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
197
|
+
return unmarshal_json_response(models.EarnPositionsResponse, http_res)
|
|
198
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
199
|
+
response_data = unmarshal_json_response(
|
|
200
|
+
errors.HTTPValidationErrorData, http_res
|
|
201
|
+
)
|
|
202
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
203
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
204
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
205
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
206
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
207
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
208
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
209
|
+
|
|
210
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
211
|
+
|
|
212
|
+
def earn_vaults(
|
|
213
|
+
self,
|
|
214
|
+
*,
|
|
215
|
+
order_by: str,
|
|
216
|
+
direction: Optional[models.Direction] = None,
|
|
217
|
+
offset: Optional[int] = None,
|
|
218
|
+
limit: Optional[int] = None,
|
|
219
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
220
|
+
asset_symbol: OptionalNullable[str] = UNSET,
|
|
221
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
222
|
+
server_url: Optional[str] = None,
|
|
223
|
+
timeout_ms: Optional[int] = None,
|
|
224
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
225
|
+
) -> models.VaultsResponse:
|
|
226
|
+
r"""List vaults
|
|
227
|
+
|
|
228
|
+
List information about 4626 vaults.
|
|
229
|
+
|
|
230
|
+
These are earn opportunities for protocols like morpho.
|
|
231
|
+
|
|
232
|
+
:param order_by: The field to order the results by.
|
|
233
|
+
:param direction: The direction to order the results by.
|
|
234
|
+
:param offset: The offset of the first item to return.
|
|
235
|
+
:param limit: The number of items to return.
|
|
236
|
+
:param chain: Optional chain filter. If not provided, returns vaults for all chains.
|
|
237
|
+
:param asset_symbol: Filter vaults by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
238
|
+
:param retries: Override the default retry configuration for this method
|
|
239
|
+
:param server_url: Override the default server URL for this method
|
|
240
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
241
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
242
|
+
"""
|
|
243
|
+
base_url = None
|
|
244
|
+
url_variables = None
|
|
245
|
+
if timeout_ms is None:
|
|
246
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
247
|
+
|
|
248
|
+
if server_url is not None:
|
|
249
|
+
base_url = server_url
|
|
250
|
+
else:
|
|
251
|
+
base_url = self._get_url(base_url, url_variables)
|
|
252
|
+
|
|
253
|
+
request = models.V2EarnVaultsRequest(
|
|
254
|
+
order_by=order_by,
|
|
255
|
+
direction=direction,
|
|
256
|
+
offset=offset,
|
|
257
|
+
limit=limit,
|
|
258
|
+
chain=chain,
|
|
259
|
+
asset_symbol=asset_symbol,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
req = self._build_request(
|
|
263
|
+
method="GET",
|
|
264
|
+
path="/v2/earn/vaults",
|
|
265
|
+
base_url=base_url,
|
|
266
|
+
url_variables=url_variables,
|
|
267
|
+
request=request,
|
|
268
|
+
request_body_required=False,
|
|
269
|
+
request_has_path_params=False,
|
|
270
|
+
request_has_query_params=True,
|
|
271
|
+
user_agent_header="user-agent",
|
|
272
|
+
accept_header_value="application/json",
|
|
273
|
+
http_headers=http_headers,
|
|
274
|
+
security=self.sdk_configuration.security,
|
|
275
|
+
allow_empty_value=None,
|
|
276
|
+
timeout_ms=timeout_ms,
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
if retries == UNSET:
|
|
280
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
281
|
+
retries = self.sdk_configuration.retry_config
|
|
282
|
+
|
|
283
|
+
retry_config = None
|
|
284
|
+
if isinstance(retries, utils.RetryConfig):
|
|
285
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
286
|
+
|
|
287
|
+
http_res = self.do_request(
|
|
288
|
+
hook_ctx=HookContext(
|
|
289
|
+
config=self.sdk_configuration,
|
|
290
|
+
base_url=base_url or "",
|
|
291
|
+
operation_id="v2_earn_vaults",
|
|
292
|
+
oauth2_scopes=None,
|
|
293
|
+
security_source=self.sdk_configuration.security,
|
|
294
|
+
),
|
|
295
|
+
request=req,
|
|
296
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
297
|
+
retry_config=retry_config,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
response_data: Any = None
|
|
301
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
302
|
+
return unmarshal_json_response(models.VaultsResponse, http_res)
|
|
303
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
304
|
+
response_data = unmarshal_json_response(
|
|
305
|
+
errors.HTTPValidationErrorData, http_res
|
|
306
|
+
)
|
|
307
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
308
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
309
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
310
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
311
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
312
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
313
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
314
|
+
|
|
315
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
316
|
+
|
|
317
|
+
async def earn_vaults_async(
|
|
318
|
+
self,
|
|
319
|
+
*,
|
|
320
|
+
order_by: str,
|
|
321
|
+
direction: Optional[models.Direction] = None,
|
|
322
|
+
offset: Optional[int] = None,
|
|
323
|
+
limit: Optional[int] = None,
|
|
324
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
325
|
+
asset_symbol: OptionalNullable[str] = UNSET,
|
|
326
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
327
|
+
server_url: Optional[str] = None,
|
|
328
|
+
timeout_ms: Optional[int] = None,
|
|
329
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
330
|
+
) -> models.VaultsResponse:
|
|
331
|
+
r"""List vaults
|
|
332
|
+
|
|
333
|
+
List information about 4626 vaults.
|
|
334
|
+
|
|
335
|
+
These are earn opportunities for protocols like morpho.
|
|
336
|
+
|
|
337
|
+
:param order_by: The field to order the results by.
|
|
338
|
+
:param direction: The direction to order the results by.
|
|
339
|
+
:param offset: The offset of the first item to return.
|
|
340
|
+
:param limit: The number of items to return.
|
|
341
|
+
:param chain: Optional chain filter. If not provided, returns vaults for all chains.
|
|
342
|
+
:param asset_symbol: Filter vaults by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
343
|
+
:param retries: Override the default retry configuration for this method
|
|
344
|
+
:param server_url: Override the default server URL for this method
|
|
345
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
346
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
347
|
+
"""
|
|
348
|
+
base_url = None
|
|
349
|
+
url_variables = None
|
|
350
|
+
if timeout_ms is None:
|
|
351
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
352
|
+
|
|
353
|
+
if server_url is not None:
|
|
354
|
+
base_url = server_url
|
|
355
|
+
else:
|
|
356
|
+
base_url = self._get_url(base_url, url_variables)
|
|
357
|
+
|
|
358
|
+
request = models.V2EarnVaultsRequest(
|
|
359
|
+
order_by=order_by,
|
|
360
|
+
direction=direction,
|
|
361
|
+
offset=offset,
|
|
362
|
+
limit=limit,
|
|
363
|
+
chain=chain,
|
|
364
|
+
asset_symbol=asset_symbol,
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
req = self._build_request_async(
|
|
368
|
+
method="GET",
|
|
369
|
+
path="/v2/earn/vaults",
|
|
370
|
+
base_url=base_url,
|
|
371
|
+
url_variables=url_variables,
|
|
372
|
+
request=request,
|
|
373
|
+
request_body_required=False,
|
|
374
|
+
request_has_path_params=False,
|
|
375
|
+
request_has_query_params=True,
|
|
376
|
+
user_agent_header="user-agent",
|
|
377
|
+
accept_header_value="application/json",
|
|
378
|
+
http_headers=http_headers,
|
|
379
|
+
security=self.sdk_configuration.security,
|
|
380
|
+
allow_empty_value=None,
|
|
381
|
+
timeout_ms=timeout_ms,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
if retries == UNSET:
|
|
385
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
386
|
+
retries = self.sdk_configuration.retry_config
|
|
387
|
+
|
|
388
|
+
retry_config = None
|
|
389
|
+
if isinstance(retries, utils.RetryConfig):
|
|
390
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
391
|
+
|
|
392
|
+
http_res = await self.do_request_async(
|
|
393
|
+
hook_ctx=HookContext(
|
|
394
|
+
config=self.sdk_configuration,
|
|
395
|
+
base_url=base_url or "",
|
|
396
|
+
operation_id="v2_earn_vaults",
|
|
397
|
+
oauth2_scopes=None,
|
|
398
|
+
security_source=self.sdk_configuration.security,
|
|
399
|
+
),
|
|
400
|
+
request=req,
|
|
401
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
402
|
+
retry_config=retry_config,
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
response_data: Any = None
|
|
406
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
407
|
+
return unmarshal_json_response(models.VaultsResponse, http_res)
|
|
408
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
409
|
+
response_data = unmarshal_json_response(
|
|
410
|
+
errors.HTTPValidationErrorData, http_res
|
|
411
|
+
)
|
|
412
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
413
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
414
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
415
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
416
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
417
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
418
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
419
|
+
|
|
420
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
421
|
+
|
|
422
|
+
def earn_aave_markets(
|
|
423
|
+
self,
|
|
424
|
+
*,
|
|
425
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
426
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
427
|
+
server_url: Optional[str] = None,
|
|
428
|
+
timeout_ms: Optional[int] = None,
|
|
429
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
430
|
+
) -> models.ListAaveMarketsResponse:
|
|
431
|
+
r"""List aave markets
|
|
432
|
+
|
|
433
|
+
List all aave markets with their supply and borrow rates.
|
|
434
|
+
|
|
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.
|
|
438
|
+
|
|
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
|
+
|
|
442
|
+
Optionally filter by chain.
|
|
443
|
+
|
|
444
|
+
:param chain: Optional chain filter. If not provided, returns rates for all chains.
|
|
445
|
+
:param retries: Override the default retry configuration for this method
|
|
446
|
+
:param server_url: Override the default server URL for this method
|
|
447
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
448
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
449
|
+
"""
|
|
450
|
+
base_url = None
|
|
451
|
+
url_variables = None
|
|
452
|
+
if timeout_ms is None:
|
|
453
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
454
|
+
|
|
455
|
+
if server_url is not None:
|
|
456
|
+
base_url = server_url
|
|
457
|
+
else:
|
|
458
|
+
base_url = self._get_url(base_url, url_variables)
|
|
459
|
+
|
|
460
|
+
request = models.V2EarnAaveMarketsRequest(
|
|
461
|
+
chain=chain,
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
req = self._build_request(
|
|
465
|
+
method="GET",
|
|
466
|
+
path="/v2/earn/aave_markets",
|
|
467
|
+
base_url=base_url,
|
|
468
|
+
url_variables=url_variables,
|
|
469
|
+
request=request,
|
|
470
|
+
request_body_required=False,
|
|
471
|
+
request_has_path_params=False,
|
|
472
|
+
request_has_query_params=True,
|
|
473
|
+
user_agent_header="user-agent",
|
|
474
|
+
accept_header_value="application/json",
|
|
475
|
+
http_headers=http_headers,
|
|
476
|
+
security=self.sdk_configuration.security,
|
|
477
|
+
allow_empty_value=None,
|
|
478
|
+
timeout_ms=timeout_ms,
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
if retries == UNSET:
|
|
482
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
483
|
+
retries = self.sdk_configuration.retry_config
|
|
484
|
+
|
|
485
|
+
retry_config = None
|
|
486
|
+
if isinstance(retries, utils.RetryConfig):
|
|
487
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
488
|
+
|
|
489
|
+
http_res = self.do_request(
|
|
490
|
+
hook_ctx=HookContext(
|
|
491
|
+
config=self.sdk_configuration,
|
|
492
|
+
base_url=base_url or "",
|
|
493
|
+
operation_id="v2_earn_aave_markets",
|
|
494
|
+
oauth2_scopes=None,
|
|
495
|
+
security_source=self.sdk_configuration.security,
|
|
496
|
+
),
|
|
497
|
+
request=req,
|
|
498
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
499
|
+
retry_config=retry_config,
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
response_data: Any = None
|
|
503
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
504
|
+
return unmarshal_json_response(models.ListAaveMarketsResponse, http_res)
|
|
505
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
506
|
+
response_data = unmarshal_json_response(
|
|
507
|
+
errors.HTTPValidationErrorData, http_res
|
|
508
|
+
)
|
|
509
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
510
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
511
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
512
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
513
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
514
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
515
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
516
|
+
|
|
517
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
518
|
+
|
|
519
|
+
async def earn_aave_markets_async(
|
|
520
|
+
self,
|
|
521
|
+
*,
|
|
522
|
+
chain: OptionalNullable[models.Chain] = UNSET,
|
|
523
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
524
|
+
server_url: Optional[str] = None,
|
|
525
|
+
timeout_ms: Optional[int] = None,
|
|
526
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
527
|
+
) -> models.ListAaveMarketsResponse:
|
|
528
|
+
r"""List aave markets
|
|
529
|
+
|
|
530
|
+
List all aave markets with their supply and borrow rates.
|
|
531
|
+
|
|
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.
|
|
535
|
+
|
|
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.
|
|
538
|
+
|
|
539
|
+
Optionally filter by chain.
|
|
540
|
+
|
|
541
|
+
:param chain: Optional chain filter. If not provided, returns rates for all chains.
|
|
542
|
+
:param retries: Override the default retry configuration for this method
|
|
543
|
+
:param server_url: Override the default server URL for this method
|
|
544
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
545
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
546
|
+
"""
|
|
547
|
+
base_url = None
|
|
548
|
+
url_variables = None
|
|
549
|
+
if timeout_ms is None:
|
|
550
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
551
|
+
|
|
552
|
+
if server_url is not None:
|
|
553
|
+
base_url = server_url
|
|
554
|
+
else:
|
|
555
|
+
base_url = self._get_url(base_url, url_variables)
|
|
556
|
+
|
|
557
|
+
request = models.V2EarnAaveMarketsRequest(
|
|
558
|
+
chain=chain,
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
req = self._build_request_async(
|
|
562
|
+
method="GET",
|
|
563
|
+
path="/v2/earn/aave_markets",
|
|
564
|
+
base_url=base_url,
|
|
565
|
+
url_variables=url_variables,
|
|
566
|
+
request=request,
|
|
567
|
+
request_body_required=False,
|
|
568
|
+
request_has_path_params=False,
|
|
569
|
+
request_has_query_params=True,
|
|
570
|
+
user_agent_header="user-agent",
|
|
571
|
+
accept_header_value="application/json",
|
|
572
|
+
http_headers=http_headers,
|
|
573
|
+
security=self.sdk_configuration.security,
|
|
574
|
+
allow_empty_value=None,
|
|
575
|
+
timeout_ms=timeout_ms,
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
if retries == UNSET:
|
|
579
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
580
|
+
retries = self.sdk_configuration.retry_config
|
|
581
|
+
|
|
582
|
+
retry_config = None
|
|
583
|
+
if isinstance(retries, utils.RetryConfig):
|
|
584
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
585
|
+
|
|
586
|
+
http_res = await self.do_request_async(
|
|
587
|
+
hook_ctx=HookContext(
|
|
588
|
+
config=self.sdk_configuration,
|
|
589
|
+
base_url=base_url or "",
|
|
590
|
+
operation_id="v2_earn_aave_markets",
|
|
591
|
+
oauth2_scopes=None,
|
|
592
|
+
security_source=self.sdk_configuration.security,
|
|
593
|
+
),
|
|
594
|
+
request=req,
|
|
595
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
596
|
+
retry_config=retry_config,
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
response_data: Any = None
|
|
600
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
601
|
+
return unmarshal_json_response(models.ListAaveMarketsResponse, http_res)
|
|
602
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
603
|
+
response_data = unmarshal_json_response(
|
|
604
|
+
errors.HTTPValidationErrorData, http_res
|
|
605
|
+
)
|
|
606
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
607
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
608
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
609
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
610
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
611
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
612
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
613
|
+
|
|
614
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
615
|
+
|
|
616
|
+
def earn_create_account(
|
|
617
|
+
self,
|
|
618
|
+
*,
|
|
619
|
+
chain: models.CreateAccountRequestChain,
|
|
620
|
+
sender: str,
|
|
621
|
+
owner: str,
|
|
622
|
+
estimate_gas: Optional[bool] = None,
|
|
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.CreateAccountResponse:
|
|
628
|
+
r"""Create earn account
|
|
629
|
+
|
|
630
|
+
Create an Earn Account.
|
|
631
|
+
|
|
632
|
+
Before creating Earn positions, the `owner` must create an Earn Account associated with their wallet address.
|
|
633
|
+
|
|
634
|
+
Only the `owner` has the authority to sign transactions for this account. This can be done in one of two ways:
|
|
635
|
+
|
|
636
|
+
1) **No gas-sponsorship:** The `owner` signs a transaction and submits it to the network for execution. The `owner` covers the cost of gas in this case.
|
|
637
|
+
|
|
638
|
+
2) **Gas-sponsorship:** The `owner` does an off-chain EIP-712 signature and submits this signature to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`). Here, another wallet address is set as `sender`. This wallet will sign, submit and cover the gas fees of the transaction.
|
|
639
|
+
|
|
640
|
+
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.
|
|
641
|
+
|
|
642
|
+
:param chain:
|
|
643
|
+
:param sender: The address of the transaction sender.
|
|
644
|
+
:param owner: The address that will own and control the compass account
|
|
645
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
646
|
+
:param retries: Override the default retry configuration for this method
|
|
647
|
+
:param server_url: Override the default server URL for this method
|
|
648
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
649
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
650
|
+
"""
|
|
651
|
+
base_url = None
|
|
652
|
+
url_variables = None
|
|
653
|
+
if timeout_ms is None:
|
|
654
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
655
|
+
|
|
656
|
+
if server_url is not None:
|
|
657
|
+
base_url = server_url
|
|
658
|
+
else:
|
|
659
|
+
base_url = self._get_url(base_url, url_variables)
|
|
660
|
+
|
|
661
|
+
request = models.CreateAccountRequest(
|
|
662
|
+
chain=chain,
|
|
663
|
+
sender=sender,
|
|
664
|
+
estimate_gas=estimate_gas,
|
|
665
|
+
owner=owner,
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
req = self._build_request(
|
|
669
|
+
method="POST",
|
|
670
|
+
path="/v2/earn/create_account",
|
|
671
|
+
base_url=base_url,
|
|
672
|
+
url_variables=url_variables,
|
|
673
|
+
request=request,
|
|
674
|
+
request_body_required=True,
|
|
675
|
+
request_has_path_params=False,
|
|
676
|
+
request_has_query_params=True,
|
|
677
|
+
user_agent_header="user-agent",
|
|
678
|
+
accept_header_value="application/json",
|
|
679
|
+
http_headers=http_headers,
|
|
680
|
+
security=self.sdk_configuration.security,
|
|
681
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
682
|
+
request, False, False, "json", models.CreateAccountRequest
|
|
683
|
+
),
|
|
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_create_account",
|
|
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.CreateAccountResponse, 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_create_account_async(
|
|
727
|
+
self,
|
|
728
|
+
*,
|
|
729
|
+
chain: models.CreateAccountRequestChain,
|
|
730
|
+
sender: str,
|
|
731
|
+
owner: str,
|
|
732
|
+
estimate_gas: Optional[bool] = None,
|
|
733
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
734
|
+
server_url: Optional[str] = None,
|
|
735
|
+
timeout_ms: Optional[int] = None,
|
|
736
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
737
|
+
) -> models.CreateAccountResponse:
|
|
738
|
+
r"""Create earn account
|
|
739
|
+
|
|
740
|
+
Create an Earn Account.
|
|
741
|
+
|
|
742
|
+
Before creating Earn positions, the `owner` must create an Earn Account associated with their wallet address.
|
|
743
|
+
|
|
744
|
+
Only the `owner` has the authority to sign transactions for this account. This can be done in one of two ways:
|
|
745
|
+
|
|
746
|
+
1) **No gas-sponsorship:** The `owner` signs a transaction and submits it to the network for execution. The `owner` covers the cost of gas in this case.
|
|
747
|
+
|
|
748
|
+
2) **Gas-sponsorship:** The `owner` does an off-chain EIP-712 signature and submits this signature to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`). Here, another wallet address is set as `sender`. This wallet will sign, submit and cover the gas fees of the transaction.
|
|
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.
|
|
751
|
+
|
|
752
|
+
:param chain:
|
|
753
|
+
:param sender: The address of the transaction sender.
|
|
754
|
+
:param owner: The address that will own and control the compass account
|
|
755
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
756
|
+
:param retries: Override the default retry configuration for this method
|
|
757
|
+
:param server_url: Override the default server URL for this method
|
|
758
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
759
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
760
|
+
"""
|
|
761
|
+
base_url = None
|
|
762
|
+
url_variables = None
|
|
763
|
+
if timeout_ms is None:
|
|
764
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
765
|
+
|
|
766
|
+
if server_url is not None:
|
|
767
|
+
base_url = server_url
|
|
768
|
+
else:
|
|
769
|
+
base_url = self._get_url(base_url, url_variables)
|
|
770
|
+
|
|
771
|
+
request = models.CreateAccountRequest(
|
|
772
|
+
chain=chain,
|
|
773
|
+
sender=sender,
|
|
774
|
+
estimate_gas=estimate_gas,
|
|
775
|
+
owner=owner,
|
|
776
|
+
)
|
|
777
|
+
|
|
778
|
+
req = self._build_request_async(
|
|
779
|
+
method="POST",
|
|
780
|
+
path="/v2/earn/create_account",
|
|
781
|
+
base_url=base_url,
|
|
782
|
+
url_variables=url_variables,
|
|
783
|
+
request=request,
|
|
784
|
+
request_body_required=True,
|
|
785
|
+
request_has_path_params=False,
|
|
786
|
+
request_has_query_params=True,
|
|
787
|
+
user_agent_header="user-agent",
|
|
788
|
+
accept_header_value="application/json",
|
|
789
|
+
http_headers=http_headers,
|
|
790
|
+
security=self.sdk_configuration.security,
|
|
791
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
792
|
+
request, False, False, "json", models.CreateAccountRequest
|
|
793
|
+
),
|
|
794
|
+
allow_empty_value=None,
|
|
795
|
+
timeout_ms=timeout_ms,
|
|
796
|
+
)
|
|
797
|
+
|
|
798
|
+
if retries == UNSET:
|
|
799
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
800
|
+
retries = self.sdk_configuration.retry_config
|
|
801
|
+
|
|
802
|
+
retry_config = None
|
|
803
|
+
if isinstance(retries, utils.RetryConfig):
|
|
804
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
805
|
+
|
|
806
|
+
http_res = await self.do_request_async(
|
|
807
|
+
hook_ctx=HookContext(
|
|
808
|
+
config=self.sdk_configuration,
|
|
809
|
+
base_url=base_url or "",
|
|
810
|
+
operation_id="v2_earn_create_account",
|
|
811
|
+
oauth2_scopes=None,
|
|
812
|
+
security_source=self.sdk_configuration.security,
|
|
813
|
+
),
|
|
814
|
+
request=req,
|
|
815
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
816
|
+
retry_config=retry_config,
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
response_data: Any = None
|
|
820
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
821
|
+
return unmarshal_json_response(models.CreateAccountResponse, http_res)
|
|
822
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
823
|
+
response_data = unmarshal_json_response(
|
|
824
|
+
errors.HTTPValidationErrorData, http_res
|
|
825
|
+
)
|
|
826
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
827
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
828
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
829
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
830
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
831
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
832
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
833
|
+
|
|
834
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
835
|
+
|
|
836
|
+
def earn_transfer(
|
|
837
|
+
self,
|
|
838
|
+
*,
|
|
839
|
+
owner: str,
|
|
840
|
+
chain: models.Chain,
|
|
841
|
+
token: str,
|
|
842
|
+
amount: Union[
|
|
843
|
+
models.EarnTransferRequestAmount, models.EarnTransferRequestAmountTypedDict
|
|
844
|
+
],
|
|
845
|
+
action: models.EarnTransferRequestAction,
|
|
846
|
+
gas_sponsorship: Optional[bool] = None,
|
|
847
|
+
spender: OptionalNullable[str] = UNSET,
|
|
848
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
849
|
+
server_url: Optional[str] = None,
|
|
850
|
+
timeout_ms: Optional[int] = None,
|
|
851
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
852
|
+
) -> models.EarnTransferResponse:
|
|
853
|
+
r"""Transfer tokens to/from account
|
|
854
|
+
|
|
855
|
+
Transfer tokens to and from an Earn Account.
|
|
856
|
+
|
|
857
|
+
If `DEPOSIT`'` is selected, tokens will be transferred from the `owner`'s wallet into their Earn Account.
|
|
858
|
+
|
|
859
|
+
If `WITHDRAW` is selected, tokens will be transferred from the `owner`'s Earn Account into their wallet.
|
|
860
|
+
|
|
861
|
+
If a gas-sponsored `DEPOSIT` transfer is desired for a given token, a one-time Permit2 allowance must be set before proceeding. This is common practice for many other applications and, for many `owner`s, this one-time allowance will already have been set for the token they would like to transfer.
|
|
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.
|
|
863
|
+
|
|
864
|
+
:param owner: The owner's wallet address.
|
|
865
|
+
:param chain: The chain to use.
|
|
866
|
+
:param token: The token you would like to transfer.
|
|
867
|
+
:param amount: The amount of 'token' to transfer.
|
|
868
|
+
:param action: Whether you are depositing to or withdrawing from your earn account.
|
|
869
|
+
:param gas_sponsorship: Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
|
|
870
|
+
:param spender: The address of the wallet which will send the transaction. This only needs to be set when `action` is 'DEPOSIT' and `gas_sponsorship` is `true`.
|
|
871
|
+
:param retries: Override the default retry configuration for this method
|
|
872
|
+
:param server_url: Override the default server URL for this method
|
|
873
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
874
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
875
|
+
"""
|
|
876
|
+
base_url = None
|
|
877
|
+
url_variables = None
|
|
878
|
+
if timeout_ms is None:
|
|
879
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
880
|
+
|
|
881
|
+
if server_url is not None:
|
|
882
|
+
base_url = server_url
|
|
883
|
+
else:
|
|
884
|
+
base_url = self._get_url(base_url, url_variables)
|
|
885
|
+
|
|
886
|
+
request = models.EarnTransferRequest(
|
|
887
|
+
owner=owner,
|
|
888
|
+
chain=chain,
|
|
889
|
+
token=token,
|
|
890
|
+
amount=amount,
|
|
891
|
+
action=action,
|
|
892
|
+
gas_sponsorship=gas_sponsorship,
|
|
893
|
+
spender=spender,
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
req = self._build_request(
|
|
897
|
+
method="POST",
|
|
898
|
+
path="/v2/earn/transfer",
|
|
899
|
+
base_url=base_url,
|
|
900
|
+
url_variables=url_variables,
|
|
901
|
+
request=request,
|
|
902
|
+
request_body_required=True,
|
|
903
|
+
request_has_path_params=False,
|
|
904
|
+
request_has_query_params=True,
|
|
905
|
+
user_agent_header="user-agent",
|
|
906
|
+
accept_header_value="application/json",
|
|
907
|
+
http_headers=http_headers,
|
|
908
|
+
security=self.sdk_configuration.security,
|
|
909
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
910
|
+
request, False, False, "json", models.EarnTransferRequest
|
|
911
|
+
),
|
|
912
|
+
allow_empty_value=None,
|
|
913
|
+
timeout_ms=timeout_ms,
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
if retries == UNSET:
|
|
917
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
918
|
+
retries = self.sdk_configuration.retry_config
|
|
919
|
+
|
|
920
|
+
retry_config = None
|
|
921
|
+
if isinstance(retries, utils.RetryConfig):
|
|
922
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
923
|
+
|
|
924
|
+
http_res = self.do_request(
|
|
925
|
+
hook_ctx=HookContext(
|
|
926
|
+
config=self.sdk_configuration,
|
|
927
|
+
base_url=base_url or "",
|
|
928
|
+
operation_id="v2_earn_transfer",
|
|
929
|
+
oauth2_scopes=None,
|
|
930
|
+
security_source=self.sdk_configuration.security,
|
|
931
|
+
),
|
|
932
|
+
request=req,
|
|
933
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
934
|
+
retry_config=retry_config,
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
response_data: Any = None
|
|
938
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
939
|
+
return unmarshal_json_response(models.EarnTransferResponse, http_res)
|
|
940
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
941
|
+
response_data = unmarshal_json_response(
|
|
942
|
+
errors.HTTPValidationErrorData, http_res
|
|
943
|
+
)
|
|
944
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
945
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
946
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
947
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
948
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
949
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
950
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
951
|
+
|
|
952
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
953
|
+
|
|
954
|
+
async def earn_transfer_async(
|
|
955
|
+
self,
|
|
956
|
+
*,
|
|
957
|
+
owner: str,
|
|
958
|
+
chain: models.Chain,
|
|
959
|
+
token: str,
|
|
960
|
+
amount: Union[
|
|
961
|
+
models.EarnTransferRequestAmount, models.EarnTransferRequestAmountTypedDict
|
|
962
|
+
],
|
|
963
|
+
action: models.EarnTransferRequestAction,
|
|
964
|
+
gas_sponsorship: Optional[bool] = None,
|
|
965
|
+
spender: OptionalNullable[str] = UNSET,
|
|
966
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
967
|
+
server_url: Optional[str] = None,
|
|
968
|
+
timeout_ms: Optional[int] = None,
|
|
969
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
970
|
+
) -> models.EarnTransferResponse:
|
|
971
|
+
r"""Transfer tokens to/from account
|
|
972
|
+
|
|
973
|
+
Transfer tokens to and from an Earn Account.
|
|
974
|
+
|
|
975
|
+
If `DEPOSIT`'` is selected, tokens will be transferred from the `owner`'s wallet into their Earn Account.
|
|
976
|
+
|
|
977
|
+
If `WITHDRAW` is selected, tokens will be transferred from the `owner`'s Earn Account into their wallet.
|
|
978
|
+
|
|
979
|
+
If a gas-sponsored `DEPOSIT` transfer is desired for a given token, a one-time Permit2 allowance must be set before proceeding. This is common practice for many other applications and, for many `owner`s, this one-time allowance will already have been set for the token they would like to transfer.
|
|
980
|
+
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.
|
|
981
|
+
|
|
982
|
+
:param owner: The owner's wallet address.
|
|
983
|
+
:param chain: The chain to use.
|
|
984
|
+
:param token: The token you would like to transfer.
|
|
985
|
+
:param amount: The amount of 'token' to transfer.
|
|
986
|
+
:param action: Whether you are depositing to or withdrawing from your earn account.
|
|
987
|
+
:param gas_sponsorship: Optionally request gas sponsorship. If set to `true`, EIP-712 signature data will be returned that must be signed by the `owner` and submitted to the `/gas_sponsorship/prepare` endpoint.
|
|
988
|
+
:param spender: The address of the wallet which will send the transaction. This only needs to be set when `action` is 'DEPOSIT' and `gas_sponsorship` is `true`.
|
|
989
|
+
:param retries: Override the default retry configuration for this method
|
|
990
|
+
:param server_url: Override the default server URL for this method
|
|
991
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
992
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
993
|
+
"""
|
|
994
|
+
base_url = None
|
|
995
|
+
url_variables = None
|
|
996
|
+
if timeout_ms is None:
|
|
997
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
998
|
+
|
|
999
|
+
if server_url is not None:
|
|
1000
|
+
base_url = server_url
|
|
1001
|
+
else:
|
|
1002
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1003
|
+
|
|
1004
|
+
request = models.EarnTransferRequest(
|
|
1005
|
+
owner=owner,
|
|
1006
|
+
chain=chain,
|
|
1007
|
+
token=token,
|
|
1008
|
+
amount=amount,
|
|
1009
|
+
action=action,
|
|
1010
|
+
gas_sponsorship=gas_sponsorship,
|
|
1011
|
+
spender=spender,
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
req = self._build_request_async(
|
|
1015
|
+
method="POST",
|
|
1016
|
+
path="/v2/earn/transfer",
|
|
1017
|
+
base_url=base_url,
|
|
1018
|
+
url_variables=url_variables,
|
|
1019
|
+
request=request,
|
|
1020
|
+
request_body_required=True,
|
|
1021
|
+
request_has_path_params=False,
|
|
1022
|
+
request_has_query_params=True,
|
|
1023
|
+
user_agent_header="user-agent",
|
|
1024
|
+
accept_header_value="application/json",
|
|
1025
|
+
http_headers=http_headers,
|
|
1026
|
+
security=self.sdk_configuration.security,
|
|
1027
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1028
|
+
request, False, False, "json", models.EarnTransferRequest
|
|
1029
|
+
),
|
|
1030
|
+
allow_empty_value=None,
|
|
1031
|
+
timeout_ms=timeout_ms,
|
|
1032
|
+
)
|
|
1033
|
+
|
|
1034
|
+
if retries == UNSET:
|
|
1035
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1036
|
+
retries = self.sdk_configuration.retry_config
|
|
1037
|
+
|
|
1038
|
+
retry_config = None
|
|
1039
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1040
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1041
|
+
|
|
1042
|
+
http_res = await self.do_request_async(
|
|
1043
|
+
hook_ctx=HookContext(
|
|
1044
|
+
config=self.sdk_configuration,
|
|
1045
|
+
base_url=base_url or "",
|
|
1046
|
+
operation_id="v2_earn_transfer",
|
|
1047
|
+
oauth2_scopes=None,
|
|
1048
|
+
security_source=self.sdk_configuration.security,
|
|
1049
|
+
),
|
|
1050
|
+
request=req,
|
|
1051
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1052
|
+
retry_config=retry_config,
|
|
1053
|
+
)
|
|
1054
|
+
|
|
1055
|
+
response_data: Any = None
|
|
1056
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1057
|
+
return unmarshal_json_response(models.EarnTransferResponse, http_res)
|
|
1058
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1059
|
+
response_data = unmarshal_json_response(
|
|
1060
|
+
errors.HTTPValidationErrorData, http_res
|
|
1061
|
+
)
|
|
1062
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1063
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1064
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1065
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1066
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1067
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1068
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1069
|
+
|
|
1070
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1071
|
+
|
|
1072
|
+
def earn_manage(
|
|
1073
|
+
self,
|
|
1074
|
+
*,
|
|
1075
|
+
venue: Union[
|
|
1076
|
+
models.EarnManageRequestVenue, models.EarnManageRequestVenueTypedDict
|
|
1077
|
+
],
|
|
1078
|
+
action: models.EarnManageRequestAction,
|
|
1079
|
+
amount: Any,
|
|
1080
|
+
owner: str,
|
|
1081
|
+
chain: models.Chain,
|
|
1082
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1083
|
+
fee: OptionalNullable[Union[models.Fee, models.FeeTypedDict]] = UNSET,
|
|
1084
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1085
|
+
server_url: Optional[str] = None,
|
|
1086
|
+
timeout_ms: Optional[int] = None,
|
|
1087
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1088
|
+
) -> models.EarnManageResponse:
|
|
1089
|
+
r"""Manage earn position
|
|
1090
|
+
|
|
1091
|
+
Manage an Earn position for a given `owner`'s Earn Account.
|
|
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
|
|
1098
|
+
|
|
1099
|
+
If `DEPOSIT` is selected for `action`, tokens will be deposited into the selected venue address from the Earn Account associated with the `owner` wallet.
|
|
1100
|
+
|
|
1101
|
+
If `WITHDRAW` is selected for `action`, tokens will be withdrawn from the selected venue address back into the Earn Account associated with the `owner` wallet.
|
|
1102
|
+
|
|
1103
|
+
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`.
|
|
1104
|
+
|
|
1105
|
+
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.
|
|
1106
|
+
|
|
1107
|
+
:param venue: The earn venue.
|
|
1108
|
+
: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.
|
|
1110
|
+
:param owner: The primary wallet address that owns and controls the Earn Account.
|
|
1111
|
+
:param chain: The chain to use.
|
|
1112
|
+
: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`).
|
|
1113
|
+
:param fee: Optional fee configuration. If provided, a fee will be applied to the transaction amount and sent to the specified recipient address. The fee can be specified as a percentage of the transaction amount or as a fixed token amount.
|
|
1114
|
+
:param retries: Override the default retry configuration for this method
|
|
1115
|
+
:param server_url: Override the default server URL for this method
|
|
1116
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1117
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1118
|
+
"""
|
|
1119
|
+
base_url = None
|
|
1120
|
+
url_variables = None
|
|
1121
|
+
if timeout_ms is None:
|
|
1122
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1123
|
+
|
|
1124
|
+
if server_url is not None:
|
|
1125
|
+
base_url = server_url
|
|
1126
|
+
else:
|
|
1127
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1128
|
+
|
|
1129
|
+
request = models.EarnManageRequest(
|
|
1130
|
+
venue=utils.get_pydantic_model(venue, models.EarnManageRequestVenue),
|
|
1131
|
+
action=action,
|
|
1132
|
+
amount=amount,
|
|
1133
|
+
owner=owner,
|
|
1134
|
+
chain=chain,
|
|
1135
|
+
gas_sponsorship=gas_sponsorship,
|
|
1136
|
+
fee=utils.get_pydantic_model(fee, OptionalNullable[models.Fee]),
|
|
1137
|
+
)
|
|
1138
|
+
|
|
1139
|
+
req = self._build_request(
|
|
1140
|
+
method="POST",
|
|
1141
|
+
path="/v2/earn/manage",
|
|
1142
|
+
base_url=base_url,
|
|
1143
|
+
url_variables=url_variables,
|
|
1144
|
+
request=request,
|
|
1145
|
+
request_body_required=True,
|
|
1146
|
+
request_has_path_params=False,
|
|
1147
|
+
request_has_query_params=True,
|
|
1148
|
+
user_agent_header="user-agent",
|
|
1149
|
+
accept_header_value="application/json",
|
|
1150
|
+
http_headers=http_headers,
|
|
1151
|
+
security=self.sdk_configuration.security,
|
|
1152
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1153
|
+
request, False, False, "json", models.EarnManageRequest
|
|
1154
|
+
),
|
|
1155
|
+
allow_empty_value=None,
|
|
1156
|
+
timeout_ms=timeout_ms,
|
|
1157
|
+
)
|
|
1158
|
+
|
|
1159
|
+
if retries == UNSET:
|
|
1160
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1161
|
+
retries = self.sdk_configuration.retry_config
|
|
1162
|
+
|
|
1163
|
+
retry_config = None
|
|
1164
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1165
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1166
|
+
|
|
1167
|
+
http_res = self.do_request(
|
|
1168
|
+
hook_ctx=HookContext(
|
|
1169
|
+
config=self.sdk_configuration,
|
|
1170
|
+
base_url=base_url or "",
|
|
1171
|
+
operation_id="v2_earn_manage",
|
|
1172
|
+
oauth2_scopes=None,
|
|
1173
|
+
security_source=self.sdk_configuration.security,
|
|
1174
|
+
),
|
|
1175
|
+
request=req,
|
|
1176
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1177
|
+
retry_config=retry_config,
|
|
1178
|
+
)
|
|
1179
|
+
|
|
1180
|
+
response_data: Any = None
|
|
1181
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1182
|
+
return unmarshal_json_response(models.EarnManageResponse, http_res)
|
|
1183
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1184
|
+
response_data = unmarshal_json_response(
|
|
1185
|
+
errors.HTTPValidationErrorData, http_res
|
|
1186
|
+
)
|
|
1187
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1188
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1189
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1190
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1191
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1192
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1193
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1194
|
+
|
|
1195
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1196
|
+
|
|
1197
|
+
async def earn_manage_async(
|
|
1198
|
+
self,
|
|
1199
|
+
*,
|
|
1200
|
+
venue: Union[
|
|
1201
|
+
models.EarnManageRequestVenue, models.EarnManageRequestVenueTypedDict
|
|
1202
|
+
],
|
|
1203
|
+
action: models.EarnManageRequestAction,
|
|
1204
|
+
amount: Any,
|
|
1205
|
+
owner: str,
|
|
1206
|
+
chain: models.Chain,
|
|
1207
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1208
|
+
fee: OptionalNullable[Union[models.Fee, models.FeeTypedDict]] = UNSET,
|
|
1209
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1210
|
+
server_url: Optional[str] = None,
|
|
1211
|
+
timeout_ms: Optional[int] = None,
|
|
1212
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1213
|
+
) -> models.EarnManageResponse:
|
|
1214
|
+
r"""Manage earn position
|
|
1215
|
+
|
|
1216
|
+
Manage an Earn position for a given `owner`'s Earn Account.
|
|
1217
|
+
|
|
1218
|
+
The `owner` is the main wallet address that owns and controls the Earn Account. It is not the Earn Account address itself.
|
|
1219
|
+
|
|
1220
|
+
Venue Types:
|
|
1221
|
+
- VAULTS
|
|
1222
|
+
- AAVE
|
|
1223
|
+
|
|
1224
|
+
If `DEPOSIT` is selected for `action`, tokens will be deposited into the selected venue address from the Earn Account associated with the `owner` wallet.
|
|
1225
|
+
|
|
1226
|
+
If `WITHDRAW` is selected for `action`, tokens will be withdrawn from the selected venue address back into the Earn Account associated with the `owner` wallet.
|
|
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.
|
|
1231
|
+
|
|
1232
|
+
:param venue: The earn venue.
|
|
1233
|
+
: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.
|
|
1235
|
+
:param owner: The primary wallet address that owns and controls the Earn Account.
|
|
1236
|
+
:param chain: The chain to use.
|
|
1237
|
+
: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`).
|
|
1238
|
+
:param fee: Optional fee configuration. If provided, a fee will be applied to the transaction amount and sent to the specified recipient address. The fee can be specified as a percentage of the transaction amount or as a fixed token amount.
|
|
1239
|
+
:param retries: Override the default retry configuration for this method
|
|
1240
|
+
:param server_url: Override the default server URL for this method
|
|
1241
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1242
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1243
|
+
"""
|
|
1244
|
+
base_url = None
|
|
1245
|
+
url_variables = None
|
|
1246
|
+
if timeout_ms is None:
|
|
1247
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1248
|
+
|
|
1249
|
+
if server_url is not None:
|
|
1250
|
+
base_url = server_url
|
|
1251
|
+
else:
|
|
1252
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1253
|
+
|
|
1254
|
+
request = models.EarnManageRequest(
|
|
1255
|
+
venue=utils.get_pydantic_model(venue, models.EarnManageRequestVenue),
|
|
1256
|
+
action=action,
|
|
1257
|
+
amount=amount,
|
|
1258
|
+
owner=owner,
|
|
1259
|
+
chain=chain,
|
|
1260
|
+
gas_sponsorship=gas_sponsorship,
|
|
1261
|
+
fee=utils.get_pydantic_model(fee, OptionalNullable[models.Fee]),
|
|
1262
|
+
)
|
|
1263
|
+
|
|
1264
|
+
req = self._build_request_async(
|
|
1265
|
+
method="POST",
|
|
1266
|
+
path="/v2/earn/manage",
|
|
1267
|
+
base_url=base_url,
|
|
1268
|
+
url_variables=url_variables,
|
|
1269
|
+
request=request,
|
|
1270
|
+
request_body_required=True,
|
|
1271
|
+
request_has_path_params=False,
|
|
1272
|
+
request_has_query_params=True,
|
|
1273
|
+
user_agent_header="user-agent",
|
|
1274
|
+
accept_header_value="application/json",
|
|
1275
|
+
http_headers=http_headers,
|
|
1276
|
+
security=self.sdk_configuration.security,
|
|
1277
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1278
|
+
request, False, False, "json", models.EarnManageRequest
|
|
1279
|
+
),
|
|
1280
|
+
allow_empty_value=None,
|
|
1281
|
+
timeout_ms=timeout_ms,
|
|
1282
|
+
)
|
|
1283
|
+
|
|
1284
|
+
if retries == UNSET:
|
|
1285
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1286
|
+
retries = self.sdk_configuration.retry_config
|
|
1287
|
+
|
|
1288
|
+
retry_config = None
|
|
1289
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1290
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1291
|
+
|
|
1292
|
+
http_res = await self.do_request_async(
|
|
1293
|
+
hook_ctx=HookContext(
|
|
1294
|
+
config=self.sdk_configuration,
|
|
1295
|
+
base_url=base_url or "",
|
|
1296
|
+
operation_id="v2_earn_manage",
|
|
1297
|
+
oauth2_scopes=None,
|
|
1298
|
+
security_source=self.sdk_configuration.security,
|
|
1299
|
+
),
|
|
1300
|
+
request=req,
|
|
1301
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1302
|
+
retry_config=retry_config,
|
|
1303
|
+
)
|
|
1304
|
+
|
|
1305
|
+
response_data: Any = None
|
|
1306
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1307
|
+
return unmarshal_json_response(models.EarnManageResponse, http_res)
|
|
1308
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1309
|
+
response_data = unmarshal_json_response(
|
|
1310
|
+
errors.HTTPValidationErrorData, http_res
|
|
1311
|
+
)
|
|
1312
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1313
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1314
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1315
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1316
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1317
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1318
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1319
|
+
|
|
1320
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1321
|
+
|
|
1322
|
+
def earn_swap(
|
|
1323
|
+
self,
|
|
1324
|
+
*,
|
|
1325
|
+
token_in: str,
|
|
1326
|
+
token_out: str,
|
|
1327
|
+
amount_in: Union[
|
|
1328
|
+
models.EarnSwapRequestAmountIn, models.EarnSwapRequestAmountInTypedDict
|
|
1329
|
+
],
|
|
1330
|
+
owner: str,
|
|
1331
|
+
chain: models.Chain,
|
|
1332
|
+
slippage: Optional[
|
|
1333
|
+
Union[
|
|
1334
|
+
models.EarnSwapRequestSlippage, models.EarnSwapRequestSlippageTypedDict
|
|
1335
|
+
]
|
|
1336
|
+
] = None,
|
|
1337
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1338
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1339
|
+
server_url: Optional[str] = None,
|
|
1340
|
+
timeout_ms: Optional[int] = None,
|
|
1341
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1342
|
+
) -> models.EarnSwapResponse:
|
|
1343
|
+
r"""Swap tokens within Earn Account
|
|
1344
|
+
|
|
1345
|
+
Swap tokens within an Earn Account.
|
|
1346
|
+
|
|
1347
|
+
:param token_in: Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
|
|
1348
|
+
:param token_out: Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
|
|
1349
|
+
:param amount_in: Human-readable amount of `token_in` to swap (token units, not wei).
|
|
1350
|
+
:param owner: The owner's wallet address.
|
|
1351
|
+
:param chain: The chain to use.
|
|
1352
|
+
:param slippage: Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
|
|
1353
|
+
:param gas_sponsorship: Optionally request gas sponsorship. If `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`).
|
|
1354
|
+
:param retries: Override the default retry configuration for this method
|
|
1355
|
+
:param server_url: Override the default server URL for this method
|
|
1356
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1357
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1358
|
+
"""
|
|
1359
|
+
base_url = None
|
|
1360
|
+
url_variables = None
|
|
1361
|
+
if timeout_ms is None:
|
|
1362
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1363
|
+
|
|
1364
|
+
if server_url is not None:
|
|
1365
|
+
base_url = server_url
|
|
1366
|
+
else:
|
|
1367
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1368
|
+
|
|
1369
|
+
request = models.EarnSwapRequest(
|
|
1370
|
+
token_in=token_in,
|
|
1371
|
+
token_out=token_out,
|
|
1372
|
+
amount_in=amount_in,
|
|
1373
|
+
slippage=slippage,
|
|
1374
|
+
owner=owner,
|
|
1375
|
+
chain=chain,
|
|
1376
|
+
gas_sponsorship=gas_sponsorship,
|
|
1377
|
+
)
|
|
1378
|
+
|
|
1379
|
+
req = self._build_request(
|
|
1380
|
+
method="POST",
|
|
1381
|
+
path="/v2/earn/swap",
|
|
1382
|
+
base_url=base_url,
|
|
1383
|
+
url_variables=url_variables,
|
|
1384
|
+
request=request,
|
|
1385
|
+
request_body_required=True,
|
|
1386
|
+
request_has_path_params=False,
|
|
1387
|
+
request_has_query_params=True,
|
|
1388
|
+
user_agent_header="user-agent",
|
|
1389
|
+
accept_header_value="application/json",
|
|
1390
|
+
http_headers=http_headers,
|
|
1391
|
+
security=self.sdk_configuration.security,
|
|
1392
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1393
|
+
request, False, False, "json", models.EarnSwapRequest
|
|
1394
|
+
),
|
|
1395
|
+
allow_empty_value=None,
|
|
1396
|
+
timeout_ms=timeout_ms,
|
|
1397
|
+
)
|
|
1398
|
+
|
|
1399
|
+
if retries == UNSET:
|
|
1400
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1401
|
+
retries = self.sdk_configuration.retry_config
|
|
1402
|
+
|
|
1403
|
+
retry_config = None
|
|
1404
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1405
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1406
|
+
|
|
1407
|
+
http_res = self.do_request(
|
|
1408
|
+
hook_ctx=HookContext(
|
|
1409
|
+
config=self.sdk_configuration,
|
|
1410
|
+
base_url=base_url or "",
|
|
1411
|
+
operation_id="v2_earn_swap",
|
|
1412
|
+
oauth2_scopes=None,
|
|
1413
|
+
security_source=self.sdk_configuration.security,
|
|
1414
|
+
),
|
|
1415
|
+
request=req,
|
|
1416
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1417
|
+
retry_config=retry_config,
|
|
1418
|
+
)
|
|
1419
|
+
|
|
1420
|
+
response_data: Any = None
|
|
1421
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1422
|
+
return unmarshal_json_response(models.EarnSwapResponse, http_res)
|
|
1423
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1424
|
+
response_data = unmarshal_json_response(
|
|
1425
|
+
errors.HTTPValidationErrorData, http_res
|
|
1426
|
+
)
|
|
1427
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1428
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1429
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1430
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1431
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1432
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1433
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1434
|
+
|
|
1435
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1436
|
+
|
|
1437
|
+
async def earn_swap_async(
|
|
1438
|
+
self,
|
|
1439
|
+
*,
|
|
1440
|
+
token_in: str,
|
|
1441
|
+
token_out: str,
|
|
1442
|
+
amount_in: Union[
|
|
1443
|
+
models.EarnSwapRequestAmountIn, models.EarnSwapRequestAmountInTypedDict
|
|
1444
|
+
],
|
|
1445
|
+
owner: str,
|
|
1446
|
+
chain: models.Chain,
|
|
1447
|
+
slippage: Optional[
|
|
1448
|
+
Union[
|
|
1449
|
+
models.EarnSwapRequestSlippage, models.EarnSwapRequestSlippageTypedDict
|
|
1450
|
+
]
|
|
1451
|
+
] = None,
|
|
1452
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1453
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1454
|
+
server_url: Optional[str] = None,
|
|
1455
|
+
timeout_ms: Optional[int] = None,
|
|
1456
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1457
|
+
) -> models.EarnSwapResponse:
|
|
1458
|
+
r"""Swap tokens within Earn Account
|
|
1459
|
+
|
|
1460
|
+
Swap tokens within an Earn Account.
|
|
1461
|
+
|
|
1462
|
+
:param token_in: Token to sell (input). Provide a token symbol from a limited set (e.g., 'USDC') or any token address.
|
|
1463
|
+
:param token_out: Token to buy (output). Provide a token symbol from a limited set (e.g., 'USDT') or any token address.
|
|
1464
|
+
:param amount_in: Human-readable amount of `token_in` to swap (token units, not wei).
|
|
1465
|
+
:param owner: The owner's wallet address.
|
|
1466
|
+
:param chain: The chain to use.
|
|
1467
|
+
:param slippage: Maximum slippage tolerance as a percentage (e.g., 0.5 = 0.5%).
|
|
1468
|
+
:param gas_sponsorship: Optionally request gas sponsorship. If `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`).
|
|
1469
|
+
:param retries: Override the default retry configuration for this method
|
|
1470
|
+
:param server_url: Override the default server URL for this method
|
|
1471
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1472
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1473
|
+
"""
|
|
1474
|
+
base_url = None
|
|
1475
|
+
url_variables = None
|
|
1476
|
+
if timeout_ms is None:
|
|
1477
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1478
|
+
|
|
1479
|
+
if server_url is not None:
|
|
1480
|
+
base_url = server_url
|
|
1481
|
+
else:
|
|
1482
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1483
|
+
|
|
1484
|
+
request = models.EarnSwapRequest(
|
|
1485
|
+
token_in=token_in,
|
|
1486
|
+
token_out=token_out,
|
|
1487
|
+
amount_in=amount_in,
|
|
1488
|
+
slippage=slippage,
|
|
1489
|
+
owner=owner,
|
|
1490
|
+
chain=chain,
|
|
1491
|
+
gas_sponsorship=gas_sponsorship,
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
req = self._build_request_async(
|
|
1495
|
+
method="POST",
|
|
1496
|
+
path="/v2/earn/swap",
|
|
1497
|
+
base_url=base_url,
|
|
1498
|
+
url_variables=url_variables,
|
|
1499
|
+
request=request,
|
|
1500
|
+
request_body_required=True,
|
|
1501
|
+
request_has_path_params=False,
|
|
1502
|
+
request_has_query_params=True,
|
|
1503
|
+
user_agent_header="user-agent",
|
|
1504
|
+
accept_header_value="application/json",
|
|
1505
|
+
http_headers=http_headers,
|
|
1506
|
+
security=self.sdk_configuration.security,
|
|
1507
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1508
|
+
request, False, False, "json", models.EarnSwapRequest
|
|
1509
|
+
),
|
|
1510
|
+
allow_empty_value=None,
|
|
1511
|
+
timeout_ms=timeout_ms,
|
|
1512
|
+
)
|
|
1513
|
+
|
|
1514
|
+
if retries == UNSET:
|
|
1515
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1516
|
+
retries = self.sdk_configuration.retry_config
|
|
1517
|
+
|
|
1518
|
+
retry_config = None
|
|
1519
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1520
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1521
|
+
|
|
1522
|
+
http_res = await self.do_request_async(
|
|
1523
|
+
hook_ctx=HookContext(
|
|
1524
|
+
config=self.sdk_configuration,
|
|
1525
|
+
base_url=base_url or "",
|
|
1526
|
+
operation_id="v2_earn_swap",
|
|
1527
|
+
oauth2_scopes=None,
|
|
1528
|
+
security_source=self.sdk_configuration.security,
|
|
1529
|
+
),
|
|
1530
|
+
request=req,
|
|
1531
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1532
|
+
retry_config=retry_config,
|
|
1533
|
+
)
|
|
1534
|
+
|
|
1535
|
+
response_data: Any = None
|
|
1536
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1537
|
+
return unmarshal_json_response(models.EarnSwapResponse, http_res)
|
|
1538
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1539
|
+
response_data = unmarshal_json_response(
|
|
1540
|
+
errors.HTTPValidationErrorData, http_res
|
|
1541
|
+
)
|
|
1542
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1543
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1544
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1545
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1546
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1547
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1548
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1549
|
+
|
|
1550
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1551
|
+
|
|
1552
|
+
def earn_bundle(
|
|
1553
|
+
self,
|
|
1554
|
+
*,
|
|
1555
|
+
owner: str,
|
|
1556
|
+
chain: models.Chain,
|
|
1557
|
+
actions: Union[
|
|
1558
|
+
List[models.V2UserOperation], List[models.V2UserOperationTypedDict]
|
|
1559
|
+
],
|
|
1560
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1561
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1562
|
+
server_url: Optional[str] = None,
|
|
1563
|
+
timeout_ms: Optional[int] = None,
|
|
1564
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1565
|
+
) -> models.V2BundleResponse:
|
|
1566
|
+
r"""Execute multiple earn actions
|
|
1567
|
+
|
|
1568
|
+
This endpoint allows combining multiple actions (swaps, vault
|
|
1569
|
+
deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
|
|
1570
|
+
executed via the Earn account).
|
|
1571
|
+
|
|
1572
|
+
**Example Use Case:** Swap USDC to AUSD, then deposit AUSD into a vault - all in one transaction.
|
|
1573
|
+
|
|
1574
|
+
Actions are executed in the order they are provided. Each action type has its own parameters:
|
|
1575
|
+
|
|
1576
|
+
- **V2_SWAP**: Swapping tokens within the Earn Account
|
|
1577
|
+
- **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
1578
|
+
|
|
1579
|
+
The bundled transaction can be gas-sponsored by setting `gas_sponsorship=true`.
|
|
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.
|
|
1582
|
+
|
|
1583
|
+
:param owner: The owner's wallet address that controls the Earn Account.
|
|
1584
|
+
:param chain: The chain to use.
|
|
1585
|
+
:param actions: List of actions to bundle. Actions are executed in order.
|
|
1586
|
+
:param gas_sponsorship: If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare.
|
|
1587
|
+
:param retries: Override the default retry configuration for this method
|
|
1588
|
+
:param server_url: Override the default server URL for this method
|
|
1589
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1590
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1591
|
+
"""
|
|
1592
|
+
base_url = None
|
|
1593
|
+
url_variables = None
|
|
1594
|
+
if timeout_ms is None:
|
|
1595
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1596
|
+
|
|
1597
|
+
if server_url is not None:
|
|
1598
|
+
base_url = server_url
|
|
1599
|
+
else:
|
|
1600
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1601
|
+
|
|
1602
|
+
request = models.V2BundleRequest(
|
|
1603
|
+
owner=owner,
|
|
1604
|
+
chain=chain,
|
|
1605
|
+
actions=utils.get_pydantic_model(actions, List[models.V2UserOperation]),
|
|
1606
|
+
gas_sponsorship=gas_sponsorship,
|
|
1607
|
+
)
|
|
1608
|
+
|
|
1609
|
+
req = self._build_request(
|
|
1610
|
+
method="POST",
|
|
1611
|
+
path="/v2/earn/bundle",
|
|
1612
|
+
base_url=base_url,
|
|
1613
|
+
url_variables=url_variables,
|
|
1614
|
+
request=request,
|
|
1615
|
+
request_body_required=True,
|
|
1616
|
+
request_has_path_params=False,
|
|
1617
|
+
request_has_query_params=True,
|
|
1618
|
+
user_agent_header="user-agent",
|
|
1619
|
+
accept_header_value="application/json",
|
|
1620
|
+
http_headers=http_headers,
|
|
1621
|
+
security=self.sdk_configuration.security,
|
|
1622
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1623
|
+
request, False, False, "json", models.V2BundleRequest
|
|
1624
|
+
),
|
|
1625
|
+
allow_empty_value=None,
|
|
1626
|
+
timeout_ms=timeout_ms,
|
|
1627
|
+
)
|
|
1628
|
+
|
|
1629
|
+
if retries == UNSET:
|
|
1630
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1631
|
+
retries = self.sdk_configuration.retry_config
|
|
1632
|
+
|
|
1633
|
+
retry_config = None
|
|
1634
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1635
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1636
|
+
|
|
1637
|
+
http_res = self.do_request(
|
|
1638
|
+
hook_ctx=HookContext(
|
|
1639
|
+
config=self.sdk_configuration,
|
|
1640
|
+
base_url=base_url or "",
|
|
1641
|
+
operation_id="v2_earn_bundle",
|
|
1642
|
+
oauth2_scopes=None,
|
|
1643
|
+
security_source=self.sdk_configuration.security,
|
|
1644
|
+
),
|
|
1645
|
+
request=req,
|
|
1646
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1647
|
+
retry_config=retry_config,
|
|
1648
|
+
)
|
|
1649
|
+
|
|
1650
|
+
response_data: Any = None
|
|
1651
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1652
|
+
return unmarshal_json_response(models.V2BundleResponse, http_res)
|
|
1653
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1654
|
+
response_data = unmarshal_json_response(
|
|
1655
|
+
errors.HTTPValidationErrorData, http_res
|
|
1656
|
+
)
|
|
1657
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1658
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1659
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1660
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1661
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1662
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1663
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1664
|
+
|
|
1665
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1666
|
+
|
|
1667
|
+
async def earn_bundle_async(
|
|
1668
|
+
self,
|
|
1669
|
+
*,
|
|
1670
|
+
owner: str,
|
|
1671
|
+
chain: models.Chain,
|
|
1672
|
+
actions: Union[
|
|
1673
|
+
List[models.V2UserOperation], List[models.V2UserOperationTypedDict]
|
|
1674
|
+
],
|
|
1675
|
+
gas_sponsorship: Optional[bool] = None,
|
|
1676
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1677
|
+
server_url: Optional[str] = None,
|
|
1678
|
+
timeout_ms: Optional[int] = None,
|
|
1679
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1680
|
+
) -> models.V2BundleResponse:
|
|
1681
|
+
r"""Execute multiple earn actions
|
|
1682
|
+
|
|
1683
|
+
This endpoint allows combining multiple actions (swaps, vault
|
|
1684
|
+
deposits/withdrawals, Aave deposits/withdrawals) into a single atomic transaction
|
|
1685
|
+
executed via the Earn account).
|
|
1686
|
+
|
|
1687
|
+
**Example Use Case:** Swap USDC to AUSD, then deposit AUSD into a vault - all in one transaction.
|
|
1688
|
+
|
|
1689
|
+
Actions are executed in the order they are provided. Each action type has its own parameters:
|
|
1690
|
+
|
|
1691
|
+
- **V2_SWAP**: Swapping tokens within the Earn Account
|
|
1692
|
+
- **V2_MANAGE**: Manage positions - deposit/withdraw to ERC-4626 vaults or Aave lending pool
|
|
1693
|
+
|
|
1694
|
+
The bundled transaction can be gas-sponsored by setting `gas_sponsorship=true`.
|
|
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.
|
|
1697
|
+
|
|
1698
|
+
:param owner: The owner's wallet address that controls the Earn Account.
|
|
1699
|
+
:param chain: The chain to use.
|
|
1700
|
+
:param actions: List of actions to bundle. Actions are executed in order.
|
|
1701
|
+
:param gas_sponsorship: If true, returns EIP-712 typed data for gas sponsorship. The owner must sign this data and submit to /gas_sponsorship/prepare.
|
|
1702
|
+
:param retries: Override the default retry configuration for this method
|
|
1703
|
+
:param server_url: Override the default server URL for this method
|
|
1704
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1705
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1706
|
+
"""
|
|
1707
|
+
base_url = None
|
|
1708
|
+
url_variables = None
|
|
1709
|
+
if timeout_ms is None:
|
|
1710
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1711
|
+
|
|
1712
|
+
if server_url is not None:
|
|
1713
|
+
base_url = server_url
|
|
1714
|
+
else:
|
|
1715
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1716
|
+
|
|
1717
|
+
request = models.V2BundleRequest(
|
|
1718
|
+
owner=owner,
|
|
1719
|
+
chain=chain,
|
|
1720
|
+
actions=utils.get_pydantic_model(actions, List[models.V2UserOperation]),
|
|
1721
|
+
gas_sponsorship=gas_sponsorship,
|
|
1722
|
+
)
|
|
1723
|
+
|
|
1724
|
+
req = self._build_request_async(
|
|
1725
|
+
method="POST",
|
|
1726
|
+
path="/v2/earn/bundle",
|
|
1727
|
+
base_url=base_url,
|
|
1728
|
+
url_variables=url_variables,
|
|
1729
|
+
request=request,
|
|
1730
|
+
request_body_required=True,
|
|
1731
|
+
request_has_path_params=False,
|
|
1732
|
+
request_has_query_params=True,
|
|
1733
|
+
user_agent_header="user-agent",
|
|
1734
|
+
accept_header_value="application/json",
|
|
1735
|
+
http_headers=http_headers,
|
|
1736
|
+
security=self.sdk_configuration.security,
|
|
1737
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1738
|
+
request, False, False, "json", models.V2BundleRequest
|
|
1739
|
+
),
|
|
1740
|
+
allow_empty_value=None,
|
|
1741
|
+
timeout_ms=timeout_ms,
|
|
1742
|
+
)
|
|
1743
|
+
|
|
1744
|
+
if retries == UNSET:
|
|
1745
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1746
|
+
retries = self.sdk_configuration.retry_config
|
|
1747
|
+
|
|
1748
|
+
retry_config = None
|
|
1749
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1750
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1751
|
+
|
|
1752
|
+
http_res = await self.do_request_async(
|
|
1753
|
+
hook_ctx=HookContext(
|
|
1754
|
+
config=self.sdk_configuration,
|
|
1755
|
+
base_url=base_url or "",
|
|
1756
|
+
operation_id="v2_earn_bundle",
|
|
1757
|
+
oauth2_scopes=None,
|
|
1758
|
+
security_source=self.sdk_configuration.security,
|
|
1759
|
+
),
|
|
1760
|
+
request=req,
|
|
1761
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
1762
|
+
retry_config=retry_config,
|
|
1763
|
+
)
|
|
1764
|
+
|
|
1765
|
+
response_data: Any = None
|
|
1766
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1767
|
+
return unmarshal_json_response(models.V2BundleResponse, http_res)
|
|
1768
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
1769
|
+
response_data = unmarshal_json_response(
|
|
1770
|
+
errors.HTTPValidationErrorData, http_res
|
|
1771
|
+
)
|
|
1772
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1773
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1774
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1775
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1776
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1777
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1778
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1779
|
+
|
|
1780
|
+
raise errors.APIError("Unexpected response received", http_res)
|