compass_api_sdk 1.1.1__py3-none-any.whl → 2.2.1rc3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. compass_api_sdk/_hooks/sdkhooks.py +4 -4
  2. compass_api_sdk/_hooks/types.py +1 -2
  3. compass_api_sdk/_version.py +3 -3
  4. compass_api_sdk/aave_v3.py +386 -114
  5. compass_api_sdk/aerodrome_slipstream.py +104 -54
  6. compass_api_sdk/basesdk.py +6 -0
  7. compass_api_sdk/bridge.py +536 -0
  8. compass_api_sdk/earn.py +2026 -0
  9. compass_api_sdk/erc_4626_vaults.py +28 -10
  10. compass_api_sdk/errors/__init__.py +8 -0
  11. compass_api_sdk/errors/apierror.py +1 -1
  12. compass_api_sdk/errors/compassapierror.py +1 -1
  13. compass_api_sdk/errors/httpvalidationerror.py +1 -1
  14. compass_api_sdk/errors/mintpreparenotfoundresponse_error.py +49 -0
  15. compass_api_sdk/errors/no_response_error.py +1 -1
  16. compass_api_sdk/errors/responsevalidationerror.py +1 -1
  17. compass_api_sdk/ethena.py +36 -10
  18. compass_api_sdk/gas_sponsorship.py +458 -0
  19. compass_api_sdk/httpclient.py +0 -1
  20. compass_api_sdk/models/__init__.py +820 -392
  21. compass_api_sdk/models/aaveborrowparams.py +4 -13
  22. compass_api_sdk/models/aaveborrowrequest.py +10 -14
  23. compass_api_sdk/models/aavehistoricaltransactionsresponse.py +3 -3
  24. compass_api_sdk/models/aavelooprequest.py +32 -28
  25. compass_api_sdk/models/aaveposition.py +104 -0
  26. compass_api_sdk/models/aaverepayparams.py +4 -13
  27. compass_api_sdk/models/aaverepayrequest.py +10 -14
  28. compass_api_sdk/models/aavesetuseremodeparams.py +28 -0
  29. compass_api_sdk/models/aavesetuseremoderequest.py +48 -0
  30. compass_api_sdk/models/aavesupplyparams.py +4 -13
  31. compass_api_sdk/models/aavesupplyrequest.py +10 -14
  32. compass_api_sdk/models/aavevenue.py +27 -0
  33. compass_api_sdk/models/aavewithdrawparams.py +4 -13
  34. compass_api_sdk/models/aavewithdrawrequest.py +10 -14
  35. compass_api_sdk/models/aerodromeenrichedposition.py +109 -0
  36. compass_api_sdk/models/aerodromelppositionsresponse.py +10 -7
  37. compass_api_sdk/models/aerodromeslipstreambuyexactlyparams.py +8 -25
  38. compass_api_sdk/models/aerodromeslipstreambuyexactlyrequest.py +14 -26
  39. compass_api_sdk/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +6 -1
  40. compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionparams.py +8 -25
  41. compass_api_sdk/models/aerodromeslipstreammintliquidityprovisionrequest.py +14 -26
  42. compass_api_sdk/models/aerodromeslipstreampoolpriceresponse.py +8 -25
  43. compass_api_sdk/models/aerodromeslipstreamsellexactlyparams.py +8 -25
  44. compass_api_sdk/models/aerodromeslipstreamsellexactlyrequest.py +13 -25
  45. compass_api_sdk/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +6 -1
  46. compass_api_sdk/models/approvetransferrequest.py +32 -0
  47. compass_api_sdk/models/approvetransferresponse.py +52 -0
  48. compass_api_sdk/models/batchedsafeoperationsresponse_input.py +52 -0
  49. compass_api_sdk/models/batchedsafeoperationsresponse_output.py +52 -0
  50. compass_api_sdk/models/batcheduseroperationsrequest.py +15 -4
  51. compass_api_sdk/models/chainmarketinfo.py +29 -0
  52. 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
  53. 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
  54. 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
  55. 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
  56. compass_api_sdk/models/compass_api_backend_v1_models_morpho_read_response_check_user_position_vaultposition.py +30 -0
  57. 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
  58. 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
  59. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_market_asset.py → compass_api_backend_v1_models_morpho_read_response_get_market_asset.py} +5 -5
  60. 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
  61. 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
  62. 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
  63. 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
  64. compass_api_sdk/models/{compass_api_backend_models_morpho_read_response_get_vaults_vaultstate.py → compass_api_backend_v1_models_morpho_read_response_get_vaults_vaultstate.py} +4 -2
  65. compass_api_sdk/models/{compass_api_backend_models_pendle_read_response_market_userposition.py → compass_api_backend_v1_models_pendle_read_response_market_userposition.py} +2 -2
  66. 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
  67. compass_api_sdk/models/{compass_api_backend_models_vaults_read_response_vault_userposition.py → compass_api_backend_v1_models_vaults_read_response_vault_userposition.py} +2 -2
  68. compass_api_sdk/models/compass_api_backend_v1_models_wildcat_read_response_market_userposition.py +22 -0
  69. compass_api_sdk/models/compass_api_backend_v2_models_earn_read_response_positions_vaultposition.py +103 -0
  70. compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712domain.py +36 -0
  71. compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_2_typed_data_eip712types.py +36 -0
  72. compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712domain.py +37 -0
  73. compass_api_sdk/models/compass_api_backend_v2_models_gas_sponsorship_permit_typed_data_eip712types.py +32 -0
  74. compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712domain.py +29 -0
  75. compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712types.py +34 -0
  76. compass_api_sdk/models/createaccountrequest.py +40 -0
  77. compass_api_sdk/models/createaccountresponse.py +56 -0
  78. compass_api_sdk/models/depositevent.py +61 -0
  79. compass_api_sdk/models/depositforburnrequest.py +77 -0
  80. compass_api_sdk/models/depositforburnresponse.py +100 -0
  81. compass_api_sdk/models/earnmanageparams.py +76 -0
  82. compass_api_sdk/models/earnmanagerequest.py +132 -0
  83. compass_api_sdk/models/earnmanageresponse.py +52 -0
  84. compass_api_sdk/models/earnpositionsresponse.py +48 -0
  85. compass_api_sdk/models/earnswapparams.py +74 -0
  86. compass_api_sdk/models/earnswaprequest.py +90 -0
  87. compass_api_sdk/models/earnswapresponse.py +55 -0
  88. compass_api_sdk/models/earntransferrequest.py +104 -0
  89. compass_api_sdk/models/earntransferresponse.py +71 -0
  90. compass_api_sdk/models/eip712domainfield.py +20 -0
  91. compass_api_sdk/models/eip712field.py +20 -0
  92. compass_api_sdk/models/ethenadepositrequest.py +6 -1
  93. compass_api_sdk/models/ethenagetvaultresponse.py +5 -5
  94. compass_api_sdk/models/ethenarequesttowithdrawrequest.py +6 -1
  95. compass_api_sdk/models/ethenaunstakerequest.py +6 -1
  96. compass_api_sdk/models/fee.py +43 -0
  97. compass_api_sdk/models/listaavemarketsresponse.py +21 -0
  98. compass_api_sdk/models/marketposition.py +5 -5
  99. compass_api_sdk/models/maxsupplyapyinfo.py +34 -0
  100. compass_api_sdk/models/mintpreparecompletedresponse.py +46 -0
  101. compass_api_sdk/models/mintpreparependingresponse.py +65 -0
  102. compass_api_sdk/models/mintpreparereadyresponse.py +43 -0
  103. compass_api_sdk/models/mintpreparerequest.py +25 -0
  104. compass_api_sdk/models/morphoborrowrequest.py +6 -1
  105. compass_api_sdk/models/morphocheckuserpositionresponse.py +9 -3
  106. compass_api_sdk/models/morphodepositrequest.py +6 -1
  107. compass_api_sdk/models/morphogetmarketresponse.py +72 -31
  108. compass_api_sdk/models/morphomarket.py +26 -20
  109. compass_api_sdk/models/morphorepayrequest.py +11 -1
  110. compass_api_sdk/models/morphosupplycollateralrequest.py +11 -1
  111. compass_api_sdk/models/morphovault.py +10 -10
  112. compass_api_sdk/models/morphowithdrawcollateralrequest.py +6 -1
  113. compass_api_sdk/models/morphowithdrawrequest.py +6 -1
  114. compass_api_sdk/models/multicallexecuterequest.py +7 -2
  115. compass_api_sdk/models/odosswapparams.py +9 -30
  116. compass_api_sdk/models/odosswaprequest.py +15 -33
  117. compass_api_sdk/models/oneinchswapparams.py +59 -0
  118. compass_api_sdk/models/openposition.py +7 -7
  119. compass_api_sdk/models/operationtype.py +11 -0
  120. compass_api_sdk/models/pendledepositevent.py +49 -0
  121. compass_api_sdk/models/pendlegetmarketresponse.py +5 -5
  122. compass_api_sdk/models/pendlemanageliquidityparams.py +2 -15
  123. compass_api_sdk/models/pendlemanageliquidityrequest.py +8 -16
  124. compass_api_sdk/models/pendlemarketinfo.py +138 -0
  125. compass_api_sdk/models/pendlemarketsresponse.py +30 -0
  126. compass_api_sdk/models/pendleptposition.py +111 -0
  127. compass_api_sdk/models/pendleptvenue.py +78 -0
  128. compass_api_sdk/models/pendleredeemyieldrequest.py +6 -1
  129. compass_api_sdk/models/pendletradeptparams.py +2 -15
  130. compass_api_sdk/models/pendletradeptrequest.py +8 -16
  131. compass_api_sdk/models/pendletradeytparams.py +2 -15
  132. compass_api_sdk/models/pendletradeytrequest.py +8 -16
  133. compass_api_sdk/models/pendlewithdrawalevent.py +54 -0
  134. compass_api_sdk/models/permit2typeddata_input.py +46 -0
  135. compass_api_sdk/models/permit2typeddata_output.py +46 -0
  136. compass_api_sdk/models/permitfield.py +20 -0
  137. compass_api_sdk/models/permitmessage.py +39 -0
  138. compass_api_sdk/models/permittransferfrommessage.py +29 -0
  139. compass_api_sdk/models/permittypeddataresponse_input.py +50 -0
  140. compass_api_sdk/models/permittypeddataresponse_output.py +50 -0
  141. compass_api_sdk/models/portfolio.py +5 -5
  142. compass_api_sdk/models/positionpnl.py +52 -0
  143. compass_api_sdk/models/reserve.py +6 -15
  144. compass_api_sdk/models/safetransactionparams.py +78 -0
  145. compass_api_sdk/models/safetransactionresponse.py +28 -0
  146. compass_api_sdk/models/safetxfield.py +20 -0
  147. compass_api_sdk/models/safetxmessage.py +66 -0
  148. compass_api_sdk/models/setallowanceparams.py +3 -16
  149. compass_api_sdk/models/setallowancerequest.py +9 -17
  150. compass_api_sdk/models/skybuyrequest.py +6 -1
  151. compass_api_sdk/models/skydepositrequest.py +7 -2
  152. compass_api_sdk/models/skysellrequest.py +7 -2
  153. compass_api_sdk/models/skywithdrawrequest.py +7 -2
  154. compass_api_sdk/models/sponsorgasrequest.py +71 -0
  155. compass_api_sdk/models/sponsorgasresponse.py +14 -0
  156. compass_api_sdk/models/tokenbalanceresponse.py +5 -15
  157. compass_api_sdk/models/tokenconfig.py +30 -0
  158. compass_api_sdk/models/tokenlistresponse.py +21 -0
  159. compass_api_sdk/models/tokenmarketdata.py +27 -0
  160. compass_api_sdk/models/tokenpermissions.py +20 -0
  161. compass_api_sdk/models/tokentransferparams.py +2 -15
  162. compass_api_sdk/models/tokentransferrequest.py +8 -16
  163. compass_api_sdk/models/uniswapbuyexactlyparams.py +8 -33
  164. compass_api_sdk/models/uniswapbuyexactlyrequest.py +14 -34
  165. compass_api_sdk/models/uniswapincreaseliquidityprovisionrequest.py +6 -1
  166. compass_api_sdk/models/uniswapmintliquidityprovisionparams.py +8 -25
  167. compass_api_sdk/models/uniswapmintliquidityprovisionrequest.py +14 -26
  168. compass_api_sdk/models/uniswappoolpriceresponse.py +8 -25
  169. compass_api_sdk/models/uniswapsellexactlyparams.py +4 -29
  170. compass_api_sdk/models/uniswapsellexactlyrequest.py +10 -30
  171. compass_api_sdk/models/uniswapwithdrawliquidityprovisionrequest.py +6 -1
  172. compass_api_sdk/models/unsignedmulticalltransaction.py +34 -3
  173. compass_api_sdk/models/unsignedtransaction.py +34 -3
  174. compass_api_sdk/models/unwrapwethrequest.py +6 -1
  175. compass_api_sdk/models/useroperation.py +33 -24
  176. compass_api_sdk/models/v1_aave_aave_supported_tokensop.py +1 -1
  177. compass_api_sdk/models/v1_aave_avg_rateop.py +15 -93
  178. compass_api_sdk/models/v1_aave_historical_transactionsop.py +15 -15
  179. compass_api_sdk/models/v1_aave_liquidity_changeop.py +8 -86
  180. compass_api_sdk/models/v1_aave_rateop.py +8 -86
  181. compass_api_sdk/models/v1_aave_reserve_overviewop.py +8 -86
  182. compass_api_sdk/models/v1_aave_std_rateop.py +15 -93
  183. compass_api_sdk/models/v1_aave_token_priceop.py +8 -86
  184. compass_api_sdk/models/v1_aave_user_position_per_tokenop.py +14 -92
  185. compass_api_sdk/models/v1_aave_user_position_summaryop.py +8 -8
  186. compass_api_sdk/models/v1_aerodrome_slipstream_liquidity_provision_positionsop.py +48 -3
  187. compass_api_sdk/models/v1_aerodrome_slipstream_pool_priceop.py +12 -168
  188. compass_api_sdk/models/v1_ethena_vaultop.py +1 -1
  189. compass_api_sdk/models/v1_generic_allowanceop.py +12 -26
  190. compass_api_sdk/models/v1_generic_ensop.py +2 -2
  191. compass_api_sdk/models/v1_generic_portfolioop.py +2 -2
  192. compass_api_sdk/models/v1_morpho_market_positionop.py +3 -3
  193. compass_api_sdk/models/v1_morpho_marketop.py +2 -2
  194. compass_api_sdk/models/v1_morpho_marketsop.py +10 -30
  195. compass_api_sdk/models/v1_morpho_user_positionop.py +2 -2
  196. compass_api_sdk/models/v1_morpho_vaultop.py +8 -8
  197. compass_api_sdk/models/v1_morpho_vaultsop.py +6 -16
  198. compass_api_sdk/models/v1_pendle_marketop.py +8 -8
  199. compass_api_sdk/models/v1_pendle_marketsop.py +1 -1
  200. compass_api_sdk/models/v1_pendle_positionsop.py +2 -2
  201. compass_api_sdk/models/v1_sky_positionop.py +5 -6
  202. compass_api_sdk/models/v1_token_balanceop.py +12 -25
  203. compass_api_sdk/models/{v1_generic_supported_tokensop.py → v1_token_listop.py} +6 -6
  204. compass_api_sdk/models/v1_token_priceop.py +8 -9
  205. compass_api_sdk/models/v1_transaction_bundler_aave_loopop.py +6 -6
  206. compass_api_sdk/models/v1_uniswap_liquidity_provision_in_rangeop.py +2 -2
  207. compass_api_sdk/models/v1_uniswap_liquidity_provision_positionsop.py +2 -2
  208. compass_api_sdk/models/v1_uniswap_pool_priceop.py +12 -168
  209. compass_api_sdk/models/v1_uniswap_quote_buy_exactlyop.py +20 -176
  210. compass_api_sdk/models/v1_uniswap_quote_sell_exactlyop.py +20 -176
  211. compass_api_sdk/models/v1_vaults_vaultop.py +8 -8
  212. compass_api_sdk/models/v1_wildcat_marketop.py +82 -0
  213. compass_api_sdk/models/v2_cctp_mintop.py +47 -0
  214. compass_api_sdk/models/v2_earn_aave_marketsop.py +57 -0
  215. compass_api_sdk/models/v2_earn_pendle_marketsop.py +105 -0
  216. compass_api_sdk/models/v2_earn_positionsop.py +31 -0
  217. compass_api_sdk/models/v2_earn_vaultsop.py +105 -0
  218. compass_api_sdk/models/v2bundlerequest.py +33 -0
  219. compass_api_sdk/models/v2bundleresponse.py +67 -0
  220. compass_api_sdk/models/v2useroperation.py +37 -0
  221. compass_api_sdk/models/vault.py +14 -14
  222. compass_api_sdk/models/vaultdepositrequest.py +6 -1
  223. compass_api_sdk/models/vaultgetvaultresponse.py +5 -5
  224. compass_api_sdk/models/vaultinfo.py +129 -0
  225. compass_api_sdk/models/vaultsresponse.py +30 -0
  226. compass_api_sdk/models/vaultvenue.py +27 -0
  227. compass_api_sdk/models/vaultwithdrawrequest.py +6 -1
  228. compass_api_sdk/models/wildcatgetmarketresponse.py +151 -0
  229. compass_api_sdk/models/{redeemunderlying.py → withdraw.py} +2 -2
  230. compass_api_sdk/models/withdrawalevent.py +61 -0
  231. compass_api_sdk/models/wrapethrequest.py +6 -1
  232. compass_api_sdk/morpho.py +126 -78
  233. compass_api_sdk/pendle.py +68 -44
  234. compass_api_sdk/sdk.py +18 -11
  235. compass_api_sdk/sky.py +62 -38
  236. compass_api_sdk/smart_account.py +10 -2
  237. compass_api_sdk/swap.py +22 -22
  238. compass_api_sdk/{token_sdk.py → token.py} +511 -103
  239. compass_api_sdk/transaction_bundler.py +46 -16
  240. compass_api_sdk/types/basemodel.py +41 -3
  241. compass_api_sdk/uniswap_v3.py +152 -114
  242. compass_api_sdk/universal.py +44 -606
  243. compass_api_sdk/utils/__init__.py +0 -3
  244. compass_api_sdk/utils/annotations.py +32 -8
  245. compass_api_sdk/utils/enums.py +60 -0
  246. compass_api_sdk/utils/forms.py +21 -10
  247. compass_api_sdk/utils/queryparams.py +14 -2
  248. compass_api_sdk/utils/requestbodies.py +3 -3
  249. compass_api_sdk/utils/retries.py +69 -5
  250. compass_api_sdk/utils/serializers.py +0 -20
  251. compass_api_sdk/utils/unmarshal_json_response.py +15 -1
  252. compass_api_sdk/wildcat.py +208 -0
  253. compass_api_sdk-2.2.1rc3.dist-info/METADATA +624 -0
  254. compass_api_sdk-2.2.1rc3.dist-info/RECORD +356 -0
  255. {compass_api_sdk-1.1.1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/WHEEL +1 -1
  256. compass_api_sdk/models/aerodromeposition.py +0 -70
  257. compass_api_sdk/models/token_enum.py +0 -81
  258. compass_api_sdk/models/tokenaddressresponse.py +0 -15
  259. compass_api_sdk/models/tokeninfo.py +0 -17
  260. compass_api_sdk/models/v1_token_addressop.py +0 -109
  261. compass_api_sdk/models/vaultposition.py +0 -24
  262. compass_api_sdk-1.1.1.dist-info/METADATA +0 -592
  263. compass_api_sdk-1.1.1.dist-info/RECORD +0 -275
@@ -1,592 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: compass_api_sdk
3
- Version: 1.1.1
4
- Summary: Compass API SDK.
5
- Author: royalnine
6
- Requires-Python: >=3.9.2
7
- Classifier: Programming Language :: Python :: 3
8
- Classifier: Programming Language :: Python :: 3.10
9
- Classifier: Programming Language :: Python :: 3.11
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: Programming Language :: Python :: 3.13
12
- Classifier: Programming Language :: Python :: 3.14
13
- Requires-Dist: httpcore (>=1.0.9)
14
- Requires-Dist: httpx (>=0.28.1)
15
- Requires-Dist: pydantic (>=2.11.2)
16
- Project-URL: Repository, https://github.com/CompassLabs/mono.git
17
- Description-Content-Type: text/markdown
18
-
19
- # compass_api_sdk
20
-
21
- Developer-friendly & type-safe Python SDK specifically catered to leverage *compass_api_sdk* API.
22
-
23
- <!-- Start Summary [summary] -->
24
- ## Summary
25
-
26
- Compass API: Compass Labs DeFi API
27
- <!-- End Summary [summary] -->
28
-
29
- <!-- Start Table of Contents [toc] -->
30
- ## Table of Contents
31
- <!-- $toc-max-depth=2 -->
32
- * [compass_api_sdk](https://github.com/CompassLabs/mono/blob/master/python-sdk/#compassapisdk)
33
- * [SDK Installation](https://github.com/CompassLabs/mono/blob/master/python-sdk/#sdk-installation)
34
- * [IDE Support](https://github.com/CompassLabs/mono/blob/master/python-sdk/#ide-support)
35
- * [SDK Example Usage](https://github.com/CompassLabs/mono/blob/master/python-sdk/#sdk-example-usage)
36
- * [Authentication](https://github.com/CompassLabs/mono/blob/master/python-sdk/#authentication)
37
- * [Available Resources and Operations](https://github.com/CompassLabs/mono/blob/master/python-sdk/#available-resources-and-operations)
38
- * [Retries](https://github.com/CompassLabs/mono/blob/master/python-sdk/#retries)
39
- * [Error Handling](https://github.com/CompassLabs/mono/blob/master/python-sdk/#error-handling)
40
- * [Server Selection](https://github.com/CompassLabs/mono/blob/master/python-sdk/#server-selection)
41
- * [Custom HTTP Client](https://github.com/CompassLabs/mono/blob/master/python-sdk/#custom-http-client)
42
- * [Resource Management](https://github.com/CompassLabs/mono/blob/master/python-sdk/#resource-management)
43
- * [Debugging](https://github.com/CompassLabs/mono/blob/master/python-sdk/#debugging)
44
- * [Development](https://github.com/CompassLabs/mono/blob/master/python-sdk/#development)
45
- * [Maturity](https://github.com/CompassLabs/mono/blob/master/python-sdk/#maturity)
46
- * [Contributions](https://github.com/CompassLabs/mono/blob/master/python-sdk/#contributions)
47
-
48
- <!-- End Table of Contents [toc] -->
49
-
50
- <!-- Start SDK Installation [installation] -->
51
- ## SDK Installation
52
-
53
- > [!NOTE]
54
- > **Python version upgrade policy**
55
- >
56
- > Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
57
-
58
- The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
59
-
60
- ### uv
61
-
62
- *uv* is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
63
-
64
- ```bash
65
- uv add compass_api_sdk
66
- ```
67
-
68
- ### PIP
69
-
70
- *PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
71
-
72
- ```bash
73
- pip install compass_api_sdk
74
- ```
75
-
76
- ### Poetry
77
-
78
- *Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.
79
-
80
- ```bash
81
- poetry add compass_api_sdk
82
- ```
83
-
84
- ### Shell and script usage with `uv`
85
-
86
- You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:
87
-
88
- ```shell
89
- uvx --from compass_api_sdk python
90
- ```
91
-
92
- It's also possible to write a standalone Python script without needing to set up a whole project like so:
93
-
94
- ```python
95
- #!/usr/bin/env -S uv run --script
96
- # /// script
97
- # requires-python = ">=3.9"
98
- # dependencies = [
99
- # "compass_api_sdk",
100
- # ]
101
- # ///
102
-
103
- from compass_api_sdk import CompassAPI
104
-
105
- sdk = CompassAPI(
106
- # SDK arguments
107
- )
108
-
109
- # Rest of script here...
110
- ```
111
-
112
- Once that is saved to a file, you can run it with `uv run script.py` where
113
- `script.py` can be replaced with the actual file name.
114
- <!-- End SDK Installation [installation] -->
115
-
116
- <!-- Start IDE Support [idesupport] -->
117
- ## IDE Support
118
-
119
- ### PyCharm
120
-
121
- Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
122
-
123
- - [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
124
- <!-- End IDE Support [idesupport] -->
125
-
126
- <!-- Start SDK Example Usage [usage] -->
127
- ## SDK Example Usage
128
-
129
- ### Example
130
-
131
- ```python
132
- # Synchronous Example
133
- from compass_api_sdk import CompassAPI, models
134
-
135
-
136
- with CompassAPI(
137
- api_key_auth="<YOUR_API_KEY_HERE>",
138
- ) as compass_api:
139
-
140
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
141
-
142
- # Handle response
143
- print(res)
144
- ```
145
-
146
- </br>
147
-
148
- The same SDK client can also be used to make asynchronous requests by importing asyncio.
149
- ```python
150
- # Asynchronous Example
151
- import asyncio
152
- from compass_api_sdk import CompassAPI, models
153
-
154
- async def main():
155
-
156
- async with CompassAPI(
157
- api_key_auth="<YOUR_API_KEY_HERE>",
158
- ) as compass_api:
159
-
160
- res = await compass_api.aave_v3.aave_aave_supported_tokens_async(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
161
-
162
- # Handle response
163
- print(res)
164
-
165
- asyncio.run(main())
166
- ```
167
- <!-- End SDK Example Usage [usage] -->
168
-
169
- <!-- Start Authentication [security] -->
170
- ## Authentication
171
-
172
- ### Per-Client Security Schemes
173
-
174
- This SDK supports the following security scheme globally:
175
-
176
- | Name | Type | Scheme |
177
- | -------------- | ------ | ------- |
178
- | `api_key_auth` | apiKey | API key |
179
-
180
- To authenticate with the API the `api_key_auth` parameter must be set when initializing the SDK client instance. For example:
181
- ```python
182
- from compass_api_sdk import CompassAPI, models
183
-
184
-
185
- with CompassAPI(
186
- api_key_auth="<YOUR_API_KEY_HERE>",
187
- ) as compass_api:
188
-
189
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
190
-
191
- # Handle response
192
- print(res)
193
-
194
- ```
195
- <!-- End Authentication [security] -->
196
-
197
- <!-- Start Available Resources and Operations [operations] -->
198
- ## Available Resources and Operations
199
-
200
- <details open>
201
- <summary>Available methods</summary>
202
-
203
- ### [aave_v3](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md)
204
-
205
- * [aave_aave_supported_tokens](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_aave_supported_tokens) - Aave Supported Tokens
206
- * [aave_rate](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_rate) - Interest Rates
207
- * [aave_avg_rate](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_avg_rate) - Interest Rates: Time Average
208
- * [aave_std_rate](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_std_rate) - Interest Rates: Standard Deviation
209
- * [aave_reserve_overview](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_reserve_overview) - Reserve Overview
210
- * [aave_token_price](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_token_price) - Token Prices
211
- * [aave_liquidity_change](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_liquidity_change) - Liquidity Index
212
- * [aave_user_position_summary](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_user_position_summary) - Positions - Total
213
- * [aave_user_position_per_token](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_user_position_per_token) - Positions - per Token
214
- * [aave_historical_transactions](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_historical_transactions) - Historical Transactions
215
- * [aave_supply](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_supply) - Supply/Lend
216
- * [aave_borrow](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_borrow) - Borrow
217
- * [aave_repay](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_repay) - Repay Loans
218
- * [aave_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aavev3/README.md#aave_withdraw) - Unstake
219
-
220
- ### [aerodrome_slipstream](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md)
221
-
222
- * [aerodrome_slipstream_liquidity_provision_positions](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_positions) - List LP Positions
223
- * [aerodrome_slipstream_pool_price](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_pool_price) - Pool Price
224
- * [aerodrome_slipstream_swap_sell_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_swap_sell_exactly) - Swap - from Specified Amount
225
- * [aerodrome_slipstream_swap_buy_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_swap_buy_exactly) - Swap - into Specified Amount
226
- * [aerodrome_slipstream_liquidity_provision_mint](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_mint) - Open a New LP Position
227
- * [aerodrome_slipstream_liquidity_provision_increase](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_increase) - Increase an LP Position
228
- * [aerodrome_slipstream_liquidity_provision_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_withdraw) - Withdraw an LP Position
229
-
230
-
231
- ### [erc_4626_vaults](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/erc4626vaults/README.md)
232
-
233
- * [vaults_vault](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/erc4626vaults/README.md#vaults_vault) - Get Vault & User Position
234
- * [vaults_deposit](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/erc4626vaults/README.md#vaults_deposit) - Deposit to Vault
235
- * [vaults_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/erc4626vaults/README.md#vaults_withdraw) - Withdraw from Vault
236
-
237
- ### [ethena](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/ethena/README.md)
238
-
239
- * [ethena_vault](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/ethena/README.md#ethena_vault) - Get Vault & User Position
240
- * [ethena_deposit](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/ethena/README.md#ethena_deposit) - Deposit USDe
241
- * [ethena_request](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/ethena/README.md#ethena_request) - Request to Withdraw USDe
242
- * [ethena_unstake](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/ethena/README.md#ethena_unstake) - Unstake USDe
243
-
244
- ### [morpho](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md)
245
-
246
- * [morpho_vaults](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_vaults) - Get Vaults
247
- * [morpho_vault](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_vault) - Get Vault & User Position
248
- * [morpho_markets](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_markets) - Get Markets
249
- * [morpho_market](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_market) - Get Market
250
- * [morpho_market_position](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_market_position) - Check Market Position
251
- * [morpho_user_position](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_user_position) - Check User Position
252
- * [morpho_deposit](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_deposit) - Deposit to Vault
253
- * [morpho_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_withdraw) - Withdraw from Vault
254
- * [morpho_supply_collateral](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_supply_collateral) - Supply Collateral to Market
255
- * [morpho_withdraw_collateral](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_withdraw_collateral) - Withdraw Collateral from Market
256
- * [morpho_borrow](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_borrow) - Borrow from Market
257
- * [morpho_repay](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/morpho/README.md#morpho_repay) - Repay to Market
258
-
259
- ### [pendle](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md)
260
-
261
- * [pendle_market](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_market) - Get Market & User Position
262
- * [pendle_positions](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_positions) - List User's Market Positions
263
- * [pendle_markets](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_markets) - List Market Data
264
- * [pendle_pt](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_pt) - Trade Principal Token (PT)
265
- * [pendle_yt](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_yt) - Trade Yield Token (YT)
266
- * [pendle_liquidity](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_liquidity) - Manage Liquidity (LP)
267
- * [pendle_redeem_yield](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/pendle/README.md#pendle_redeem_yield) - Redeem Claimable Yield
268
-
269
- ### [sky](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md)
270
-
271
- * [sky_position](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md#sky_position) - Check USDS Position
272
- * [sky_buy](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md#sky_buy) - Buy USDS
273
- * [sky_sell](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md#sky_sell) - Sell USDS
274
- * [sky_deposit](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md#sky_deposit) - Deposit USDS
275
- * [sky_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/sky/README.md#sky_withdraw) - Withdraw USDS
276
-
277
- ### [smart_account](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/smartaccount/README.md)
278
-
279
- * [smart_account_batched_user_operations](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/smartaccount/README.md#smart_account_batched_user_operations) - Get Smart Account Batched User Operations
280
-
281
- ### [swap](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/swap/README.md)
282
-
283
- * [swap_odos](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/swap/README.md#swap_odos) - Odos Swap
284
-
285
- ### [token](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/tokensdk/README.md)
286
-
287
- * [token_address](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/tokensdk/README.md#token_address) - Token Address
288
- * [token_price](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/tokensdk/README.md#token_price) - Token Price
289
- * [token_balance](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/tokensdk/README.md#token_balance) - Token Balance
290
- * [token_transfer](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/tokensdk/README.md#token_transfer) - Transfer Tokens
291
-
292
- ### [transaction_bundler](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/transactionbundler/README.md)
293
-
294
- * [transaction_bundler_authorization](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/transactionbundler/README.md#transaction_bundler_authorization) - Enable Transaction Bundling
295
- * [transaction_bundler_execute](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/transactionbundler/README.md#transaction_bundler_execute) - Construct Bundled Transaction
296
- * [transaction_bundler_aave_loop](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/transactionbundler/README.md#transaction_bundler_aave_loop) - AAVE Leverage Long/Short
297
-
298
- ### [uniswap_v3](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md)
299
-
300
- * [uniswap_quote_buy_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_quote_buy_exactly) - Get Quote - to Specified Amount
301
- * [uniswap_quote_sell_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_quote_sell_exactly) - Get quote - From Specified Amount
302
- * [uniswap_pool_price](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_pool_price) - Pool Price
303
- * [uniswap_liquidity_provision_in_range](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_in_range) - Check if LP is Active.
304
- * [uniswap_liquidity_provision_positions](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_positions) - List LP
305
- * [uniswap_swap_buy_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_swap_buy_exactly) - Buy exact amount
306
- * [uniswap_swap_sell_exactly](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_swap_sell_exactly) - Sell exact amount
307
- * [uniswap_liquidity_provision_mint](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_mint) - Open a new LP position
308
- * [uniswap_liquidity_provision_increase](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_increase) - Increase an LP position
309
- * [uniswap_liquidity_provision_withdraw](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_withdraw) - Withdraw an LP position
310
-
311
- ### [universal](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md)
312
-
313
- * [generic_portfolio](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_portfolio) - List User Portfolio
314
- * [generic_supported_tokens](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_supported_tokens) - List Supported Tokens
315
- * [generic_supported_chains](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_supported_chains) - List Supported Chains
316
- * [generic_allowance](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_allowance) - Get Allowance
317
- * [generic_ens](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_ens) - Resolve ENS
318
- * [generic_wrap_eth](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_wrap_eth) - Wrap ETH
319
- * [generic_unwrap_weth](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_unwrap_weth) - Unwrap WETH
320
- * [generic_allowance_set](https://github.com/CompassLabs/mono/blob/master/python-sdk/docs/sdks/universal/README.md#generic_allowance_set) - Set Allowance
321
-
322
- </details>
323
- <!-- End Available Resources and Operations [operations] -->
324
-
325
- <!-- Start Retries [retries] -->
326
- ## Retries
327
-
328
- Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
329
-
330
- To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
331
- ```python
332
- from compass_api_sdk import CompassAPI, models
333
- from compass_api_sdk.utils import BackoffStrategy, RetryConfig
334
-
335
-
336
- with CompassAPI(
337
- api_key_auth="<YOUR_API_KEY_HERE>",
338
- ) as compass_api:
339
-
340
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM,
341
- RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
342
-
343
- # Handle response
344
- print(res)
345
-
346
- ```
347
-
348
- If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
349
- ```python
350
- from compass_api_sdk import CompassAPI, models
351
- from compass_api_sdk.utils import BackoffStrategy, RetryConfig
352
-
353
-
354
- with CompassAPI(
355
- retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
356
- api_key_auth="<YOUR_API_KEY_HERE>",
357
- ) as compass_api:
358
-
359
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
360
-
361
- # Handle response
362
- print(res)
363
-
364
- ```
365
- <!-- End Retries [retries] -->
366
-
367
- <!-- Start Error Handling [errors] -->
368
- ## Error Handling
369
-
370
- [`CompassAPIError`](https://github.com/CompassLabs/mono/blob/master/python-sdk/./src/compass_api_sdk/errors/compassapierror.py) is the base class for all HTTP error responses. It has the following properties:
371
-
372
- | Property | Type | Description |
373
- | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
374
- | `err.message` | `str` | Error message |
375
- | `err.status_code` | `int` | HTTP response status code eg `404` |
376
- | `err.headers` | `httpx.Headers` | HTTP response headers |
377
- | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
378
- | `err.raw_response` | `httpx.Response` | Raw HTTP response |
379
- | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](https://github.com/CompassLabs/mono/blob/master/python-sdk/#error-classes). |
380
-
381
- ### Example
382
- ```python
383
- from compass_api_sdk import CompassAPI, errors, models
384
-
385
-
386
- with CompassAPI(
387
- api_key_auth="<YOUR_API_KEY_HERE>",
388
- ) as compass_api:
389
- res = None
390
- try:
391
-
392
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
393
-
394
- # Handle response
395
- print(res)
396
-
397
-
398
- except errors.CompassAPIError as e:
399
- # The base class for HTTP error responses
400
- print(e.message)
401
- print(e.status_code)
402
- print(e.body)
403
- print(e.headers)
404
- print(e.raw_response)
405
-
406
- # Depending on the method different errors may be thrown
407
- if isinstance(e, errors.HTTPValidationError):
408
- print(e.data.detail) # Optional[List[models.ValidationError]]
409
- ```
410
-
411
- ### Error Classes
412
- **Primary errors:**
413
- * [`CompassAPIError`](https://github.com/CompassLabs/mono/blob/master/python-sdk/./src/compass_api_sdk/errors/compassapierror.py): The base class for HTTP error responses.
414
- * [`HTTPValidationError`](https://github.com/CompassLabs/mono/blob/master/python-sdk/./src/compass_api_sdk/errors/httpvalidationerror.py): Validation Error. Status code `422`.
415
-
416
- <details><summary>Less common errors (5)</summary>
417
-
418
- <br />
419
-
420
- **Network errors:**
421
- * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
422
- * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
423
- * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
424
-
425
-
426
- **Inherit from [`CompassAPIError`](https://github.com/CompassLabs/mono/blob/master/python-sdk/./src/compass_api_sdk/errors/compassapierror.py)**:
427
- * [`ResponseValidationError`](https://github.com/CompassLabs/mono/blob/master/python-sdk/./src/compass_api_sdk/errors/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute.
428
-
429
- </details>
430
- <!-- End Error Handling [errors] -->
431
-
432
- <!-- Start Server Selection [server] -->
433
- ## Server Selection
434
-
435
- ### Override Server URL Per-Client
436
-
437
- The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
438
- ```python
439
- from compass_api_sdk import CompassAPI, models
440
-
441
-
442
- with CompassAPI(
443
- server_url="https://api.compasslabs.ai",
444
- api_key_auth="<YOUR_API_KEY_HERE>",
445
- ) as compass_api:
446
-
447
- res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
448
-
449
- # Handle response
450
- print(res)
451
-
452
- ```
453
- <!-- End Server Selection [server] -->
454
-
455
- <!-- Start Custom HTTP Client [http-client] -->
456
- ## Custom HTTP Client
457
-
458
- The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
459
- Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
460
- This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
461
-
462
- For example, you could specify a header for every request that this sdk makes as follows:
463
- ```python
464
- from compass_api_sdk import CompassAPI
465
- import httpx
466
-
467
- http_client = httpx.Client(headers={"x-custom-header": "someValue"})
468
- s = CompassAPI(client=http_client)
469
- ```
470
-
471
- or you could wrap the client with your own custom logic:
472
- ```python
473
- from compass_api_sdk import CompassAPI
474
- from compass_api_sdk.httpclient import AsyncHttpClient
475
- import httpx
476
-
477
- class CustomClient(AsyncHttpClient):
478
- client: AsyncHttpClient
479
-
480
- def __init__(self, client: AsyncHttpClient):
481
- self.client = client
482
-
483
- async def send(
484
- self,
485
- request: httpx.Request,
486
- *,
487
- stream: bool = False,
488
- auth: Union[
489
- httpx._types.AuthTypes, httpx._client.UseClientDefault, None
490
- ] = httpx.USE_CLIENT_DEFAULT,
491
- follow_redirects: Union[
492
- bool, httpx._client.UseClientDefault
493
- ] = httpx.USE_CLIENT_DEFAULT,
494
- ) -> httpx.Response:
495
- request.headers["Client-Level-Header"] = "added by client"
496
-
497
- return await self.client.send(
498
- request, stream=stream, auth=auth, follow_redirects=follow_redirects
499
- )
500
-
501
- def build_request(
502
- self,
503
- method: str,
504
- url: httpx._types.URLTypes,
505
- *,
506
- content: Optional[httpx._types.RequestContent] = None,
507
- data: Optional[httpx._types.RequestData] = None,
508
- files: Optional[httpx._types.RequestFiles] = None,
509
- json: Optional[Any] = None,
510
- params: Optional[httpx._types.QueryParamTypes] = None,
511
- headers: Optional[httpx._types.HeaderTypes] = None,
512
- cookies: Optional[httpx._types.CookieTypes] = None,
513
- timeout: Union[
514
- httpx._types.TimeoutTypes, httpx._client.UseClientDefault
515
- ] = httpx.USE_CLIENT_DEFAULT,
516
- extensions: Optional[httpx._types.RequestExtensions] = None,
517
- ) -> httpx.Request:
518
- return self.client.build_request(
519
- method,
520
- url,
521
- content=content,
522
- data=data,
523
- files=files,
524
- json=json,
525
- params=params,
526
- headers=headers,
527
- cookies=cookies,
528
- timeout=timeout,
529
- extensions=extensions,
530
- )
531
-
532
- s = CompassAPI(async_client=CustomClient(httpx.AsyncClient()))
533
- ```
534
- <!-- End Custom HTTP Client [http-client] -->
535
-
536
- <!-- Start Resource Management [resource-management] -->
537
- ## Resource Management
538
-
539
- The `CompassAPI` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
540
-
541
- [context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
542
-
543
- ```python
544
- from compass_api_sdk import CompassAPI
545
- def main():
546
-
547
- with CompassAPI(
548
- api_key_auth="<YOUR_API_KEY_HERE>",
549
- ) as compass_api:
550
- # Rest of application here...
551
-
552
-
553
- # Or when using async:
554
- async def amain():
555
-
556
- async with CompassAPI(
557
- api_key_auth="<YOUR_API_KEY_HERE>",
558
- ) as compass_api:
559
- # Rest of application here...
560
- ```
561
- <!-- End Resource Management [resource-management] -->
562
-
563
- <!-- Start Debugging [debug] -->
564
- ## Debugging
565
-
566
- You can setup your SDK to emit debug logs for SDK requests and responses.
567
-
568
- You can pass your own logger class directly into your SDK.
569
- ```python
570
- from compass_api_sdk import CompassAPI
571
- import logging
572
-
573
- logging.basicConfig(level=logging.DEBUG)
574
- s = CompassAPI(debug_logger=logging.getLogger("compass_api_sdk"))
575
- ```
576
- <!-- End Debugging [debug] -->
577
-
578
- # Development
579
-
580
- ## Maturity
581
-
582
- This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
583
- to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
584
- looking for the latest version.
585
-
586
- ## Contributions
587
-
588
- While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
589
- We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
590
-
591
- <!-- Placeholder for Future Speakeasy SDK Sections -->
592
-