compass_api_sdk 0.9.51__py3-none-any.whl → 0.9.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of compass_api_sdk might be problematic. Click here for more details.
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/aave_v3.py +314 -260
- compass_api_sdk/aerodrome_slipstream.py +186 -184
- compass_api_sdk/erc_4626_vaults.py +82 -58
- compass_api_sdk/errors/__init__.py +3 -2
- compass_api_sdk/models/__init__.py +1736 -1528
- compass_api_sdk/models/aavereserveoverviewresponse.py +34 -3
- compass_api_sdk/models/{chain.py → compass_api_backend_config_chain_chain.py} +4 -4
- compass_api_sdk/models/compass_api_backend_models_aave_read_response_historical_transactions_aavehistoricaltransactionsresponse.py +115 -0
- compass_api_sdk/models/{borrow.py → compass_api_backend_models_aave_read_response_historical_transactions_borrow.py} +4 -2
- compass_api_sdk/models/{liquidationcall.py → compass_api_backend_models_aave_read_response_historical_transactions_liquidationcall.py} +6 -2
- compass_api_sdk/models/{redeemunderlying.py → compass_api_backend_models_aave_read_response_historical_transactions_redeemunderlying.py} +6 -2
- compass_api_sdk/models/{repay.py → compass_api_backend_models_aave_read_response_historical_transactions_repay.py} +4 -2
- compass_api_sdk/models/{supply.py → compass_api_backend_models_aave_read_response_historical_transactions_supply.py} +4 -2
- compass_api_sdk/models/{swapborrowrate.py → compass_api_backend_models_aave_read_response_historical_transactions_swapborrowrate.py} +6 -2
- compass_api_sdk/models/{usageascollateral.py → compass_api_backend_models_aave_read_response_historical_transactions_usageascollateral.py} +6 -2
- compass_api_sdk/models/{aaveborrowrequest.py → compass_api_backend_models_aave_transact_request_borrow_aaveborrowrequest.py} +24 -12
- compass_api_sdk/models/{aaverepayrequest.py → compass_api_backend_models_aave_transact_request_repay_aaverepayrequest.py} +24 -12
- compass_api_sdk/models/{aavesupplyrequest.py → compass_api_backend_models_aave_transact_request_supply_aavesupplyrequest.py} +24 -12
- compass_api_sdk/models/{aavewithdrawrequest.py → compass_api_backend_models_aave_transact_request_withdraw_aavewithdrawrequest.py} +25 -13
- compass_api_sdk/models/{aerodromelppositionsresponse.py → compass_api_backend_models_aerodrome_slipstream_read_response_positions_aerodromelppositionsresponse.py} +6 -2
- compass_api_sdk/models/compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_increase_aerodromeslipstreamincreaseliquidityprovisionrequest.py +125 -0
- compass_api_sdk/models/{aerodromeslipstreammintliquidityprovisionrequest.py → compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_mint_aerodromeslipstreammintliquidityprovisionrequest.py} +43 -35
- compass_api_sdk/models/compass_api_backend_models_aerodrome_slipstream_transact_request_liquidity_provision_withdraw_aerodromeslipstreamwithdrawliquidityprovisionrequest.py +68 -0
- compass_api_sdk/models/compass_api_backend_models_aerodrome_slipstream_transact_request_swap_buy_exactly_aerodromeslipstreambuyexactlyrequest.py +116 -0
- compass_api_sdk/models/{aerodromeslipstreamsellexactlyrequest.py → compass_api_backend_models_aerodrome_slipstream_transact_request_swap_sell_exactly_aerodromeslipstreamsellexactlyrequest.py} +31 -19
- compass_api_sdk/models/compass_api_backend_models_generic_read_response_chains_supportedchaininfo.py +21 -0
- compass_api_sdk/models/{portfolio.py → compass_api_backend_models_generic_read_response_portfolio_portfolio.py} +2 -2
- compass_api_sdk/models/compass_api_backend_models_generic_transact_request_allowance_setallowancerequest.py +139 -0
- compass_api_sdk/models/compass_api_backend_models_generic_transact_request_unwrap_weth_unwrapwethrequest.py +69 -0
- compass_api_sdk/models/compass_api_backend_models_generic_transact_request_wrap_eth_wrapethrequest.py +66 -0
- compass_api_sdk/models/{marketposition.py → compass_api_backend_models_morpho_read_response_check_user_position_marketposition.py} +6 -2
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_check_user_position_morphocheckuserpositionresponse.py +48 -0
- compass_api_sdk/models/{vault.py → compass_api_backend_models_morpho_read_response_check_user_position_vault.py} +4 -2
- compass_api_sdk/models/{vaultposition.py → compass_api_backend_models_morpho_read_response_check_user_position_vaultposition.py} +12 -5
- compass_api_sdk/models/{morphogetmarketresponse.py → compass_api_backend_models_morpho_read_response_get_market_morphogetmarketresponse.py} +6 -2
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_markets_morphogetmarketsresponse.py +26 -0
- compass_api_sdk/models/{morphomarket.py → compass_api_backend_models_morpho_read_response_get_markets_morphomarket.py} +4 -2
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vaults_morphogetvaultsresponse.py +24 -0
- compass_api_sdk/models/{morphovault.py → compass_api_backend_models_morpho_read_response_get_vaults_morphovault.py} +2 -2
- compass_api_sdk/models/{morphoborrowrequest.py → compass_api_backend_models_morpho_transact_request_borrow_morphoborrowrequest.py} +22 -13
- compass_api_sdk/models/{morphodepositrequest.py → compass_api_backend_models_morpho_transact_request_deposit_morphodepositrequest.py} +26 -13
- compass_api_sdk/models/{morphorepayrequest.py → compass_api_backend_models_morpho_transact_request_repay_morphorepayrequest.py} +12 -7
- compass_api_sdk/models/{morphosupplycollateralrequest.py → compass_api_backend_models_morpho_transact_request_supply_collateral_morphosupplycollateralrequest.py} +22 -13
- compass_api_sdk/models/{morphowithdrawcollateralrequest.py → compass_api_backend_models_morpho_transact_request_withdraw_collateral_morphowithdrawcollateralrequest.py} +22 -13
- compass_api_sdk/models/{morphowithdrawrequest.py → compass_api_backend_models_morpho_transact_request_withdraw_morphowithdrawrequest.py} +18 -7
- compass_api_sdk/models/{multicallauthorizationrequest.py → compass_api_backend_models_multicall_read_request_get_authorization_multicallauthorizationrequest.py} +17 -7
- compass_api_sdk/models/{aavelooprequest.py → compass_api_backend_models_multicall_transact_request_aave_loop_request_aavelooprequest.py} +67 -13
- compass_api_sdk/models/compass_api_backend_models_multicall_transact_request_multicall_execution_request_multicallexecuterequest.py +92 -0
- compass_api_sdk/models/{useroperation.py → compass_api_backend_models_multicall_transact_request_multicall_execution_request_useroperation.py} +40 -42
- compass_api_sdk/models/{pendlegetmarketresponse.py → compass_api_backend_models_pendle_read_response_market_pendlegetmarketresponse.py} +4 -2
- compass_api_sdk/models/compass_api_backend_models_pendle_read_response_markets_pendlelistmarketsresponse.py +24 -0
- compass_api_sdk/models/{pendlemarket.py → compass_api_backend_models_pendle_read_response_markets_pendlemarket.py} +2 -2
- compass_api_sdk/models/{openposition.py → compass_api_backend_models_pendle_read_response_positions_openposition.py} +4 -2
- compass_api_sdk/models/compass_api_backend_models_pendle_read_response_positions_pendlelistuserpositionsresponse.py +24 -0
- compass_api_sdk/models/{position.py → compass_api_backend_models_pendle_read_response_positions_position.py} +18 -7
- compass_api_sdk/models/{pendleredeemyieldrequest.py → compass_api_backend_models_pendle_transact_request_redeem_yield_pendleredeemyieldrequest.py} +17 -7
- compass_api_sdk/models/{skybuyrequest.py → compass_api_backend_models_sky_transact_request_buy_skybuyrequest.py} +22 -19
- compass_api_sdk/models/{skydepositrequest.py → compass_api_backend_models_sky_transact_request_deposit_skydepositrequest.py} +26 -15
- compass_api_sdk/models/compass_api_backend_models_sky_transact_request_sell_skysellrequest.py +70 -0
- compass_api_sdk/models/{skywithdrawrequest.py → compass_api_backend_models_sky_transact_request_withdraw_skywithdrawrequest.py} +17 -10
- compass_api_sdk/models/compass_api_backend_models_smart_account_transact_request_user_operations_batcheduseroperationsrequest.py +49 -0
- compass_api_sdk/models/compass_api_backend_models_swap_transact_request_odos_odosswaprequest.py +108 -0
- compass_api_sdk/models/compass_api_backend_models_token_transact_request_transfer_tokentransferrequest.py +98 -0
- compass_api_sdk/models/compass_api_backend_models_uniswap_transact_liquidity_provision_request_increase_uniswapincreaseliquidityprovisionrequest.py +129 -0
- compass_api_sdk/models/{uniswapmintliquidityprovisionrequest.py → compass_api_backend_models_uniswap_transact_liquidity_provision_request_mint_uniswapmintliquidityprovisionrequest.py} +49 -31
- compass_api_sdk/models/compass_api_backend_models_uniswap_transact_liquidity_provision_request_withdraw_uniswapwithdrawliquidityprovisionrequest.py +68 -0
- compass_api_sdk/models/compass_api_backend_models_uniswap_transact_swap_request_buy_exactly_uniswapbuyexactlyrequest.py +123 -0
- compass_api_sdk/models/compass_api_backend_models_uniswap_transact_swap_request_sell_exactly_uniswapsellexactlyrequest.py +123 -0
- compass_api_sdk/models/{vaultgetvaultresponse.py → compass_api_backend_models_vaults_read_response_vault_vaultgetvaultresponse.py} +4 -2
- compass_api_sdk/models/compass_api_backend_models_vaults_transact_request_deposit_vaultdepositrequest.py +110 -0
- compass_api_sdk/models/compass_api_backend_models_vaults_transact_request_withdraw_vaultwithdrawrequest.py +96 -0
- compass_api_sdk/models/details.py +44 -7
- compass_api_sdk/models/movement10percent.py +65 -10
- compass_api_sdk/models/pendlemanageliquidityparams.py +81 -0
- compass_api_sdk/models/pendlemanageliquidityrequest.py +95 -0
- compass_api_sdk/models/pendletradeptparams.py +81 -0
- compass_api_sdk/models/pendletradeptrequest.py +95 -0
- compass_api_sdk/models/pendletradeytparams.py +81 -0
- compass_api_sdk/models/pendletradeytrequest.py +95 -0
- compass_api_sdk/models/pendletxresponse.py +45 -0
- compass_api_sdk/models/token_enum.py +17 -0
- compass_api_sdk/models/{tokentransferrequest.py → tokentransferparams.py} +16 -27
- compass_api_sdk/models/transactionresponse.py +40 -0
- compass_api_sdk/models/uniswapbuyexactlyparams.py +19 -24
- compass_api_sdk/models/uniswapbuyexactlytransactionresponse.py +45 -0
- compass_api_sdk/models/uniswapsellexactlyparams.py +43 -40
- compass_api_sdk/models/uniswapsellexactlytransactionresponse.py +45 -0
- compass_api_sdk/models/{aave_aave_supported_tokensop.py → v1_aave_aave_supported_tokensop.py} +9 -13
- compass_api_sdk/models/{aave_avg_rateop.py → v1_aave_avg_rateop.py} +32 -19
- compass_api_sdk/models/{aave_historical_transactionsop.py → v1_aave_historical_transactionsop.py} +9 -13
- compass_api_sdk/models/{aave_liquidity_changeop.py → v1_aave_liquidity_changeop.py} +30 -17
- compass_api_sdk/models/{aave_rateop.py → v1_aave_rateop.py} +32 -19
- compass_api_sdk/models/{aave_reserve_overviewop.py → v1_aave_reserve_overviewop.py} +32 -19
- compass_api_sdk/models/{aave_std_rateop.py → v1_aave_std_rateop.py} +32 -19
- compass_api_sdk/models/{aave_token_priceop.py → v1_aave_token_priceop.py} +32 -19
- compass_api_sdk/models/{aave_user_position_per_tokenop.py → v1_aave_user_position_per_tokenop.py} +32 -19
- compass_api_sdk/models/{aave_user_position_summaryop.py → v1_aave_user_position_summaryop.py} +9 -13
- compass_api_sdk/models/{uniswap_liquidity_provision_positionsop.py → v1_aerodrome_slipstream_liquidity_provision_positionsop.py} +7 -13
- compass_api_sdk/models/{aerodrome_slipstream_pool_priceop.py → v1_aerodrome_slipstream_pool_priceop.py} +53 -25
- compass_api_sdk/models/{generic_allowanceop.py → v1_generic_allowanceop.py} +24 -25
- compass_api_sdk/models/{generic_ensop.py → v1_generic_ensop.py} +7 -13
- compass_api_sdk/models/{generic_portfolioop.py → v1_generic_portfolioop.py} +9 -13
- compass_api_sdk/models/{generic_supported_chainsop.py → v1_generic_supported_chainsop.py} +2 -2
- compass_api_sdk/models/v1_generic_supported_tokensop.py +24 -0
- compass_api_sdk/models/{morpho_market_positionop.py → v1_morpho_market_positionop.py} +9 -8
- compass_api_sdk/models/{morpho_marketop.py → v1_morpho_marketop.py} +9 -8
- compass_api_sdk/models/{morpho_marketsop.py → v1_morpho_marketsop.py} +9 -8
- compass_api_sdk/models/{morpho_user_positionop.py → v1_morpho_user_positionop.py} +9 -8
- compass_api_sdk/models/{morpho_vaultop.py → v1_morpho_vaultop.py} +9 -13
- compass_api_sdk/models/{morpho_vaultsop.py → v1_morpho_vaultsop.py} +9 -8
- compass_api_sdk/models/{pendle_marketop.py → v1_pendle_marketop.py} +9 -13
- compass_api_sdk/models/v1_pendle_marketsop.py +24 -0
- compass_api_sdk/models/{pendle_positionsop.py → v1_pendle_positionsop.py} +10 -14
- compass_api_sdk/models/{sky_positionop.py → v1_sky_positionop.py} +14 -15
- compass_api_sdk/models/{token_addressop.py → v1_token_addressop.py} +30 -17
- compass_api_sdk/models/{token_balanceop.py → v1_token_balanceop.py} +14 -18
- compass_api_sdk/models/{token_priceop.py → v1_token_priceop.py} +14 -18
- compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +24 -0
- compass_api_sdk/models/{uniswap_liquidity_provision_in_rangeop.py → v1_uniswap_liquidity_provision_in_rangeop.py} +9 -13
- compass_api_sdk/models/{aerodrome_slipstream_liquidity_provision_positionsop.py → v1_uniswap_liquidity_provision_positionsop.py} +9 -13
- compass_api_sdk/models/{uniswap_pool_priceop.py → v1_uniswap_pool_priceop.py} +59 -29
- compass_api_sdk/models/{uniswap_quote_buy_exactlyop.py → v1_uniswap_quote_buy_exactlyop.py} +65 -35
- compass_api_sdk/models/{uniswap_quote_sell_exactlyop.py → v1_uniswap_quote_sell_exactlyop.py} +65 -35
- compass_api_sdk/models/{vaults_vaultop.py → v1_vaults_vaultop.py} +9 -13
- compass_api_sdk/models/{vaultdepositrequest.py → vaultdepositparams.py} +7 -20
- compass_api_sdk/models/{vaultwithdrawrequest.py → vaultwithdrawparams.py} +2 -13
- compass_api_sdk/morpho.py +310 -222
- compass_api_sdk/pendle.py +307 -1081
- compass_api_sdk/sky.py +186 -94
- compass_api_sdk/smart_account.py +46 -18
- compass_api_sdk/swap.py +40 -26
- compass_api_sdk/token_sdk.py +76 -66
- compass_api_sdk/transaction_bundler.py +126 -76
- compass_api_sdk/uniswap_v3.py +302 -278
- compass_api_sdk/universal.py +189 -329
- compass_api_sdk/utils/__init__.py +3 -2
- {compass_api_sdk-0.9.51.dist-info → compass_api_sdk-0.9.52.dist-info}/METADATA +83 -88
- compass_api_sdk-0.9.52.dist-info/RECORD +263 -0
- compass_api_sdk/models/aavehistoricaltransactionsresponse.py +0 -65
- compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +0 -104
- compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +0 -123
- compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +0 -64
- compass_api_sdk/models/batcheduseroperationsrequest.py +0 -32
- compass_api_sdk/models/generic_supported_tokensop.py +0 -28
- compass_api_sdk/models/generic_visualize_portfolioop.py +0 -37
- compass_api_sdk/models/image.py +0 -15
- compass_api_sdk/models/morphocheckuserpositionresponse.py +0 -32
- compass_api_sdk/models/morphogetmarketsresponse.py +0 -17
- compass_api_sdk/models/morphogetvaultsresponse.py +0 -17
- compass_api_sdk/models/multicallexecuterequest.py +0 -36
- compass_api_sdk/models/odosswaprequest.py +0 -86
- compass_api_sdk/models/pendle_marketsop.py +0 -28
- compass_api_sdk/models/pendle_quoteop.py +0 -128
- compass_api_sdk/models/pendleaddliquidityparams.py +0 -50
- compass_api_sdk/models/pendleaddliquidityrequest.py +0 -61
- compass_api_sdk/models/pendlebuyptparams.py +0 -48
- compass_api_sdk/models/pendlebuyptrequest.py +0 -59
- compass_api_sdk/models/pendlebuyytparams.py +0 -48
- compass_api_sdk/models/pendlebuyytrequest.py +0 -59
- compass_api_sdk/models/pendlegetquoteresponse.py +0 -15
- compass_api_sdk/models/pendlelistmarketsresponse.py +0 -17
- compass_api_sdk/models/pendlelistuserpositionsresponse.py +0 -17
- compass_api_sdk/models/pendleremoveliquidityparams.py +0 -50
- compass_api_sdk/models/pendleremoveliquidityrequest.py +0 -61
- compass_api_sdk/models/pendlesellptparams.py +0 -48
- compass_api_sdk/models/pendlesellptrequest.py +0 -61
- compass_api_sdk/models/pendlesellytparams.py +0 -48
- compass_api_sdk/models/pendlesellytrequest.py +0 -61
- compass_api_sdk/models/setallowancerequest.py +0 -109
- compass_api_sdk/models/skysellrequest.py +0 -64
- compass_api_sdk/models/supportedchaininfo.py +0 -19
- compass_api_sdk/models/txresponse.py +0 -27
- compass_api_sdk/models/uniswapbuyexactlyrequest.py +0 -112
- compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +0 -111
- compass_api_sdk/models/uniswapsellexactlyrequest.py +0 -104
- compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +0 -63
- compass_api_sdk/models/unwrapwethrequest.py +0 -53
- compass_api_sdk/models/wrapethrequest.py +0 -52
- compass_api_sdk-0.9.51.dist-info/RECORD +0 -266
- {compass_api_sdk-0.9.51.dist-info → compass_api_sdk-0.9.52.dist-info}/WHEEL +0 -0
compass_api_sdk/pendle.py
CHANGED
|
@@ -9,10 +9,10 @@ from typing import Any, Mapping, Optional, Union
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Pendle(BaseSDK):
|
|
12
|
-
def
|
|
12
|
+
def pendle_market(
|
|
13
13
|
self,
|
|
14
14
|
*,
|
|
15
|
-
chain: models.
|
|
15
|
+
chain: models.V1PendleMarketChain = models.V1PendleMarketChain.ARBITRUM,
|
|
16
16
|
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
17
17
|
block: OptionalNullable[int] = UNSET,
|
|
18
18
|
user_address: OptionalNullable[str] = UNSET,
|
|
@@ -20,14 +20,14 @@ class Pendle(BaseSDK):
|
|
|
20
20
|
server_url: Optional[str] = None,
|
|
21
21
|
timeout_ms: Optional[int] = None,
|
|
22
22
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
23
|
-
) -> models.
|
|
23
|
+
) -> models.CompassAPIBackendModelsPendleReadResponseMarketPendleGetMarketResponse:
|
|
24
24
|
r"""Get Market & User Position
|
|
25
25
|
|
|
26
26
|
Get the market's implied APY, maturity date and the associated token data.
|
|
27
27
|
|
|
28
28
|
The user position is only included if 'user_address' parameter is included.
|
|
29
29
|
|
|
30
|
-
:param chain:
|
|
30
|
+
:param chain:
|
|
31
31
|
:param market_address: The market address of the desired position.
|
|
32
32
|
:param block: Optional block number (defaults to latest).
|
|
33
33
|
:param user_address: The user address of the desired market position. Only include if you would like the user position included in the response. Defaults to `None`.
|
|
@@ -46,7 +46,7 @@ class Pendle(BaseSDK):
|
|
|
46
46
|
else:
|
|
47
47
|
base_url = self._get_url(base_url, url_variables)
|
|
48
48
|
|
|
49
|
-
request = models.
|
|
49
|
+
request = models.V1PendleMarketRequest(
|
|
50
50
|
chain=chain,
|
|
51
51
|
block=block,
|
|
52
52
|
market_address=market_address,
|
|
@@ -55,7 +55,7 @@ class Pendle(BaseSDK):
|
|
|
55
55
|
|
|
56
56
|
req = self._build_request(
|
|
57
57
|
method="GET",
|
|
58
|
-
path="/
|
|
58
|
+
path="/v1/pendle/market",
|
|
59
59
|
base_url=base_url,
|
|
60
60
|
url_variables=url_variables,
|
|
61
61
|
request=request,
|
|
@@ -81,7 +81,7 @@ class Pendle(BaseSDK):
|
|
|
81
81
|
hook_ctx=HookContext(
|
|
82
82
|
config=self.sdk_configuration,
|
|
83
83
|
base_url=base_url or "",
|
|
84
|
-
operation_id="
|
|
84
|
+
operation_id="v1_pendle_market",
|
|
85
85
|
oauth2_scopes=[],
|
|
86
86
|
security_source=self.sdk_configuration.security,
|
|
87
87
|
),
|
|
@@ -92,7 +92,10 @@ class Pendle(BaseSDK):
|
|
|
92
92
|
|
|
93
93
|
response_data: Any = None
|
|
94
94
|
if utils.match_response(http_res, "200", "application/json"):
|
|
95
|
-
return unmarshal_json_response(
|
|
95
|
+
return unmarshal_json_response(
|
|
96
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketPendleGetMarketResponse,
|
|
97
|
+
http_res,
|
|
98
|
+
)
|
|
96
99
|
if utils.match_response(http_res, "422", "application/json"):
|
|
97
100
|
response_data = unmarshal_json_response(
|
|
98
101
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -107,10 +110,10 @@ class Pendle(BaseSDK):
|
|
|
107
110
|
|
|
108
111
|
raise errors.APIError("Unexpected response received", http_res)
|
|
109
112
|
|
|
110
|
-
async def
|
|
113
|
+
async def pendle_market_async(
|
|
111
114
|
self,
|
|
112
115
|
*,
|
|
113
|
-
chain: models.
|
|
116
|
+
chain: models.V1PendleMarketChain = models.V1PendleMarketChain.ARBITRUM,
|
|
114
117
|
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
115
118
|
block: OptionalNullable[int] = UNSET,
|
|
116
119
|
user_address: OptionalNullable[str] = UNSET,
|
|
@@ -118,14 +121,14 @@ class Pendle(BaseSDK):
|
|
|
118
121
|
server_url: Optional[str] = None,
|
|
119
122
|
timeout_ms: Optional[int] = None,
|
|
120
123
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
121
|
-
) -> models.
|
|
124
|
+
) -> models.CompassAPIBackendModelsPendleReadResponseMarketPendleGetMarketResponse:
|
|
122
125
|
r"""Get Market & User Position
|
|
123
126
|
|
|
124
127
|
Get the market's implied APY, maturity date and the associated token data.
|
|
125
128
|
|
|
126
129
|
The user position is only included if 'user_address' parameter is included.
|
|
127
130
|
|
|
128
|
-
:param chain:
|
|
131
|
+
:param chain:
|
|
129
132
|
:param market_address: The market address of the desired position.
|
|
130
133
|
:param block: Optional block number (defaults to latest).
|
|
131
134
|
:param user_address: The user address of the desired market position. Only include if you would like the user position included in the response. Defaults to `None`.
|
|
@@ -144,7 +147,7 @@ class Pendle(BaseSDK):
|
|
|
144
147
|
else:
|
|
145
148
|
base_url = self._get_url(base_url, url_variables)
|
|
146
149
|
|
|
147
|
-
request = models.
|
|
150
|
+
request = models.V1PendleMarketRequest(
|
|
148
151
|
chain=chain,
|
|
149
152
|
block=block,
|
|
150
153
|
market_address=market_address,
|
|
@@ -153,7 +156,7 @@ class Pendle(BaseSDK):
|
|
|
153
156
|
|
|
154
157
|
req = self._build_request_async(
|
|
155
158
|
method="GET",
|
|
156
|
-
path="/
|
|
159
|
+
path="/v1/pendle/market",
|
|
157
160
|
base_url=base_url,
|
|
158
161
|
url_variables=url_variables,
|
|
159
162
|
request=request,
|
|
@@ -179,7 +182,7 @@ class Pendle(BaseSDK):
|
|
|
179
182
|
hook_ctx=HookContext(
|
|
180
183
|
config=self.sdk_configuration,
|
|
181
184
|
base_url=base_url or "",
|
|
182
|
-
operation_id="
|
|
185
|
+
operation_id="v1_pendle_market",
|
|
183
186
|
oauth2_scopes=[],
|
|
184
187
|
security_source=self.sdk_configuration.security,
|
|
185
188
|
),
|
|
@@ -190,7 +193,10 @@ class Pendle(BaseSDK):
|
|
|
190
193
|
|
|
191
194
|
response_data: Any = None
|
|
192
195
|
if utils.match_response(http_res, "200", "application/json"):
|
|
193
|
-
return unmarshal_json_response(
|
|
196
|
+
return unmarshal_json_response(
|
|
197
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketPendleGetMarketResponse,
|
|
198
|
+
http_res,
|
|
199
|
+
)
|
|
194
200
|
if utils.match_response(http_res, "422", "application/json"):
|
|
195
201
|
response_data = unmarshal_json_response(
|
|
196
202
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -205,21 +211,21 @@ class Pendle(BaseSDK):
|
|
|
205
211
|
|
|
206
212
|
raise errors.APIError("Unexpected response received", http_res)
|
|
207
213
|
|
|
208
|
-
def
|
|
214
|
+
def pendle_positions(
|
|
209
215
|
self,
|
|
210
216
|
*,
|
|
211
|
-
chain: models.
|
|
212
|
-
user_address: str = "
|
|
217
|
+
chain: models.V1PendlePositionsChain = models.V1PendlePositionsChain.ARBITRUM,
|
|
218
|
+
user_address: str = "0x68C314e30b543a35819e5625da563E6Da65D5dd4",
|
|
213
219
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
214
220
|
server_url: Optional[str] = None,
|
|
215
221
|
timeout_ms: Optional[int] = None,
|
|
216
222
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
217
|
-
) -> models.
|
|
223
|
+
) -> models.CompassAPIBackendModelsPendleReadResponsePositionsPendleListUserPositionsResponse:
|
|
218
224
|
r"""List User's Market Positions
|
|
219
225
|
|
|
220
226
|
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
221
227
|
|
|
222
|
-
:param chain:
|
|
228
|
+
:param chain:
|
|
223
229
|
:param user_address: The user address of the desired position.
|
|
224
230
|
:param retries: Override the default retry configuration for this method
|
|
225
231
|
:param server_url: Override the default server URL for this method
|
|
@@ -236,14 +242,14 @@ class Pendle(BaseSDK):
|
|
|
236
242
|
else:
|
|
237
243
|
base_url = self._get_url(base_url, url_variables)
|
|
238
244
|
|
|
239
|
-
request = models.
|
|
245
|
+
request = models.V1PendlePositionsRequest(
|
|
240
246
|
chain=chain,
|
|
241
247
|
user_address=user_address,
|
|
242
248
|
)
|
|
243
249
|
|
|
244
250
|
req = self._build_request(
|
|
245
251
|
method="GET",
|
|
246
|
-
path="/
|
|
252
|
+
path="/v1/pendle/positions",
|
|
247
253
|
base_url=base_url,
|
|
248
254
|
url_variables=url_variables,
|
|
249
255
|
request=request,
|
|
@@ -269,7 +275,7 @@ class Pendle(BaseSDK):
|
|
|
269
275
|
hook_ctx=HookContext(
|
|
270
276
|
config=self.sdk_configuration,
|
|
271
277
|
base_url=base_url or "",
|
|
272
|
-
operation_id="
|
|
278
|
+
operation_id="v1_pendle_positions",
|
|
273
279
|
oauth2_scopes=[],
|
|
274
280
|
security_source=self.sdk_configuration.security,
|
|
275
281
|
),
|
|
@@ -281,7 +287,8 @@ class Pendle(BaseSDK):
|
|
|
281
287
|
response_data: Any = None
|
|
282
288
|
if utils.match_response(http_res, "200", "application/json"):
|
|
283
289
|
return unmarshal_json_response(
|
|
284
|
-
models.
|
|
290
|
+
models.CompassAPIBackendModelsPendleReadResponsePositionsPendleListUserPositionsResponse,
|
|
291
|
+
http_res,
|
|
285
292
|
)
|
|
286
293
|
if utils.match_response(http_res, "422", "application/json"):
|
|
287
294
|
response_data = unmarshal_json_response(
|
|
@@ -297,21 +304,21 @@ class Pendle(BaseSDK):
|
|
|
297
304
|
|
|
298
305
|
raise errors.APIError("Unexpected response received", http_res)
|
|
299
306
|
|
|
300
|
-
async def
|
|
307
|
+
async def pendle_positions_async(
|
|
301
308
|
self,
|
|
302
309
|
*,
|
|
303
|
-
chain: models.
|
|
304
|
-
user_address: str = "
|
|
310
|
+
chain: models.V1PendlePositionsChain = models.V1PendlePositionsChain.ARBITRUM,
|
|
311
|
+
user_address: str = "0x68C314e30b543a35819e5625da563E6Da65D5dd4",
|
|
305
312
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
306
313
|
server_url: Optional[str] = None,
|
|
307
314
|
timeout_ms: Optional[int] = None,
|
|
308
315
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
309
|
-
) -> models.
|
|
316
|
+
) -> models.CompassAPIBackendModelsPendleReadResponsePositionsPendleListUserPositionsResponse:
|
|
310
317
|
r"""List User's Market Positions
|
|
311
318
|
|
|
312
319
|
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
313
320
|
|
|
314
|
-
:param chain:
|
|
321
|
+
:param chain:
|
|
315
322
|
:param user_address: The user address of the desired position.
|
|
316
323
|
:param retries: Override the default retry configuration for this method
|
|
317
324
|
:param server_url: Override the default server URL for this method
|
|
@@ -328,14 +335,14 @@ class Pendle(BaseSDK):
|
|
|
328
335
|
else:
|
|
329
336
|
base_url = self._get_url(base_url, url_variables)
|
|
330
337
|
|
|
331
|
-
request = models.
|
|
338
|
+
request = models.V1PendlePositionsRequest(
|
|
332
339
|
chain=chain,
|
|
333
340
|
user_address=user_address,
|
|
334
341
|
)
|
|
335
342
|
|
|
336
343
|
req = self._build_request_async(
|
|
337
344
|
method="GET",
|
|
338
|
-
path="/
|
|
345
|
+
path="/v1/pendle/positions",
|
|
339
346
|
base_url=base_url,
|
|
340
347
|
url_variables=url_variables,
|
|
341
348
|
request=request,
|
|
@@ -361,7 +368,7 @@ class Pendle(BaseSDK):
|
|
|
361
368
|
hook_ctx=HookContext(
|
|
362
369
|
config=self.sdk_configuration,
|
|
363
370
|
base_url=base_url or "",
|
|
364
|
-
operation_id="
|
|
371
|
+
operation_id="v1_pendle_positions",
|
|
365
372
|
oauth2_scopes=[],
|
|
366
373
|
security_source=self.sdk_configuration.security,
|
|
367
374
|
),
|
|
@@ -373,7 +380,8 @@ class Pendle(BaseSDK):
|
|
|
373
380
|
response_data: Any = None
|
|
374
381
|
if utils.match_response(http_res, "200", "application/json"):
|
|
375
382
|
return unmarshal_json_response(
|
|
376
|
-
models.
|
|
383
|
+
models.CompassAPIBackendModelsPendleReadResponsePositionsPendleListUserPositionsResponse,
|
|
384
|
+
http_res,
|
|
377
385
|
)
|
|
378
386
|
if utils.match_response(http_res, "422", "application/json"):
|
|
379
387
|
response_data = unmarshal_json_response(
|
|
@@ -389,20 +397,22 @@ class Pendle(BaseSDK):
|
|
|
389
397
|
|
|
390
398
|
raise errors.APIError("Unexpected response received", http_res)
|
|
391
399
|
|
|
392
|
-
def
|
|
400
|
+
def pendle_markets(
|
|
393
401
|
self,
|
|
394
402
|
*,
|
|
395
|
-
chain: models.
|
|
403
|
+
chain: models.V1PendleMarketsChain = models.V1PendleMarketsChain.ARBITRUM,
|
|
396
404
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
397
405
|
server_url: Optional[str] = None,
|
|
398
406
|
timeout_ms: Optional[int] = None,
|
|
399
407
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
400
|
-
) ->
|
|
408
|
+
) -> (
|
|
409
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketsPendleListMarketsResponse
|
|
410
|
+
):
|
|
401
411
|
r"""List Market Data
|
|
402
412
|
|
|
403
413
|
Get a list of active markets.
|
|
404
414
|
|
|
405
|
-
:param chain:
|
|
415
|
+
:param chain:
|
|
406
416
|
:param retries: Override the default retry configuration for this method
|
|
407
417
|
:param server_url: Override the default server URL for this method
|
|
408
418
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -418,13 +428,13 @@ class Pendle(BaseSDK):
|
|
|
418
428
|
else:
|
|
419
429
|
base_url = self._get_url(base_url, url_variables)
|
|
420
430
|
|
|
421
|
-
request = models.
|
|
431
|
+
request = models.V1PendleMarketsRequest(
|
|
422
432
|
chain=chain,
|
|
423
433
|
)
|
|
424
434
|
|
|
425
435
|
req = self._build_request(
|
|
426
436
|
method="GET",
|
|
427
|
-
path="/
|
|
437
|
+
path="/v1/pendle/markets",
|
|
428
438
|
base_url=base_url,
|
|
429
439
|
url_variables=url_variables,
|
|
430
440
|
request=request,
|
|
@@ -450,7 +460,7 @@ class Pendle(BaseSDK):
|
|
|
450
460
|
hook_ctx=HookContext(
|
|
451
461
|
config=self.sdk_configuration,
|
|
452
462
|
base_url=base_url or "",
|
|
453
|
-
operation_id="
|
|
463
|
+
operation_id="v1_pendle_markets",
|
|
454
464
|
oauth2_scopes=[],
|
|
455
465
|
security_source=self.sdk_configuration.security,
|
|
456
466
|
),
|
|
@@ -461,7 +471,10 @@ class Pendle(BaseSDK):
|
|
|
461
471
|
|
|
462
472
|
response_data: Any = None
|
|
463
473
|
if utils.match_response(http_res, "200", "application/json"):
|
|
464
|
-
return unmarshal_json_response(
|
|
474
|
+
return unmarshal_json_response(
|
|
475
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketsPendleListMarketsResponse,
|
|
476
|
+
http_res,
|
|
477
|
+
)
|
|
465
478
|
if utils.match_response(http_res, "422", "application/json"):
|
|
466
479
|
response_data = unmarshal_json_response(
|
|
467
480
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -476,20 +489,22 @@ class Pendle(BaseSDK):
|
|
|
476
489
|
|
|
477
490
|
raise errors.APIError("Unexpected response received", http_res)
|
|
478
491
|
|
|
479
|
-
async def
|
|
492
|
+
async def pendle_markets_async(
|
|
480
493
|
self,
|
|
481
494
|
*,
|
|
482
|
-
chain: models.
|
|
495
|
+
chain: models.V1PendleMarketsChain = models.V1PendleMarketsChain.ARBITRUM,
|
|
483
496
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
484
497
|
server_url: Optional[str] = None,
|
|
485
498
|
timeout_ms: Optional[int] = None,
|
|
486
499
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
487
|
-
) ->
|
|
500
|
+
) -> (
|
|
501
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketsPendleListMarketsResponse
|
|
502
|
+
):
|
|
488
503
|
r"""List Market Data
|
|
489
504
|
|
|
490
505
|
Get a list of active markets.
|
|
491
506
|
|
|
492
|
-
:param chain:
|
|
507
|
+
:param chain:
|
|
493
508
|
:param retries: Override the default retry configuration for this method
|
|
494
509
|
:param server_url: Override the default server URL for this method
|
|
495
510
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -505,13 +520,13 @@ class Pendle(BaseSDK):
|
|
|
505
520
|
else:
|
|
506
521
|
base_url = self._get_url(base_url, url_variables)
|
|
507
522
|
|
|
508
|
-
request = models.
|
|
523
|
+
request = models.V1PendleMarketsRequest(
|
|
509
524
|
chain=chain,
|
|
510
525
|
)
|
|
511
526
|
|
|
512
527
|
req = self._build_request_async(
|
|
513
528
|
method="GET",
|
|
514
|
-
path="/
|
|
529
|
+
path="/v1/pendle/markets",
|
|
515
530
|
base_url=base_url,
|
|
516
531
|
url_variables=url_variables,
|
|
517
532
|
request=request,
|
|
@@ -537,114 +552,7 @@ class Pendle(BaseSDK):
|
|
|
537
552
|
hook_ctx=HookContext(
|
|
538
553
|
config=self.sdk_configuration,
|
|
539
554
|
base_url=base_url or "",
|
|
540
|
-
operation_id="
|
|
541
|
-
oauth2_scopes=[],
|
|
542
|
-
security_source=self.sdk_configuration.security,
|
|
543
|
-
),
|
|
544
|
-
request=req,
|
|
545
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
546
|
-
retry_config=retry_config,
|
|
547
|
-
)
|
|
548
|
-
|
|
549
|
-
response_data: Any = None
|
|
550
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
551
|
-
return unmarshal_json_response(models.PendleListMarketsResponse, http_res)
|
|
552
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
553
|
-
response_data = unmarshal_json_response(
|
|
554
|
-
errors.HTTPValidationErrorData, http_res
|
|
555
|
-
)
|
|
556
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
557
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
558
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
559
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
560
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
561
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
562
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
563
|
-
|
|
564
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
565
|
-
|
|
566
|
-
def quote(
|
|
567
|
-
self,
|
|
568
|
-
*,
|
|
569
|
-
chain: models.PendleQuoteChain = models.PendleQuoteChain.ARBITRUM_MAINNET,
|
|
570
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
571
|
-
amount: Union[models.PendleQuoteAmount, models.PendleQuoteAmountTypedDict],
|
|
572
|
-
token_type: models.TokenType = models.TokenType.PT,
|
|
573
|
-
trade_type: models.TradeType = models.TradeType.BUY,
|
|
574
|
-
block: OptionalNullable[int] = UNSET,
|
|
575
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
576
|
-
server_url: Optional[str] = None,
|
|
577
|
-
timeout_ms: Optional[int] = None,
|
|
578
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
579
|
-
) -> models.PendleGetQuoteResponse:
|
|
580
|
-
r"""Get Quote
|
|
581
|
-
|
|
582
|
-
Retrieve a quote for trading Principal Token (PT), Yield Token (YT), or Liquidity
|
|
583
|
-
Provider Token (LP) on Pendle.
|
|
584
|
-
|
|
585
|
-
For `BUY`, `amount` is the quantity of the Underlying Token to spend, and the quote returns the amount of `token_type` received.
|
|
586
|
-
|
|
587
|
-
For `SELL`, `amount` is the quantity of `token_type` to sell, and the quote returns the amount of Underlying Token received.
|
|
588
|
-
|
|
589
|
-
:param chain: The chain to use.
|
|
590
|
-
:param market_address: The market address of the desired position.
|
|
591
|
-
:param amount: The quantity to trade.
|
|
592
|
-
:param token_type: Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
593
|
-
:param trade_type: Specifies the trade direction (`BUY` or `SELL`)
|
|
594
|
-
:param block: Optional block number (defaults to latest).
|
|
595
|
-
:param retries: Override the default retry configuration for this method
|
|
596
|
-
:param server_url: Override the default server URL for this method
|
|
597
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
598
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
599
|
-
"""
|
|
600
|
-
base_url = None
|
|
601
|
-
url_variables = None
|
|
602
|
-
if timeout_ms is None:
|
|
603
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
604
|
-
|
|
605
|
-
if server_url is not None:
|
|
606
|
-
base_url = server_url
|
|
607
|
-
else:
|
|
608
|
-
base_url = self._get_url(base_url, url_variables)
|
|
609
|
-
|
|
610
|
-
request = models.PendleQuoteRequest(
|
|
611
|
-
chain=chain,
|
|
612
|
-
block=block,
|
|
613
|
-
market_address=market_address,
|
|
614
|
-
amount=amount,
|
|
615
|
-
token_type=token_type,
|
|
616
|
-
trade_type=trade_type,
|
|
617
|
-
)
|
|
618
|
-
|
|
619
|
-
req = self._build_request(
|
|
620
|
-
method="GET",
|
|
621
|
-
path="/v0/pendle/quote",
|
|
622
|
-
base_url=base_url,
|
|
623
|
-
url_variables=url_variables,
|
|
624
|
-
request=request,
|
|
625
|
-
request_body_required=False,
|
|
626
|
-
request_has_path_params=False,
|
|
627
|
-
request_has_query_params=True,
|
|
628
|
-
user_agent_header="user-agent",
|
|
629
|
-
accept_header_value="application/json",
|
|
630
|
-
http_headers=http_headers,
|
|
631
|
-
security=self.sdk_configuration.security,
|
|
632
|
-
timeout_ms=timeout_ms,
|
|
633
|
-
)
|
|
634
|
-
|
|
635
|
-
if retries == UNSET:
|
|
636
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
637
|
-
retries = self.sdk_configuration.retry_config
|
|
638
|
-
|
|
639
|
-
retry_config = None
|
|
640
|
-
if isinstance(retries, utils.RetryConfig):
|
|
641
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
642
|
-
|
|
643
|
-
http_res = self.do_request(
|
|
644
|
-
hook_ctx=HookContext(
|
|
645
|
-
config=self.sdk_configuration,
|
|
646
|
-
base_url=base_url or "",
|
|
647
|
-
operation_id="pendle_quote",
|
|
555
|
+
operation_id="v1_pendle_markets",
|
|
648
556
|
oauth2_scopes=[],
|
|
649
557
|
security_source=self.sdk_configuration.security,
|
|
650
558
|
),
|
|
@@ -655,114 +563,10 @@ class Pendle(BaseSDK):
|
|
|
655
563
|
|
|
656
564
|
response_data: Any = None
|
|
657
565
|
if utils.match_response(http_res, "200", "application/json"):
|
|
658
|
-
return unmarshal_json_response(
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
errors.HTTPValidationErrorData, http_res
|
|
566
|
+
return unmarshal_json_response(
|
|
567
|
+
models.CompassAPIBackendModelsPendleReadResponseMarketsPendleListMarketsResponse,
|
|
568
|
+
http_res,
|
|
662
569
|
)
|
|
663
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
664
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
665
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
666
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
667
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
668
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
669
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
670
|
-
|
|
671
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
672
|
-
|
|
673
|
-
async def quote_async(
|
|
674
|
-
self,
|
|
675
|
-
*,
|
|
676
|
-
chain: models.PendleQuoteChain = models.PendleQuoteChain.ARBITRUM_MAINNET,
|
|
677
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
678
|
-
amount: Union[models.PendleQuoteAmount, models.PendleQuoteAmountTypedDict],
|
|
679
|
-
token_type: models.TokenType = models.TokenType.PT,
|
|
680
|
-
trade_type: models.TradeType = models.TradeType.BUY,
|
|
681
|
-
block: OptionalNullable[int] = UNSET,
|
|
682
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
683
|
-
server_url: Optional[str] = None,
|
|
684
|
-
timeout_ms: Optional[int] = None,
|
|
685
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
686
|
-
) -> models.PendleGetQuoteResponse:
|
|
687
|
-
r"""Get Quote
|
|
688
|
-
|
|
689
|
-
Retrieve a quote for trading Principal Token (PT), Yield Token (YT), or Liquidity
|
|
690
|
-
Provider Token (LP) on Pendle.
|
|
691
|
-
|
|
692
|
-
For `BUY`, `amount` is the quantity of the Underlying Token to spend, and the quote returns the amount of `token_type` received.
|
|
693
|
-
|
|
694
|
-
For `SELL`, `amount` is the quantity of `token_type` to sell, and the quote returns the amount of Underlying Token received.
|
|
695
|
-
|
|
696
|
-
:param chain: The chain to use.
|
|
697
|
-
:param market_address: The market address of the desired position.
|
|
698
|
-
:param amount: The quantity to trade.
|
|
699
|
-
:param token_type: Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
700
|
-
:param trade_type: Specifies the trade direction (`BUY` or `SELL`)
|
|
701
|
-
:param block: Optional block number (defaults to latest).
|
|
702
|
-
:param retries: Override the default retry configuration for this method
|
|
703
|
-
:param server_url: Override the default server URL for this method
|
|
704
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
705
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
706
|
-
"""
|
|
707
|
-
base_url = None
|
|
708
|
-
url_variables = None
|
|
709
|
-
if timeout_ms is None:
|
|
710
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
711
|
-
|
|
712
|
-
if server_url is not None:
|
|
713
|
-
base_url = server_url
|
|
714
|
-
else:
|
|
715
|
-
base_url = self._get_url(base_url, url_variables)
|
|
716
|
-
|
|
717
|
-
request = models.PendleQuoteRequest(
|
|
718
|
-
chain=chain,
|
|
719
|
-
block=block,
|
|
720
|
-
market_address=market_address,
|
|
721
|
-
amount=amount,
|
|
722
|
-
token_type=token_type,
|
|
723
|
-
trade_type=trade_type,
|
|
724
|
-
)
|
|
725
|
-
|
|
726
|
-
req = self._build_request_async(
|
|
727
|
-
method="GET",
|
|
728
|
-
path="/v0/pendle/quote",
|
|
729
|
-
base_url=base_url,
|
|
730
|
-
url_variables=url_variables,
|
|
731
|
-
request=request,
|
|
732
|
-
request_body_required=False,
|
|
733
|
-
request_has_path_params=False,
|
|
734
|
-
request_has_query_params=True,
|
|
735
|
-
user_agent_header="user-agent",
|
|
736
|
-
accept_header_value="application/json",
|
|
737
|
-
http_headers=http_headers,
|
|
738
|
-
security=self.sdk_configuration.security,
|
|
739
|
-
timeout_ms=timeout_ms,
|
|
740
|
-
)
|
|
741
|
-
|
|
742
|
-
if retries == UNSET:
|
|
743
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
744
|
-
retries = self.sdk_configuration.retry_config
|
|
745
|
-
|
|
746
|
-
retry_config = None
|
|
747
|
-
if isinstance(retries, utils.RetryConfig):
|
|
748
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
749
|
-
|
|
750
|
-
http_res = await self.do_request_async(
|
|
751
|
-
hook_ctx=HookContext(
|
|
752
|
-
config=self.sdk_configuration,
|
|
753
|
-
base_url=base_url or "",
|
|
754
|
-
operation_id="pendle_quote",
|
|
755
|
-
oauth2_scopes=[],
|
|
756
|
-
security_source=self.sdk_configuration.security,
|
|
757
|
-
),
|
|
758
|
-
request=req,
|
|
759
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
760
|
-
retry_config=retry_config,
|
|
761
|
-
)
|
|
762
|
-
|
|
763
|
-
response_data: Any = None
|
|
764
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
765
|
-
return unmarshal_json_response(models.PendleGetQuoteResponse, http_res)
|
|
766
570
|
if utils.match_response(http_res, "422", "application/json"):
|
|
767
571
|
response_data = unmarshal_json_response(
|
|
768
572
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -777,37 +581,51 @@ class Pendle(BaseSDK):
|
|
|
777
581
|
|
|
778
582
|
raise errors.APIError("Unexpected response received", http_res)
|
|
779
583
|
|
|
780
|
-
def
|
|
584
|
+
def pendle_pt(
|
|
781
585
|
self,
|
|
782
586
|
*,
|
|
783
587
|
market_address: str,
|
|
784
|
-
|
|
785
|
-
|
|
588
|
+
action: models.PendleTradePtRequestAction,
|
|
589
|
+
token: Union[
|
|
590
|
+
models.PendleTradePtRequestToken, models.PendleTradePtRequestTokenTypedDict
|
|
591
|
+
],
|
|
592
|
+
amount_in: Union[
|
|
593
|
+
models.PendleTradePtRequestAmountIn,
|
|
594
|
+
models.PendleTradePtRequestAmountInTypedDict,
|
|
786
595
|
],
|
|
787
596
|
max_slippage_percent: float,
|
|
788
|
-
chain: models.
|
|
597
|
+
chain: models.PendleTradePtRequestChain,
|
|
789
598
|
sender: str,
|
|
790
599
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
791
600
|
server_url: Optional[str] = None,
|
|
792
601
|
timeout_ms: Optional[int] = None,
|
|
793
602
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
794
|
-
) -> models.
|
|
795
|
-
r"""
|
|
603
|
+
) -> models.PendleTxResponse:
|
|
604
|
+
r"""Trade Principal Token (PT)
|
|
605
|
+
|
|
606
|
+
Trade market's Principal Token (PT) for fixed yield.
|
|
607
|
+
|
|
608
|
+
PT is traded with a token of the user's choice.
|
|
609
|
+
|
|
610
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
611
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the PT contract.
|
|
796
612
|
|
|
797
|
-
|
|
613
|
+
A quote is included with the response.
|
|
798
614
|
<Info>
|
|
799
615
|
**Required Allowances**
|
|
800
616
|
|
|
801
|
-
In order to make this transaction, token allowances need to be set
|
|
617
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
802
618
|
|
|
803
619
|
- `PendleRouter`
|
|
804
620
|
</Info>
|
|
805
621
|
|
|
806
622
|
|
|
807
|
-
:param market_address: The address of the market identifying which Principal Token (PT) you would like to
|
|
808
|
-
:param
|
|
623
|
+
:param market_address: The address of the market identifying which Principal Token (PT) you would like to trade.
|
|
624
|
+
:param action: Specifies the direction of the PT trade. Valid values are `BUY` (to buy PT) or `SELL` (to sell PT).
|
|
625
|
+
:param token: TThe symbol or address of the token to trade PT with. For `action` set to `BUY`, this is the token to buy PT with. For `action` set to `SELL`, this is the token to sell PT for.
|
|
626
|
+
:param amount_in: For `action` set to `BUY`, this is the amount in of `token` to buy PT with. For `action` set to `SELL`, this is the amount in of PT to sell for `token`.
|
|
809
627
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
810
|
-
:param chain:
|
|
628
|
+
:param chain:
|
|
811
629
|
:param sender: The address of the transaction sender.
|
|
812
630
|
:param retries: Override the default retry configuration for this method
|
|
813
631
|
:param server_url: Override the default server URL for this method
|
|
@@ -824,9 +642,11 @@ class Pendle(BaseSDK):
|
|
|
824
642
|
else:
|
|
825
643
|
base_url = self._get_url(base_url, url_variables)
|
|
826
644
|
|
|
827
|
-
request = models.
|
|
645
|
+
request = models.PendleTradePtRequest(
|
|
828
646
|
market_address=market_address,
|
|
829
|
-
|
|
647
|
+
action=action,
|
|
648
|
+
token=token,
|
|
649
|
+
amount_in=amount_in,
|
|
830
650
|
max_slippage_percent=max_slippage_percent,
|
|
831
651
|
chain=chain,
|
|
832
652
|
sender=sender,
|
|
@@ -834,7 +654,7 @@ class Pendle(BaseSDK):
|
|
|
834
654
|
|
|
835
655
|
req = self._build_request(
|
|
836
656
|
method="POST",
|
|
837
|
-
path="/
|
|
657
|
+
path="/v1/pendle/pt",
|
|
838
658
|
base_url=base_url,
|
|
839
659
|
url_variables=url_variables,
|
|
840
660
|
request=request,
|
|
@@ -846,7 +666,7 @@ class Pendle(BaseSDK):
|
|
|
846
666
|
http_headers=http_headers,
|
|
847
667
|
security=self.sdk_configuration.security,
|
|
848
668
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
849
|
-
request, False, False, "json", models.
|
|
669
|
+
request, False, False, "json", models.PendleTradePtRequest
|
|
850
670
|
),
|
|
851
671
|
timeout_ms=timeout_ms,
|
|
852
672
|
)
|
|
@@ -863,7 +683,7 @@ class Pendle(BaseSDK):
|
|
|
863
683
|
hook_ctx=HookContext(
|
|
864
684
|
config=self.sdk_configuration,
|
|
865
685
|
base_url=base_url or "",
|
|
866
|
-
operation_id="
|
|
686
|
+
operation_id="v1_pendle_pt",
|
|
867
687
|
oauth2_scopes=[],
|
|
868
688
|
security_source=self.sdk_configuration.security,
|
|
869
689
|
),
|
|
@@ -874,7 +694,7 @@ class Pendle(BaseSDK):
|
|
|
874
694
|
|
|
875
695
|
response_data: Any = None
|
|
876
696
|
if utils.match_response(http_res, "200", "application/json"):
|
|
877
|
-
return unmarshal_json_response(models.
|
|
697
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
878
698
|
if utils.match_response(http_res, "422", "application/json"):
|
|
879
699
|
response_data = unmarshal_json_response(
|
|
880
700
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -889,37 +709,51 @@ class Pendle(BaseSDK):
|
|
|
889
709
|
|
|
890
710
|
raise errors.APIError("Unexpected response received", http_res)
|
|
891
711
|
|
|
892
|
-
async def
|
|
712
|
+
async def pendle_pt_async(
|
|
893
713
|
self,
|
|
894
714
|
*,
|
|
895
715
|
market_address: str,
|
|
896
|
-
|
|
897
|
-
|
|
716
|
+
action: models.PendleTradePtRequestAction,
|
|
717
|
+
token: Union[
|
|
718
|
+
models.PendleTradePtRequestToken, models.PendleTradePtRequestTokenTypedDict
|
|
719
|
+
],
|
|
720
|
+
amount_in: Union[
|
|
721
|
+
models.PendleTradePtRequestAmountIn,
|
|
722
|
+
models.PendleTradePtRequestAmountInTypedDict,
|
|
898
723
|
],
|
|
899
724
|
max_slippage_percent: float,
|
|
900
|
-
chain: models.
|
|
725
|
+
chain: models.PendleTradePtRequestChain,
|
|
901
726
|
sender: str,
|
|
902
727
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
903
728
|
server_url: Optional[str] = None,
|
|
904
729
|
timeout_ms: Optional[int] = None,
|
|
905
730
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
906
|
-
) -> models.
|
|
907
|
-
r"""
|
|
731
|
+
) -> models.PendleTxResponse:
|
|
732
|
+
r"""Trade Principal Token (PT)
|
|
733
|
+
|
|
734
|
+
Trade market's Principal Token (PT) for fixed yield.
|
|
735
|
+
|
|
736
|
+
PT is traded with a token of the user's choice.
|
|
737
|
+
|
|
738
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
739
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the PT contract.
|
|
908
740
|
|
|
909
|
-
|
|
741
|
+
A quote is included with the response.
|
|
910
742
|
<Info>
|
|
911
743
|
**Required Allowances**
|
|
912
744
|
|
|
913
|
-
In order to make this transaction, token allowances need to be set
|
|
745
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
914
746
|
|
|
915
747
|
- `PendleRouter`
|
|
916
748
|
</Info>
|
|
917
749
|
|
|
918
750
|
|
|
919
|
-
:param market_address: The address of the market identifying which Principal Token (PT) you would like to
|
|
920
|
-
:param
|
|
751
|
+
:param market_address: The address of the market identifying which Principal Token (PT) you would like to trade.
|
|
752
|
+
:param action: Specifies the direction of the PT trade. Valid values are `BUY` (to buy PT) or `SELL` (to sell PT).
|
|
753
|
+
:param token: TThe symbol or address of the token to trade PT with. For `action` set to `BUY`, this is the token to buy PT with. For `action` set to `SELL`, this is the token to sell PT for.
|
|
754
|
+
:param amount_in: For `action` set to `BUY`, this is the amount in of `token` to buy PT with. For `action` set to `SELL`, this is the amount in of PT to sell for `token`.
|
|
921
755
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
922
|
-
:param chain:
|
|
756
|
+
:param chain:
|
|
923
757
|
:param sender: The address of the transaction sender.
|
|
924
758
|
:param retries: Override the default retry configuration for this method
|
|
925
759
|
:param server_url: Override the default server URL for this method
|
|
@@ -936,9 +770,11 @@ class Pendle(BaseSDK):
|
|
|
936
770
|
else:
|
|
937
771
|
base_url = self._get_url(base_url, url_variables)
|
|
938
772
|
|
|
939
|
-
request = models.
|
|
773
|
+
request = models.PendleTradePtRequest(
|
|
940
774
|
market_address=market_address,
|
|
941
|
-
|
|
775
|
+
action=action,
|
|
776
|
+
token=token,
|
|
777
|
+
amount_in=amount_in,
|
|
942
778
|
max_slippage_percent=max_slippage_percent,
|
|
943
779
|
chain=chain,
|
|
944
780
|
sender=sender,
|
|
@@ -946,7 +782,7 @@ class Pendle(BaseSDK):
|
|
|
946
782
|
|
|
947
783
|
req = self._build_request_async(
|
|
948
784
|
method="POST",
|
|
949
|
-
path="/
|
|
785
|
+
path="/v1/pendle/pt",
|
|
950
786
|
base_url=base_url,
|
|
951
787
|
url_variables=url_variables,
|
|
952
788
|
request=request,
|
|
@@ -958,7 +794,7 @@ class Pendle(BaseSDK):
|
|
|
958
794
|
http_headers=http_headers,
|
|
959
795
|
security=self.sdk_configuration.security,
|
|
960
796
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
961
|
-
request, False, False, "json", models.
|
|
797
|
+
request, False, False, "json", models.PendleTradePtRequest
|
|
962
798
|
),
|
|
963
799
|
timeout_ms=timeout_ms,
|
|
964
800
|
)
|
|
@@ -975,7 +811,7 @@ class Pendle(BaseSDK):
|
|
|
975
811
|
hook_ctx=HookContext(
|
|
976
812
|
config=self.sdk_configuration,
|
|
977
813
|
base_url=base_url or "",
|
|
978
|
-
operation_id="
|
|
814
|
+
operation_id="v1_pendle_pt",
|
|
979
815
|
oauth2_scopes=[],
|
|
980
816
|
security_source=self.sdk_configuration.security,
|
|
981
817
|
),
|
|
@@ -986,7 +822,7 @@ class Pendle(BaseSDK):
|
|
|
986
822
|
|
|
987
823
|
response_data: Any = None
|
|
988
824
|
if utils.match_response(http_res, "200", "application/json"):
|
|
989
|
-
return unmarshal_json_response(models.
|
|
825
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
990
826
|
if utils.match_response(http_res, "422", "application/json"):
|
|
991
827
|
response_data = unmarshal_json_response(
|
|
992
828
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1001,37 +837,51 @@ class Pendle(BaseSDK):
|
|
|
1001
837
|
|
|
1002
838
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1003
839
|
|
|
1004
|
-
def
|
|
840
|
+
def pendle_yt(
|
|
1005
841
|
self,
|
|
1006
842
|
*,
|
|
1007
843
|
market_address: str,
|
|
1008
|
-
|
|
1009
|
-
|
|
844
|
+
action: models.PendleTradeYtRequestAction,
|
|
845
|
+
token: Union[
|
|
846
|
+
models.PendleTradeYtRequestToken, models.PendleTradeYtRequestTokenTypedDict
|
|
847
|
+
],
|
|
848
|
+
amount_in: Union[
|
|
849
|
+
models.PendleTradeYtRequestAmountIn,
|
|
850
|
+
models.PendleTradeYtRequestAmountInTypedDict,
|
|
1010
851
|
],
|
|
1011
852
|
max_slippage_percent: float,
|
|
1012
|
-
chain: models.
|
|
853
|
+
chain: models.PendleTradeYtRequestChain,
|
|
1013
854
|
sender: str,
|
|
1014
855
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1015
856
|
server_url: Optional[str] = None,
|
|
1016
857
|
timeout_ms: Optional[int] = None,
|
|
1017
858
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1018
|
-
) -> models.
|
|
1019
|
-
r"""
|
|
859
|
+
) -> models.PendleTxResponse:
|
|
860
|
+
r"""Trade Yield Token (YT)
|
|
861
|
+
|
|
862
|
+
Trade Yield Token (YT) for variable yield.
|
|
863
|
+
|
|
864
|
+
YT is traded with a token of the user's choice.
|
|
865
|
+
|
|
866
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
867
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the YT contract.
|
|
1020
868
|
|
|
1021
|
-
|
|
869
|
+
A quote is included with the response.
|
|
1022
870
|
<Info>
|
|
1023
871
|
**Required Allowances**
|
|
1024
872
|
|
|
1025
|
-
In order to make this transaction, token allowances need to be set
|
|
873
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1026
874
|
|
|
1027
875
|
- `PendleRouter`
|
|
1028
876
|
</Info>
|
|
1029
877
|
|
|
1030
878
|
|
|
1031
|
-
:param market_address: The address of the market identifying which
|
|
1032
|
-
:param
|
|
879
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to trade.
|
|
880
|
+
:param action: Specifies the direction of the YT trade. Valid values are `BUY` (to buy YT) or `SELL` (to sell YT).
|
|
881
|
+
:param token: TThe symbol or address of the token to trade YT with. For `action` set to `BUY`, this is the token to buy YT with. For `action` set to `SELL`, this is the token to sell YT for.
|
|
882
|
+
:param amount_in: For `action` set to `BUY`, this is the amount in of `token` to buy YT with. For `action` set to `SELL`, this is the amount in of YT to sell for `token`.
|
|
1033
883
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1034
|
-
:param chain:
|
|
884
|
+
:param chain:
|
|
1035
885
|
:param sender: The address of the transaction sender.
|
|
1036
886
|
:param retries: Override the default retry configuration for this method
|
|
1037
887
|
:param server_url: Override the default server URL for this method
|
|
@@ -1048,9 +898,11 @@ class Pendle(BaseSDK):
|
|
|
1048
898
|
else:
|
|
1049
899
|
base_url = self._get_url(base_url, url_variables)
|
|
1050
900
|
|
|
1051
|
-
request = models.
|
|
901
|
+
request = models.PendleTradeYtRequest(
|
|
1052
902
|
market_address=market_address,
|
|
1053
|
-
|
|
903
|
+
action=action,
|
|
904
|
+
token=token,
|
|
905
|
+
amount_in=amount_in,
|
|
1054
906
|
max_slippage_percent=max_slippage_percent,
|
|
1055
907
|
chain=chain,
|
|
1056
908
|
sender=sender,
|
|
@@ -1058,7 +910,7 @@ class Pendle(BaseSDK):
|
|
|
1058
910
|
|
|
1059
911
|
req = self._build_request(
|
|
1060
912
|
method="POST",
|
|
1061
|
-
path="/
|
|
913
|
+
path="/v1/pendle/yt",
|
|
1062
914
|
base_url=base_url,
|
|
1063
915
|
url_variables=url_variables,
|
|
1064
916
|
request=request,
|
|
@@ -1070,7 +922,7 @@ class Pendle(BaseSDK):
|
|
|
1070
922
|
http_headers=http_headers,
|
|
1071
923
|
security=self.sdk_configuration.security,
|
|
1072
924
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1073
|
-
request, False, False, "json", models.
|
|
925
|
+
request, False, False, "json", models.PendleTradeYtRequest
|
|
1074
926
|
),
|
|
1075
927
|
timeout_ms=timeout_ms,
|
|
1076
928
|
)
|
|
@@ -1087,7 +939,7 @@ class Pendle(BaseSDK):
|
|
|
1087
939
|
hook_ctx=HookContext(
|
|
1088
940
|
config=self.sdk_configuration,
|
|
1089
941
|
base_url=base_url or "",
|
|
1090
|
-
operation_id="
|
|
942
|
+
operation_id="v1_pendle_yt",
|
|
1091
943
|
oauth2_scopes=[],
|
|
1092
944
|
security_source=self.sdk_configuration.security,
|
|
1093
945
|
),
|
|
@@ -1098,7 +950,7 @@ class Pendle(BaseSDK):
|
|
|
1098
950
|
|
|
1099
951
|
response_data: Any = None
|
|
1100
952
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1101
|
-
return unmarshal_json_response(models.
|
|
953
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1102
954
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1103
955
|
response_data = unmarshal_json_response(
|
|
1104
956
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1113,37 +965,51 @@ class Pendle(BaseSDK):
|
|
|
1113
965
|
|
|
1114
966
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1115
967
|
|
|
1116
|
-
async def
|
|
968
|
+
async def pendle_yt_async(
|
|
1117
969
|
self,
|
|
1118
970
|
*,
|
|
1119
971
|
market_address: str,
|
|
1120
|
-
|
|
1121
|
-
|
|
972
|
+
action: models.PendleTradeYtRequestAction,
|
|
973
|
+
token: Union[
|
|
974
|
+
models.PendleTradeYtRequestToken, models.PendleTradeYtRequestTokenTypedDict
|
|
975
|
+
],
|
|
976
|
+
amount_in: Union[
|
|
977
|
+
models.PendleTradeYtRequestAmountIn,
|
|
978
|
+
models.PendleTradeYtRequestAmountInTypedDict,
|
|
1122
979
|
],
|
|
1123
980
|
max_slippage_percent: float,
|
|
1124
|
-
chain: models.
|
|
981
|
+
chain: models.PendleTradeYtRequestChain,
|
|
1125
982
|
sender: str,
|
|
1126
983
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1127
984
|
server_url: Optional[str] = None,
|
|
1128
985
|
timeout_ms: Optional[int] = None,
|
|
1129
986
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1130
|
-
) -> models.
|
|
1131
|
-
r"""
|
|
987
|
+
) -> models.PendleTxResponse:
|
|
988
|
+
r"""Trade Yield Token (YT)
|
|
989
|
+
|
|
990
|
+
Trade Yield Token (YT) for variable yield.
|
|
991
|
+
|
|
992
|
+
YT is traded with a token of the user's choice.
|
|
993
|
+
|
|
994
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
995
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the YT contract.
|
|
1132
996
|
|
|
1133
|
-
|
|
997
|
+
A quote is included with the response.
|
|
1134
998
|
<Info>
|
|
1135
999
|
**Required Allowances**
|
|
1136
1000
|
|
|
1137
|
-
In order to make this transaction, token allowances need to be set
|
|
1001
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1138
1002
|
|
|
1139
1003
|
- `PendleRouter`
|
|
1140
1004
|
</Info>
|
|
1141
1005
|
|
|
1142
1006
|
|
|
1143
|
-
:param market_address: The address of the market identifying which
|
|
1144
|
-
:param
|
|
1007
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to trade.
|
|
1008
|
+
:param action: Specifies the direction of the YT trade. Valid values are `BUY` (to buy YT) or `SELL` (to sell YT).
|
|
1009
|
+
:param token: TThe symbol or address of the token to trade YT with. For `action` set to `BUY`, this is the token to buy YT with. For `action` set to `SELL`, this is the token to sell YT for.
|
|
1010
|
+
:param amount_in: For `action` set to `BUY`, this is the amount in of `token` to buy YT with. For `action` set to `SELL`, this is the amount in of YT to sell for `token`.
|
|
1145
1011
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1146
|
-
:param chain:
|
|
1012
|
+
:param chain:
|
|
1147
1013
|
:param sender: The address of the transaction sender.
|
|
1148
1014
|
:param retries: Override the default retry configuration for this method
|
|
1149
1015
|
:param server_url: Override the default server URL for this method
|
|
@@ -1160,9 +1026,11 @@ class Pendle(BaseSDK):
|
|
|
1160
1026
|
else:
|
|
1161
1027
|
base_url = self._get_url(base_url, url_variables)
|
|
1162
1028
|
|
|
1163
|
-
request = models.
|
|
1029
|
+
request = models.PendleTradeYtRequest(
|
|
1164
1030
|
market_address=market_address,
|
|
1165
|
-
|
|
1031
|
+
action=action,
|
|
1032
|
+
token=token,
|
|
1033
|
+
amount_in=amount_in,
|
|
1166
1034
|
max_slippage_percent=max_slippage_percent,
|
|
1167
1035
|
chain=chain,
|
|
1168
1036
|
sender=sender,
|
|
@@ -1170,7 +1038,7 @@ class Pendle(BaseSDK):
|
|
|
1170
1038
|
|
|
1171
1039
|
req = self._build_request_async(
|
|
1172
1040
|
method="POST",
|
|
1173
|
-
path="/
|
|
1041
|
+
path="/v1/pendle/yt",
|
|
1174
1042
|
base_url=base_url,
|
|
1175
1043
|
url_variables=url_variables,
|
|
1176
1044
|
request=request,
|
|
@@ -1182,7 +1050,7 @@ class Pendle(BaseSDK):
|
|
|
1182
1050
|
http_headers=http_headers,
|
|
1183
1051
|
security=self.sdk_configuration.security,
|
|
1184
1052
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1185
|
-
request, False, False, "json", models.
|
|
1053
|
+
request, False, False, "json", models.PendleTradeYtRequest
|
|
1186
1054
|
),
|
|
1187
1055
|
timeout_ms=timeout_ms,
|
|
1188
1056
|
)
|
|
@@ -1199,7 +1067,7 @@ class Pendle(BaseSDK):
|
|
|
1199
1067
|
hook_ctx=HookContext(
|
|
1200
1068
|
config=self.sdk_configuration,
|
|
1201
1069
|
base_url=base_url or "",
|
|
1202
|
-
operation_id="
|
|
1070
|
+
operation_id="v1_pendle_yt",
|
|
1203
1071
|
oauth2_scopes=[],
|
|
1204
1072
|
security_source=self.sdk_configuration.security,
|
|
1205
1073
|
),
|
|
@@ -1210,7 +1078,7 @@ class Pendle(BaseSDK):
|
|
|
1210
1078
|
|
|
1211
1079
|
response_data: Any = None
|
|
1212
1080
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1213
|
-
return unmarshal_json_response(models.
|
|
1081
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1214
1082
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1215
1083
|
response_data = unmarshal_json_response(
|
|
1216
1084
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1225,37 +1093,55 @@ class Pendle(BaseSDK):
|
|
|
1225
1093
|
|
|
1226
1094
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1227
1095
|
|
|
1228
|
-
def
|
|
1096
|
+
def pendle_liquidity(
|
|
1229
1097
|
self,
|
|
1230
1098
|
*,
|
|
1231
1099
|
market_address: str,
|
|
1232
|
-
|
|
1233
|
-
|
|
1100
|
+
action: models.PendleManageLiquidityRequestAction,
|
|
1101
|
+
token: Union[
|
|
1102
|
+
models.PendleManageLiquidityRequestToken,
|
|
1103
|
+
models.PendleManageLiquidityRequestTokenTypedDict,
|
|
1104
|
+
],
|
|
1105
|
+
amount_in: Union[
|
|
1106
|
+
models.PendleManageLiquidityRequestAmountIn,
|
|
1107
|
+
models.PendleManageLiquidityRequestAmountInTypedDict,
|
|
1234
1108
|
],
|
|
1235
1109
|
max_slippage_percent: float,
|
|
1236
|
-
chain: models.
|
|
1110
|
+
chain: models.PendleManageLiquidityRequestChain,
|
|
1237
1111
|
sender: str,
|
|
1238
1112
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1239
1113
|
server_url: Optional[str] = None,
|
|
1240
1114
|
timeout_ms: Optional[int] = None,
|
|
1241
1115
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1242
|
-
) -> models.
|
|
1243
|
-
r"""
|
|
1116
|
+
) -> models.PendleTxResponse:
|
|
1117
|
+
r"""Manage Liquidity (LP)
|
|
1118
|
+
|
|
1119
|
+
Manage liquidity in a Pendle Market.
|
|
1120
|
+
|
|
1121
|
+
Liquidity is supplied to or withdrawn from the market with a token of the user's choice.
|
|
1122
|
+
|
|
1123
|
+
Representation of the liquidity provided is in the form of market's Liquidity
|
|
1124
|
+
Provider Token (LP) received by the user.
|
|
1244
1125
|
|
|
1245
|
-
|
|
1126
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
1127
|
+
beforehand. For `action` set to `SUPPLY`, this is the `token` contract. For `action` set to `WTIHDRAW`, this is the market contract (LP).
|
|
1128
|
+
|
|
1129
|
+
A quote is included with the response.
|
|
1246
1130
|
<Info>
|
|
1247
1131
|
**Required Allowances**
|
|
1248
1132
|
|
|
1249
|
-
In order to make this transaction, token allowances need to be set
|
|
1133
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1250
1134
|
|
|
1251
1135
|
- `PendleRouter`
|
|
1252
1136
|
</Info>
|
|
1253
1137
|
|
|
1254
1138
|
|
|
1255
|
-
:param market_address: The address
|
|
1256
|
-
:param
|
|
1139
|
+
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1140
|
+
:param action: Specifies the direction of the liquidity operation for the Pendle market. Valid values are `SUPPLY` (to add liquidity) or `WITHDRAW` (to remove liquidity).
|
|
1141
|
+
:param token: The symbol or address of the token to manage liquidity with. For `action` set to `SUPPLY`, this is the token to add as liquidity. For `action` set to `WITHDRAW`, this is the token to remove from liquidity.
|
|
1142
|
+
:param amount_in: For `action` set to `SUPPLY`, this is the amount in of `token` to add as liquidity in exchange for Liquidity Provider (LP) tokens. For `action` set to `WITHDRAW`, this is the amount in of LP tokens to redeem for `token`.
|
|
1257
1143
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1258
|
-
:param chain:
|
|
1144
|
+
:param chain:
|
|
1259
1145
|
:param sender: The address of the transaction sender.
|
|
1260
1146
|
:param retries: Override the default retry configuration for this method
|
|
1261
1147
|
:param server_url: Override the default server URL for this method
|
|
@@ -1272,9 +1158,11 @@ class Pendle(BaseSDK):
|
|
|
1272
1158
|
else:
|
|
1273
1159
|
base_url = self._get_url(base_url, url_variables)
|
|
1274
1160
|
|
|
1275
|
-
request = models.
|
|
1161
|
+
request = models.PendleManageLiquidityRequest(
|
|
1276
1162
|
market_address=market_address,
|
|
1277
|
-
|
|
1163
|
+
action=action,
|
|
1164
|
+
token=token,
|
|
1165
|
+
amount_in=amount_in,
|
|
1278
1166
|
max_slippage_percent=max_slippage_percent,
|
|
1279
1167
|
chain=chain,
|
|
1280
1168
|
sender=sender,
|
|
@@ -1282,7 +1170,7 @@ class Pendle(BaseSDK):
|
|
|
1282
1170
|
|
|
1283
1171
|
req = self._build_request(
|
|
1284
1172
|
method="POST",
|
|
1285
|
-
path="/
|
|
1173
|
+
path="/v1/pendle/liquidity",
|
|
1286
1174
|
base_url=base_url,
|
|
1287
1175
|
url_variables=url_variables,
|
|
1288
1176
|
request=request,
|
|
@@ -1294,7 +1182,7 @@ class Pendle(BaseSDK):
|
|
|
1294
1182
|
http_headers=http_headers,
|
|
1295
1183
|
security=self.sdk_configuration.security,
|
|
1296
1184
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1297
|
-
request, False, False, "json", models.
|
|
1185
|
+
request, False, False, "json", models.PendleManageLiquidityRequest
|
|
1298
1186
|
),
|
|
1299
1187
|
timeout_ms=timeout_ms,
|
|
1300
1188
|
)
|
|
@@ -1311,7 +1199,7 @@ class Pendle(BaseSDK):
|
|
|
1311
1199
|
hook_ctx=HookContext(
|
|
1312
1200
|
config=self.sdk_configuration,
|
|
1313
1201
|
base_url=base_url or "",
|
|
1314
|
-
operation_id="
|
|
1202
|
+
operation_id="v1_pendle_liquidity",
|
|
1315
1203
|
oauth2_scopes=[],
|
|
1316
1204
|
security_source=self.sdk_configuration.security,
|
|
1317
1205
|
),
|
|
@@ -1322,7 +1210,7 @@ class Pendle(BaseSDK):
|
|
|
1322
1210
|
|
|
1323
1211
|
response_data: Any = None
|
|
1324
1212
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1325
|
-
return unmarshal_json_response(models.
|
|
1213
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1326
1214
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1327
1215
|
response_data = unmarshal_json_response(
|
|
1328
1216
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1337,37 +1225,55 @@ class Pendle(BaseSDK):
|
|
|
1337
1225
|
|
|
1338
1226
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1339
1227
|
|
|
1340
|
-
async def
|
|
1228
|
+
async def pendle_liquidity_async(
|
|
1341
1229
|
self,
|
|
1342
1230
|
*,
|
|
1343
1231
|
market_address: str,
|
|
1344
|
-
|
|
1345
|
-
|
|
1232
|
+
action: models.PendleManageLiquidityRequestAction,
|
|
1233
|
+
token: Union[
|
|
1234
|
+
models.PendleManageLiquidityRequestToken,
|
|
1235
|
+
models.PendleManageLiquidityRequestTokenTypedDict,
|
|
1236
|
+
],
|
|
1237
|
+
amount_in: Union[
|
|
1238
|
+
models.PendleManageLiquidityRequestAmountIn,
|
|
1239
|
+
models.PendleManageLiquidityRequestAmountInTypedDict,
|
|
1346
1240
|
],
|
|
1347
1241
|
max_slippage_percent: float,
|
|
1348
|
-
chain: models.
|
|
1242
|
+
chain: models.PendleManageLiquidityRequestChain,
|
|
1349
1243
|
sender: str,
|
|
1350
1244
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1351
1245
|
server_url: Optional[str] = None,
|
|
1352
1246
|
timeout_ms: Optional[int] = None,
|
|
1353
1247
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1354
|
-
) -> models.
|
|
1355
|
-
r"""
|
|
1248
|
+
) -> models.PendleTxResponse:
|
|
1249
|
+
r"""Manage Liquidity (LP)
|
|
1250
|
+
|
|
1251
|
+
Manage liquidity in a Pendle Market.
|
|
1356
1252
|
|
|
1357
|
-
|
|
1253
|
+
Liquidity is supplied to or withdrawn from the market with a token of the user's choice.
|
|
1254
|
+
|
|
1255
|
+
Representation of the liquidity provided is in the form of market's Liquidity
|
|
1256
|
+
Provider Token (LP) received by the user.
|
|
1257
|
+
|
|
1258
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
1259
|
+
beforehand. For `action` set to `SUPPLY`, this is the `token` contract. For `action` set to `WTIHDRAW`, this is the market contract (LP).
|
|
1260
|
+
|
|
1261
|
+
A quote is included with the response.
|
|
1358
1262
|
<Info>
|
|
1359
1263
|
**Required Allowances**
|
|
1360
1264
|
|
|
1361
|
-
In order to make this transaction, token allowances need to be set
|
|
1265
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1362
1266
|
|
|
1363
1267
|
- `PendleRouter`
|
|
1364
1268
|
</Info>
|
|
1365
1269
|
|
|
1366
1270
|
|
|
1367
|
-
:param market_address: The address
|
|
1368
|
-
:param
|
|
1271
|
+
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1272
|
+
:param action: Specifies the direction of the liquidity operation for the Pendle market. Valid values are `SUPPLY` (to add liquidity) or `WITHDRAW` (to remove liquidity).
|
|
1273
|
+
:param token: The symbol or address of the token to manage liquidity with. For `action` set to `SUPPLY`, this is the token to add as liquidity. For `action` set to `WITHDRAW`, this is the token to remove from liquidity.
|
|
1274
|
+
:param amount_in: For `action` set to `SUPPLY`, this is the amount in of `token` to add as liquidity in exchange for Liquidity Provider (LP) tokens. For `action` set to `WITHDRAW`, this is the amount in of LP tokens to redeem for `token`.
|
|
1369
1275
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1370
|
-
:param chain:
|
|
1276
|
+
:param chain:
|
|
1371
1277
|
:param sender: The address of the transaction sender.
|
|
1372
1278
|
:param retries: Override the default retry configuration for this method
|
|
1373
1279
|
:param server_url: Override the default server URL for this method
|
|
@@ -1384,9 +1290,11 @@ class Pendle(BaseSDK):
|
|
|
1384
1290
|
else:
|
|
1385
1291
|
base_url = self._get_url(base_url, url_variables)
|
|
1386
1292
|
|
|
1387
|
-
request = models.
|
|
1293
|
+
request = models.PendleManageLiquidityRequest(
|
|
1388
1294
|
market_address=market_address,
|
|
1389
|
-
|
|
1295
|
+
action=action,
|
|
1296
|
+
token=token,
|
|
1297
|
+
amount_in=amount_in,
|
|
1390
1298
|
max_slippage_percent=max_slippage_percent,
|
|
1391
1299
|
chain=chain,
|
|
1392
1300
|
sender=sender,
|
|
@@ -1394,7 +1302,7 @@ class Pendle(BaseSDK):
|
|
|
1394
1302
|
|
|
1395
1303
|
req = self._build_request_async(
|
|
1396
1304
|
method="POST",
|
|
1397
|
-
path="/
|
|
1305
|
+
path="/v1/pendle/liquidity",
|
|
1398
1306
|
base_url=base_url,
|
|
1399
1307
|
url_variables=url_variables,
|
|
1400
1308
|
request=request,
|
|
@@ -1406,7 +1314,7 @@ class Pendle(BaseSDK):
|
|
|
1406
1314
|
http_headers=http_headers,
|
|
1407
1315
|
security=self.sdk_configuration.security,
|
|
1408
1316
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1409
|
-
request, False, False, "json", models.
|
|
1317
|
+
request, False, False, "json", models.PendleManageLiquidityRequest
|
|
1410
1318
|
),
|
|
1411
1319
|
timeout_ms=timeout_ms,
|
|
1412
1320
|
)
|
|
@@ -1423,7 +1331,7 @@ class Pendle(BaseSDK):
|
|
|
1423
1331
|
hook_ctx=HookContext(
|
|
1424
1332
|
config=self.sdk_configuration,
|
|
1425
1333
|
base_url=base_url or "",
|
|
1426
|
-
operation_id="
|
|
1334
|
+
operation_id="v1_pendle_liquidity",
|
|
1427
1335
|
oauth2_scopes=[],
|
|
1428
1336
|
security_source=self.sdk_configuration.security,
|
|
1429
1337
|
),
|
|
@@ -1434,7 +1342,7 @@ class Pendle(BaseSDK):
|
|
|
1434
1342
|
|
|
1435
1343
|
response_data: Any = None
|
|
1436
1344
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1437
|
-
return unmarshal_json_response(models.
|
|
1345
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1438
1346
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1439
1347
|
response_data = unmarshal_json_response(
|
|
1440
1348
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1449,37 +1357,31 @@ class Pendle(BaseSDK):
|
|
|
1449
1357
|
|
|
1450
1358
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1451
1359
|
|
|
1452
|
-
def
|
|
1360
|
+
def pendle_redeem_yield(
|
|
1453
1361
|
self,
|
|
1454
1362
|
*,
|
|
1455
1363
|
market_address: str,
|
|
1456
|
-
|
|
1457
|
-
models.PendleSellYtRequestAmount, models.PendleSellYtRequestAmountTypedDict
|
|
1458
|
-
],
|
|
1459
|
-
max_slippage_percent: float,
|
|
1460
|
-
chain: models.Chain,
|
|
1364
|
+
chain: models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequestChain,
|
|
1461
1365
|
sender: str,
|
|
1462
1366
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1463
1367
|
server_url: Optional[str] = None,
|
|
1464
1368
|
timeout_ms: Optional[int] = None,
|
|
1465
1369
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1466
|
-
) -> models.
|
|
1467
|
-
r"""
|
|
1370
|
+
) -> models.TransactionResponse:
|
|
1371
|
+
r"""Redeem Claimable Yield
|
|
1468
1372
|
|
|
1469
|
-
|
|
1373
|
+
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1470
1374
|
<Info>
|
|
1471
1375
|
**Required Allowances**
|
|
1472
1376
|
|
|
1473
|
-
In order to make this transaction, token allowances need to be set
|
|
1377
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1474
1378
|
|
|
1475
1379
|
- `PendleRouter`
|
|
1476
1380
|
</Info>
|
|
1477
1381
|
|
|
1478
1382
|
|
|
1479
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to
|
|
1480
|
-
:param
|
|
1481
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1482
|
-
:param chain: The chain to use.
|
|
1383
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1384
|
+
:param chain:
|
|
1483
1385
|
:param sender: The address of the transaction sender.
|
|
1484
1386
|
:param retries: Override the default retry configuration for this method
|
|
1485
1387
|
:param server_url: Override the default server URL for this method
|
|
@@ -1496,17 +1398,15 @@ class Pendle(BaseSDK):
|
|
|
1496
1398
|
else:
|
|
1497
1399
|
base_url = self._get_url(base_url, url_variables)
|
|
1498
1400
|
|
|
1499
|
-
request = models.
|
|
1401
|
+
request = models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequest(
|
|
1500
1402
|
market_address=market_address,
|
|
1501
|
-
amount=amount,
|
|
1502
|
-
max_slippage_percent=max_slippage_percent,
|
|
1503
1403
|
chain=chain,
|
|
1504
1404
|
sender=sender,
|
|
1505
1405
|
)
|
|
1506
1406
|
|
|
1507
1407
|
req = self._build_request(
|
|
1508
1408
|
method="POST",
|
|
1509
|
-
path="/
|
|
1409
|
+
path="/v1/pendle/redeem_yield",
|
|
1510
1410
|
base_url=base_url,
|
|
1511
1411
|
url_variables=url_variables,
|
|
1512
1412
|
request=request,
|
|
@@ -1518,7 +1418,11 @@ class Pendle(BaseSDK):
|
|
|
1518
1418
|
http_headers=http_headers,
|
|
1519
1419
|
security=self.sdk_configuration.security,
|
|
1520
1420
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1521
|
-
request,
|
|
1421
|
+
request,
|
|
1422
|
+
False,
|
|
1423
|
+
False,
|
|
1424
|
+
"json",
|
|
1425
|
+
models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequest,
|
|
1522
1426
|
),
|
|
1523
1427
|
timeout_ms=timeout_ms,
|
|
1524
1428
|
)
|
|
@@ -1535,7 +1439,7 @@ class Pendle(BaseSDK):
|
|
|
1535
1439
|
hook_ctx=HookContext(
|
|
1536
1440
|
config=self.sdk_configuration,
|
|
1537
1441
|
base_url=base_url or "",
|
|
1538
|
-
operation_id="
|
|
1442
|
+
operation_id="v1_pendle_redeem_yield",
|
|
1539
1443
|
oauth2_scopes=[],
|
|
1540
1444
|
security_source=self.sdk_configuration.security,
|
|
1541
1445
|
),
|
|
@@ -1546,7 +1450,7 @@ class Pendle(BaseSDK):
|
|
|
1546
1450
|
|
|
1547
1451
|
response_data: Any = None
|
|
1548
1452
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1549
|
-
return unmarshal_json_response(models.
|
|
1453
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
1550
1454
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1551
1455
|
response_data = unmarshal_json_response(
|
|
1552
1456
|
errors.HTTPValidationErrorData, http_res
|
|
@@ -1561,37 +1465,31 @@ class Pendle(BaseSDK):
|
|
|
1561
1465
|
|
|
1562
1466
|
raise errors.APIError("Unexpected response received", http_res)
|
|
1563
1467
|
|
|
1564
|
-
async def
|
|
1468
|
+
async def pendle_redeem_yield_async(
|
|
1565
1469
|
self,
|
|
1566
1470
|
*,
|
|
1567
1471
|
market_address: str,
|
|
1568
|
-
|
|
1569
|
-
models.PendleSellYtRequestAmount, models.PendleSellYtRequestAmountTypedDict
|
|
1570
|
-
],
|
|
1571
|
-
max_slippage_percent: float,
|
|
1572
|
-
chain: models.Chain,
|
|
1472
|
+
chain: models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequestChain,
|
|
1573
1473
|
sender: str,
|
|
1574
1474
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1575
1475
|
server_url: Optional[str] = None,
|
|
1576
1476
|
timeout_ms: Optional[int] = None,
|
|
1577
1477
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1578
|
-
) -> models.
|
|
1579
|
-
r"""
|
|
1478
|
+
) -> models.TransactionResponse:
|
|
1479
|
+
r"""Redeem Claimable Yield
|
|
1580
1480
|
|
|
1581
|
-
|
|
1481
|
+
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1582
1482
|
<Info>
|
|
1583
1483
|
**Required Allowances**
|
|
1584
1484
|
|
|
1585
|
-
In order to make this transaction, token allowances need to be set
|
|
1485
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1586
1486
|
|
|
1587
1487
|
- `PendleRouter`
|
|
1588
1488
|
</Info>
|
|
1589
1489
|
|
|
1590
1490
|
|
|
1591
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to
|
|
1592
|
-
:param
|
|
1593
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1594
|
-
:param chain: The chain to use.
|
|
1491
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1492
|
+
:param chain:
|
|
1595
1493
|
:param sender: The address of the transaction sender.
|
|
1596
1494
|
:param retries: Override the default retry configuration for this method
|
|
1597
1495
|
:param server_url: Override the default server URL for this method
|
|
@@ -1608,691 +1506,15 @@ class Pendle(BaseSDK):
|
|
|
1608
1506
|
else:
|
|
1609
1507
|
base_url = self._get_url(base_url, url_variables)
|
|
1610
1508
|
|
|
1611
|
-
request = models.
|
|
1509
|
+
request = models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequest(
|
|
1612
1510
|
market_address=market_address,
|
|
1613
|
-
amount=amount,
|
|
1614
|
-
max_slippage_percent=max_slippage_percent,
|
|
1615
|
-
chain=chain,
|
|
1616
|
-
sender=sender,
|
|
1617
|
-
)
|
|
1618
|
-
|
|
1619
|
-
req = self._build_request_async(
|
|
1620
|
-
method="POST",
|
|
1621
|
-
path="/v0/pendle/sell_yt",
|
|
1622
|
-
base_url=base_url,
|
|
1623
|
-
url_variables=url_variables,
|
|
1624
|
-
request=request,
|
|
1625
|
-
request_body_required=True,
|
|
1626
|
-
request_has_path_params=False,
|
|
1627
|
-
request_has_query_params=True,
|
|
1628
|
-
user_agent_header="user-agent",
|
|
1629
|
-
accept_header_value="application/json",
|
|
1630
|
-
http_headers=http_headers,
|
|
1631
|
-
security=self.sdk_configuration.security,
|
|
1632
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1633
|
-
request, False, False, "json", models.PendleSellYtRequest
|
|
1634
|
-
),
|
|
1635
|
-
timeout_ms=timeout_ms,
|
|
1636
|
-
)
|
|
1637
|
-
|
|
1638
|
-
if retries == UNSET:
|
|
1639
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1640
|
-
retries = self.sdk_configuration.retry_config
|
|
1641
|
-
|
|
1642
|
-
retry_config = None
|
|
1643
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1644
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1645
|
-
|
|
1646
|
-
http_res = await self.do_request_async(
|
|
1647
|
-
hook_ctx=HookContext(
|
|
1648
|
-
config=self.sdk_configuration,
|
|
1649
|
-
base_url=base_url or "",
|
|
1650
|
-
operation_id="pendle_sell_yt",
|
|
1651
|
-
oauth2_scopes=[],
|
|
1652
|
-
security_source=self.sdk_configuration.security,
|
|
1653
|
-
),
|
|
1654
|
-
request=req,
|
|
1655
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1656
|
-
retry_config=retry_config,
|
|
1657
|
-
)
|
|
1658
|
-
|
|
1659
|
-
response_data: Any = None
|
|
1660
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1661
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
1662
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1663
|
-
response_data = unmarshal_json_response(
|
|
1664
|
-
errors.HTTPValidationErrorData, http_res
|
|
1665
|
-
)
|
|
1666
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
1667
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1668
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1669
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1670
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1671
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1672
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1673
|
-
|
|
1674
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
1675
|
-
|
|
1676
|
-
def redeem_yield(
|
|
1677
|
-
self,
|
|
1678
|
-
*,
|
|
1679
|
-
market_address: str,
|
|
1680
|
-
chain: models.Chain,
|
|
1681
|
-
sender: str,
|
|
1682
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1683
|
-
server_url: Optional[str] = None,
|
|
1684
|
-
timeout_ms: Optional[int] = None,
|
|
1685
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1686
|
-
) -> models.TxResponse:
|
|
1687
|
-
r"""Redeem Claimable Yield
|
|
1688
|
-
|
|
1689
|
-
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1690
|
-
<Info>
|
|
1691
|
-
**Required Allowances**
|
|
1692
|
-
|
|
1693
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
1694
|
-
|
|
1695
|
-
- `PendleRouter`
|
|
1696
|
-
</Info>
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1700
|
-
:param chain: The chain to use.
|
|
1701
|
-
:param sender: The address of the transaction sender.
|
|
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.PendleRedeemYieldRequest(
|
|
1718
|
-
market_address=market_address,
|
|
1719
|
-
chain=chain,
|
|
1720
|
-
sender=sender,
|
|
1721
|
-
)
|
|
1722
|
-
|
|
1723
|
-
req = self._build_request(
|
|
1724
|
-
method="POST",
|
|
1725
|
-
path="/v0/pendle/redeem_yield",
|
|
1726
|
-
base_url=base_url,
|
|
1727
|
-
url_variables=url_variables,
|
|
1728
|
-
request=request,
|
|
1729
|
-
request_body_required=True,
|
|
1730
|
-
request_has_path_params=False,
|
|
1731
|
-
request_has_query_params=True,
|
|
1732
|
-
user_agent_header="user-agent",
|
|
1733
|
-
accept_header_value="application/json",
|
|
1734
|
-
http_headers=http_headers,
|
|
1735
|
-
security=self.sdk_configuration.security,
|
|
1736
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1737
|
-
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1738
|
-
),
|
|
1739
|
-
timeout_ms=timeout_ms,
|
|
1740
|
-
)
|
|
1741
|
-
|
|
1742
|
-
if retries == UNSET:
|
|
1743
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1744
|
-
retries = self.sdk_configuration.retry_config
|
|
1745
|
-
|
|
1746
|
-
retry_config = None
|
|
1747
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1748
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1749
|
-
|
|
1750
|
-
http_res = self.do_request(
|
|
1751
|
-
hook_ctx=HookContext(
|
|
1752
|
-
config=self.sdk_configuration,
|
|
1753
|
-
base_url=base_url or "",
|
|
1754
|
-
operation_id="pendle_redeem_yield",
|
|
1755
|
-
oauth2_scopes=[],
|
|
1756
|
-
security_source=self.sdk_configuration.security,
|
|
1757
|
-
),
|
|
1758
|
-
request=req,
|
|
1759
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1760
|
-
retry_config=retry_config,
|
|
1761
|
-
)
|
|
1762
|
-
|
|
1763
|
-
response_data: Any = None
|
|
1764
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1765
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
1766
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1767
|
-
response_data = unmarshal_json_response(
|
|
1768
|
-
errors.HTTPValidationErrorData, http_res
|
|
1769
|
-
)
|
|
1770
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
1771
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1772
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1773
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1774
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1775
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1776
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1777
|
-
|
|
1778
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
1779
|
-
|
|
1780
|
-
async def redeem_yield_async(
|
|
1781
|
-
self,
|
|
1782
|
-
*,
|
|
1783
|
-
market_address: str,
|
|
1784
|
-
chain: models.Chain,
|
|
1785
|
-
sender: str,
|
|
1786
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1787
|
-
server_url: Optional[str] = None,
|
|
1788
|
-
timeout_ms: Optional[int] = None,
|
|
1789
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1790
|
-
) -> models.TxResponse:
|
|
1791
|
-
r"""Redeem Claimable Yield
|
|
1792
|
-
|
|
1793
|
-
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1794
|
-
<Info>
|
|
1795
|
-
**Required Allowances**
|
|
1796
|
-
|
|
1797
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
1798
|
-
|
|
1799
|
-
- `PendleRouter`
|
|
1800
|
-
</Info>
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1804
|
-
:param chain: The chain to use.
|
|
1805
|
-
:param sender: The address of the transaction sender.
|
|
1806
|
-
:param retries: Override the default retry configuration for this method
|
|
1807
|
-
:param server_url: Override the default server URL for this method
|
|
1808
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1809
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1810
|
-
"""
|
|
1811
|
-
base_url = None
|
|
1812
|
-
url_variables = None
|
|
1813
|
-
if timeout_ms is None:
|
|
1814
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1815
|
-
|
|
1816
|
-
if server_url is not None:
|
|
1817
|
-
base_url = server_url
|
|
1818
|
-
else:
|
|
1819
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1820
|
-
|
|
1821
|
-
request = models.PendleRedeemYieldRequest(
|
|
1822
|
-
market_address=market_address,
|
|
1823
|
-
chain=chain,
|
|
1824
|
-
sender=sender,
|
|
1825
|
-
)
|
|
1826
|
-
|
|
1827
|
-
req = self._build_request_async(
|
|
1828
|
-
method="POST",
|
|
1829
|
-
path="/v0/pendle/redeem_yield",
|
|
1830
|
-
base_url=base_url,
|
|
1831
|
-
url_variables=url_variables,
|
|
1832
|
-
request=request,
|
|
1833
|
-
request_body_required=True,
|
|
1834
|
-
request_has_path_params=False,
|
|
1835
|
-
request_has_query_params=True,
|
|
1836
|
-
user_agent_header="user-agent",
|
|
1837
|
-
accept_header_value="application/json",
|
|
1838
|
-
http_headers=http_headers,
|
|
1839
|
-
security=self.sdk_configuration.security,
|
|
1840
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1841
|
-
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1842
|
-
),
|
|
1843
|
-
timeout_ms=timeout_ms,
|
|
1844
|
-
)
|
|
1845
|
-
|
|
1846
|
-
if retries == UNSET:
|
|
1847
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1848
|
-
retries = self.sdk_configuration.retry_config
|
|
1849
|
-
|
|
1850
|
-
retry_config = None
|
|
1851
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1852
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1853
|
-
|
|
1854
|
-
http_res = await self.do_request_async(
|
|
1855
|
-
hook_ctx=HookContext(
|
|
1856
|
-
config=self.sdk_configuration,
|
|
1857
|
-
base_url=base_url or "",
|
|
1858
|
-
operation_id="pendle_redeem_yield",
|
|
1859
|
-
oauth2_scopes=[],
|
|
1860
|
-
security_source=self.sdk_configuration.security,
|
|
1861
|
-
),
|
|
1862
|
-
request=req,
|
|
1863
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1864
|
-
retry_config=retry_config,
|
|
1865
|
-
)
|
|
1866
|
-
|
|
1867
|
-
response_data: Any = None
|
|
1868
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1869
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
1870
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1871
|
-
response_data = unmarshal_json_response(
|
|
1872
|
-
errors.HTTPValidationErrorData, http_res
|
|
1873
|
-
)
|
|
1874
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
1875
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1876
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1877
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1878
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1879
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1880
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1881
|
-
|
|
1882
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
1883
|
-
|
|
1884
|
-
def add_liquidity(
|
|
1885
|
-
self,
|
|
1886
|
-
*,
|
|
1887
|
-
market_address: str,
|
|
1888
|
-
amount: Union[
|
|
1889
|
-
models.PendleAddLiquidityRequestAmount,
|
|
1890
|
-
models.PendleAddLiquidityRequestAmountTypedDict,
|
|
1891
|
-
],
|
|
1892
|
-
max_slippage_percent: float,
|
|
1893
|
-
chain: models.Chain,
|
|
1894
|
-
sender: str,
|
|
1895
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1896
|
-
server_url: Optional[str] = None,
|
|
1897
|
-
timeout_ms: Optional[int] = None,
|
|
1898
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1899
|
-
) -> models.TxResponse:
|
|
1900
|
-
r"""Add Liquidity
|
|
1901
|
-
|
|
1902
|
-
Add liquidity to a Pendle Market to earn yield.
|
|
1903
|
-
|
|
1904
|
-
Liquidity is added in the form of the market's Underlying Token. Representation of
|
|
1905
|
-
the liquidity received is the market's Liquidity Provider Token (LP).
|
|
1906
|
-
<Info>
|
|
1907
|
-
**Required Allowances**
|
|
1908
|
-
|
|
1909
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
1910
|
-
|
|
1911
|
-
- `PendleRouter`
|
|
1912
|
-
</Info>
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1916
|
-
:param amount: The amount of liquidity you would like to add to the market denominated in the market's Underlying Token.
|
|
1917
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1918
|
-
:param chain: The chain to use.
|
|
1919
|
-
:param sender: The address of the transaction sender.
|
|
1920
|
-
:param retries: Override the default retry configuration for this method
|
|
1921
|
-
:param server_url: Override the default server URL for this method
|
|
1922
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1923
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1924
|
-
"""
|
|
1925
|
-
base_url = None
|
|
1926
|
-
url_variables = None
|
|
1927
|
-
if timeout_ms is None:
|
|
1928
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1929
|
-
|
|
1930
|
-
if server_url is not None:
|
|
1931
|
-
base_url = server_url
|
|
1932
|
-
else:
|
|
1933
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1934
|
-
|
|
1935
|
-
request = models.PendleAddLiquidityRequest(
|
|
1936
|
-
market_address=market_address,
|
|
1937
|
-
amount=amount,
|
|
1938
|
-
max_slippage_percent=max_slippage_percent,
|
|
1939
|
-
chain=chain,
|
|
1940
|
-
sender=sender,
|
|
1941
|
-
)
|
|
1942
|
-
|
|
1943
|
-
req = self._build_request(
|
|
1944
|
-
method="POST",
|
|
1945
|
-
path="/v0/pendle/add_liquidity",
|
|
1946
|
-
base_url=base_url,
|
|
1947
|
-
url_variables=url_variables,
|
|
1948
|
-
request=request,
|
|
1949
|
-
request_body_required=True,
|
|
1950
|
-
request_has_path_params=False,
|
|
1951
|
-
request_has_query_params=True,
|
|
1952
|
-
user_agent_header="user-agent",
|
|
1953
|
-
accept_header_value="application/json",
|
|
1954
|
-
http_headers=http_headers,
|
|
1955
|
-
security=self.sdk_configuration.security,
|
|
1956
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1957
|
-
request, False, False, "json", models.PendleAddLiquidityRequest
|
|
1958
|
-
),
|
|
1959
|
-
timeout_ms=timeout_ms,
|
|
1960
|
-
)
|
|
1961
|
-
|
|
1962
|
-
if retries == UNSET:
|
|
1963
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1964
|
-
retries = self.sdk_configuration.retry_config
|
|
1965
|
-
|
|
1966
|
-
retry_config = None
|
|
1967
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1968
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1969
|
-
|
|
1970
|
-
http_res = self.do_request(
|
|
1971
|
-
hook_ctx=HookContext(
|
|
1972
|
-
config=self.sdk_configuration,
|
|
1973
|
-
base_url=base_url or "",
|
|
1974
|
-
operation_id="pendle_add_liquidity",
|
|
1975
|
-
oauth2_scopes=[],
|
|
1976
|
-
security_source=self.sdk_configuration.security,
|
|
1977
|
-
),
|
|
1978
|
-
request=req,
|
|
1979
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1980
|
-
retry_config=retry_config,
|
|
1981
|
-
)
|
|
1982
|
-
|
|
1983
|
-
response_data: Any = None
|
|
1984
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1985
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
1986
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1987
|
-
response_data = unmarshal_json_response(
|
|
1988
|
-
errors.HTTPValidationErrorData, http_res
|
|
1989
|
-
)
|
|
1990
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
1991
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1992
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1993
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1994
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1995
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1996
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1997
|
-
|
|
1998
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
1999
|
-
|
|
2000
|
-
async def add_liquidity_async(
|
|
2001
|
-
self,
|
|
2002
|
-
*,
|
|
2003
|
-
market_address: str,
|
|
2004
|
-
amount: Union[
|
|
2005
|
-
models.PendleAddLiquidityRequestAmount,
|
|
2006
|
-
models.PendleAddLiquidityRequestAmountTypedDict,
|
|
2007
|
-
],
|
|
2008
|
-
max_slippage_percent: float,
|
|
2009
|
-
chain: models.Chain,
|
|
2010
|
-
sender: str,
|
|
2011
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2012
|
-
server_url: Optional[str] = None,
|
|
2013
|
-
timeout_ms: Optional[int] = None,
|
|
2014
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2015
|
-
) -> models.TxResponse:
|
|
2016
|
-
r"""Add Liquidity
|
|
2017
|
-
|
|
2018
|
-
Add liquidity to a Pendle Market to earn yield.
|
|
2019
|
-
|
|
2020
|
-
Liquidity is added in the form of the market's Underlying Token. Representation of
|
|
2021
|
-
the liquidity received is the market's Liquidity Provider Token (LP).
|
|
2022
|
-
<Info>
|
|
2023
|
-
**Required Allowances**
|
|
2024
|
-
|
|
2025
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
2026
|
-
|
|
2027
|
-
- `PendleRouter`
|
|
2028
|
-
</Info>
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
2032
|
-
:param amount: The amount of liquidity you would like to add to the market denominated in the market's Underlying Token.
|
|
2033
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2034
|
-
:param chain: The chain to use.
|
|
2035
|
-
:param sender: The address of the transaction sender.
|
|
2036
|
-
:param retries: Override the default retry configuration for this method
|
|
2037
|
-
:param server_url: Override the default server URL for this method
|
|
2038
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2039
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2040
|
-
"""
|
|
2041
|
-
base_url = None
|
|
2042
|
-
url_variables = None
|
|
2043
|
-
if timeout_ms is None:
|
|
2044
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2045
|
-
|
|
2046
|
-
if server_url is not None:
|
|
2047
|
-
base_url = server_url
|
|
2048
|
-
else:
|
|
2049
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2050
|
-
|
|
2051
|
-
request = models.PendleAddLiquidityRequest(
|
|
2052
|
-
market_address=market_address,
|
|
2053
|
-
amount=amount,
|
|
2054
|
-
max_slippage_percent=max_slippage_percent,
|
|
2055
|
-
chain=chain,
|
|
2056
|
-
sender=sender,
|
|
2057
|
-
)
|
|
2058
|
-
|
|
2059
|
-
req = self._build_request_async(
|
|
2060
|
-
method="POST",
|
|
2061
|
-
path="/v0/pendle/add_liquidity",
|
|
2062
|
-
base_url=base_url,
|
|
2063
|
-
url_variables=url_variables,
|
|
2064
|
-
request=request,
|
|
2065
|
-
request_body_required=True,
|
|
2066
|
-
request_has_path_params=False,
|
|
2067
|
-
request_has_query_params=True,
|
|
2068
|
-
user_agent_header="user-agent",
|
|
2069
|
-
accept_header_value="application/json",
|
|
2070
|
-
http_headers=http_headers,
|
|
2071
|
-
security=self.sdk_configuration.security,
|
|
2072
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2073
|
-
request, False, False, "json", models.PendleAddLiquidityRequest
|
|
2074
|
-
),
|
|
2075
|
-
timeout_ms=timeout_ms,
|
|
2076
|
-
)
|
|
2077
|
-
|
|
2078
|
-
if retries == UNSET:
|
|
2079
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2080
|
-
retries = self.sdk_configuration.retry_config
|
|
2081
|
-
|
|
2082
|
-
retry_config = None
|
|
2083
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2084
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2085
|
-
|
|
2086
|
-
http_res = await self.do_request_async(
|
|
2087
|
-
hook_ctx=HookContext(
|
|
2088
|
-
config=self.sdk_configuration,
|
|
2089
|
-
base_url=base_url or "",
|
|
2090
|
-
operation_id="pendle_add_liquidity",
|
|
2091
|
-
oauth2_scopes=[],
|
|
2092
|
-
security_source=self.sdk_configuration.security,
|
|
2093
|
-
),
|
|
2094
|
-
request=req,
|
|
2095
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2096
|
-
retry_config=retry_config,
|
|
2097
|
-
)
|
|
2098
|
-
|
|
2099
|
-
response_data: Any = None
|
|
2100
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2101
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
2102
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2103
|
-
response_data = unmarshal_json_response(
|
|
2104
|
-
errors.HTTPValidationErrorData, http_res
|
|
2105
|
-
)
|
|
2106
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
2107
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2108
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2109
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2110
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2111
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2112
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2113
|
-
|
|
2114
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
2115
|
-
|
|
2116
|
-
def remove_liquidity(
|
|
2117
|
-
self,
|
|
2118
|
-
*,
|
|
2119
|
-
market_address: str,
|
|
2120
|
-
amount: Union[
|
|
2121
|
-
models.PendleRemoveLiquidityRequestAmount,
|
|
2122
|
-
models.PendleRemoveLiquidityRequestAmountTypedDict,
|
|
2123
|
-
],
|
|
2124
|
-
max_slippage_percent: float,
|
|
2125
|
-
chain: models.Chain,
|
|
2126
|
-
sender: str,
|
|
2127
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2128
|
-
server_url: Optional[str] = None,
|
|
2129
|
-
timeout_ms: Optional[int] = None,
|
|
2130
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2131
|
-
) -> models.TxResponse:
|
|
2132
|
-
r"""Remove Liquidity
|
|
2133
|
-
|
|
2134
|
-
Remove liquidity from a Pendle Market.
|
|
2135
|
-
|
|
2136
|
-
Liquidity is removed in the form of the market's Liquidity Provider Token (LP) into
|
|
2137
|
-
the market's Underlying Token. An appropriate allowance for the Pendle Router on the
|
|
2138
|
-
market contract must be set beforehand
|
|
2139
|
-
<Info>
|
|
2140
|
-
**Required Allowances**
|
|
2141
|
-
|
|
2142
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
2143
|
-
|
|
2144
|
-
- `PendleRouter`
|
|
2145
|
-
</Info>
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
:param market_address: The address identifying which Pendle Market you would like to remove liquidity from.
|
|
2149
|
-
:param amount: The amount of liquidity you would like to remove from the market denominated in the market's Liquidity Provider Token (LP).
|
|
2150
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2151
|
-
:param chain: The chain to use.
|
|
2152
|
-
:param sender: The address of the transaction sender.
|
|
2153
|
-
:param retries: Override the default retry configuration for this method
|
|
2154
|
-
:param server_url: Override the default server URL for this method
|
|
2155
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2156
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2157
|
-
"""
|
|
2158
|
-
base_url = None
|
|
2159
|
-
url_variables = None
|
|
2160
|
-
if timeout_ms is None:
|
|
2161
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2162
|
-
|
|
2163
|
-
if server_url is not None:
|
|
2164
|
-
base_url = server_url
|
|
2165
|
-
else:
|
|
2166
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2167
|
-
|
|
2168
|
-
request = models.PendleRemoveLiquidityRequest(
|
|
2169
|
-
market_address=market_address,
|
|
2170
|
-
amount=amount,
|
|
2171
|
-
max_slippage_percent=max_slippage_percent,
|
|
2172
|
-
chain=chain,
|
|
2173
|
-
sender=sender,
|
|
2174
|
-
)
|
|
2175
|
-
|
|
2176
|
-
req = self._build_request(
|
|
2177
|
-
method="POST",
|
|
2178
|
-
path="/v0/pendle/remove_liquidity",
|
|
2179
|
-
base_url=base_url,
|
|
2180
|
-
url_variables=url_variables,
|
|
2181
|
-
request=request,
|
|
2182
|
-
request_body_required=True,
|
|
2183
|
-
request_has_path_params=False,
|
|
2184
|
-
request_has_query_params=True,
|
|
2185
|
-
user_agent_header="user-agent",
|
|
2186
|
-
accept_header_value="application/json",
|
|
2187
|
-
http_headers=http_headers,
|
|
2188
|
-
security=self.sdk_configuration.security,
|
|
2189
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2190
|
-
request, False, False, "json", models.PendleRemoveLiquidityRequest
|
|
2191
|
-
),
|
|
2192
|
-
timeout_ms=timeout_ms,
|
|
2193
|
-
)
|
|
2194
|
-
|
|
2195
|
-
if retries == UNSET:
|
|
2196
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2197
|
-
retries = self.sdk_configuration.retry_config
|
|
2198
|
-
|
|
2199
|
-
retry_config = None
|
|
2200
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2201
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2202
|
-
|
|
2203
|
-
http_res = self.do_request(
|
|
2204
|
-
hook_ctx=HookContext(
|
|
2205
|
-
config=self.sdk_configuration,
|
|
2206
|
-
base_url=base_url or "",
|
|
2207
|
-
operation_id="pendle_remove_liquidity",
|
|
2208
|
-
oauth2_scopes=[],
|
|
2209
|
-
security_source=self.sdk_configuration.security,
|
|
2210
|
-
),
|
|
2211
|
-
request=req,
|
|
2212
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2213
|
-
retry_config=retry_config,
|
|
2214
|
-
)
|
|
2215
|
-
|
|
2216
|
-
response_data: Any = None
|
|
2217
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2218
|
-
return unmarshal_json_response(models.TxResponse, http_res)
|
|
2219
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2220
|
-
response_data = unmarshal_json_response(
|
|
2221
|
-
errors.HTTPValidationErrorData, http_res
|
|
2222
|
-
)
|
|
2223
|
-
raise errors.HTTPValidationError(response_data, http_res)
|
|
2224
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2225
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2226
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2227
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2228
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2229
|
-
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2230
|
-
|
|
2231
|
-
raise errors.APIError("Unexpected response received", http_res)
|
|
2232
|
-
|
|
2233
|
-
async def remove_liquidity_async(
|
|
2234
|
-
self,
|
|
2235
|
-
*,
|
|
2236
|
-
market_address: str,
|
|
2237
|
-
amount: Union[
|
|
2238
|
-
models.PendleRemoveLiquidityRequestAmount,
|
|
2239
|
-
models.PendleRemoveLiquidityRequestAmountTypedDict,
|
|
2240
|
-
],
|
|
2241
|
-
max_slippage_percent: float,
|
|
2242
|
-
chain: models.Chain,
|
|
2243
|
-
sender: str,
|
|
2244
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2245
|
-
server_url: Optional[str] = None,
|
|
2246
|
-
timeout_ms: Optional[int] = None,
|
|
2247
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2248
|
-
) -> models.TxResponse:
|
|
2249
|
-
r"""Remove Liquidity
|
|
2250
|
-
|
|
2251
|
-
Remove liquidity from a Pendle Market.
|
|
2252
|
-
|
|
2253
|
-
Liquidity is removed in the form of the market's Liquidity Provider Token (LP) into
|
|
2254
|
-
the market's Underlying Token. An appropriate allowance for the Pendle Router on the
|
|
2255
|
-
market contract must be set beforehand
|
|
2256
|
-
<Info>
|
|
2257
|
-
**Required Allowances**
|
|
2258
|
-
|
|
2259
|
-
In order to make this transaction, token allowances need to be set on the following contracts.
|
|
2260
|
-
|
|
2261
|
-
- `PendleRouter`
|
|
2262
|
-
</Info>
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
:param market_address: The address identifying which Pendle Market you would like to remove liquidity from.
|
|
2266
|
-
:param amount: The amount of liquidity you would like to remove from the market denominated in the market's Liquidity Provider Token (LP).
|
|
2267
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2268
|
-
:param chain: The chain to use.
|
|
2269
|
-
:param sender: The address of the transaction sender.
|
|
2270
|
-
:param retries: Override the default retry configuration for this method
|
|
2271
|
-
:param server_url: Override the default server URL for this method
|
|
2272
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2273
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2274
|
-
"""
|
|
2275
|
-
base_url = None
|
|
2276
|
-
url_variables = None
|
|
2277
|
-
if timeout_ms is None:
|
|
2278
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2279
|
-
|
|
2280
|
-
if server_url is not None:
|
|
2281
|
-
base_url = server_url
|
|
2282
|
-
else:
|
|
2283
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2284
|
-
|
|
2285
|
-
request = models.PendleRemoveLiquidityRequest(
|
|
2286
|
-
market_address=market_address,
|
|
2287
|
-
amount=amount,
|
|
2288
|
-
max_slippage_percent=max_slippage_percent,
|
|
2289
1511
|
chain=chain,
|
|
2290
1512
|
sender=sender,
|
|
2291
1513
|
)
|
|
2292
1514
|
|
|
2293
1515
|
req = self._build_request_async(
|
|
2294
1516
|
method="POST",
|
|
2295
|
-
path="/
|
|
1517
|
+
path="/v1/pendle/redeem_yield",
|
|
2296
1518
|
base_url=base_url,
|
|
2297
1519
|
url_variables=url_variables,
|
|
2298
1520
|
request=request,
|
|
@@ -2304,7 +1526,11 @@ class Pendle(BaseSDK):
|
|
|
2304
1526
|
http_headers=http_headers,
|
|
2305
1527
|
security=self.sdk_configuration.security,
|
|
2306
1528
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2307
|
-
request,
|
|
1529
|
+
request,
|
|
1530
|
+
False,
|
|
1531
|
+
False,
|
|
1532
|
+
"json",
|
|
1533
|
+
models.CompassAPIBackendModelsPendleTransactRequestRedeemYieldPendleRedeemYieldRequest,
|
|
2308
1534
|
),
|
|
2309
1535
|
timeout_ms=timeout_ms,
|
|
2310
1536
|
)
|
|
@@ -2321,7 +1547,7 @@ class Pendle(BaseSDK):
|
|
|
2321
1547
|
hook_ctx=HookContext(
|
|
2322
1548
|
config=self.sdk_configuration,
|
|
2323
1549
|
base_url=base_url or "",
|
|
2324
|
-
operation_id="
|
|
1550
|
+
operation_id="v1_pendle_redeem_yield",
|
|
2325
1551
|
oauth2_scopes=[],
|
|
2326
1552
|
security_source=self.sdk_configuration.security,
|
|
2327
1553
|
),
|
|
@@ -2332,7 +1558,7 @@ class Pendle(BaseSDK):
|
|
|
2332
1558
|
|
|
2333
1559
|
response_data: Any = None
|
|
2334
1560
|
if utils.match_response(http_res, "200", "application/json"):
|
|
2335
|
-
return unmarshal_json_response(models.
|
|
1561
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
2336
1562
|
if utils.match_response(http_res, "422", "application/json"):
|
|
2337
1563
|
response_data = unmarshal_json_response(
|
|
2338
1564
|
errors.HTTPValidationErrorData, http_res
|