compass_api_sdk 0.9.35__py3-none-any.whl → 2.0.21rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- compass_api_sdk/_hooks/sdkhooks.py +4 -4
- compass_api_sdk/_hooks/types.py +1 -2
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/aave_v3.py +971 -728
- compass_api_sdk/aerodrome_slipstream.py +367 -390
- compass_api_sdk/basesdk.py +21 -5
- compass_api_sdk/bridge.py +536 -0
- compass_api_sdk/earn.py +1780 -0
- compass_api_sdk/erc_4626_vaults.py +127 -154
- compass_api_sdk/errors/__init__.py +38 -4
- compass_api_sdk/errors/apierror.py +32 -14
- compass_api_sdk/errors/compassapierror.py +30 -0
- compass_api_sdk/errors/httpvalidationerror.py +15 -8
- compass_api_sdk/errors/mintpreparenotfoundresponse_error.py +49 -0
- compass_api_sdk/errors/no_response_error.py +17 -0
- compass_api_sdk/errors/responsevalidationerror.py +27 -0
- compass_api_sdk/{token_sdk.py → ethena.py} +318 -293
- compass_api_sdk/gas_sponsorship.py +446 -0
- compass_api_sdk/httpclient.py +0 -1
- compass_api_sdk/models/__init__.py +1701 -945
- compass_api_sdk/models/aaveborrowparams.py +4 -13
- compass_api_sdk/models/aaveborrowrequest.py +19 -19
- compass_api_sdk/models/aavehistoricaltransactionsresponse.py +8 -8
- compass_api_sdk/models/aavelooprequest.py +88 -36
- compass_api_sdk/models/aaveposition.py +49 -0
- compass_api_sdk/models/aaverepayparams.py +4 -13
- compass_api_sdk/models/aaverepayrequest.py +19 -19
- compass_api_sdk/models/aavereserveoverviewresponse.py +34 -3
- compass_api_sdk/models/aavesetuseremodeparams.py +28 -0
- compass_api_sdk/models/aavesetuseremoderequest.py +48 -0
- compass_api_sdk/models/aavesupplyparams.py +4 -13
- compass_api_sdk/models/aavesupplyrequest.py +19 -19
- compass_api_sdk/models/aavesupportedtokenmetadata.py +30 -0
- compass_api_sdk/models/aavesupportedtokensresponse.py +20 -0
- compass_api_sdk/models/aavevenue.py +27 -0
- compass_api_sdk/models/aavewithdrawparams.py +4 -13
- compass_api_sdk/models/aavewithdrawrequest.py +19 -19
- compass_api_sdk/models/aerodromeenrichedposition.py +109 -0
- compass_api_sdk/models/aerodromelppositionsresponse.py +10 -7
- compass_api_sdk/models/aerodromeslipstreambuyexactlyparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +21 -31
- compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +13 -6
- compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionrequest.py +21 -31
- compass_api_sdk/models/aerodromeslipstreampoolpriceresponse.py +8 -25
- compass_api_sdk/models/aerodromeslipstreamsellexactlyparams.py +8 -25
- compass_api_sdk/models/aerodromeslipstreamsellexactlyrequest.py +20 -30
- compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +13 -6
- compass_api_sdk/models/approvetransferrequest.py +32 -0
- compass_api_sdk/models/{curator.py → approvetransferresponse.py} +12 -13
- compass_api_sdk/models/apy.py +3 -0
- compass_api_sdk/models/batchedsafeoperationsresponse_input.py +52 -0
- compass_api_sdk/models/batchedsafeoperationsresponse_output.py +52 -0
- compass_api_sdk/models/batcheduseroperationsrequest.py +24 -9
- compass_api_sdk/models/bundlertransactionresponse.py +17 -0
- compass_api_sdk/models/chain.py +3 -3
- compass_api_sdk/models/chainmarketinfo.py +29 -0
- compass_api_sdk/models/{compass_api_backend_models_generic_read_response_portfolio_tokenbalance.py → compass_api_backend_v1_models_generic_read_response_portfolio_tokenbalance.py} +6 -15
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_apydata.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_apydata.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_asset.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_asset.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_marketstate.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_marketstate.py} +4 -2
- compass_api_sdk/models/compass_api_backend_v1_models_morpho_read_response_check_user_position_vaultposition.py +30 -0
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_check_user_position_vaultstate.py → compass_api_backend_v1_models_morpho_read_response_check_user_position_vaultstate.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_apydata.py → compass_api_backend_v1_models_morpho_read_response_get_market_apydata.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vault_asset.py → compass_api_backend_v1_models_morpho_read_response_get_market_asset.py} +5 -5
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_marketstate.py → compass_api_backend_v1_models_morpho_read_response_get_market_marketstate.py} +4 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_markets_asset.py → compass_api_backend_v1_models_morpho_read_response_get_markets_asset.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_markets_marketstate.py → compass_api_backend_v1_models_morpho_read_response_get_markets_marketstate.py} +2 -2
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vaults_asset.py → compass_api_backend_v1_models_morpho_read_response_get_vaults_asset.py} +2 -2
- compass_api_sdk/models/compass_api_backend_v1_models_morpho_read_response_get_vaults_vaultstate.py +73 -0
- compass_api_sdk/models/compass_api_backend_v1_models_pendle_read_response_market_userposition.py +82 -0
- compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_positions_tokenbalance.py → compass_api_backend_v1_models_pendle_read_response_positions_tokenbalance.py} +2 -2
- compass_api_sdk/models/compass_api_backend_v1_models_vaults_read_response_vault_userposition.py +20 -0
- compass_api_sdk/models/compass_api_backend_v1_models_wildcat_read_response_market_userposition.py +22 -0
- compass_api_sdk/models/compass_api_backend_v2_models_earn_read_response_positions_vaultposition.py +49 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712domain.py +36 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712types.py +36 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712domain.py +37 -0
- compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712types.py +32 -0
- compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712domain.py +29 -0
- compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712types.py +34 -0
- compass_api_sdk/models/cooldownposition.py +35 -0
- compass_api_sdk/models/createaccountrequest.py +40 -0
- compass_api_sdk/models/createaccountresponse.py +56 -0
- compass_api_sdk/models/depositforburnrequest.py +77 -0
- compass_api_sdk/models/depositforburnresponse.py +100 -0
- compass_api_sdk/models/details.py +44 -7
- compass_api_sdk/models/earnmanageparams.py +74 -0
- compass_api_sdk/models/earnmanagerequest.py +130 -0
- compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_asset.py → earnmanageresponse.py} +13 -21
- compass_api_sdk/models/earnpositionsresponse.py +39 -0
- compass_api_sdk/models/earnswapparams.py +74 -0
- compass_api_sdk/models/earnswaprequest.py +90 -0
- compass_api_sdk/models/earnswapresponse.py +55 -0
- compass_api_sdk/models/earntransferrequest.py +104 -0
- compass_api_sdk/models/earntransferresponse.py +71 -0
- compass_api_sdk/models/eip712domainfield.py +20 -0
- compass_api_sdk/models/eip712field.py +20 -0
- compass_api_sdk/models/ethenadepositparams.py +82 -0
- compass_api_sdk/models/ethenadepositrequest.py +100 -0
- compass_api_sdk/models/ethenagetvaultresponse.py +109 -0
- compass_api_sdk/models/ethenarequesttowithdrawparams.py +28 -0
- compass_api_sdk/models/ethenarequesttowithdrawrequest.py +46 -0
- compass_api_sdk/models/ethenarequesttowithdrawtransactionresponse.py +37 -0
- compass_api_sdk/models/ethenaunstakeparams.py +65 -0
- compass_api_sdk/models/ethenaunstakerequest.py +83 -0
- compass_api_sdk/models/fee.py +42 -0
- compass_api_sdk/models/listaavemarketsresponse.py +21 -0
- compass_api_sdk/models/marketposition.py +5 -5
- compass_api_sdk/models/maxsupplyapyinfo.py +34 -0
- compass_api_sdk/models/mintpreparecompletedresponse.py +46 -0
- compass_api_sdk/models/mintpreparependingresponse.py +65 -0
- compass_api_sdk/models/mintpreparereadyresponse.py +43 -0
- compass_api_sdk/models/mintpreparerequest.py +25 -0
- compass_api_sdk/models/morphoborrowrequest.py +9 -3
- compass_api_sdk/models/morphocheckuserpositionresponse.py +9 -3
- compass_api_sdk/models/morphodepositrequest.py +9 -3
- compass_api_sdk/models/morphogetmarketresponse.py +72 -31
- compass_api_sdk/models/morphomarket.py +26 -20
- compass_api_sdk/models/morphorepayrequest.py +14 -3
- compass_api_sdk/models/morphosupplycollateralrequest.py +14 -3
- compass_api_sdk/models/morphovault.py +10 -10
- compass_api_sdk/models/morphowithdrawcollateralrequest.py +9 -3
- compass_api_sdk/models/morphowithdrawrequest.py +9 -3
- compass_api_sdk/models/movement10percent.py +65 -10
- compass_api_sdk/models/multicallauthorizationrequest.py +9 -9
- compass_api_sdk/models/multicallexecuterequest.py +59 -11
- compass_api_sdk/models/odosswapparams.py +52 -0
- compass_api_sdk/models/odosswaprequest.py +72 -0
- compass_api_sdk/models/odostransactionresponse.py +37 -0
- compass_api_sdk/models/oneinchswapparams.py +59 -0
- compass_api_sdk/models/openposition.py +7 -7
- compass_api_sdk/models/operationtype.py +11 -0
- compass_api_sdk/models/pendlegetmarketresponse.py +52 -2
- compass_api_sdk/models/pendlemanageliquidityparams.py +68 -0
- compass_api_sdk/models/pendlemanageliquidityrequest.py +87 -0
- compass_api_sdk/models/pendleredeemyieldrequest.py +15 -6
- compass_api_sdk/models/pendletradeptparams.py +68 -0
- compass_api_sdk/models/pendletradeptrequest.py +87 -0
- compass_api_sdk/models/pendletradeytparams.py +68 -0
- compass_api_sdk/models/pendletradeytrequest.py +87 -0
- compass_api_sdk/models/pendletxresponse.py +36 -0
- compass_api_sdk/models/permit2typeddata_input.py +46 -0
- compass_api_sdk/models/permit2typeddata_output.py +46 -0
- compass_api_sdk/models/permitfield.py +20 -0
- compass_api_sdk/models/permitmessage.py +39 -0
- compass_api_sdk/models/permittransferfrommessage.py +29 -0
- compass_api_sdk/models/permittypeddataresponse_input.py +50 -0
- compass_api_sdk/models/permittypeddataresponse_output.py +50 -0
- compass_api_sdk/models/portfolio.py +5 -5
- compass_api_sdk/models/protocol.py +13 -0
- compass_api_sdk/models/reserve.py +6 -15
- compass_api_sdk/models/safetransactionparams.py +78 -0
- compass_api_sdk/models/safetransactionresponse.py +28 -0
- compass_api_sdk/models/safetxfield.py +20 -0
- compass_api_sdk/models/safetxmessage.py +66 -0
- compass_api_sdk/models/setallowanceparams.py +5 -16
- compass_api_sdk/models/setallowancerequest.py +19 -22
- compass_api_sdk/models/skybuyrequest.py +12 -9
- compass_api_sdk/models/skydepositrequest.py +13 -9
- compass_api_sdk/models/skysellrequest.py +12 -9
- compass_api_sdk/models/skywithdrawrequest.py +13 -9
- compass_api_sdk/models/sponsorgasrequest.py +71 -0
- compass_api_sdk/models/sponsorgasresponse.py +14 -0
- compass_api_sdk/models/supportedchaininfo.py +19 -0
- compass_api_sdk/models/tokenbalanceresponse.py +5 -15
- compass_api_sdk/models/tokenconfig.py +30 -0
- compass_api_sdk/models/tokenlistresponse.py +21 -0
- compass_api_sdk/models/tokenmarketdata.py +27 -0
- compass_api_sdk/models/tokenpermissions.py +20 -0
- compass_api_sdk/models/tokentransferparams.py +54 -0
- compass_api_sdk/models/tokentransferrequest.py +23 -27
- compass_api_sdk/models/transactionresponse.py +31 -0
- compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_asset.py → underlyingtoken.py} +2 -2
- compass_api_sdk/models/uniswapbuyexactlyparams.py +19 -41
- compass_api_sdk/models/uniswapbuyexactlyrequest.py +31 -44
- compass_api_sdk/models/uniswapbuyexactlytransactionresponse.py +37 -0
- compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +15 -6
- compass_api_sdk/models/uniswapmintliquidityprovisionparams.py +8 -25
- compass_api_sdk/models/uniswapmintliquidityprovisionrequest.py +23 -31
- compass_api_sdk/models/uniswappoolpriceresponse.py +8 -25
- compass_api_sdk/models/uniswappositionssolidityresponse.py +42 -2
- compass_api_sdk/models/uniswapsellexactlyparams.py +19 -41
- compass_api_sdk/models/uniswapsellexactlyrequest.py +31 -44
- compass_api_sdk/models/uniswapsellexactlytransactionresponse.py +37 -0
- compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +15 -6
- compass_api_sdk/models/unsignedmulticalltransaction.py +44 -13
- compass_api_sdk/models/unsignedtransaction.py +44 -13
- compass_api_sdk/models/unwrapwethrequest.py +15 -6
- compass_api_sdk/models/useroperation.py +61 -49
- compass_api_sdk/models/useroperationresponse.py +2 -2
- compass_api_sdk/models/userstate.py +3 -3
- compass_api_sdk/models/v1_aave_aave_supported_tokensop.py +69 -0
- compass_api_sdk/models/v1_aave_avg_rateop.py +83 -0
- compass_api_sdk/models/{aave_historical_transactionsop.py → v1_aave_historical_transactionsop.py} +21 -25
- compass_api_sdk/models/v1_aave_liquidity_changeop.py +45 -0
- compass_api_sdk/models/{pendle_marketop.py → v1_aave_rateop.py} +16 -20
- compass_api_sdk/models/v1_aave_reserve_overviewop.py +76 -0
- compass_api_sdk/models/v1_aave_std_rateop.py +83 -0
- compass_api_sdk/models/v1_aave_token_priceop.py +76 -0
- compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +83 -0
- compass_api_sdk/models/{aave_user_position_summaryop.py → v1_aave_user_position_summaryop.py} +16 -20
- compass_api_sdk/models/v1_aerodrome_slipstream_liquidity_provision_positionsop.py +76 -0
- compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +45 -0
- compass_api_sdk/models/v1_ethena_vaultop.py +75 -0
- compass_api_sdk/models/{generic_allowanceop.py → v1_generic_allowanceop.py} +28 -41
- compass_api_sdk/models/{generic_ensop.py → v1_generic_ensop.py} +8 -14
- compass_api_sdk/models/{generic_portfolioop.py → v1_generic_portfolioop.py} +10 -14
- compass_api_sdk/models/v1_generic_supported_chainsop.py +57 -0
- compass_api_sdk/models/{morpho_market_positionop.py → v1_morpho_market_positionop.py} +11 -10
- compass_api_sdk/models/{morpho_marketop.py → v1_morpho_marketop.py} +10 -9
- compass_api_sdk/models/{morpho_marketsop.py → v1_morpho_marketsop.py} +13 -12
- compass_api_sdk/models/{morpho_user_positionop.py → v1_morpho_user_positionop.py} +10 -9
- compass_api_sdk/models/{vaults_vaultop.py → v1_morpho_vaultop.py} +16 -20
- compass_api_sdk/models/{morpho_vaultsop.py → v1_morpho_vaultsop.py} +11 -10
- compass_api_sdk/models/{pendle_positionop.py → v1_pendle_marketop.py} +24 -27
- 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/v1_sky_positionop.py +29 -0
- compass_api_sdk/models/v1_token_balanceop.py +38 -0
- compass_api_sdk/models/v1_token_listop.py +24 -0
- compass_api_sdk/models/v1_token_priceop.py +76 -0
- compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +27 -0
- compass_api_sdk/models/{uniswap_liquidity_provision_in_rangeop.py → v1_uniswap_liquidity_provision_in_rangeop.py} +10 -14
- compass_api_sdk/models/{uniswap_liquidity_provision_positionsop.py → v1_uniswap_liquidity_provision_positionsop.py} +10 -14
- compass_api_sdk/models/v1_uniswap_pool_priceop.py +58 -0
- compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +79 -0
- compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +79 -0
- compass_api_sdk/models/v1_vaults_vaultop.py +84 -0
- compass_api_sdk/models/v1_wildcat_marketop.py +82 -0
- compass_api_sdk/models/v2_cctp_mintop.py +47 -0
- compass_api_sdk/models/v2_earn_aave_marketsop.py +57 -0
- compass_api_sdk/models/v2_earn_positionsop.py +56 -0
- compass_api_sdk/models/v2_earn_vaultsop.py +105 -0
- compass_api_sdk/models/v2bundlerequest.py +33 -0
- compass_api_sdk/models/v2bundleresponse.py +67 -0
- compass_api_sdk/models/v2useroperation.py +37 -0
- compass_api_sdk/models/vault.py +14 -14
- compass_api_sdk/models/vaultdepositparams.py +85 -0
- compass_api_sdk/models/vaultdepositrequest.py +15 -6
- compass_api_sdk/models/vaultgetvaultresponse.py +21 -11
- compass_api_sdk/models/vaultinfo.py +129 -0
- compass_api_sdk/models/vaultsresponse.py +30 -0
- compass_api_sdk/models/vaultvenue.py +27 -0
- compass_api_sdk/models/vaultwithdrawparams.py +75 -0
- compass_api_sdk/models/vaultwithdrawrequest.py +15 -6
- compass_api_sdk/models/wildcatgetmarketresponse.py +151 -0
- compass_api_sdk/models/{redeemunderlying.py → withdraw.py} +2 -2
- compass_api_sdk/models/wrapethrequest.py +15 -6
- compass_api_sdk/morpho.py +481 -816
- compass_api_sdk/pendle.py +495 -1384
- compass_api_sdk/sdk.py +39 -13
- compass_api_sdk/sky.py +275 -240
- compass_api_sdk/smart_account.py +37 -50
- compass_api_sdk/swap.py +248 -0
- compass_api_sdk/token.py +1192 -0
- compass_api_sdk/transaction_bundler.py +151 -184
- compass_api_sdk/uniswap_v3.py +531 -620
- compass_api_sdk/universal.py +181 -932
- compass_api_sdk/utils/__init__.py +18 -5
- compass_api_sdk/utils/annotations.py +32 -8
- compass_api_sdk/utils/eventstreaming.py +10 -0
- compass_api_sdk/utils/forms.py +21 -10
- compass_api_sdk/utils/queryparams.py +14 -2
- compass_api_sdk/utils/retries.py +69 -5
- compass_api_sdk/utils/serializers.py +3 -2
- compass_api_sdk/utils/unmarshal_json_response.py +38 -0
- compass_api_sdk/wildcat.py +208 -0
- compass_api_sdk-2.0.21rc1.dist-info/METADATA +623 -0
- compass_api_sdk-2.0.21rc1.dist-info/RECORD +346 -0
- {compass_api_sdk-0.9.35.dist-info → compass_api_sdk-2.0.21rc1.dist-info}/WHEEL +1 -1
- compass_api_sdk/models/aave_avg_rateop.py +0 -141
- compass_api_sdk/models/aave_liquidity_changeop.py +0 -103
- compass_api_sdk/models/aave_rateop.py +0 -134
- compass_api_sdk/models/aave_reserve_overviewop.py +0 -134
- compass_api_sdk/models/aave_std_rateop.py +0 -141
- compass_api_sdk/models/aave_token_priceop.py +0 -134
- compass_api_sdk/models/aave_user_position_per_tokenop.py +0 -141
- compass_api_sdk/models/aerodrome_slipstream_liquidity_provision_positionsop.py +0 -37
- compass_api_sdk/models/aerodrome_slipstream_pool_priceop.py +0 -159
- compass_api_sdk/models/aerodromeposition.py +0 -70
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vault_vaultstate.py +0 -53
- compass_api_sdk/models/compass_api_backend_models_morpho_read_response_get_vaults_vaultstate.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/liquidity.py +0 -16
- compass_api_sdk/models/metadata.py +0 -50
- compass_api_sdk/models/morpho_vault_positionop.py +0 -37
- compass_api_sdk/models/morpho_vaultop.py +0 -30
- compass_api_sdk/models/morphocheckvaultpositionresponse.py +0 -20
- compass_api_sdk/models/morphogetvaultresponse.py +0 -86
- compass_api_sdk/models/pendle_marketsop.py +0 -28
- 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/pendlegetuserpositionresponse.py +0 -56
- 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/sky_positionop.py +0 -31
- compass_api_sdk/models/token_addressop.py +0 -89
- compass_api_sdk/models/token_balanceop.py +0 -55
- compass_api_sdk/models/token_enum.py +0 -57
- compass_api_sdk/models/token_priceop.py +0 -89
- compass_api_sdk/models/tokenaddressresponse.py +0 -15
- compass_api_sdk/models/tokeninfo.py +0 -17
- compass_api_sdk/models/tokentransfererc20params.py +0 -63
- compass_api_sdk/models/txresponse.py +0 -27
- compass_api_sdk/models/uniswap_pool_priceop.py +0 -170
- compass_api_sdk/models/uniswap_quote_buy_exactlyop.py +0 -191
- compass_api_sdk/models/uniswap_quote_sell_exactlyop.py +0 -191
- compass_api_sdk/models/userposition.py +0 -16
- compass_api_sdk/models/vaultposition.py +0 -24
- compass_api_sdk-0.9.35.dist-info/METADATA +0 -558
- compass_api_sdk-0.9.35.dist-info/RECORD +0 -260
compass_api_sdk/pendle.py
CHANGED
|
@@ -4,30 +4,33 @@ from .basesdk import BaseSDK
|
|
|
4
4
|
from compass_api_sdk import errors, models, utils
|
|
5
5
|
from compass_api_sdk._hooks import HookContext
|
|
6
6
|
from compass_api_sdk.types import OptionalNullable, UNSET
|
|
7
|
+
from compass_api_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
7
8
|
from typing import Any, Mapping, Optional, Union
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Pendle(BaseSDK):
|
|
11
|
-
def
|
|
12
|
+
def pendle_market(
|
|
12
13
|
self,
|
|
13
14
|
*,
|
|
14
|
-
chain: models.
|
|
15
|
-
|
|
16
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
15
|
+
chain: models.V1PendleMarketChain,
|
|
16
|
+
market_address: str,
|
|
17
17
|
block: OptionalNullable[int] = UNSET,
|
|
18
|
+
user_address: OptionalNullable[str] = UNSET,
|
|
18
19
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
19
20
|
server_url: Optional[str] = None,
|
|
20
21
|
timeout_ms: Optional[int] = None,
|
|
21
22
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
22
|
-
) -> models.
|
|
23
|
-
r"""
|
|
23
|
+
) -> models.PendleGetMarketResponse:
|
|
24
|
+
r"""Get Market & User Position
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
Get the market's implied APY, maturity date and the associated token data.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
The user position is only included if 'user_address' parameter is included.
|
|
29
|
+
|
|
30
|
+
:param chain:
|
|
29
31
|
:param market_address: The market address of the desired position.
|
|
30
32
|
:param block: Optional block number (defaults to latest).
|
|
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`.
|
|
31
34
|
:param retries: Override the default retry configuration for this method
|
|
32
35
|
:param server_url: Override the default server URL for this method
|
|
33
36
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -43,16 +46,16 @@ class Pendle(BaseSDK):
|
|
|
43
46
|
else:
|
|
44
47
|
base_url = self._get_url(base_url, url_variables)
|
|
45
48
|
|
|
46
|
-
request = models.
|
|
49
|
+
request = models.V1PendleMarketRequest(
|
|
47
50
|
chain=chain,
|
|
48
51
|
block=block,
|
|
49
|
-
user_address=user_address,
|
|
50
52
|
market_address=market_address,
|
|
53
|
+
user_address=user_address,
|
|
51
54
|
)
|
|
52
55
|
|
|
53
56
|
req = self._build_request(
|
|
54
57
|
method="GET",
|
|
55
|
-
path="/
|
|
58
|
+
path="/v1/pendle/market",
|
|
56
59
|
base_url=base_url,
|
|
57
60
|
url_variables=url_variables,
|
|
58
61
|
request=request,
|
|
@@ -63,6 +66,7 @@ class Pendle(BaseSDK):
|
|
|
63
66
|
accept_header_value="application/json",
|
|
64
67
|
http_headers=http_headers,
|
|
65
68
|
security=self.sdk_configuration.security,
|
|
69
|
+
allow_empty_value=None,
|
|
66
70
|
timeout_ms=timeout_ms,
|
|
67
71
|
)
|
|
68
72
|
|
|
@@ -78,8 +82,8 @@ class Pendle(BaseSDK):
|
|
|
78
82
|
hook_ctx=HookContext(
|
|
79
83
|
config=self.sdk_configuration,
|
|
80
84
|
base_url=base_url or "",
|
|
81
|
-
operation_id="
|
|
82
|
-
oauth2_scopes=
|
|
85
|
+
operation_id="v1_pendle_market",
|
|
86
|
+
oauth2_scopes=None,
|
|
83
87
|
security_source=self.sdk_configuration.security,
|
|
84
88
|
),
|
|
85
89
|
request=req,
|
|
@@ -89,54 +93,43 @@ class Pendle(BaseSDK):
|
|
|
89
93
|
|
|
90
94
|
response_data: Any = None
|
|
91
95
|
if utils.match_response(http_res, "200", "application/json"):
|
|
92
|
-
return
|
|
93
|
-
http_res.text, models.PendleGetUserPositionResponse
|
|
94
|
-
)
|
|
96
|
+
return unmarshal_json_response(models.PendleGetMarketResponse, http_res)
|
|
95
97
|
if utils.match_response(http_res, "422", "application/json"):
|
|
96
|
-
response_data =
|
|
97
|
-
|
|
98
|
+
response_data = unmarshal_json_response(
|
|
99
|
+
errors.HTTPValidationErrorData, http_res
|
|
98
100
|
)
|
|
99
|
-
raise errors.HTTPValidationError(
|
|
101
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
100
102
|
if utils.match_response(http_res, "4XX", "*"):
|
|
101
103
|
http_res_text = utils.stream_to_text(http_res)
|
|
102
|
-
raise errors.APIError(
|
|
103
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
104
|
-
)
|
|
104
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
105
105
|
if utils.match_response(http_res, "5XX", "*"):
|
|
106
106
|
http_res_text = utils.stream_to_text(http_res)
|
|
107
|
-
raise errors.APIError(
|
|
108
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
109
|
-
)
|
|
107
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
110
108
|
|
|
111
|
-
|
|
112
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
113
|
-
raise errors.APIError(
|
|
114
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
115
|
-
http_res.status_code,
|
|
116
|
-
http_res_text,
|
|
117
|
-
http_res,
|
|
118
|
-
)
|
|
109
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
119
110
|
|
|
120
|
-
async def
|
|
111
|
+
async def pendle_market_async(
|
|
121
112
|
self,
|
|
122
113
|
*,
|
|
123
|
-
chain: models.
|
|
124
|
-
|
|
125
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
114
|
+
chain: models.V1PendleMarketChain,
|
|
115
|
+
market_address: str,
|
|
126
116
|
block: OptionalNullable[int] = UNSET,
|
|
117
|
+
user_address: OptionalNullable[str] = UNSET,
|
|
127
118
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
128
119
|
server_url: Optional[str] = None,
|
|
129
120
|
timeout_ms: Optional[int] = None,
|
|
130
121
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
131
|
-
) -> models.
|
|
132
|
-
r"""
|
|
122
|
+
) -> models.PendleGetMarketResponse:
|
|
123
|
+
r"""Get Market & User Position
|
|
124
|
+
|
|
125
|
+
Get the market's implied APY, maturity date and the associated token data.
|
|
133
126
|
|
|
134
|
-
|
|
127
|
+
The user position is only included if 'user_address' parameter is included.
|
|
135
128
|
|
|
136
|
-
:param chain:
|
|
137
|
-
:param user_address: The user address of the desired position.
|
|
129
|
+
:param chain:
|
|
138
130
|
:param market_address: The market address of the desired position.
|
|
139
131
|
:param block: Optional block number (defaults to latest).
|
|
132
|
+
: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`.
|
|
140
133
|
:param retries: Override the default retry configuration for this method
|
|
141
134
|
:param server_url: Override the default server URL for this method
|
|
142
135
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -152,16 +145,16 @@ class Pendle(BaseSDK):
|
|
|
152
145
|
else:
|
|
153
146
|
base_url = self._get_url(base_url, url_variables)
|
|
154
147
|
|
|
155
|
-
request = models.
|
|
148
|
+
request = models.V1PendleMarketRequest(
|
|
156
149
|
chain=chain,
|
|
157
150
|
block=block,
|
|
158
|
-
user_address=user_address,
|
|
159
151
|
market_address=market_address,
|
|
152
|
+
user_address=user_address,
|
|
160
153
|
)
|
|
161
154
|
|
|
162
155
|
req = self._build_request_async(
|
|
163
156
|
method="GET",
|
|
164
|
-
path="/
|
|
157
|
+
path="/v1/pendle/market",
|
|
165
158
|
base_url=base_url,
|
|
166
159
|
url_variables=url_variables,
|
|
167
160
|
request=request,
|
|
@@ -172,6 +165,7 @@ class Pendle(BaseSDK):
|
|
|
172
165
|
accept_header_value="application/json",
|
|
173
166
|
http_headers=http_headers,
|
|
174
167
|
security=self.sdk_configuration.security,
|
|
168
|
+
allow_empty_value=None,
|
|
175
169
|
timeout_ms=timeout_ms,
|
|
176
170
|
)
|
|
177
171
|
|
|
@@ -187,8 +181,8 @@ class Pendle(BaseSDK):
|
|
|
187
181
|
hook_ctx=HookContext(
|
|
188
182
|
config=self.sdk_configuration,
|
|
189
183
|
base_url=base_url or "",
|
|
190
|
-
operation_id="
|
|
191
|
-
oauth2_scopes=
|
|
184
|
+
operation_id="v1_pendle_market",
|
|
185
|
+
oauth2_scopes=None,
|
|
192
186
|
security_source=self.sdk_configuration.security,
|
|
193
187
|
),
|
|
194
188
|
request=req,
|
|
@@ -198,39 +192,26 @@ class Pendle(BaseSDK):
|
|
|
198
192
|
|
|
199
193
|
response_data: Any = None
|
|
200
194
|
if utils.match_response(http_res, "200", "application/json"):
|
|
201
|
-
return
|
|
202
|
-
http_res.text, models.PendleGetUserPositionResponse
|
|
203
|
-
)
|
|
195
|
+
return unmarshal_json_response(models.PendleGetMarketResponse, http_res)
|
|
204
196
|
if utils.match_response(http_res, "422", "application/json"):
|
|
205
|
-
response_data =
|
|
206
|
-
|
|
197
|
+
response_data = unmarshal_json_response(
|
|
198
|
+
errors.HTTPValidationErrorData, http_res
|
|
207
199
|
)
|
|
208
|
-
raise errors.HTTPValidationError(
|
|
200
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
209
201
|
if utils.match_response(http_res, "4XX", "*"):
|
|
210
202
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
211
|
-
raise errors.APIError(
|
|
212
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
213
|
-
)
|
|
203
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
214
204
|
if utils.match_response(http_res, "5XX", "*"):
|
|
215
205
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
216
|
-
raise errors.APIError(
|
|
217
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
218
|
-
)
|
|
206
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
219
207
|
|
|
220
|
-
|
|
221
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
222
|
-
raise errors.APIError(
|
|
223
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
224
|
-
http_res.status_code,
|
|
225
|
-
http_res_text,
|
|
226
|
-
http_res,
|
|
227
|
-
)
|
|
208
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
228
209
|
|
|
229
|
-
def
|
|
210
|
+
def pendle_positions(
|
|
230
211
|
self,
|
|
231
212
|
*,
|
|
232
|
-
chain: models.
|
|
233
|
-
user_address: str
|
|
213
|
+
chain: models.V1PendlePositionsChain,
|
|
214
|
+
user_address: str,
|
|
234
215
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
235
216
|
server_url: Optional[str] = None,
|
|
236
217
|
timeout_ms: Optional[int] = None,
|
|
@@ -240,7 +221,7 @@ class Pendle(BaseSDK):
|
|
|
240
221
|
|
|
241
222
|
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
242
223
|
|
|
243
|
-
:param chain:
|
|
224
|
+
:param chain:
|
|
244
225
|
:param user_address: The user address of the desired position.
|
|
245
226
|
:param retries: Override the default retry configuration for this method
|
|
246
227
|
:param server_url: Override the default server URL for this method
|
|
@@ -257,14 +238,14 @@ class Pendle(BaseSDK):
|
|
|
257
238
|
else:
|
|
258
239
|
base_url = self._get_url(base_url, url_variables)
|
|
259
240
|
|
|
260
|
-
request = models.
|
|
241
|
+
request = models.V1PendlePositionsRequest(
|
|
261
242
|
chain=chain,
|
|
262
243
|
user_address=user_address,
|
|
263
244
|
)
|
|
264
245
|
|
|
265
246
|
req = self._build_request(
|
|
266
247
|
method="GET",
|
|
267
|
-
path="/
|
|
248
|
+
path="/v1/pendle/positions",
|
|
268
249
|
base_url=base_url,
|
|
269
250
|
url_variables=url_variables,
|
|
270
251
|
request=request,
|
|
@@ -275,6 +256,7 @@ class Pendle(BaseSDK):
|
|
|
275
256
|
accept_header_value="application/json",
|
|
276
257
|
http_headers=http_headers,
|
|
277
258
|
security=self.sdk_configuration.security,
|
|
259
|
+
allow_empty_value=None,
|
|
278
260
|
timeout_ms=timeout_ms,
|
|
279
261
|
)
|
|
280
262
|
|
|
@@ -290,8 +272,8 @@ class Pendle(BaseSDK):
|
|
|
290
272
|
hook_ctx=HookContext(
|
|
291
273
|
config=self.sdk_configuration,
|
|
292
274
|
base_url=base_url or "",
|
|
293
|
-
operation_id="
|
|
294
|
-
oauth2_scopes=
|
|
275
|
+
operation_id="v1_pendle_positions",
|
|
276
|
+
oauth2_scopes=None,
|
|
295
277
|
security_source=self.sdk_configuration.security,
|
|
296
278
|
),
|
|
297
279
|
request=req,
|
|
@@ -301,39 +283,28 @@ class Pendle(BaseSDK):
|
|
|
301
283
|
|
|
302
284
|
response_data: Any = None
|
|
303
285
|
if utils.match_response(http_res, "200", "application/json"):
|
|
304
|
-
return
|
|
305
|
-
|
|
286
|
+
return unmarshal_json_response(
|
|
287
|
+
models.PendleListUserPositionsResponse, http_res
|
|
306
288
|
)
|
|
307
289
|
if utils.match_response(http_res, "422", "application/json"):
|
|
308
|
-
response_data =
|
|
309
|
-
|
|
290
|
+
response_data = unmarshal_json_response(
|
|
291
|
+
errors.HTTPValidationErrorData, http_res
|
|
310
292
|
)
|
|
311
|
-
raise errors.HTTPValidationError(
|
|
293
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
312
294
|
if utils.match_response(http_res, "4XX", "*"):
|
|
313
295
|
http_res_text = utils.stream_to_text(http_res)
|
|
314
|
-
raise errors.APIError(
|
|
315
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
316
|
-
)
|
|
296
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
317
297
|
if utils.match_response(http_res, "5XX", "*"):
|
|
318
298
|
http_res_text = utils.stream_to_text(http_res)
|
|
319
|
-
raise errors.APIError(
|
|
320
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
321
|
-
)
|
|
299
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
322
300
|
|
|
323
|
-
|
|
324
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
325
|
-
raise errors.APIError(
|
|
326
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
327
|
-
http_res.status_code,
|
|
328
|
-
http_res_text,
|
|
329
|
-
http_res,
|
|
330
|
-
)
|
|
301
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
331
302
|
|
|
332
|
-
async def
|
|
303
|
+
async def pendle_positions_async(
|
|
333
304
|
self,
|
|
334
305
|
*,
|
|
335
|
-
chain: models.
|
|
336
|
-
user_address: str
|
|
306
|
+
chain: models.V1PendlePositionsChain,
|
|
307
|
+
user_address: str,
|
|
337
308
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
338
309
|
server_url: Optional[str] = None,
|
|
339
310
|
timeout_ms: Optional[int] = None,
|
|
@@ -343,7 +314,7 @@ class Pendle(BaseSDK):
|
|
|
343
314
|
|
|
344
315
|
List the user's SY, PT, YT and LP positions for all markets on a given chain.
|
|
345
316
|
|
|
346
|
-
:param chain:
|
|
317
|
+
:param chain:
|
|
347
318
|
:param user_address: The user address of the desired position.
|
|
348
319
|
:param retries: Override the default retry configuration for this method
|
|
349
320
|
:param server_url: Override the default server URL for this method
|
|
@@ -360,14 +331,14 @@ class Pendle(BaseSDK):
|
|
|
360
331
|
else:
|
|
361
332
|
base_url = self._get_url(base_url, url_variables)
|
|
362
333
|
|
|
363
|
-
request = models.
|
|
334
|
+
request = models.V1PendlePositionsRequest(
|
|
364
335
|
chain=chain,
|
|
365
336
|
user_address=user_address,
|
|
366
337
|
)
|
|
367
338
|
|
|
368
339
|
req = self._build_request_async(
|
|
369
340
|
method="GET",
|
|
370
|
-
path="/
|
|
341
|
+
path="/v1/pendle/positions",
|
|
371
342
|
base_url=base_url,
|
|
372
343
|
url_variables=url_variables,
|
|
373
344
|
request=request,
|
|
@@ -378,6 +349,7 @@ class Pendle(BaseSDK):
|
|
|
378
349
|
accept_header_value="application/json",
|
|
379
350
|
http_headers=http_headers,
|
|
380
351
|
security=self.sdk_configuration.security,
|
|
352
|
+
allow_empty_value=None,
|
|
381
353
|
timeout_ms=timeout_ms,
|
|
382
354
|
)
|
|
383
355
|
|
|
@@ -393,8 +365,8 @@ class Pendle(BaseSDK):
|
|
|
393
365
|
hook_ctx=HookContext(
|
|
394
366
|
config=self.sdk_configuration,
|
|
395
367
|
base_url=base_url or "",
|
|
396
|
-
operation_id="
|
|
397
|
-
oauth2_scopes=
|
|
368
|
+
operation_id="v1_pendle_positions",
|
|
369
|
+
oauth2_scopes=None,
|
|
398
370
|
security_source=self.sdk_configuration.security,
|
|
399
371
|
),
|
|
400
372
|
request=req,
|
|
@@ -404,52 +376,37 @@ class Pendle(BaseSDK):
|
|
|
404
376
|
|
|
405
377
|
response_data: Any = None
|
|
406
378
|
if utils.match_response(http_res, "200", "application/json"):
|
|
407
|
-
return
|
|
408
|
-
|
|
379
|
+
return unmarshal_json_response(
|
|
380
|
+
models.PendleListUserPositionsResponse, http_res
|
|
409
381
|
)
|
|
410
382
|
if utils.match_response(http_res, "422", "application/json"):
|
|
411
|
-
response_data =
|
|
412
|
-
|
|
383
|
+
response_data = unmarshal_json_response(
|
|
384
|
+
errors.HTTPValidationErrorData, http_res
|
|
413
385
|
)
|
|
414
|
-
raise errors.HTTPValidationError(
|
|
386
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
415
387
|
if utils.match_response(http_res, "4XX", "*"):
|
|
416
388
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
417
|
-
raise errors.APIError(
|
|
418
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
419
|
-
)
|
|
389
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
420
390
|
if utils.match_response(http_res, "5XX", "*"):
|
|
421
391
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
422
|
-
raise errors.APIError(
|
|
423
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
424
|
-
)
|
|
392
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
425
393
|
|
|
426
|
-
|
|
427
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
428
|
-
raise errors.APIError(
|
|
429
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
430
|
-
http_res.status_code,
|
|
431
|
-
http_res_text,
|
|
432
|
-
http_res,
|
|
433
|
-
)
|
|
394
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
434
395
|
|
|
435
|
-
def
|
|
396
|
+
def pendle_markets(
|
|
436
397
|
self,
|
|
437
398
|
*,
|
|
438
|
-
chain: models.
|
|
439
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
440
|
-
block: OptionalNullable[int] = UNSET,
|
|
399
|
+
chain: models.V1PendleMarketsChain,
|
|
441
400
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
442
401
|
server_url: Optional[str] = None,
|
|
443
402
|
timeout_ms: Optional[int] = None,
|
|
444
403
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
445
|
-
) -> models.
|
|
446
|
-
r"""
|
|
404
|
+
) -> models.PendleListMarketsResponse:
|
|
405
|
+
r"""List Market Data
|
|
447
406
|
|
|
448
|
-
Get
|
|
407
|
+
Get a list of active markets.
|
|
449
408
|
|
|
450
|
-
:param chain:
|
|
451
|
-
:param market_address: The market address of the desired position.
|
|
452
|
-
:param block: Optional block number (defaults to latest).
|
|
409
|
+
:param chain:
|
|
453
410
|
:param retries: Override the default retry configuration for this method
|
|
454
411
|
:param server_url: Override the default server URL for this method
|
|
455
412
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -465,15 +422,13 @@ class Pendle(BaseSDK):
|
|
|
465
422
|
else:
|
|
466
423
|
base_url = self._get_url(base_url, url_variables)
|
|
467
424
|
|
|
468
|
-
request = models.
|
|
425
|
+
request = models.V1PendleMarketsRequest(
|
|
469
426
|
chain=chain,
|
|
470
|
-
block=block,
|
|
471
|
-
market_address=market_address,
|
|
472
427
|
)
|
|
473
428
|
|
|
474
429
|
req = self._build_request(
|
|
475
430
|
method="GET",
|
|
476
|
-
path="/
|
|
431
|
+
path="/v1/pendle/markets",
|
|
477
432
|
base_url=base_url,
|
|
478
433
|
url_variables=url_variables,
|
|
479
434
|
request=request,
|
|
@@ -484,6 +439,7 @@ class Pendle(BaseSDK):
|
|
|
484
439
|
accept_header_value="application/json",
|
|
485
440
|
http_headers=http_headers,
|
|
486
441
|
security=self.sdk_configuration.security,
|
|
442
|
+
allow_empty_value=None,
|
|
487
443
|
timeout_ms=timeout_ms,
|
|
488
444
|
)
|
|
489
445
|
|
|
@@ -499,8 +455,8 @@ class Pendle(BaseSDK):
|
|
|
499
455
|
hook_ctx=HookContext(
|
|
500
456
|
config=self.sdk_configuration,
|
|
501
457
|
base_url=base_url or "",
|
|
502
|
-
operation_id="
|
|
503
|
-
oauth2_scopes=
|
|
458
|
+
operation_id="v1_pendle_markets",
|
|
459
|
+
oauth2_scopes=None,
|
|
504
460
|
security_source=self.sdk_configuration.security,
|
|
505
461
|
),
|
|
506
462
|
request=req,
|
|
@@ -510,50 +466,35 @@ class Pendle(BaseSDK):
|
|
|
510
466
|
|
|
511
467
|
response_data: Any = None
|
|
512
468
|
if utils.match_response(http_res, "200", "application/json"):
|
|
513
|
-
return
|
|
469
|
+
return unmarshal_json_response(models.PendleListMarketsResponse, http_res)
|
|
514
470
|
if utils.match_response(http_res, "422", "application/json"):
|
|
515
|
-
response_data =
|
|
516
|
-
|
|
471
|
+
response_data = unmarshal_json_response(
|
|
472
|
+
errors.HTTPValidationErrorData, http_res
|
|
517
473
|
)
|
|
518
|
-
raise errors.HTTPValidationError(
|
|
474
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
519
475
|
if utils.match_response(http_res, "4XX", "*"):
|
|
520
476
|
http_res_text = utils.stream_to_text(http_res)
|
|
521
|
-
raise errors.APIError(
|
|
522
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
523
|
-
)
|
|
477
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
524
478
|
if utils.match_response(http_res, "5XX", "*"):
|
|
525
479
|
http_res_text = utils.stream_to_text(http_res)
|
|
526
|
-
raise errors.APIError(
|
|
527
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
528
|
-
)
|
|
480
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
529
481
|
|
|
530
|
-
|
|
531
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
532
|
-
raise errors.APIError(
|
|
533
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
534
|
-
http_res.status_code,
|
|
535
|
-
http_res_text,
|
|
536
|
-
http_res,
|
|
537
|
-
)
|
|
482
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
538
483
|
|
|
539
|
-
async def
|
|
484
|
+
async def pendle_markets_async(
|
|
540
485
|
self,
|
|
541
486
|
*,
|
|
542
|
-
chain: models.
|
|
543
|
-
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
544
|
-
block: OptionalNullable[int] = UNSET,
|
|
487
|
+
chain: models.V1PendleMarketsChain,
|
|
545
488
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
546
489
|
server_url: Optional[str] = None,
|
|
547
490
|
timeout_ms: Optional[int] = None,
|
|
548
491
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
549
|
-
) -> models.
|
|
550
|
-
r"""
|
|
492
|
+
) -> models.PendleListMarketsResponse:
|
|
493
|
+
r"""List Market Data
|
|
551
494
|
|
|
552
|
-
Get
|
|
495
|
+
Get a list of active markets.
|
|
553
496
|
|
|
554
|
-
:param chain:
|
|
555
|
-
:param market_address: The market address of the desired position.
|
|
556
|
-
:param block: Optional block number (defaults to latest).
|
|
497
|
+
:param chain:
|
|
557
498
|
:param retries: Override the default retry configuration for this method
|
|
558
499
|
:param server_url: Override the default server URL for this method
|
|
559
500
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -569,15 +510,13 @@ class Pendle(BaseSDK):
|
|
|
569
510
|
else:
|
|
570
511
|
base_url = self._get_url(base_url, url_variables)
|
|
571
512
|
|
|
572
|
-
request = models.
|
|
513
|
+
request = models.V1PendleMarketsRequest(
|
|
573
514
|
chain=chain,
|
|
574
|
-
block=block,
|
|
575
|
-
market_address=market_address,
|
|
576
515
|
)
|
|
577
516
|
|
|
578
517
|
req = self._build_request_async(
|
|
579
518
|
method="GET",
|
|
580
|
-
path="/
|
|
519
|
+
path="/v1/pendle/markets",
|
|
581
520
|
base_url=base_url,
|
|
582
521
|
url_variables=url_variables,
|
|
583
522
|
request=request,
|
|
@@ -588,6 +527,7 @@ class Pendle(BaseSDK):
|
|
|
588
527
|
accept_header_value="application/json",
|
|
589
528
|
http_headers=http_headers,
|
|
590
529
|
security=self.sdk_configuration.security,
|
|
530
|
+
allow_empty_value=None,
|
|
591
531
|
timeout_ms=timeout_ms,
|
|
592
532
|
)
|
|
593
533
|
|
|
@@ -603,8 +543,8 @@ class Pendle(BaseSDK):
|
|
|
603
543
|
hook_ctx=HookContext(
|
|
604
544
|
config=self.sdk_configuration,
|
|
605
545
|
base_url=base_url or "",
|
|
606
|
-
operation_id="
|
|
607
|
-
oauth2_scopes=
|
|
546
|
+
operation_id="v1_pendle_markets",
|
|
547
|
+
oauth2_scopes=None,
|
|
608
548
|
security_source=self.sdk_configuration.security,
|
|
609
549
|
),
|
|
610
550
|
request=req,
|
|
@@ -614,46 +554,65 @@ class Pendle(BaseSDK):
|
|
|
614
554
|
|
|
615
555
|
response_data: Any = None
|
|
616
556
|
if utils.match_response(http_res, "200", "application/json"):
|
|
617
|
-
return
|
|
557
|
+
return unmarshal_json_response(models.PendleListMarketsResponse, http_res)
|
|
618
558
|
if utils.match_response(http_res, "422", "application/json"):
|
|
619
|
-
response_data =
|
|
620
|
-
|
|
559
|
+
response_data = unmarshal_json_response(
|
|
560
|
+
errors.HTTPValidationErrorData, http_res
|
|
621
561
|
)
|
|
622
|
-
raise errors.HTTPValidationError(
|
|
562
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
623
563
|
if utils.match_response(http_res, "4XX", "*"):
|
|
624
564
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
625
|
-
raise errors.APIError(
|
|
626
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
627
|
-
)
|
|
565
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
628
566
|
if utils.match_response(http_res, "5XX", "*"):
|
|
629
567
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
630
|
-
raise errors.APIError(
|
|
631
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
632
|
-
)
|
|
568
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
633
569
|
|
|
634
|
-
|
|
635
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
636
|
-
raise errors.APIError(
|
|
637
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
638
|
-
http_res.status_code,
|
|
639
|
-
http_res_text,
|
|
640
|
-
http_res,
|
|
641
|
-
)
|
|
570
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
642
571
|
|
|
643
|
-
def
|
|
572
|
+
def pendle_pt(
|
|
644
573
|
self,
|
|
645
574
|
*,
|
|
646
|
-
|
|
575
|
+
market_address: str,
|
|
576
|
+
action: models.PendleTradePtRequestAction,
|
|
577
|
+
token: str,
|
|
578
|
+
amount_in: Union[
|
|
579
|
+
models.PendleTradePtRequestAmountIn,
|
|
580
|
+
models.PendleTradePtRequestAmountInTypedDict,
|
|
581
|
+
],
|
|
582
|
+
max_slippage_percent: float,
|
|
583
|
+
chain: models.PendleTradePtRequestChain,
|
|
584
|
+
sender: str,
|
|
585
|
+
estimate_gas: Optional[bool] = None,
|
|
647
586
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
648
587
|
server_url: Optional[str] = None,
|
|
649
588
|
timeout_ms: Optional[int] = None,
|
|
650
589
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
651
|
-
) -> models.
|
|
652
|
-
r"""
|
|
590
|
+
) -> models.PendleTxResponse:
|
|
591
|
+
r"""Trade Principal Token (PT)
|
|
653
592
|
|
|
654
|
-
|
|
593
|
+
Trade market's Principal Token (PT) for fixed yield.
|
|
594
|
+
|
|
595
|
+
PT is traded with a token of the user's choice.
|
|
596
|
+
|
|
597
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
598
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the PT contract.
|
|
599
|
+
<Info>
|
|
600
|
+
**Required Allowances**
|
|
601
|
+
|
|
602
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
655
603
|
|
|
656
|
-
|
|
604
|
+
- `PendleRouter`
|
|
605
|
+
</Info>
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
:param market_address: The address of the market identifying which Principal Token (PT) you would like to trade.
|
|
609
|
+
:param action: Specifies the direction of the PT trade. Valid values are `BUY` (to buy PT) or `SELL` (to sell PT).
|
|
610
|
+
: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.
|
|
611
|
+
: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`.
|
|
612
|
+
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
613
|
+
:param chain:
|
|
614
|
+
:param sender: The address of the transaction sender.
|
|
615
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
657
616
|
:param retries: Override the default retry configuration for this method
|
|
658
617
|
:param server_url: Override the default server URL for this method
|
|
659
618
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -669,23 +628,34 @@ class Pendle(BaseSDK):
|
|
|
669
628
|
else:
|
|
670
629
|
base_url = self._get_url(base_url, url_variables)
|
|
671
630
|
|
|
672
|
-
request = models.
|
|
631
|
+
request = models.PendleTradePtRequest(
|
|
632
|
+
market_address=market_address,
|
|
633
|
+
action=action,
|
|
634
|
+
token=token,
|
|
635
|
+
amount_in=amount_in,
|
|
636
|
+
max_slippage_percent=max_slippage_percent,
|
|
673
637
|
chain=chain,
|
|
638
|
+
sender=sender,
|
|
639
|
+
estimate_gas=estimate_gas,
|
|
674
640
|
)
|
|
675
641
|
|
|
676
642
|
req = self._build_request(
|
|
677
|
-
method="
|
|
678
|
-
path="/
|
|
643
|
+
method="POST",
|
|
644
|
+
path="/v1/pendle/pt",
|
|
679
645
|
base_url=base_url,
|
|
680
646
|
url_variables=url_variables,
|
|
681
647
|
request=request,
|
|
682
|
-
request_body_required=
|
|
648
|
+
request_body_required=True,
|
|
683
649
|
request_has_path_params=False,
|
|
684
650
|
request_has_query_params=True,
|
|
685
651
|
user_agent_header="user-agent",
|
|
686
652
|
accept_header_value="application/json",
|
|
687
653
|
http_headers=http_headers,
|
|
688
654
|
security=self.sdk_configuration.security,
|
|
655
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
656
|
+
request, False, False, "json", models.PendleTradePtRequest
|
|
657
|
+
),
|
|
658
|
+
allow_empty_value=None,
|
|
689
659
|
timeout_ms=timeout_ms,
|
|
690
660
|
)
|
|
691
661
|
|
|
@@ -701,8 +671,8 @@ class Pendle(BaseSDK):
|
|
|
701
671
|
hook_ctx=HookContext(
|
|
702
672
|
config=self.sdk_configuration,
|
|
703
673
|
base_url=base_url or "",
|
|
704
|
-
operation_id="
|
|
705
|
-
oauth2_scopes=
|
|
674
|
+
operation_id="v1_pendle_pt",
|
|
675
|
+
oauth2_scopes=None,
|
|
706
676
|
security_source=self.sdk_configuration.security,
|
|
707
677
|
),
|
|
708
678
|
request=req,
|
|
@@ -712,46 +682,65 @@ class Pendle(BaseSDK):
|
|
|
712
682
|
|
|
713
683
|
response_data: Any = None
|
|
714
684
|
if utils.match_response(http_res, "200", "application/json"):
|
|
715
|
-
return
|
|
685
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
716
686
|
if utils.match_response(http_res, "422", "application/json"):
|
|
717
|
-
response_data =
|
|
718
|
-
|
|
687
|
+
response_data = unmarshal_json_response(
|
|
688
|
+
errors.HTTPValidationErrorData, http_res
|
|
719
689
|
)
|
|
720
|
-
raise errors.HTTPValidationError(
|
|
690
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
721
691
|
if utils.match_response(http_res, "4XX", "*"):
|
|
722
692
|
http_res_text = utils.stream_to_text(http_res)
|
|
723
|
-
raise errors.APIError(
|
|
724
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
725
|
-
)
|
|
693
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
726
694
|
if utils.match_response(http_res, "5XX", "*"):
|
|
727
695
|
http_res_text = utils.stream_to_text(http_res)
|
|
728
|
-
raise errors.APIError(
|
|
729
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
730
|
-
)
|
|
696
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
731
697
|
|
|
732
|
-
|
|
733
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
734
|
-
raise errors.APIError(
|
|
735
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
736
|
-
http_res.status_code,
|
|
737
|
-
http_res_text,
|
|
738
|
-
http_res,
|
|
739
|
-
)
|
|
698
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
740
699
|
|
|
741
|
-
async def
|
|
700
|
+
async def pendle_pt_async(
|
|
742
701
|
self,
|
|
743
702
|
*,
|
|
744
|
-
|
|
703
|
+
market_address: str,
|
|
704
|
+
action: models.PendleTradePtRequestAction,
|
|
705
|
+
token: str,
|
|
706
|
+
amount_in: Union[
|
|
707
|
+
models.PendleTradePtRequestAmountIn,
|
|
708
|
+
models.PendleTradePtRequestAmountInTypedDict,
|
|
709
|
+
],
|
|
710
|
+
max_slippage_percent: float,
|
|
711
|
+
chain: models.PendleTradePtRequestChain,
|
|
712
|
+
sender: str,
|
|
713
|
+
estimate_gas: Optional[bool] = None,
|
|
745
714
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
746
715
|
server_url: Optional[str] = None,
|
|
747
716
|
timeout_ms: Optional[int] = None,
|
|
748
717
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
749
|
-
) -> models.
|
|
750
|
-
r"""
|
|
718
|
+
) -> models.PendleTxResponse:
|
|
719
|
+
r"""Trade Principal Token (PT)
|
|
751
720
|
|
|
752
|
-
|
|
721
|
+
Trade market's Principal Token (PT) for fixed yield.
|
|
722
|
+
|
|
723
|
+
PT is traded with a token of the user's choice.
|
|
753
724
|
|
|
754
|
-
|
|
725
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
726
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the PT contract.
|
|
727
|
+
<Info>
|
|
728
|
+
**Required Allowances**
|
|
729
|
+
|
|
730
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
731
|
+
|
|
732
|
+
- `PendleRouter`
|
|
733
|
+
</Info>
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
:param market_address: The address of the market identifying which Principal Token (PT) you would like to trade.
|
|
737
|
+
:param action: Specifies the direction of the PT trade. Valid values are `BUY` (to buy PT) or `SELL` (to sell PT).
|
|
738
|
+
: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.
|
|
739
|
+
: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`.
|
|
740
|
+
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
741
|
+
:param chain:
|
|
742
|
+
:param sender: The address of the transaction sender.
|
|
743
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
755
744
|
:param retries: Override the default retry configuration for this method
|
|
756
745
|
:param server_url: Override the default server URL for this method
|
|
757
746
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -767,23 +756,34 @@ class Pendle(BaseSDK):
|
|
|
767
756
|
else:
|
|
768
757
|
base_url = self._get_url(base_url, url_variables)
|
|
769
758
|
|
|
770
|
-
request = models.
|
|
759
|
+
request = models.PendleTradePtRequest(
|
|
760
|
+
market_address=market_address,
|
|
761
|
+
action=action,
|
|
762
|
+
token=token,
|
|
763
|
+
amount_in=amount_in,
|
|
764
|
+
max_slippage_percent=max_slippage_percent,
|
|
771
765
|
chain=chain,
|
|
766
|
+
sender=sender,
|
|
767
|
+
estimate_gas=estimate_gas,
|
|
772
768
|
)
|
|
773
769
|
|
|
774
770
|
req = self._build_request_async(
|
|
775
|
-
method="
|
|
776
|
-
path="/
|
|
771
|
+
method="POST",
|
|
772
|
+
path="/v1/pendle/pt",
|
|
777
773
|
base_url=base_url,
|
|
778
774
|
url_variables=url_variables,
|
|
779
775
|
request=request,
|
|
780
|
-
request_body_required=
|
|
776
|
+
request_body_required=True,
|
|
781
777
|
request_has_path_params=False,
|
|
782
778
|
request_has_query_params=True,
|
|
783
779
|
user_agent_header="user-agent",
|
|
784
780
|
accept_header_value="application/json",
|
|
785
781
|
http_headers=http_headers,
|
|
786
782
|
security=self.sdk_configuration.security,
|
|
783
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
784
|
+
request, False, False, "json", models.PendleTradePtRequest
|
|
785
|
+
),
|
|
786
|
+
allow_empty_value=None,
|
|
787
787
|
timeout_ms=timeout_ms,
|
|
788
788
|
)
|
|
789
789
|
|
|
@@ -799,8 +799,8 @@ class Pendle(BaseSDK):
|
|
|
799
799
|
hook_ctx=HookContext(
|
|
800
800
|
config=self.sdk_configuration,
|
|
801
801
|
base_url=base_url or "",
|
|
802
|
-
operation_id="
|
|
803
|
-
oauth2_scopes=
|
|
802
|
+
operation_id="v1_pendle_pt",
|
|
803
|
+
oauth2_scopes=None,
|
|
804
804
|
security_source=self.sdk_configuration.security,
|
|
805
805
|
),
|
|
806
806
|
request=req,
|
|
@@ -810,56 +810,65 @@ class Pendle(BaseSDK):
|
|
|
810
810
|
|
|
811
811
|
response_data: Any = None
|
|
812
812
|
if utils.match_response(http_res, "200", "application/json"):
|
|
813
|
-
return
|
|
813
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
814
814
|
if utils.match_response(http_res, "422", "application/json"):
|
|
815
|
-
response_data =
|
|
816
|
-
|
|
815
|
+
response_data = unmarshal_json_response(
|
|
816
|
+
errors.HTTPValidationErrorData, http_res
|
|
817
817
|
)
|
|
818
|
-
raise errors.HTTPValidationError(
|
|
818
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
819
819
|
if utils.match_response(http_res, "4XX", "*"):
|
|
820
820
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
821
|
-
raise errors.APIError(
|
|
822
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
823
|
-
)
|
|
821
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
824
822
|
if utils.match_response(http_res, "5XX", "*"):
|
|
825
823
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
826
|
-
raise errors.APIError(
|
|
827
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
828
|
-
)
|
|
824
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
829
825
|
|
|
830
|
-
|
|
831
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
832
|
-
raise errors.APIError(
|
|
833
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
834
|
-
http_res.status_code,
|
|
835
|
-
http_res_text,
|
|
836
|
-
http_res,
|
|
837
|
-
)
|
|
826
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
838
827
|
|
|
839
|
-
def
|
|
828
|
+
def pendle_yt(
|
|
840
829
|
self,
|
|
841
830
|
*,
|
|
842
831
|
market_address: str,
|
|
843
|
-
|
|
844
|
-
|
|
832
|
+
action: models.PendleTradeYtRequestAction,
|
|
833
|
+
token: str,
|
|
834
|
+
amount_in: Union[
|
|
835
|
+
models.PendleTradeYtRequestAmountIn,
|
|
836
|
+
models.PendleTradeYtRequestAmountInTypedDict,
|
|
845
837
|
],
|
|
846
838
|
max_slippage_percent: float,
|
|
847
|
-
chain: models.
|
|
839
|
+
chain: models.PendleTradeYtRequestChain,
|
|
848
840
|
sender: str,
|
|
841
|
+
estimate_gas: Optional[bool] = None,
|
|
849
842
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
850
843
|
server_url: Optional[str] = None,
|
|
851
844
|
timeout_ms: Optional[int] = None,
|
|
852
845
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
853
|
-
) -> models.
|
|
854
|
-
r"""
|
|
846
|
+
) -> models.PendleTxResponse:
|
|
847
|
+
r"""Trade Yield Token (YT)
|
|
848
|
+
|
|
849
|
+
Trade Yield Token (YT) for variable yield.
|
|
850
|
+
|
|
851
|
+
YT is traded with a token of the user's choice.
|
|
855
852
|
|
|
856
|
-
|
|
853
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
854
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the YT contract.
|
|
855
|
+
<Info>
|
|
856
|
+
**Required Allowances**
|
|
857
857
|
|
|
858
|
-
|
|
859
|
-
|
|
858
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
859
|
+
|
|
860
|
+
- `PendleRouter`
|
|
861
|
+
</Info>
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to trade.
|
|
865
|
+
:param action: Specifies the direction of the YT trade. Valid values are `BUY` (to buy YT) or `SELL` (to sell YT).
|
|
866
|
+
: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.
|
|
867
|
+
: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`.
|
|
860
868
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
861
|
-
:param chain:
|
|
869
|
+
:param chain:
|
|
862
870
|
:param sender: The address of the transaction sender.
|
|
871
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
863
872
|
:param retries: Override the default retry configuration for this method
|
|
864
873
|
:param server_url: Override the default server URL for this method
|
|
865
874
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -875,17 +884,20 @@ class Pendle(BaseSDK):
|
|
|
875
884
|
else:
|
|
876
885
|
base_url = self._get_url(base_url, url_variables)
|
|
877
886
|
|
|
878
|
-
request = models.
|
|
887
|
+
request = models.PendleTradeYtRequest(
|
|
879
888
|
market_address=market_address,
|
|
880
|
-
|
|
889
|
+
action=action,
|
|
890
|
+
token=token,
|
|
891
|
+
amount_in=amount_in,
|
|
881
892
|
max_slippage_percent=max_slippage_percent,
|
|
882
893
|
chain=chain,
|
|
883
894
|
sender=sender,
|
|
895
|
+
estimate_gas=estimate_gas,
|
|
884
896
|
)
|
|
885
897
|
|
|
886
898
|
req = self._build_request(
|
|
887
899
|
method="POST",
|
|
888
|
-
path="/
|
|
900
|
+
path="/v1/pendle/yt",
|
|
889
901
|
base_url=base_url,
|
|
890
902
|
url_variables=url_variables,
|
|
891
903
|
request=request,
|
|
@@ -897,8 +909,9 @@ class Pendle(BaseSDK):
|
|
|
897
909
|
http_headers=http_headers,
|
|
898
910
|
security=self.sdk_configuration.security,
|
|
899
911
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
900
|
-
request, False, False, "json", models.
|
|
912
|
+
request, False, False, "json", models.PendleTradeYtRequest
|
|
901
913
|
),
|
|
914
|
+
allow_empty_value=None,
|
|
902
915
|
timeout_ms=timeout_ms,
|
|
903
916
|
)
|
|
904
917
|
|
|
@@ -914,8 +927,8 @@ class Pendle(BaseSDK):
|
|
|
914
927
|
hook_ctx=HookContext(
|
|
915
928
|
config=self.sdk_configuration,
|
|
916
929
|
base_url=base_url or "",
|
|
917
|
-
operation_id="
|
|
918
|
-
oauth2_scopes=
|
|
930
|
+
operation_id="v1_pendle_yt",
|
|
931
|
+
oauth2_scopes=None,
|
|
919
932
|
security_source=self.sdk_configuration.security,
|
|
920
933
|
),
|
|
921
934
|
request=req,
|
|
@@ -925,56 +938,65 @@ class Pendle(BaseSDK):
|
|
|
925
938
|
|
|
926
939
|
response_data: Any = None
|
|
927
940
|
if utils.match_response(http_res, "200", "application/json"):
|
|
928
|
-
return
|
|
941
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
929
942
|
if utils.match_response(http_res, "422", "application/json"):
|
|
930
|
-
response_data =
|
|
931
|
-
|
|
943
|
+
response_data = unmarshal_json_response(
|
|
944
|
+
errors.HTTPValidationErrorData, http_res
|
|
932
945
|
)
|
|
933
|
-
raise errors.HTTPValidationError(
|
|
946
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
934
947
|
if utils.match_response(http_res, "4XX", "*"):
|
|
935
948
|
http_res_text = utils.stream_to_text(http_res)
|
|
936
|
-
raise errors.APIError(
|
|
937
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
938
|
-
)
|
|
949
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
939
950
|
if utils.match_response(http_res, "5XX", "*"):
|
|
940
951
|
http_res_text = utils.stream_to_text(http_res)
|
|
941
|
-
raise errors.APIError(
|
|
942
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
943
|
-
)
|
|
952
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
944
953
|
|
|
945
|
-
|
|
946
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
947
|
-
raise errors.APIError(
|
|
948
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
949
|
-
http_res.status_code,
|
|
950
|
-
http_res_text,
|
|
951
|
-
http_res,
|
|
952
|
-
)
|
|
954
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
953
955
|
|
|
954
|
-
async def
|
|
956
|
+
async def pendle_yt_async(
|
|
955
957
|
self,
|
|
956
958
|
*,
|
|
957
959
|
market_address: str,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
+
action: models.PendleTradeYtRequestAction,
|
|
961
|
+
token: str,
|
|
962
|
+
amount_in: Union[
|
|
963
|
+
models.PendleTradeYtRequestAmountIn,
|
|
964
|
+
models.PendleTradeYtRequestAmountInTypedDict,
|
|
960
965
|
],
|
|
961
966
|
max_slippage_percent: float,
|
|
962
|
-
chain: models.
|
|
967
|
+
chain: models.PendleTradeYtRequestChain,
|
|
963
968
|
sender: str,
|
|
969
|
+
estimate_gas: Optional[bool] = None,
|
|
964
970
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
965
971
|
server_url: Optional[str] = None,
|
|
966
972
|
timeout_ms: Optional[int] = None,
|
|
967
973
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
968
|
-
) -> models.
|
|
969
|
-
r"""
|
|
974
|
+
) -> models.PendleTxResponse:
|
|
975
|
+
r"""Trade Yield Token (YT)
|
|
976
|
+
|
|
977
|
+
Trade Yield Token (YT) for variable yield.
|
|
978
|
+
|
|
979
|
+
YT is traded with a token of the user's choice.
|
|
970
980
|
|
|
971
|
-
|
|
981
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
982
|
+
beforehand. For `action` set to `BUY`, this is the `token` contract. For `action` set to `SELL`, this is the YT contract.
|
|
983
|
+
<Info>
|
|
984
|
+
**Required Allowances**
|
|
972
985
|
|
|
973
|
-
|
|
974
|
-
|
|
986
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
987
|
+
|
|
988
|
+
- `PendleRouter`
|
|
989
|
+
</Info>
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to trade.
|
|
993
|
+
:param action: Specifies the direction of the YT trade. Valid values are `BUY` (to buy YT) or `SELL` (to sell YT).
|
|
994
|
+
: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.
|
|
995
|
+
: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`.
|
|
975
996
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
976
|
-
:param chain:
|
|
997
|
+
:param chain:
|
|
977
998
|
:param sender: The address of the transaction sender.
|
|
999
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
978
1000
|
:param retries: Override the default retry configuration for this method
|
|
979
1001
|
:param server_url: Override the default server URL for this method
|
|
980
1002
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -990,17 +1012,20 @@ class Pendle(BaseSDK):
|
|
|
990
1012
|
else:
|
|
991
1013
|
base_url = self._get_url(base_url, url_variables)
|
|
992
1014
|
|
|
993
|
-
request = models.
|
|
1015
|
+
request = models.PendleTradeYtRequest(
|
|
994
1016
|
market_address=market_address,
|
|
995
|
-
|
|
1017
|
+
action=action,
|
|
1018
|
+
token=token,
|
|
1019
|
+
amount_in=amount_in,
|
|
996
1020
|
max_slippage_percent=max_slippage_percent,
|
|
997
1021
|
chain=chain,
|
|
998
1022
|
sender=sender,
|
|
1023
|
+
estimate_gas=estimate_gas,
|
|
999
1024
|
)
|
|
1000
1025
|
|
|
1001
1026
|
req = self._build_request_async(
|
|
1002
1027
|
method="POST",
|
|
1003
|
-
path="/
|
|
1028
|
+
path="/v1/pendle/yt",
|
|
1004
1029
|
base_url=base_url,
|
|
1005
1030
|
url_variables=url_variables,
|
|
1006
1031
|
request=request,
|
|
@@ -1012,8 +1037,9 @@ class Pendle(BaseSDK):
|
|
|
1012
1037
|
http_headers=http_headers,
|
|
1013
1038
|
security=self.sdk_configuration.security,
|
|
1014
1039
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1015
|
-
request, False, False, "json", models.
|
|
1040
|
+
request, False, False, "json", models.PendleTradeYtRequest
|
|
1016
1041
|
),
|
|
1042
|
+
allow_empty_value=None,
|
|
1017
1043
|
timeout_ms=timeout_ms,
|
|
1018
1044
|
)
|
|
1019
1045
|
|
|
@@ -1029,8 +1055,8 @@ class Pendle(BaseSDK):
|
|
|
1029
1055
|
hook_ctx=HookContext(
|
|
1030
1056
|
config=self.sdk_configuration,
|
|
1031
1057
|
base_url=base_url or "",
|
|
1032
|
-
operation_id="
|
|
1033
|
-
oauth2_scopes=
|
|
1058
|
+
operation_id="v1_pendle_yt",
|
|
1059
|
+
oauth2_scopes=None,
|
|
1034
1060
|
security_source=self.sdk_configuration.security,
|
|
1035
1061
|
),
|
|
1036
1062
|
request=req,
|
|
@@ -1040,56 +1066,68 @@ class Pendle(BaseSDK):
|
|
|
1040
1066
|
|
|
1041
1067
|
response_data: Any = None
|
|
1042
1068
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1043
|
-
return
|
|
1069
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1044
1070
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1045
|
-
response_data =
|
|
1046
|
-
|
|
1071
|
+
response_data = unmarshal_json_response(
|
|
1072
|
+
errors.HTTPValidationErrorData, http_res
|
|
1047
1073
|
)
|
|
1048
|
-
raise errors.HTTPValidationError(
|
|
1074
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1049
1075
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1050
1076
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1051
|
-
raise errors.APIError(
|
|
1052
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1053
|
-
)
|
|
1077
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1054
1078
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1055
1079
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1056
|
-
raise errors.APIError(
|
|
1057
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1058
|
-
)
|
|
1080
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1059
1081
|
|
|
1060
|
-
|
|
1061
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1062
|
-
raise errors.APIError(
|
|
1063
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1064
|
-
http_res.status_code,
|
|
1065
|
-
http_res_text,
|
|
1066
|
-
http_res,
|
|
1067
|
-
)
|
|
1082
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1068
1083
|
|
|
1069
|
-
def
|
|
1084
|
+
def pendle_liquidity(
|
|
1070
1085
|
self,
|
|
1071
1086
|
*,
|
|
1072
1087
|
market_address: str,
|
|
1073
|
-
|
|
1074
|
-
|
|
1088
|
+
action: models.PendleManageLiquidityRequestAction,
|
|
1089
|
+
token: str,
|
|
1090
|
+
amount_in: Union[
|
|
1091
|
+
models.PendleManageLiquidityRequestAmountIn,
|
|
1092
|
+
models.PendleManageLiquidityRequestAmountInTypedDict,
|
|
1075
1093
|
],
|
|
1076
1094
|
max_slippage_percent: float,
|
|
1077
|
-
chain: models.
|
|
1095
|
+
chain: models.PendleManageLiquidityRequestChain,
|
|
1078
1096
|
sender: str,
|
|
1097
|
+
estimate_gas: Optional[bool] = None,
|
|
1079
1098
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1080
1099
|
server_url: Optional[str] = None,
|
|
1081
1100
|
timeout_ms: Optional[int] = None,
|
|
1082
1101
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1083
|
-
) -> models.
|
|
1084
|
-
r"""
|
|
1102
|
+
) -> models.PendleTxResponse:
|
|
1103
|
+
r"""Manage Liquidity (LP)
|
|
1104
|
+
|
|
1105
|
+
Manage liquidity in a Pendle Market.
|
|
1106
|
+
|
|
1107
|
+
Liquidity is supplied to or withdrawn from the market with a token of the user's choice.
|
|
1108
|
+
|
|
1109
|
+
Representation of the liquidity provided is in the form of market's Liquidity
|
|
1110
|
+
Provider Token (LP) received by the user.
|
|
1111
|
+
|
|
1112
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
1113
|
+
beforehand. For `action` set to `SUPPLY`, this is the `token` contract. For `action` set to `WTIHDRAW`, this is the market contract (LP).
|
|
1114
|
+
<Info>
|
|
1115
|
+
**Required Allowances**
|
|
1116
|
+
|
|
1117
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1118
|
+
|
|
1119
|
+
- `PendleRouter`
|
|
1120
|
+
</Info>
|
|
1085
1121
|
|
|
1086
|
-
Sell Principal Token (PT) for the market's Underlying Token.
|
|
1087
1122
|
|
|
1088
|
-
:param market_address: The address
|
|
1089
|
-
:param
|
|
1123
|
+
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1124
|
+
: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).
|
|
1125
|
+
: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.
|
|
1126
|
+
: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`.
|
|
1090
1127
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1091
|
-
:param chain:
|
|
1128
|
+
:param chain:
|
|
1092
1129
|
:param sender: The address of the transaction sender.
|
|
1130
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
1093
1131
|
:param retries: Override the default retry configuration for this method
|
|
1094
1132
|
:param server_url: Override the default server URL for this method
|
|
1095
1133
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1105,17 +1143,20 @@ class Pendle(BaseSDK):
|
|
|
1105
1143
|
else:
|
|
1106
1144
|
base_url = self._get_url(base_url, url_variables)
|
|
1107
1145
|
|
|
1108
|
-
request = models.
|
|
1146
|
+
request = models.PendleManageLiquidityRequest(
|
|
1109
1147
|
market_address=market_address,
|
|
1110
|
-
|
|
1148
|
+
action=action,
|
|
1149
|
+
token=token,
|
|
1150
|
+
amount_in=amount_in,
|
|
1111
1151
|
max_slippage_percent=max_slippage_percent,
|
|
1112
1152
|
chain=chain,
|
|
1113
1153
|
sender=sender,
|
|
1154
|
+
estimate_gas=estimate_gas,
|
|
1114
1155
|
)
|
|
1115
1156
|
|
|
1116
1157
|
req = self._build_request(
|
|
1117
1158
|
method="POST",
|
|
1118
|
-
path="/
|
|
1159
|
+
path="/v1/pendle/liquidity",
|
|
1119
1160
|
base_url=base_url,
|
|
1120
1161
|
url_variables=url_variables,
|
|
1121
1162
|
request=request,
|
|
@@ -1127,8 +1168,9 @@ class Pendle(BaseSDK):
|
|
|
1127
1168
|
http_headers=http_headers,
|
|
1128
1169
|
security=self.sdk_configuration.security,
|
|
1129
1170
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1130
|
-
request, False, False, "json", models.
|
|
1171
|
+
request, False, False, "json", models.PendleManageLiquidityRequest
|
|
1131
1172
|
),
|
|
1173
|
+
allow_empty_value=None,
|
|
1132
1174
|
timeout_ms=timeout_ms,
|
|
1133
1175
|
)
|
|
1134
1176
|
|
|
@@ -1144,8 +1186,8 @@ class Pendle(BaseSDK):
|
|
|
1144
1186
|
hook_ctx=HookContext(
|
|
1145
1187
|
config=self.sdk_configuration,
|
|
1146
1188
|
base_url=base_url or "",
|
|
1147
|
-
operation_id="
|
|
1148
|
-
oauth2_scopes=
|
|
1189
|
+
operation_id="v1_pendle_liquidity",
|
|
1190
|
+
oauth2_scopes=None,
|
|
1149
1191
|
security_source=self.sdk_configuration.security,
|
|
1150
1192
|
),
|
|
1151
1193
|
request=req,
|
|
@@ -1155,56 +1197,68 @@ class Pendle(BaseSDK):
|
|
|
1155
1197
|
|
|
1156
1198
|
response_data: Any = None
|
|
1157
1199
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1158
|
-
return
|
|
1200
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1159
1201
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1160
|
-
response_data =
|
|
1161
|
-
|
|
1202
|
+
response_data = unmarshal_json_response(
|
|
1203
|
+
errors.HTTPValidationErrorData, http_res
|
|
1162
1204
|
)
|
|
1163
|
-
raise errors.HTTPValidationError(
|
|
1205
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1164
1206
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1165
1207
|
http_res_text = utils.stream_to_text(http_res)
|
|
1166
|
-
raise errors.APIError(
|
|
1167
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1168
|
-
)
|
|
1208
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1169
1209
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1170
1210
|
http_res_text = utils.stream_to_text(http_res)
|
|
1171
|
-
raise errors.APIError(
|
|
1172
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1173
|
-
)
|
|
1211
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1174
1212
|
|
|
1175
|
-
|
|
1176
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1177
|
-
raise errors.APIError(
|
|
1178
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1179
|
-
http_res.status_code,
|
|
1180
|
-
http_res_text,
|
|
1181
|
-
http_res,
|
|
1182
|
-
)
|
|
1213
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1183
1214
|
|
|
1184
|
-
async def
|
|
1215
|
+
async def pendle_liquidity_async(
|
|
1185
1216
|
self,
|
|
1186
1217
|
*,
|
|
1187
1218
|
market_address: str,
|
|
1188
|
-
|
|
1189
|
-
|
|
1219
|
+
action: models.PendleManageLiquidityRequestAction,
|
|
1220
|
+
token: str,
|
|
1221
|
+
amount_in: Union[
|
|
1222
|
+
models.PendleManageLiquidityRequestAmountIn,
|
|
1223
|
+
models.PendleManageLiquidityRequestAmountInTypedDict,
|
|
1190
1224
|
],
|
|
1191
1225
|
max_slippage_percent: float,
|
|
1192
|
-
chain: models.
|
|
1226
|
+
chain: models.PendleManageLiquidityRequestChain,
|
|
1193
1227
|
sender: str,
|
|
1228
|
+
estimate_gas: Optional[bool] = None,
|
|
1194
1229
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1195
1230
|
server_url: Optional[str] = None,
|
|
1196
1231
|
timeout_ms: Optional[int] = None,
|
|
1197
1232
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1198
|
-
) -> models.
|
|
1199
|
-
r"""
|
|
1233
|
+
) -> models.PendleTxResponse:
|
|
1234
|
+
r"""Manage Liquidity (LP)
|
|
1235
|
+
|
|
1236
|
+
Manage liquidity in a Pendle Market.
|
|
1237
|
+
|
|
1238
|
+
Liquidity is supplied to or withdrawn from the market with a token of the user's choice.
|
|
1239
|
+
|
|
1240
|
+
Representation of the liquidity provided is in the form of market's Liquidity
|
|
1241
|
+
Provider Token (LP) received by the user.
|
|
1242
|
+
|
|
1243
|
+
A sufficient allowance for the Pendle Router on the appropriate token contract must be set
|
|
1244
|
+
beforehand. For `action` set to `SUPPLY`, this is the `token` contract. For `action` set to `WTIHDRAW`, this is the market contract (LP).
|
|
1245
|
+
<Info>
|
|
1246
|
+
**Required Allowances**
|
|
1200
1247
|
|
|
1201
|
-
|
|
1248
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1202
1249
|
|
|
1203
|
-
|
|
1204
|
-
|
|
1250
|
+
- `PendleRouter`
|
|
1251
|
+
</Info>
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1255
|
+
: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).
|
|
1256
|
+
: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.
|
|
1257
|
+
: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`.
|
|
1205
1258
|
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1206
|
-
:param chain:
|
|
1259
|
+
:param chain:
|
|
1207
1260
|
:param sender: The address of the transaction sender.
|
|
1261
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
1208
1262
|
:param retries: Override the default retry configuration for this method
|
|
1209
1263
|
:param server_url: Override the default server URL for this method
|
|
1210
1264
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1220,17 +1274,20 @@ class Pendle(BaseSDK):
|
|
|
1220
1274
|
else:
|
|
1221
1275
|
base_url = self._get_url(base_url, url_variables)
|
|
1222
1276
|
|
|
1223
|
-
request = models.
|
|
1277
|
+
request = models.PendleManageLiquidityRequest(
|
|
1224
1278
|
market_address=market_address,
|
|
1225
|
-
|
|
1279
|
+
action=action,
|
|
1280
|
+
token=token,
|
|
1281
|
+
amount_in=amount_in,
|
|
1226
1282
|
max_slippage_percent=max_slippage_percent,
|
|
1227
1283
|
chain=chain,
|
|
1228
1284
|
sender=sender,
|
|
1285
|
+
estimate_gas=estimate_gas,
|
|
1229
1286
|
)
|
|
1230
1287
|
|
|
1231
1288
|
req = self._build_request_async(
|
|
1232
1289
|
method="POST",
|
|
1233
|
-
path="/
|
|
1290
|
+
path="/v1/pendle/liquidity",
|
|
1234
1291
|
base_url=base_url,
|
|
1235
1292
|
url_variables=url_variables,
|
|
1236
1293
|
request=request,
|
|
@@ -1242,8 +1299,9 @@ class Pendle(BaseSDK):
|
|
|
1242
1299
|
http_headers=http_headers,
|
|
1243
1300
|
security=self.sdk_configuration.security,
|
|
1244
1301
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1245
|
-
request, False, False, "json", models.
|
|
1302
|
+
request, False, False, "json", models.PendleManageLiquidityRequest
|
|
1246
1303
|
),
|
|
1304
|
+
allow_empty_value=None,
|
|
1247
1305
|
timeout_ms=timeout_ms,
|
|
1248
1306
|
)
|
|
1249
1307
|
|
|
@@ -1259,8 +1317,8 @@ class Pendle(BaseSDK):
|
|
|
1259
1317
|
hook_ctx=HookContext(
|
|
1260
1318
|
config=self.sdk_configuration,
|
|
1261
1319
|
base_url=base_url or "",
|
|
1262
|
-
operation_id="
|
|
1263
|
-
oauth2_scopes=
|
|
1320
|
+
operation_id="v1_pendle_liquidity",
|
|
1321
|
+
oauth2_scopes=None,
|
|
1264
1322
|
security_source=self.sdk_configuration.security,
|
|
1265
1323
|
),
|
|
1266
1324
|
request=req,
|
|
@@ -1270,56 +1328,49 @@ class Pendle(BaseSDK):
|
|
|
1270
1328
|
|
|
1271
1329
|
response_data: Any = None
|
|
1272
1330
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1273
|
-
return
|
|
1331
|
+
return unmarshal_json_response(models.PendleTxResponse, http_res)
|
|
1274
1332
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1275
|
-
response_data =
|
|
1276
|
-
|
|
1333
|
+
response_data = unmarshal_json_response(
|
|
1334
|
+
errors.HTTPValidationErrorData, http_res
|
|
1277
1335
|
)
|
|
1278
|
-
raise errors.HTTPValidationError(
|
|
1336
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1279
1337
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1280
1338
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1281
|
-
raise errors.APIError(
|
|
1282
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1283
|
-
)
|
|
1339
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1284
1340
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1285
1341
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1286
|
-
raise errors.APIError(
|
|
1287
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1288
|
-
)
|
|
1342
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1289
1343
|
|
|
1290
|
-
|
|
1291
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1292
|
-
raise errors.APIError(
|
|
1293
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1294
|
-
http_res.status_code,
|
|
1295
|
-
http_res_text,
|
|
1296
|
-
http_res,
|
|
1297
|
-
)
|
|
1344
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1298
1345
|
|
|
1299
|
-
def
|
|
1346
|
+
def pendle_redeem_yield(
|
|
1300
1347
|
self,
|
|
1301
1348
|
*,
|
|
1302
1349
|
market_address: str,
|
|
1303
|
-
|
|
1304
|
-
models.PendleBuyYtRequestAmount, models.PendleBuyYtRequestAmountTypedDict
|
|
1305
|
-
],
|
|
1306
|
-
max_slippage_percent: float,
|
|
1307
|
-
chain: models.Chain,
|
|
1350
|
+
chain: models.PendleRedeemYieldRequestChain,
|
|
1308
1351
|
sender: str,
|
|
1352
|
+
estimate_gas: Optional[bool] = None,
|
|
1309
1353
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1310
1354
|
server_url: Optional[str] = None,
|
|
1311
1355
|
timeout_ms: Optional[int] = None,
|
|
1312
1356
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1313
|
-
) -> models.
|
|
1314
|
-
r"""
|
|
1357
|
+
) -> models.TransactionResponse:
|
|
1358
|
+
r"""Redeem Claimable Yield
|
|
1359
|
+
|
|
1360
|
+
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1361
|
+
<Info>
|
|
1362
|
+
**Required Allowances**
|
|
1315
1363
|
|
|
1316
|
-
|
|
1364
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1317
1365
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1366
|
+
- `PendleRouter`
|
|
1367
|
+
</Info>
|
|
1368
|
+
|
|
1369
|
+
|
|
1370
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1371
|
+
:param chain:
|
|
1322
1372
|
:param sender: The address of the transaction sender.
|
|
1373
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
1323
1374
|
:param retries: Override the default retry configuration for this method
|
|
1324
1375
|
:param server_url: Override the default server URL for this method
|
|
1325
1376
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1335,17 +1386,16 @@ class Pendle(BaseSDK):
|
|
|
1335
1386
|
else:
|
|
1336
1387
|
base_url = self._get_url(base_url, url_variables)
|
|
1337
1388
|
|
|
1338
|
-
request = models.
|
|
1389
|
+
request = models.PendleRedeemYieldRequest(
|
|
1339
1390
|
market_address=market_address,
|
|
1340
|
-
amount=amount,
|
|
1341
|
-
max_slippage_percent=max_slippage_percent,
|
|
1342
1391
|
chain=chain,
|
|
1343
1392
|
sender=sender,
|
|
1393
|
+
estimate_gas=estimate_gas,
|
|
1344
1394
|
)
|
|
1345
1395
|
|
|
1346
1396
|
req = self._build_request(
|
|
1347
1397
|
method="POST",
|
|
1348
|
-
path="/
|
|
1398
|
+
path="/v1/pendle/redeem_yield",
|
|
1349
1399
|
base_url=base_url,
|
|
1350
1400
|
url_variables=url_variables,
|
|
1351
1401
|
request=request,
|
|
@@ -1357,8 +1407,9 @@ class Pendle(BaseSDK):
|
|
|
1357
1407
|
http_headers=http_headers,
|
|
1358
1408
|
security=self.sdk_configuration.security,
|
|
1359
1409
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1360
|
-
request, False, False, "json", models.
|
|
1410
|
+
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1361
1411
|
),
|
|
1412
|
+
allow_empty_value=None,
|
|
1362
1413
|
timeout_ms=timeout_ms,
|
|
1363
1414
|
)
|
|
1364
1415
|
|
|
@@ -1374,8 +1425,8 @@ class Pendle(BaseSDK):
|
|
|
1374
1425
|
hook_ctx=HookContext(
|
|
1375
1426
|
config=self.sdk_configuration,
|
|
1376
1427
|
base_url=base_url or "",
|
|
1377
|
-
operation_id="
|
|
1378
|
-
oauth2_scopes=
|
|
1428
|
+
operation_id="v1_pendle_redeem_yield",
|
|
1429
|
+
oauth2_scopes=None,
|
|
1379
1430
|
security_source=self.sdk_configuration.security,
|
|
1380
1431
|
),
|
|
1381
1432
|
request=req,
|
|
@@ -1385,56 +1436,49 @@ class Pendle(BaseSDK):
|
|
|
1385
1436
|
|
|
1386
1437
|
response_data: Any = None
|
|
1387
1438
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1388
|
-
return
|
|
1439
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
1389
1440
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1390
|
-
response_data =
|
|
1391
|
-
|
|
1441
|
+
response_data = unmarshal_json_response(
|
|
1442
|
+
errors.HTTPValidationErrorData, http_res
|
|
1392
1443
|
)
|
|
1393
|
-
raise errors.HTTPValidationError(
|
|
1444
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1394
1445
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1395
1446
|
http_res_text = utils.stream_to_text(http_res)
|
|
1396
|
-
raise errors.APIError(
|
|
1397
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1398
|
-
)
|
|
1447
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1399
1448
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1400
1449
|
http_res_text = utils.stream_to_text(http_res)
|
|
1401
|
-
raise errors.APIError(
|
|
1402
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1403
|
-
)
|
|
1450
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1404
1451
|
|
|
1405
|
-
|
|
1406
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1407
|
-
raise errors.APIError(
|
|
1408
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1409
|
-
http_res.status_code,
|
|
1410
|
-
http_res_text,
|
|
1411
|
-
http_res,
|
|
1412
|
-
)
|
|
1452
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1413
1453
|
|
|
1414
|
-
async def
|
|
1454
|
+
async def pendle_redeem_yield_async(
|
|
1415
1455
|
self,
|
|
1416
1456
|
*,
|
|
1417
1457
|
market_address: str,
|
|
1418
|
-
|
|
1419
|
-
models.PendleBuyYtRequestAmount, models.PendleBuyYtRequestAmountTypedDict
|
|
1420
|
-
],
|
|
1421
|
-
max_slippage_percent: float,
|
|
1422
|
-
chain: models.Chain,
|
|
1458
|
+
chain: models.PendleRedeemYieldRequestChain,
|
|
1423
1459
|
sender: str,
|
|
1460
|
+
estimate_gas: Optional[bool] = None,
|
|
1424
1461
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1425
1462
|
server_url: Optional[str] = None,
|
|
1426
1463
|
timeout_ms: Optional[int] = None,
|
|
1427
1464
|
http_headers: Optional[Mapping[str, str]] = None,
|
|
1428
|
-
) -> models.
|
|
1429
|
-
r"""
|
|
1465
|
+
) -> models.TransactionResponse:
|
|
1466
|
+
r"""Redeem Claimable Yield
|
|
1430
1467
|
|
|
1431
|
-
|
|
1468
|
+
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1469
|
+
<Info>
|
|
1470
|
+
**Required Allowances**
|
|
1432
1471
|
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1472
|
+
In order to make this transaction, token allowances need to be set for the following contracts.
|
|
1473
|
+
|
|
1474
|
+
- `PendleRouter`
|
|
1475
|
+
</Info>
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1479
|
+
:param chain:
|
|
1437
1480
|
:param sender: The address of the transaction sender.
|
|
1481
|
+
:param estimate_gas: Determines whether to estimate gas costs for transactions, also verifying that the transaction can be successfully executed.
|
|
1438
1482
|
:param retries: Override the default retry configuration for this method
|
|
1439
1483
|
:param server_url: Override the default server URL for this method
|
|
1440
1484
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1450,17 +1494,16 @@ class Pendle(BaseSDK):
|
|
|
1450
1494
|
else:
|
|
1451
1495
|
base_url = self._get_url(base_url, url_variables)
|
|
1452
1496
|
|
|
1453
|
-
request = models.
|
|
1497
|
+
request = models.PendleRedeemYieldRequest(
|
|
1454
1498
|
market_address=market_address,
|
|
1455
|
-
amount=amount,
|
|
1456
|
-
max_slippage_percent=max_slippage_percent,
|
|
1457
1499
|
chain=chain,
|
|
1458
1500
|
sender=sender,
|
|
1501
|
+
estimate_gas=estimate_gas,
|
|
1459
1502
|
)
|
|
1460
1503
|
|
|
1461
1504
|
req = self._build_request_async(
|
|
1462
1505
|
method="POST",
|
|
1463
|
-
path="/
|
|
1506
|
+
path="/v1/pendle/redeem_yield",
|
|
1464
1507
|
base_url=base_url,
|
|
1465
1508
|
url_variables=url_variables,
|
|
1466
1509
|
request=request,
|
|
@@ -1472,8 +1515,9 @@ class Pendle(BaseSDK):
|
|
|
1472
1515
|
http_headers=http_headers,
|
|
1473
1516
|
security=self.sdk_configuration.security,
|
|
1474
1517
|
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1475
|
-
request, False, False, "json", models.
|
|
1518
|
+
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1476
1519
|
),
|
|
1520
|
+
allow_empty_value=None,
|
|
1477
1521
|
timeout_ms=timeout_ms,
|
|
1478
1522
|
)
|
|
1479
1523
|
|
|
@@ -1489,8 +1533,8 @@ class Pendle(BaseSDK):
|
|
|
1489
1533
|
hook_ctx=HookContext(
|
|
1490
1534
|
config=self.sdk_configuration,
|
|
1491
1535
|
base_url=base_url or "",
|
|
1492
|
-
operation_id="
|
|
1493
|
-
oauth2_scopes=
|
|
1536
|
+
operation_id="v1_pendle_redeem_yield",
|
|
1537
|
+
oauth2_scopes=None,
|
|
1494
1538
|
security_source=self.sdk_configuration.security,
|
|
1495
1539
|
),
|
|
1496
1540
|
request=req,
|
|
@@ -1500,950 +1544,17 @@ class Pendle(BaseSDK):
|
|
|
1500
1544
|
|
|
1501
1545
|
response_data: Any = None
|
|
1502
1546
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1503
|
-
return
|
|
1547
|
+
return unmarshal_json_response(models.TransactionResponse, http_res)
|
|
1504
1548
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1505
|
-
response_data =
|
|
1506
|
-
|
|
1549
|
+
response_data = unmarshal_json_response(
|
|
1550
|
+
errors.HTTPValidationErrorData, http_res
|
|
1507
1551
|
)
|
|
1508
|
-
raise errors.HTTPValidationError(
|
|
1552
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
1509
1553
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1510
1554
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1511
|
-
raise errors.APIError(
|
|
1512
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1513
|
-
)
|
|
1555
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1514
1556
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1515
1557
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1516
|
-
raise errors.APIError(
|
|
1517
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1518
|
-
)
|
|
1519
|
-
|
|
1520
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1521
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1522
|
-
raise errors.APIError(
|
|
1523
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1524
|
-
http_res.status_code,
|
|
1525
|
-
http_res_text,
|
|
1526
|
-
http_res,
|
|
1527
|
-
)
|
|
1528
|
-
|
|
1529
|
-
def sell_yt(
|
|
1530
|
-
self,
|
|
1531
|
-
*,
|
|
1532
|
-
market_address: str,
|
|
1533
|
-
amount: Union[
|
|
1534
|
-
models.PendleSellYtRequestAmount, models.PendleSellYtRequestAmountTypedDict
|
|
1535
|
-
],
|
|
1536
|
-
max_slippage_percent: float,
|
|
1537
|
-
chain: models.Chain,
|
|
1538
|
-
sender: str,
|
|
1539
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1540
|
-
server_url: Optional[str] = None,
|
|
1541
|
-
timeout_ms: Optional[int] = None,
|
|
1542
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1543
|
-
) -> models.TxResponse:
|
|
1544
|
-
r"""Sell Yield Token (YT)
|
|
1545
|
-
|
|
1546
|
-
Sell Yield Token (YT) for the market's Underlying Token.
|
|
1547
|
-
|
|
1548
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to sell.
|
|
1549
|
-
:param amount: The amount of market's Yield Token (YT) you would like to sell for market's Underlying Token.
|
|
1550
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1551
|
-
:param chain: The chain to use.
|
|
1552
|
-
:param sender: The address of the transaction sender.
|
|
1553
|
-
:param retries: Override the default retry configuration for this method
|
|
1554
|
-
:param server_url: Override the default server URL for this method
|
|
1555
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1556
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1557
|
-
"""
|
|
1558
|
-
base_url = None
|
|
1559
|
-
url_variables = None
|
|
1560
|
-
if timeout_ms is None:
|
|
1561
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1562
|
-
|
|
1563
|
-
if server_url is not None:
|
|
1564
|
-
base_url = server_url
|
|
1565
|
-
else:
|
|
1566
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1567
|
-
|
|
1568
|
-
request = models.PendleSellYtRequest(
|
|
1569
|
-
market_address=market_address,
|
|
1570
|
-
amount=amount,
|
|
1571
|
-
max_slippage_percent=max_slippage_percent,
|
|
1572
|
-
chain=chain,
|
|
1573
|
-
sender=sender,
|
|
1574
|
-
)
|
|
1575
|
-
|
|
1576
|
-
req = self._build_request(
|
|
1577
|
-
method="POST",
|
|
1578
|
-
path="/v0/pendle/sell_yt",
|
|
1579
|
-
base_url=base_url,
|
|
1580
|
-
url_variables=url_variables,
|
|
1581
|
-
request=request,
|
|
1582
|
-
request_body_required=True,
|
|
1583
|
-
request_has_path_params=False,
|
|
1584
|
-
request_has_query_params=True,
|
|
1585
|
-
user_agent_header="user-agent",
|
|
1586
|
-
accept_header_value="application/json",
|
|
1587
|
-
http_headers=http_headers,
|
|
1588
|
-
security=self.sdk_configuration.security,
|
|
1589
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1590
|
-
request, False, False, "json", models.PendleSellYtRequest
|
|
1591
|
-
),
|
|
1592
|
-
timeout_ms=timeout_ms,
|
|
1593
|
-
)
|
|
1594
|
-
|
|
1595
|
-
if retries == UNSET:
|
|
1596
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1597
|
-
retries = self.sdk_configuration.retry_config
|
|
1598
|
-
|
|
1599
|
-
retry_config = None
|
|
1600
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1601
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1602
|
-
|
|
1603
|
-
http_res = self.do_request(
|
|
1604
|
-
hook_ctx=HookContext(
|
|
1605
|
-
config=self.sdk_configuration,
|
|
1606
|
-
base_url=base_url or "",
|
|
1607
|
-
operation_id="pendle_sell_yt",
|
|
1608
|
-
oauth2_scopes=[],
|
|
1609
|
-
security_source=self.sdk_configuration.security,
|
|
1610
|
-
),
|
|
1611
|
-
request=req,
|
|
1612
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1613
|
-
retry_config=retry_config,
|
|
1614
|
-
)
|
|
1615
|
-
|
|
1616
|
-
response_data: Any = None
|
|
1617
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1618
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1619
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1620
|
-
response_data = utils.unmarshal_json(
|
|
1621
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1622
|
-
)
|
|
1623
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1624
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1625
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1626
|
-
raise errors.APIError(
|
|
1627
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1628
|
-
)
|
|
1629
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1630
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1631
|
-
raise errors.APIError(
|
|
1632
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1633
|
-
)
|
|
1558
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1634
1559
|
|
|
1635
|
-
|
|
1636
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1637
|
-
raise errors.APIError(
|
|
1638
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1639
|
-
http_res.status_code,
|
|
1640
|
-
http_res_text,
|
|
1641
|
-
http_res,
|
|
1642
|
-
)
|
|
1643
|
-
|
|
1644
|
-
async def sell_yt_async(
|
|
1645
|
-
self,
|
|
1646
|
-
*,
|
|
1647
|
-
market_address: str,
|
|
1648
|
-
amount: Union[
|
|
1649
|
-
models.PendleSellYtRequestAmount, models.PendleSellYtRequestAmountTypedDict
|
|
1650
|
-
],
|
|
1651
|
-
max_slippage_percent: float,
|
|
1652
|
-
chain: models.Chain,
|
|
1653
|
-
sender: str,
|
|
1654
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1655
|
-
server_url: Optional[str] = None,
|
|
1656
|
-
timeout_ms: Optional[int] = None,
|
|
1657
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1658
|
-
) -> models.TxResponse:
|
|
1659
|
-
r"""Sell Yield Token (YT)
|
|
1660
|
-
|
|
1661
|
-
Sell Yield Token (YT) for the market's Underlying Token.
|
|
1662
|
-
|
|
1663
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to sell.
|
|
1664
|
-
:param amount: The amount of market's Yield Token (YT) you would like to sell for market's Underlying Token.
|
|
1665
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1666
|
-
:param chain: The chain to use.
|
|
1667
|
-
:param sender: The address of the transaction sender.
|
|
1668
|
-
:param retries: Override the default retry configuration for this method
|
|
1669
|
-
:param server_url: Override the default server URL for this method
|
|
1670
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1671
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1672
|
-
"""
|
|
1673
|
-
base_url = None
|
|
1674
|
-
url_variables = None
|
|
1675
|
-
if timeout_ms is None:
|
|
1676
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1677
|
-
|
|
1678
|
-
if server_url is not None:
|
|
1679
|
-
base_url = server_url
|
|
1680
|
-
else:
|
|
1681
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1682
|
-
|
|
1683
|
-
request = models.PendleSellYtRequest(
|
|
1684
|
-
market_address=market_address,
|
|
1685
|
-
amount=amount,
|
|
1686
|
-
max_slippage_percent=max_slippage_percent,
|
|
1687
|
-
chain=chain,
|
|
1688
|
-
sender=sender,
|
|
1689
|
-
)
|
|
1690
|
-
|
|
1691
|
-
req = self._build_request_async(
|
|
1692
|
-
method="POST",
|
|
1693
|
-
path="/v0/pendle/sell_yt",
|
|
1694
|
-
base_url=base_url,
|
|
1695
|
-
url_variables=url_variables,
|
|
1696
|
-
request=request,
|
|
1697
|
-
request_body_required=True,
|
|
1698
|
-
request_has_path_params=False,
|
|
1699
|
-
request_has_query_params=True,
|
|
1700
|
-
user_agent_header="user-agent",
|
|
1701
|
-
accept_header_value="application/json",
|
|
1702
|
-
http_headers=http_headers,
|
|
1703
|
-
security=self.sdk_configuration.security,
|
|
1704
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1705
|
-
request, False, False, "json", models.PendleSellYtRequest
|
|
1706
|
-
),
|
|
1707
|
-
timeout_ms=timeout_ms,
|
|
1708
|
-
)
|
|
1709
|
-
|
|
1710
|
-
if retries == UNSET:
|
|
1711
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1712
|
-
retries = self.sdk_configuration.retry_config
|
|
1713
|
-
|
|
1714
|
-
retry_config = None
|
|
1715
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1716
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1717
|
-
|
|
1718
|
-
http_res = await self.do_request_async(
|
|
1719
|
-
hook_ctx=HookContext(
|
|
1720
|
-
config=self.sdk_configuration,
|
|
1721
|
-
base_url=base_url or "",
|
|
1722
|
-
operation_id="pendle_sell_yt",
|
|
1723
|
-
oauth2_scopes=[],
|
|
1724
|
-
security_source=self.sdk_configuration.security,
|
|
1725
|
-
),
|
|
1726
|
-
request=req,
|
|
1727
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1728
|
-
retry_config=retry_config,
|
|
1729
|
-
)
|
|
1730
|
-
|
|
1731
|
-
response_data: Any = None
|
|
1732
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1733
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1734
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1735
|
-
response_data = utils.unmarshal_json(
|
|
1736
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1737
|
-
)
|
|
1738
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1739
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1740
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1741
|
-
raise errors.APIError(
|
|
1742
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1743
|
-
)
|
|
1744
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1745
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1746
|
-
raise errors.APIError(
|
|
1747
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1748
|
-
)
|
|
1749
|
-
|
|
1750
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1751
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1752
|
-
raise errors.APIError(
|
|
1753
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1754
|
-
http_res.status_code,
|
|
1755
|
-
http_res_text,
|
|
1756
|
-
http_res,
|
|
1757
|
-
)
|
|
1758
|
-
|
|
1759
|
-
def redeem_yield(
|
|
1760
|
-
self,
|
|
1761
|
-
*,
|
|
1762
|
-
market_address: str,
|
|
1763
|
-
chain: models.Chain,
|
|
1764
|
-
sender: str,
|
|
1765
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1766
|
-
server_url: Optional[str] = None,
|
|
1767
|
-
timeout_ms: Optional[int] = None,
|
|
1768
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1769
|
-
) -> models.TxResponse:
|
|
1770
|
-
r"""Redeem Claimable Yield
|
|
1771
|
-
|
|
1772
|
-
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1773
|
-
|
|
1774
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1775
|
-
:param chain: The chain to use.
|
|
1776
|
-
:param sender: The address of the transaction sender.
|
|
1777
|
-
:param retries: Override the default retry configuration for this method
|
|
1778
|
-
:param server_url: Override the default server URL for this method
|
|
1779
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1780
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1781
|
-
"""
|
|
1782
|
-
base_url = None
|
|
1783
|
-
url_variables = None
|
|
1784
|
-
if timeout_ms is None:
|
|
1785
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1786
|
-
|
|
1787
|
-
if server_url is not None:
|
|
1788
|
-
base_url = server_url
|
|
1789
|
-
else:
|
|
1790
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1791
|
-
|
|
1792
|
-
request = models.PendleRedeemYieldRequest(
|
|
1793
|
-
market_address=market_address,
|
|
1794
|
-
chain=chain,
|
|
1795
|
-
sender=sender,
|
|
1796
|
-
)
|
|
1797
|
-
|
|
1798
|
-
req = self._build_request(
|
|
1799
|
-
method="POST",
|
|
1800
|
-
path="/v0/pendle/redeem_yield",
|
|
1801
|
-
base_url=base_url,
|
|
1802
|
-
url_variables=url_variables,
|
|
1803
|
-
request=request,
|
|
1804
|
-
request_body_required=True,
|
|
1805
|
-
request_has_path_params=False,
|
|
1806
|
-
request_has_query_params=True,
|
|
1807
|
-
user_agent_header="user-agent",
|
|
1808
|
-
accept_header_value="application/json",
|
|
1809
|
-
http_headers=http_headers,
|
|
1810
|
-
security=self.sdk_configuration.security,
|
|
1811
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1812
|
-
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1813
|
-
),
|
|
1814
|
-
timeout_ms=timeout_ms,
|
|
1815
|
-
)
|
|
1816
|
-
|
|
1817
|
-
if retries == UNSET:
|
|
1818
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1819
|
-
retries = self.sdk_configuration.retry_config
|
|
1820
|
-
|
|
1821
|
-
retry_config = None
|
|
1822
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1823
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1824
|
-
|
|
1825
|
-
http_res = self.do_request(
|
|
1826
|
-
hook_ctx=HookContext(
|
|
1827
|
-
config=self.sdk_configuration,
|
|
1828
|
-
base_url=base_url or "",
|
|
1829
|
-
operation_id="pendle_redeem_yield",
|
|
1830
|
-
oauth2_scopes=[],
|
|
1831
|
-
security_source=self.sdk_configuration.security,
|
|
1832
|
-
),
|
|
1833
|
-
request=req,
|
|
1834
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1835
|
-
retry_config=retry_config,
|
|
1836
|
-
)
|
|
1837
|
-
|
|
1838
|
-
response_data: Any = None
|
|
1839
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1840
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1841
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1842
|
-
response_data = utils.unmarshal_json(
|
|
1843
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1844
|
-
)
|
|
1845
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1846
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1847
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1848
|
-
raise errors.APIError(
|
|
1849
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1850
|
-
)
|
|
1851
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1852
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1853
|
-
raise errors.APIError(
|
|
1854
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1855
|
-
)
|
|
1856
|
-
|
|
1857
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1858
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1859
|
-
raise errors.APIError(
|
|
1860
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1861
|
-
http_res.status_code,
|
|
1862
|
-
http_res_text,
|
|
1863
|
-
http_res,
|
|
1864
|
-
)
|
|
1865
|
-
|
|
1866
|
-
async def redeem_yield_async(
|
|
1867
|
-
self,
|
|
1868
|
-
*,
|
|
1869
|
-
market_address: str,
|
|
1870
|
-
chain: models.Chain,
|
|
1871
|
-
sender: str,
|
|
1872
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1873
|
-
server_url: Optional[str] = None,
|
|
1874
|
-
timeout_ms: Optional[int] = None,
|
|
1875
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1876
|
-
) -> models.TxResponse:
|
|
1877
|
-
r"""Redeem Claimable Yield
|
|
1878
|
-
|
|
1879
|
-
Redeem claimable yield from the market's associated Yield Token (YT).
|
|
1880
|
-
|
|
1881
|
-
:param market_address: The address of the market identifying which Yield Token (YT) you would like to claim yield from.
|
|
1882
|
-
:param chain: The chain to use.
|
|
1883
|
-
:param sender: The address of the transaction sender.
|
|
1884
|
-
:param retries: Override the default retry configuration for this method
|
|
1885
|
-
:param server_url: Override the default server URL for this method
|
|
1886
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1887
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
1888
|
-
"""
|
|
1889
|
-
base_url = None
|
|
1890
|
-
url_variables = None
|
|
1891
|
-
if timeout_ms is None:
|
|
1892
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1893
|
-
|
|
1894
|
-
if server_url is not None:
|
|
1895
|
-
base_url = server_url
|
|
1896
|
-
else:
|
|
1897
|
-
base_url = self._get_url(base_url, url_variables)
|
|
1898
|
-
|
|
1899
|
-
request = models.PendleRedeemYieldRequest(
|
|
1900
|
-
market_address=market_address,
|
|
1901
|
-
chain=chain,
|
|
1902
|
-
sender=sender,
|
|
1903
|
-
)
|
|
1904
|
-
|
|
1905
|
-
req = self._build_request_async(
|
|
1906
|
-
method="POST",
|
|
1907
|
-
path="/v0/pendle/redeem_yield",
|
|
1908
|
-
base_url=base_url,
|
|
1909
|
-
url_variables=url_variables,
|
|
1910
|
-
request=request,
|
|
1911
|
-
request_body_required=True,
|
|
1912
|
-
request_has_path_params=False,
|
|
1913
|
-
request_has_query_params=True,
|
|
1914
|
-
user_agent_header="user-agent",
|
|
1915
|
-
accept_header_value="application/json",
|
|
1916
|
-
http_headers=http_headers,
|
|
1917
|
-
security=self.sdk_configuration.security,
|
|
1918
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
1919
|
-
request, False, False, "json", models.PendleRedeemYieldRequest
|
|
1920
|
-
),
|
|
1921
|
-
timeout_ms=timeout_ms,
|
|
1922
|
-
)
|
|
1923
|
-
|
|
1924
|
-
if retries == UNSET:
|
|
1925
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
1926
|
-
retries = self.sdk_configuration.retry_config
|
|
1927
|
-
|
|
1928
|
-
retry_config = None
|
|
1929
|
-
if isinstance(retries, utils.RetryConfig):
|
|
1930
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1931
|
-
|
|
1932
|
-
http_res = await self.do_request_async(
|
|
1933
|
-
hook_ctx=HookContext(
|
|
1934
|
-
config=self.sdk_configuration,
|
|
1935
|
-
base_url=base_url or "",
|
|
1936
|
-
operation_id="pendle_redeem_yield",
|
|
1937
|
-
oauth2_scopes=[],
|
|
1938
|
-
security_source=self.sdk_configuration.security,
|
|
1939
|
-
),
|
|
1940
|
-
request=req,
|
|
1941
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
1942
|
-
retry_config=retry_config,
|
|
1943
|
-
)
|
|
1944
|
-
|
|
1945
|
-
response_data: Any = None
|
|
1946
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
1947
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
1948
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
1949
|
-
response_data = utils.unmarshal_json(
|
|
1950
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
1951
|
-
)
|
|
1952
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
1953
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
1954
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1955
|
-
raise errors.APIError(
|
|
1956
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1957
|
-
)
|
|
1958
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
1959
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1960
|
-
raise errors.APIError(
|
|
1961
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1962
|
-
)
|
|
1963
|
-
|
|
1964
|
-
content_type = http_res.headers.get("Content-Type")
|
|
1965
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1966
|
-
raise errors.APIError(
|
|
1967
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1968
|
-
http_res.status_code,
|
|
1969
|
-
http_res_text,
|
|
1970
|
-
http_res,
|
|
1971
|
-
)
|
|
1972
|
-
|
|
1973
|
-
def add_liquidity(
|
|
1974
|
-
self,
|
|
1975
|
-
*,
|
|
1976
|
-
market_address: str,
|
|
1977
|
-
amount: Union[
|
|
1978
|
-
models.PendleAddLiquidityRequestAmount,
|
|
1979
|
-
models.PendleAddLiquidityRequestAmountTypedDict,
|
|
1980
|
-
],
|
|
1981
|
-
max_slippage_percent: float,
|
|
1982
|
-
chain: models.Chain,
|
|
1983
|
-
sender: str,
|
|
1984
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1985
|
-
server_url: Optional[str] = None,
|
|
1986
|
-
timeout_ms: Optional[int] = None,
|
|
1987
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
1988
|
-
) -> models.TxResponse:
|
|
1989
|
-
r"""Add Liquidity
|
|
1990
|
-
|
|
1991
|
-
Add liquidity to a Pendle Market to earn yield.
|
|
1992
|
-
|
|
1993
|
-
Liquidity is added in the form of the market's Underlying Token. Representation of
|
|
1994
|
-
the liquidity received is the market's Liquidity Provider Token (LP).
|
|
1995
|
-
|
|
1996
|
-
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
1997
|
-
:param amount: The amount of liquidity you would like to add to the market denominated in the market's Underlying Token.
|
|
1998
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
1999
|
-
:param chain: The chain to use.
|
|
2000
|
-
:param sender: The address of the transaction sender.
|
|
2001
|
-
:param retries: Override the default retry configuration for this method
|
|
2002
|
-
:param server_url: Override the default server URL for this method
|
|
2003
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2004
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2005
|
-
"""
|
|
2006
|
-
base_url = None
|
|
2007
|
-
url_variables = None
|
|
2008
|
-
if timeout_ms is None:
|
|
2009
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2010
|
-
|
|
2011
|
-
if server_url is not None:
|
|
2012
|
-
base_url = server_url
|
|
2013
|
-
else:
|
|
2014
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2015
|
-
|
|
2016
|
-
request = models.PendleAddLiquidityRequest(
|
|
2017
|
-
market_address=market_address,
|
|
2018
|
-
amount=amount,
|
|
2019
|
-
max_slippage_percent=max_slippage_percent,
|
|
2020
|
-
chain=chain,
|
|
2021
|
-
sender=sender,
|
|
2022
|
-
)
|
|
2023
|
-
|
|
2024
|
-
req = self._build_request(
|
|
2025
|
-
method="POST",
|
|
2026
|
-
path="/v0/pendle/add_liquidity",
|
|
2027
|
-
base_url=base_url,
|
|
2028
|
-
url_variables=url_variables,
|
|
2029
|
-
request=request,
|
|
2030
|
-
request_body_required=True,
|
|
2031
|
-
request_has_path_params=False,
|
|
2032
|
-
request_has_query_params=True,
|
|
2033
|
-
user_agent_header="user-agent",
|
|
2034
|
-
accept_header_value="application/json",
|
|
2035
|
-
http_headers=http_headers,
|
|
2036
|
-
security=self.sdk_configuration.security,
|
|
2037
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2038
|
-
request, False, False, "json", models.PendleAddLiquidityRequest
|
|
2039
|
-
),
|
|
2040
|
-
timeout_ms=timeout_ms,
|
|
2041
|
-
)
|
|
2042
|
-
|
|
2043
|
-
if retries == UNSET:
|
|
2044
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2045
|
-
retries = self.sdk_configuration.retry_config
|
|
2046
|
-
|
|
2047
|
-
retry_config = None
|
|
2048
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2049
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2050
|
-
|
|
2051
|
-
http_res = self.do_request(
|
|
2052
|
-
hook_ctx=HookContext(
|
|
2053
|
-
config=self.sdk_configuration,
|
|
2054
|
-
base_url=base_url or "",
|
|
2055
|
-
operation_id="pendle_add_liquidity",
|
|
2056
|
-
oauth2_scopes=[],
|
|
2057
|
-
security_source=self.sdk_configuration.security,
|
|
2058
|
-
),
|
|
2059
|
-
request=req,
|
|
2060
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2061
|
-
retry_config=retry_config,
|
|
2062
|
-
)
|
|
2063
|
-
|
|
2064
|
-
response_data: Any = None
|
|
2065
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2066
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
2067
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2068
|
-
response_data = utils.unmarshal_json(
|
|
2069
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
2070
|
-
)
|
|
2071
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
2072
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2073
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2074
|
-
raise errors.APIError(
|
|
2075
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2076
|
-
)
|
|
2077
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2078
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2079
|
-
raise errors.APIError(
|
|
2080
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2081
|
-
)
|
|
2082
|
-
|
|
2083
|
-
content_type = http_res.headers.get("Content-Type")
|
|
2084
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2085
|
-
raise errors.APIError(
|
|
2086
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2087
|
-
http_res.status_code,
|
|
2088
|
-
http_res_text,
|
|
2089
|
-
http_res,
|
|
2090
|
-
)
|
|
2091
|
-
|
|
2092
|
-
async def add_liquidity_async(
|
|
2093
|
-
self,
|
|
2094
|
-
*,
|
|
2095
|
-
market_address: str,
|
|
2096
|
-
amount: Union[
|
|
2097
|
-
models.PendleAddLiquidityRequestAmount,
|
|
2098
|
-
models.PendleAddLiquidityRequestAmountTypedDict,
|
|
2099
|
-
],
|
|
2100
|
-
max_slippage_percent: float,
|
|
2101
|
-
chain: models.Chain,
|
|
2102
|
-
sender: str,
|
|
2103
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2104
|
-
server_url: Optional[str] = None,
|
|
2105
|
-
timeout_ms: Optional[int] = None,
|
|
2106
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2107
|
-
) -> models.TxResponse:
|
|
2108
|
-
r"""Add Liquidity
|
|
2109
|
-
|
|
2110
|
-
Add liquidity to a Pendle Market to earn yield.
|
|
2111
|
-
|
|
2112
|
-
Liquidity is added in the form of the market's Underlying Token. Representation of
|
|
2113
|
-
the liquidity received is the market's Liquidity Provider Token (LP).
|
|
2114
|
-
|
|
2115
|
-
:param market_address: The address identifying which Pendle Market you would like to add liquidity to.
|
|
2116
|
-
:param amount: The amount of liquidity you would like to add to the market denominated in the market's Underlying Token.
|
|
2117
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2118
|
-
:param chain: The chain to use.
|
|
2119
|
-
:param sender: The address of the transaction sender.
|
|
2120
|
-
:param retries: Override the default retry configuration for this method
|
|
2121
|
-
:param server_url: Override the default server URL for this method
|
|
2122
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2123
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2124
|
-
"""
|
|
2125
|
-
base_url = None
|
|
2126
|
-
url_variables = None
|
|
2127
|
-
if timeout_ms is None:
|
|
2128
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2129
|
-
|
|
2130
|
-
if server_url is not None:
|
|
2131
|
-
base_url = server_url
|
|
2132
|
-
else:
|
|
2133
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2134
|
-
|
|
2135
|
-
request = models.PendleAddLiquidityRequest(
|
|
2136
|
-
market_address=market_address,
|
|
2137
|
-
amount=amount,
|
|
2138
|
-
max_slippage_percent=max_slippage_percent,
|
|
2139
|
-
chain=chain,
|
|
2140
|
-
sender=sender,
|
|
2141
|
-
)
|
|
2142
|
-
|
|
2143
|
-
req = self._build_request_async(
|
|
2144
|
-
method="POST",
|
|
2145
|
-
path="/v0/pendle/add_liquidity",
|
|
2146
|
-
base_url=base_url,
|
|
2147
|
-
url_variables=url_variables,
|
|
2148
|
-
request=request,
|
|
2149
|
-
request_body_required=True,
|
|
2150
|
-
request_has_path_params=False,
|
|
2151
|
-
request_has_query_params=True,
|
|
2152
|
-
user_agent_header="user-agent",
|
|
2153
|
-
accept_header_value="application/json",
|
|
2154
|
-
http_headers=http_headers,
|
|
2155
|
-
security=self.sdk_configuration.security,
|
|
2156
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2157
|
-
request, False, False, "json", models.PendleAddLiquidityRequest
|
|
2158
|
-
),
|
|
2159
|
-
timeout_ms=timeout_ms,
|
|
2160
|
-
)
|
|
2161
|
-
|
|
2162
|
-
if retries == UNSET:
|
|
2163
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2164
|
-
retries = self.sdk_configuration.retry_config
|
|
2165
|
-
|
|
2166
|
-
retry_config = None
|
|
2167
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2168
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2169
|
-
|
|
2170
|
-
http_res = await self.do_request_async(
|
|
2171
|
-
hook_ctx=HookContext(
|
|
2172
|
-
config=self.sdk_configuration,
|
|
2173
|
-
base_url=base_url or "",
|
|
2174
|
-
operation_id="pendle_add_liquidity",
|
|
2175
|
-
oauth2_scopes=[],
|
|
2176
|
-
security_source=self.sdk_configuration.security,
|
|
2177
|
-
),
|
|
2178
|
-
request=req,
|
|
2179
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2180
|
-
retry_config=retry_config,
|
|
2181
|
-
)
|
|
2182
|
-
|
|
2183
|
-
response_data: Any = None
|
|
2184
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2185
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
2186
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2187
|
-
response_data = utils.unmarshal_json(
|
|
2188
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
2189
|
-
)
|
|
2190
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
2191
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2192
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2193
|
-
raise errors.APIError(
|
|
2194
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2195
|
-
)
|
|
2196
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2197
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2198
|
-
raise errors.APIError(
|
|
2199
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2200
|
-
)
|
|
2201
|
-
|
|
2202
|
-
content_type = http_res.headers.get("Content-Type")
|
|
2203
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2204
|
-
raise errors.APIError(
|
|
2205
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2206
|
-
http_res.status_code,
|
|
2207
|
-
http_res_text,
|
|
2208
|
-
http_res,
|
|
2209
|
-
)
|
|
2210
|
-
|
|
2211
|
-
def remove_liquidity(
|
|
2212
|
-
self,
|
|
2213
|
-
*,
|
|
2214
|
-
market_address: str,
|
|
2215
|
-
amount: Union[
|
|
2216
|
-
models.PendleRemoveLiquidityRequestAmount,
|
|
2217
|
-
models.PendleRemoveLiquidityRequestAmountTypedDict,
|
|
2218
|
-
],
|
|
2219
|
-
max_slippage_percent: float,
|
|
2220
|
-
chain: models.Chain,
|
|
2221
|
-
sender: str,
|
|
2222
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2223
|
-
server_url: Optional[str] = None,
|
|
2224
|
-
timeout_ms: Optional[int] = None,
|
|
2225
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2226
|
-
) -> models.TxResponse:
|
|
2227
|
-
r"""Remove Liquidity
|
|
2228
|
-
|
|
2229
|
-
Remove liquidity from a Pendle Market.
|
|
2230
|
-
|
|
2231
|
-
Liquidity is removed in the form of the market's Liquidity Provider Token (LP) into
|
|
2232
|
-
the market's Underlying Token. An appropriate allowance for the Pendle Router on the
|
|
2233
|
-
market contract must be set beforehand
|
|
2234
|
-
|
|
2235
|
-
:param market_address: The address identifying which Pendle Market you would like to remove liquidity from.
|
|
2236
|
-
:param amount: The amount of liquidity you would like to remove from the market denominated in the market's Liquidity Provider Token (LP).
|
|
2237
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2238
|
-
:param chain: The chain to use.
|
|
2239
|
-
:param sender: The address of the transaction sender.
|
|
2240
|
-
:param retries: Override the default retry configuration for this method
|
|
2241
|
-
:param server_url: Override the default server URL for this method
|
|
2242
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2243
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2244
|
-
"""
|
|
2245
|
-
base_url = None
|
|
2246
|
-
url_variables = None
|
|
2247
|
-
if timeout_ms is None:
|
|
2248
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2249
|
-
|
|
2250
|
-
if server_url is not None:
|
|
2251
|
-
base_url = server_url
|
|
2252
|
-
else:
|
|
2253
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2254
|
-
|
|
2255
|
-
request = models.PendleRemoveLiquidityRequest(
|
|
2256
|
-
market_address=market_address,
|
|
2257
|
-
amount=amount,
|
|
2258
|
-
max_slippage_percent=max_slippage_percent,
|
|
2259
|
-
chain=chain,
|
|
2260
|
-
sender=sender,
|
|
2261
|
-
)
|
|
2262
|
-
|
|
2263
|
-
req = self._build_request(
|
|
2264
|
-
method="POST",
|
|
2265
|
-
path="/v0/pendle/remove_liquidity",
|
|
2266
|
-
base_url=base_url,
|
|
2267
|
-
url_variables=url_variables,
|
|
2268
|
-
request=request,
|
|
2269
|
-
request_body_required=True,
|
|
2270
|
-
request_has_path_params=False,
|
|
2271
|
-
request_has_query_params=True,
|
|
2272
|
-
user_agent_header="user-agent",
|
|
2273
|
-
accept_header_value="application/json",
|
|
2274
|
-
http_headers=http_headers,
|
|
2275
|
-
security=self.sdk_configuration.security,
|
|
2276
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2277
|
-
request, False, False, "json", models.PendleRemoveLiquidityRequest
|
|
2278
|
-
),
|
|
2279
|
-
timeout_ms=timeout_ms,
|
|
2280
|
-
)
|
|
2281
|
-
|
|
2282
|
-
if retries == UNSET:
|
|
2283
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2284
|
-
retries = self.sdk_configuration.retry_config
|
|
2285
|
-
|
|
2286
|
-
retry_config = None
|
|
2287
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2288
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2289
|
-
|
|
2290
|
-
http_res = self.do_request(
|
|
2291
|
-
hook_ctx=HookContext(
|
|
2292
|
-
config=self.sdk_configuration,
|
|
2293
|
-
base_url=base_url or "",
|
|
2294
|
-
operation_id="pendle_remove_liquidity",
|
|
2295
|
-
oauth2_scopes=[],
|
|
2296
|
-
security_source=self.sdk_configuration.security,
|
|
2297
|
-
),
|
|
2298
|
-
request=req,
|
|
2299
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2300
|
-
retry_config=retry_config,
|
|
2301
|
-
)
|
|
2302
|
-
|
|
2303
|
-
response_data: Any = None
|
|
2304
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2305
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
2306
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2307
|
-
response_data = utils.unmarshal_json(
|
|
2308
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
2309
|
-
)
|
|
2310
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
2311
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2312
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2313
|
-
raise errors.APIError(
|
|
2314
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2315
|
-
)
|
|
2316
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2317
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2318
|
-
raise errors.APIError(
|
|
2319
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2320
|
-
)
|
|
2321
|
-
|
|
2322
|
-
content_type = http_res.headers.get("Content-Type")
|
|
2323
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
2324
|
-
raise errors.APIError(
|
|
2325
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2326
|
-
http_res.status_code,
|
|
2327
|
-
http_res_text,
|
|
2328
|
-
http_res,
|
|
2329
|
-
)
|
|
2330
|
-
|
|
2331
|
-
async def remove_liquidity_async(
|
|
2332
|
-
self,
|
|
2333
|
-
*,
|
|
2334
|
-
market_address: str,
|
|
2335
|
-
amount: Union[
|
|
2336
|
-
models.PendleRemoveLiquidityRequestAmount,
|
|
2337
|
-
models.PendleRemoveLiquidityRequestAmountTypedDict,
|
|
2338
|
-
],
|
|
2339
|
-
max_slippage_percent: float,
|
|
2340
|
-
chain: models.Chain,
|
|
2341
|
-
sender: str,
|
|
2342
|
-
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2343
|
-
server_url: Optional[str] = None,
|
|
2344
|
-
timeout_ms: Optional[int] = None,
|
|
2345
|
-
http_headers: Optional[Mapping[str, str]] = None,
|
|
2346
|
-
) -> models.TxResponse:
|
|
2347
|
-
r"""Remove Liquidity
|
|
2348
|
-
|
|
2349
|
-
Remove liquidity from a Pendle Market.
|
|
2350
|
-
|
|
2351
|
-
Liquidity is removed in the form of the market's Liquidity Provider Token (LP) into
|
|
2352
|
-
the market's Underlying Token. An appropriate allowance for the Pendle Router on the
|
|
2353
|
-
market contract must be set beforehand
|
|
2354
|
-
|
|
2355
|
-
:param market_address: The address identifying which Pendle Market you would like to remove liquidity from.
|
|
2356
|
-
:param amount: The amount of liquidity you would like to remove from the market denominated in the market's Liquidity Provider Token (LP).
|
|
2357
|
-
:param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1%` slippage allowed.
|
|
2358
|
-
:param chain: The chain to use.
|
|
2359
|
-
:param sender: The address of the transaction sender.
|
|
2360
|
-
:param retries: Override the default retry configuration for this method
|
|
2361
|
-
:param server_url: Override the default server URL for this method
|
|
2362
|
-
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2363
|
-
:param http_headers: Additional headers to set or replace on requests.
|
|
2364
|
-
"""
|
|
2365
|
-
base_url = None
|
|
2366
|
-
url_variables = None
|
|
2367
|
-
if timeout_ms is None:
|
|
2368
|
-
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2369
|
-
|
|
2370
|
-
if server_url is not None:
|
|
2371
|
-
base_url = server_url
|
|
2372
|
-
else:
|
|
2373
|
-
base_url = self._get_url(base_url, url_variables)
|
|
2374
|
-
|
|
2375
|
-
request = models.PendleRemoveLiquidityRequest(
|
|
2376
|
-
market_address=market_address,
|
|
2377
|
-
amount=amount,
|
|
2378
|
-
max_slippage_percent=max_slippage_percent,
|
|
2379
|
-
chain=chain,
|
|
2380
|
-
sender=sender,
|
|
2381
|
-
)
|
|
2382
|
-
|
|
2383
|
-
req = self._build_request_async(
|
|
2384
|
-
method="POST",
|
|
2385
|
-
path="/v0/pendle/remove_liquidity",
|
|
2386
|
-
base_url=base_url,
|
|
2387
|
-
url_variables=url_variables,
|
|
2388
|
-
request=request,
|
|
2389
|
-
request_body_required=True,
|
|
2390
|
-
request_has_path_params=False,
|
|
2391
|
-
request_has_query_params=True,
|
|
2392
|
-
user_agent_header="user-agent",
|
|
2393
|
-
accept_header_value="application/json",
|
|
2394
|
-
http_headers=http_headers,
|
|
2395
|
-
security=self.sdk_configuration.security,
|
|
2396
|
-
get_serialized_body=lambda: utils.serialize_request_body(
|
|
2397
|
-
request, False, False, "json", models.PendleRemoveLiquidityRequest
|
|
2398
|
-
),
|
|
2399
|
-
timeout_ms=timeout_ms,
|
|
2400
|
-
)
|
|
2401
|
-
|
|
2402
|
-
if retries == UNSET:
|
|
2403
|
-
if self.sdk_configuration.retry_config is not UNSET:
|
|
2404
|
-
retries = self.sdk_configuration.retry_config
|
|
2405
|
-
|
|
2406
|
-
retry_config = None
|
|
2407
|
-
if isinstance(retries, utils.RetryConfig):
|
|
2408
|
-
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2409
|
-
|
|
2410
|
-
http_res = await self.do_request_async(
|
|
2411
|
-
hook_ctx=HookContext(
|
|
2412
|
-
config=self.sdk_configuration,
|
|
2413
|
-
base_url=base_url or "",
|
|
2414
|
-
operation_id="pendle_remove_liquidity",
|
|
2415
|
-
oauth2_scopes=[],
|
|
2416
|
-
security_source=self.sdk_configuration.security,
|
|
2417
|
-
),
|
|
2418
|
-
request=req,
|
|
2419
|
-
error_status_codes=["422", "4XX", "5XX"],
|
|
2420
|
-
retry_config=retry_config,
|
|
2421
|
-
)
|
|
2422
|
-
|
|
2423
|
-
response_data: Any = None
|
|
2424
|
-
if utils.match_response(http_res, "200", "application/json"):
|
|
2425
|
-
return utils.unmarshal_json(http_res.text, models.TxResponse)
|
|
2426
|
-
if utils.match_response(http_res, "422", "application/json"):
|
|
2427
|
-
response_data = utils.unmarshal_json(
|
|
2428
|
-
http_res.text, errors.HTTPValidationErrorData
|
|
2429
|
-
)
|
|
2430
|
-
raise errors.HTTPValidationError(data=response_data)
|
|
2431
|
-
if utils.match_response(http_res, "4XX", "*"):
|
|
2432
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2433
|
-
raise errors.APIError(
|
|
2434
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2435
|
-
)
|
|
2436
|
-
if utils.match_response(http_res, "5XX", "*"):
|
|
2437
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2438
|
-
raise errors.APIError(
|
|
2439
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
2440
|
-
)
|
|
2441
|
-
|
|
2442
|
-
content_type = http_res.headers.get("Content-Type")
|
|
2443
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2444
|
-
raise errors.APIError(
|
|
2445
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
2446
|
-
http_res.status_code,
|
|
2447
|
-
http_res_text,
|
|
2448
|
-
http_res,
|
|
2449
|
-
)
|
|
1560
|
+
raise errors.APIError("Unexpected response received", http_res)
|