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
@@ -0,0 +1,624 @@
1
+ Metadata-Version: 2.4
2
+ Name: compass_api_sdk
3
+ Version: 2.2.1rc3
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
+
24
+
25
+
26
+ <!-- Start Summary [summary] -->
27
+ ## Summary
28
+
29
+ Compass API: Compass Labs DeFi API
30
+ <!-- End Summary [summary] -->
31
+
32
+ <!-- Start Table of Contents [toc] -->
33
+ ## Table of Contents
34
+ <!-- $toc-max-depth=2 -->
35
+ * [compass_api_sdk](#compassapisdk)
36
+ * [SDK Installation](#sdk-installation)
37
+ * [IDE Support](#ide-support)
38
+ * [SDK Example Usage](#sdk-example-usage)
39
+ * [Authentication](#authentication)
40
+ * [Available Resources and Operations](#available-resources-and-operations)
41
+ * [Retries](#retries)
42
+ * [Error Handling](#error-handling)
43
+ * [Server Selection](#server-selection)
44
+ * [Custom HTTP Client](#custom-http-client)
45
+ * [Resource Management](#resource-management)
46
+ * [Debugging](#debugging)
47
+ * [Development](#development)
48
+ * [Maturity](#maturity)
49
+ * [Contributions](#contributions)
50
+
51
+ <!-- End Table of Contents [toc] -->
52
+
53
+ <!-- Start SDK Installation [installation] -->
54
+ ## SDK Installation
55
+
56
+
57
+
58
+ >
59
+
60
+ The SDK can be installed with *uv*, *pip*, or *poetry* package managers.
61
+
62
+ ### uv
63
+
64
+ *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.
65
+
66
+ ```bash
67
+ uv add git+https://github.com/CompassLabs/mono.git#subdirectory=python-sdk
68
+ ```
69
+
70
+ ### PIP
71
+
72
+ *PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
73
+
74
+ ```bash
75
+ pip install git+https://github.com/CompassLabs/mono.git#subdirectory=python-sdk
76
+ ```
77
+
78
+ ### Poetry
79
+
80
+ *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.
81
+
82
+ ```bash
83
+ poetry add git+https://github.com/CompassLabs/mono.git#subdirectory=python-sdk
84
+ ```
85
+
86
+ ### Shell and script usage with `uv`
87
+
88
+ 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:
89
+
90
+ ```shell
91
+ uvx --from compass_api_sdk python
92
+ ```
93
+
94
+ It's also possible to write a standalone Python script without needing to set up a whole project like so:
95
+
96
+ ```python
97
+ #!/usr/bin/env -S uv run --script
98
+ # /// script
99
+ # requires-python = ">=3.9"
100
+ # dependencies = [
101
+ # "compass_api_sdk",
102
+ # ]
103
+ # ///
104
+
105
+ from compass_api_sdk import CompassAPI
106
+
107
+ sdk = CompassAPI(
108
+ # SDK arguments
109
+ )
110
+
111
+ # Rest of script here...
112
+ ```
113
+
114
+ Once that is saved to a file, you can run it with `uv run script.py` where
115
+ `script.py` can be replaced with the actual file name.
116
+ <!-- End SDK Installation [installation] -->
117
+
118
+ <!-- Start IDE Support [idesupport] -->
119
+ ## IDE Support
120
+
121
+ ### PyCharm
122
+
123
+ 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.
124
+
125
+ - [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
126
+ <!-- End IDE Support [idesupport] -->
127
+
128
+ <!-- Start SDK Example Usage [usage] -->
129
+ ## SDK Example Usage
130
+
131
+ ### Example
132
+
133
+ ```python
134
+ # Synchronous Example
135
+ from compass_api_sdk import CompassAPI, models
136
+
137
+
138
+ with CompassAPI(
139
+ api_key_auth="<YOUR_API_KEY_HERE>",
140
+ ) as compass_api:
141
+
142
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
143
+
144
+ # Handle response
145
+ print(res)
146
+ ```
147
+
148
+ </br>
149
+
150
+ The same SDK client can also be used to make asynchronous requests by importing asyncio.
151
+
152
+ ```python
153
+ # Asynchronous Example
154
+ import asyncio
155
+ from compass_api_sdk import CompassAPI, models
156
+
157
+ async def main():
158
+
159
+ async with CompassAPI(
160
+ api_key_auth="<YOUR_API_KEY_HERE>",
161
+ ) as compass_api:
162
+
163
+ res = await compass_api.aave_v3.aave_aave_supported_tokens_async(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
164
+
165
+ # Handle response
166
+ print(res)
167
+
168
+ asyncio.run(main())
169
+ ```
170
+ <!-- End SDK Example Usage [usage] -->
171
+
172
+ <!-- Start Authentication [security] -->
173
+ ## Authentication
174
+
175
+ ### Per-Client Security Schemes
176
+
177
+ This SDK supports the following security scheme globally:
178
+
179
+ | Name | Type | Scheme |
180
+ | -------------- | ------ | ------- |
181
+ | `api_key_auth` | apiKey | API key |
182
+
183
+ To authenticate with the API the `api_key_auth` parameter must be set when initializing the SDK client instance. For example:
184
+ ```python
185
+ from compass_api_sdk import CompassAPI, models
186
+
187
+
188
+ with CompassAPI(
189
+ api_key_auth="<YOUR_API_KEY_HERE>",
190
+ ) as compass_api:
191
+
192
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
193
+
194
+ # Handle response
195
+ print(res)
196
+
197
+ ```
198
+ <!-- End Authentication [security] -->
199
+
200
+ <!-- Start Available Resources and Operations [operations] -->
201
+ ## Available Resources and Operations
202
+
203
+ <details open>
204
+ <summary>Available methods</summary>
205
+
206
+ ### [AaveV3](docs/sdks/aavev3/README.md)
207
+
208
+ * [aave_aave_supported_tokens](docs/sdks/aavev3/README.md#aave_aave_supported_tokens) - Aave Supported Tokens
209
+ * [aave_rate](docs/sdks/aavev3/README.md#aave_rate) - Interest Rates
210
+ * [aave_avg_rate](docs/sdks/aavev3/README.md#aave_avg_rate) - Interest Rates: Time Average
211
+ * [aave_std_rate](docs/sdks/aavev3/README.md#aave_std_rate) - Interest Rates: Standard Deviation
212
+ * [aave_reserve_overview](docs/sdks/aavev3/README.md#aave_reserve_overview) - Reserve Overview
213
+ * [aave_token_price](docs/sdks/aavev3/README.md#aave_token_price) - Token Prices
214
+ * [aave_liquidity_change](docs/sdks/aavev3/README.md#aave_liquidity_change) - Liquidity Index
215
+ * [aave_user_position_summary](docs/sdks/aavev3/README.md#aave_user_position_summary) - Positions - Total
216
+ * [aave_user_position_per_token](docs/sdks/aavev3/README.md#aave_user_position_per_token) - Positions - per Token
217
+ * [aave_historical_transactions](docs/sdks/aavev3/README.md#aave_historical_transactions) - Historical Transactions
218
+ * [aave_supply](docs/sdks/aavev3/README.md#aave_supply) - Supply/Lend
219
+ * [aave_borrow](docs/sdks/aavev3/README.md#aave_borrow) - Borrow
220
+ * [aave_repay](docs/sdks/aavev3/README.md#aave_repay) - Repay Loans
221
+ * [aave_withdraw](docs/sdks/aavev3/README.md#aave_withdraw) - Unstake
222
+ * [aave_set_user_emode](docs/sdks/aavev3/README.md#aave_set_user_emode) - Set User eMode
223
+
224
+ ### [AerodromeSlipstream](docs/sdks/aerodromeslipstream/README.md)
225
+
226
+ * [aerodrome_slipstream_liquidity_provision_positions](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_positions) - List LP Positions
227
+ * [aerodrome_slipstream_pool_price](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_pool_price) - Pool Price
228
+ * [aerodrome_slipstream_swap_sell_exactly](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_swap_sell_exactly) - Swap - from Specified Amount
229
+ * [aerodrome_slipstream_swap_buy_exactly](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_swap_buy_exactly) - Swap - into Specified Amount
230
+ * [aerodrome_slipstream_liquidity_provision_mint](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_mint) - Open a New LP Position
231
+ * [aerodrome_slipstream_liquidity_provision_increase](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_increase) - Increase an LP Position
232
+ * [aerodrome_slipstream_liquidity_provision_withdraw](docs/sdks/aerodromeslipstream/README.md#aerodrome_slipstream_liquidity_provision_withdraw) - Withdraw an LP Position
233
+
234
+ ### [Bridge](docs/sdks/bridge/README.md)
235
+
236
+ * [cctp_burn](docs/sdks/bridge/README.md#cctp_burn) - Initiate USDC bridging
237
+ * [cctp_mint](docs/sdks/bridge/README.md#cctp_mint) - Complete USDC bridging
238
+
239
+ ### [Earn](docs/sdks/earn/README.md)
240
+
241
+ * [earn_positions](docs/sdks/earn/README.md#earn_positions) - List earn positions
242
+ * [earn_vaults](docs/sdks/earn/README.md#earn_vaults) - List vaults
243
+ * [earn_aave_markets](docs/sdks/earn/README.md#earn_aave_markets) - List aave markets
244
+ * [earn_pendle_markets](docs/sdks/earn/README.md#earn_pendle_markets) - List pendle markets
245
+ * [earn_create_account](docs/sdks/earn/README.md#earn_create_account) - Create earn account
246
+ * [earn_transfer](docs/sdks/earn/README.md#earn_transfer) - Transfer tokens to/from account
247
+ * [earn_manage](docs/sdks/earn/README.md#earn_manage) - Manage earn position
248
+ * [earn_swap](docs/sdks/earn/README.md#earn_swap) - Swap tokens within Earn Account
249
+ * [earn_bundle](docs/sdks/earn/README.md#earn_bundle) - Execute multiple earn actions
250
+
251
+ ### [ERC4626Vaults](docs/sdks/erc4626vaults/README.md)
252
+
253
+ * [vaults_vault](docs/sdks/erc4626vaults/README.md#vaults_vault) - Get Vault & User Position
254
+ * [vaults_deposit](docs/sdks/erc4626vaults/README.md#vaults_deposit) - Deposit to Vault
255
+ * [vaults_withdraw](docs/sdks/erc4626vaults/README.md#vaults_withdraw) - Withdraw from Vault
256
+
257
+ ### [Ethena](docs/sdks/ethena/README.md)
258
+
259
+ * [ethena_vault](docs/sdks/ethena/README.md#ethena_vault) - Get Vault & User Position
260
+ * [ethena_deposit](docs/sdks/ethena/README.md#ethena_deposit) - Deposit USDe
261
+ * [ethena_request](docs/sdks/ethena/README.md#ethena_request) - Request to Withdraw USDe
262
+ * [ethena_unstake](docs/sdks/ethena/README.md#ethena_unstake) - Unstake USDe
263
+
264
+ ### [GasSponsorship](docs/sdks/gassponsorship/README.md)
265
+
266
+ * [gas_sponsorship_prepare](docs/sdks/gassponsorship/README.md#gas_sponsorship_prepare) - Prepare gas-sponsored transaction
267
+ * [gas_sponsorship_approve_transfer](docs/sdks/gassponsorship/README.md#gas_sponsorship_approve_transfer) - Approve token transfer
268
+
269
+ ### [Morpho](docs/sdks/morpho/README.md)
270
+
271
+ * [morpho_vaults](docs/sdks/morpho/README.md#morpho_vaults) - Get Vaults
272
+ * [morpho_vault](docs/sdks/morpho/README.md#morpho_vault) - Get Vault & User Position
273
+ * [morpho_markets](docs/sdks/morpho/README.md#morpho_markets) - Get Markets
274
+ * [morpho_market](docs/sdks/morpho/README.md#morpho_market) - Get Market
275
+ * [morpho_market_position](docs/sdks/morpho/README.md#morpho_market_position) - Check Market Position
276
+ * [morpho_user_position](docs/sdks/morpho/README.md#morpho_user_position) - Check User Position
277
+ * [morpho_deposit](docs/sdks/morpho/README.md#morpho_deposit) - Deposit to Vault
278
+ * [morpho_withdraw](docs/sdks/morpho/README.md#morpho_withdraw) - Withdraw from Vault
279
+ * [morpho_supply_collateral](docs/sdks/morpho/README.md#morpho_supply_collateral) - Supply Collateral to Market
280
+ * [morpho_withdraw_collateral](docs/sdks/morpho/README.md#morpho_withdraw_collateral) - Withdraw Collateral from Market
281
+ * [morpho_borrow](docs/sdks/morpho/README.md#morpho_borrow) - Borrow from Market
282
+ * [morpho_repay](docs/sdks/morpho/README.md#morpho_repay) - Repay to Market
283
+
284
+ ### [Pendle](docs/sdks/pendle/README.md)
285
+
286
+ * [pendle_market](docs/sdks/pendle/README.md#pendle_market) - Get Market & User Position
287
+ * [pendle_positions](docs/sdks/pendle/README.md#pendle_positions) - List User's Market Positions
288
+ * [pendle_markets](docs/sdks/pendle/README.md#pendle_markets) - List Market Data
289
+ * [pendle_pt](docs/sdks/pendle/README.md#pendle_pt) - Trade Principal Token (PT)
290
+ * [pendle_yt](docs/sdks/pendle/README.md#pendle_yt) - Trade Yield Token (YT)
291
+ * [pendle_liquidity](docs/sdks/pendle/README.md#pendle_liquidity) - Manage Liquidity (LP)
292
+ * [pendle_redeem_yield](docs/sdks/pendle/README.md#pendle_redeem_yield) - Redeem Claimable Yield
293
+
294
+ ### [Sky](docs/sdks/sky/README.md)
295
+
296
+ * [sky_position](docs/sdks/sky/README.md#sky_position) - Check USDS Position
297
+ * [sky_buy](docs/sdks/sky/README.md#sky_buy) - Buy USDS
298
+ * [sky_sell](docs/sdks/sky/README.md#sky_sell) - Sell USDS
299
+ * [sky_deposit](docs/sdks/sky/README.md#sky_deposit) - Deposit USDS
300
+ * [sky_withdraw](docs/sdks/sky/README.md#sky_withdraw) - Withdraw USDS
301
+
302
+ ### [SmartAccount](docs/sdks/smartaccount/README.md)
303
+
304
+ * [smart_account_batched_user_operations](docs/sdks/smartaccount/README.md#smart_account_batched_user_operations) - Get Smart Account Batched User Operations
305
+
306
+ ### [Swap](docs/sdks/swap/README.md)
307
+
308
+ * [swap_odos](docs/sdks/swap/README.md#swap_odos) - Odos Swap
309
+
310
+ ### [Token](docs/sdks/token/README.md)
311
+
312
+ * [token_price](docs/sdks/token/README.md#token_price) - Token Price
313
+ * [token_balance](docs/sdks/token/README.md#token_balance) - Token Balance
314
+ * [token_list](docs/sdks/token/README.md#token_list) - List known tokens
315
+ * [token_transfer](docs/sdks/token/README.md#token_transfer) - Transfer Tokens
316
+ * [token_wrap_eth](docs/sdks/token/README.md#token_wrap_eth) - Wrap ETH
317
+ * [token_unwrap_weth](docs/sdks/token/README.md#token_unwrap_weth) - Unwrap WETH
318
+
319
+ ### [TransactionBundler](docs/sdks/transactionbundler/README.md)
320
+
321
+ * [transaction_bundler_authorization](docs/sdks/transactionbundler/README.md#transaction_bundler_authorization) - Enable Transaction Bundling
322
+ * [transaction_bundler_execute](docs/sdks/transactionbundler/README.md#transaction_bundler_execute) - Construct Bundled Transaction
323
+ * [transaction_bundler_aave_loop](docs/sdks/transactionbundler/README.md#transaction_bundler_aave_loop) - AAVE Leverage Long/Short
324
+
325
+ ### [UniswapV3](docs/sdks/uniswapv3/README.md)
326
+
327
+ * [uniswap_quote_buy_exactly](docs/sdks/uniswapv3/README.md#uniswap_quote_buy_exactly) - Get Quote - to Specified Amount
328
+ * [uniswap_quote_sell_exactly](docs/sdks/uniswapv3/README.md#uniswap_quote_sell_exactly) - Get quote - From Specified Amount
329
+ * [uniswap_pool_price](docs/sdks/uniswapv3/README.md#uniswap_pool_price) - Pool Price
330
+ * [uniswap_liquidity_provision_in_range](docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_in_range) - Check if LP is Active.
331
+ * [uniswap_liquidity_provision_positions](docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_positions) - List LP
332
+ * [uniswap_swap_buy_exactly](docs/sdks/uniswapv3/README.md#uniswap_swap_buy_exactly) - Buy exact amount
333
+ * [uniswap_swap_sell_exactly](docs/sdks/uniswapv3/README.md#uniswap_swap_sell_exactly) - Sell exact amount
334
+ * [uniswap_liquidity_provision_mint](docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_mint) - Open a new LP position
335
+ * [uniswap_liquidity_provision_increase](docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_increase) - Increase an LP position
336
+ * [uniswap_liquidity_provision_withdraw](docs/sdks/uniswapv3/README.md#uniswap_liquidity_provision_withdraw) - Withdraw an LP position
337
+
338
+ ### [Universal](docs/sdks/universal/README.md)
339
+
340
+ * [generic_portfolio](docs/sdks/universal/README.md#generic_portfolio) - List User Portfolio
341
+ * [generic_supported_chains](docs/sdks/universal/README.md#generic_supported_chains) - List Supported Chains
342
+ * [generic_allowance](docs/sdks/universal/README.md#generic_allowance) - Get Allowance
343
+ * [generic_ens](docs/sdks/universal/README.md#generic_ens) - Resolve ENS
344
+ * [generic_allowance_set](docs/sdks/universal/README.md#generic_allowance_set) - Set Allowance
345
+
346
+ ### [Wildcat](docs/sdks/wildcat/README.md)
347
+
348
+ * [wildcat_market](docs/sdks/wildcat/README.md#wildcat_market) - Get Market & User Position
349
+
350
+ </details>
351
+ <!-- End Available Resources and Operations [operations] -->
352
+
353
+ <!-- Start Retries [retries] -->
354
+ ## Retries
355
+
356
+ 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.
357
+
358
+ To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
359
+ ```python
360
+ from compass_api_sdk import CompassAPI, models
361
+ from compass_api_sdk.utils import BackoffStrategy, RetryConfig
362
+
363
+
364
+ with CompassAPI(
365
+ api_key_auth="<YOUR_API_KEY_HERE>",
366
+ ) as compass_api:
367
+
368
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM,
369
+ RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
370
+
371
+ # Handle response
372
+ print(res)
373
+
374
+ ```
375
+
376
+ 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:
377
+ ```python
378
+ from compass_api_sdk import CompassAPI, models
379
+ from compass_api_sdk.utils import BackoffStrategy, RetryConfig
380
+
381
+
382
+ with CompassAPI(
383
+ retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
384
+ api_key_auth="<YOUR_API_KEY_HERE>",
385
+ ) as compass_api:
386
+
387
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
388
+
389
+ # Handle response
390
+ print(res)
391
+
392
+ ```
393
+ <!-- End Retries [retries] -->
394
+
395
+ <!-- Start Error Handling [errors] -->
396
+ ## Error Handling
397
+
398
+ [`CompassAPIError`](./src/compass_api_sdk/errors/compassapierror.py) is the base class for all HTTP error responses. It has the following properties:
399
+
400
+ | Property | Type | Description |
401
+ | ------------------ | ---------------- | --------------------------------------------------------------------------------------- |
402
+ | `err.message` | `str` | Error message |
403
+ | `err.status_code` | `int` | HTTP response status code eg `404` |
404
+ | `err.headers` | `httpx.Headers` | HTTP response headers |
405
+ | `err.body` | `str` | HTTP body. Can be empty string if no body is returned. |
406
+ | `err.raw_response` | `httpx.Response` | Raw HTTP response |
407
+ | `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
408
+
409
+ ### Example
410
+ ```python
411
+ from compass_api_sdk import CompassAPI, errors, models
412
+
413
+
414
+ with CompassAPI(
415
+ api_key_auth="<YOUR_API_KEY_HERE>",
416
+ ) as compass_api:
417
+ res = None
418
+ try:
419
+
420
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
421
+
422
+ # Handle response
423
+ print(res)
424
+
425
+
426
+ except errors.CompassAPIError as e:
427
+ # The base class for HTTP error responses
428
+ print(e.message)
429
+ print(e.status_code)
430
+ print(e.body)
431
+ print(e.headers)
432
+ print(e.raw_response)
433
+
434
+ # Depending on the method different errors may be thrown
435
+ if isinstance(e, errors.HTTPValidationError):
436
+ print(e.data.detail) # Optional[List[models.ValidationError]]
437
+ ```
438
+
439
+ ### Error Classes
440
+ **Primary errors:**
441
+ * [`CompassAPIError`](./src/compass_api_sdk/errors/compassapierror.py): The base class for HTTP error responses.
442
+ * [`HTTPValidationError`](./src/compass_api_sdk/errors/httpvalidationerror.py): Validation Error. Status code `422`.
443
+
444
+ <details><summary>Less common errors (6)</summary>
445
+
446
+ <br />
447
+
448
+ **Network errors:**
449
+ * [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors.
450
+ * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server.
451
+ * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out.
452
+
453
+
454
+ **Inherit from [`CompassAPIError`](./src/compass_api_sdk/errors/compassapierror.py)**:
455
+ * [`MintPrepareNotFoundResponseError`](./src/compass_api_sdk/errors/mintpreparenotfoundresponseerror.py): Response when the burn event has not been found yet. This means the burn transaction hasn't been confirmed on-chain yet, or the user hasn't broadcast the burn transaction. Status code `404`. Applicable to 1 of 93 methods.*
456
+ * [`ResponseValidationError`](./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.
457
+
458
+ </details>
459
+
460
+ \* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
461
+ <!-- End Error Handling [errors] -->
462
+
463
+ <!-- Start Server Selection [server] -->
464
+ ## Server Selection
465
+
466
+ ### Override Server URL Per-Client
467
+
468
+ 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:
469
+ ```python
470
+ from compass_api_sdk import CompassAPI, models
471
+
472
+
473
+ with CompassAPI(
474
+ server_url="https://api.compasslabs.ai",
475
+ api_key_auth="<YOUR_API_KEY_HERE>",
476
+ ) as compass_api:
477
+
478
+ res = compass_api.aave_v3.aave_aave_supported_tokens(chain=models.V1AaveAaveSupportedTokensChain.ARBITRUM)
479
+
480
+ # Handle response
481
+ print(res)
482
+
483
+ ```
484
+ <!-- End Server Selection [server] -->
485
+
486
+ <!-- Start Custom HTTP Client [http-client] -->
487
+ ## Custom HTTP Client
488
+
489
+ 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.
490
+ 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.
491
+ 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.
492
+
493
+ For example, you could specify a header for every request that this sdk makes as follows:
494
+ ```python
495
+ from compass_api_sdk import CompassAPI
496
+ import httpx
497
+
498
+ http_client = httpx.Client(headers={"x-custom-header": "someValue"})
499
+ s = CompassAPI(client=http_client)
500
+ ```
501
+
502
+ or you could wrap the client with your own custom logic:
503
+ ```python
504
+ from compass_api_sdk import CompassAPI
505
+ from compass_api_sdk.httpclient import AsyncHttpClient
506
+ import httpx
507
+
508
+ class CustomClient(AsyncHttpClient):
509
+ client: AsyncHttpClient
510
+
511
+ def __init__(self, client: AsyncHttpClient):
512
+ self.client = client
513
+
514
+ async def send(
515
+ self,
516
+ request: httpx.Request,
517
+ *,
518
+ stream: bool = False,
519
+ auth: Union[
520
+ httpx._types.AuthTypes, httpx._client.UseClientDefault, None
521
+ ] = httpx.USE_CLIENT_DEFAULT,
522
+ follow_redirects: Union[
523
+ bool, httpx._client.UseClientDefault
524
+ ] = httpx.USE_CLIENT_DEFAULT,
525
+ ) -> httpx.Response:
526
+ request.headers["Client-Level-Header"] = "added by client"
527
+
528
+ return await self.client.send(
529
+ request, stream=stream, auth=auth, follow_redirects=follow_redirects
530
+ )
531
+
532
+ def build_request(
533
+ self,
534
+ method: str,
535
+ url: httpx._types.URLTypes,
536
+ *,
537
+ content: Optional[httpx._types.RequestContent] = None,
538
+ data: Optional[httpx._types.RequestData] = None,
539
+ files: Optional[httpx._types.RequestFiles] = None,
540
+ json: Optional[Any] = None,
541
+ params: Optional[httpx._types.QueryParamTypes] = None,
542
+ headers: Optional[httpx._types.HeaderTypes] = None,
543
+ cookies: Optional[httpx._types.CookieTypes] = None,
544
+ timeout: Union[
545
+ httpx._types.TimeoutTypes, httpx._client.UseClientDefault
546
+ ] = httpx.USE_CLIENT_DEFAULT,
547
+ extensions: Optional[httpx._types.RequestExtensions] = None,
548
+ ) -> httpx.Request:
549
+ return self.client.build_request(
550
+ method,
551
+ url,
552
+ content=content,
553
+ data=data,
554
+ files=files,
555
+ json=json,
556
+ params=params,
557
+ headers=headers,
558
+ cookies=cookies,
559
+ timeout=timeout,
560
+ extensions=extensions,
561
+ )
562
+
563
+ s = CompassAPI(async_client=CustomClient(httpx.AsyncClient()))
564
+ ```
565
+ <!-- End Custom HTTP Client [http-client] -->
566
+
567
+ <!-- Start Resource Management [resource-management] -->
568
+ ## Resource Management
569
+
570
+ 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.
571
+
572
+ [context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
573
+
574
+ ```python
575
+ from compass_api_sdk import CompassAPI
576
+ def main():
577
+
578
+ with CompassAPI(
579
+ api_key_auth="<YOUR_API_KEY_HERE>",
580
+ ) as compass_api:
581
+ # Rest of application here...
582
+
583
+
584
+ # Or when using async:
585
+ async def amain():
586
+
587
+ async with CompassAPI(
588
+ api_key_auth="<YOUR_API_KEY_HERE>",
589
+ ) as compass_api:
590
+ # Rest of application here...
591
+ ```
592
+ <!-- End Resource Management [resource-management] -->
593
+
594
+ <!-- Start Debugging [debug] -->
595
+ ## Debugging
596
+
597
+ You can setup your SDK to emit debug logs for SDK requests and responses.
598
+
599
+ You can pass your own logger class directly into your SDK.
600
+ ```python
601
+ from compass_api_sdk import CompassAPI
602
+ import logging
603
+
604
+ logging.basicConfig(level=logging.DEBUG)
605
+ s = CompassAPI(debug_logger=logging.getLogger("compass_api_sdk"))
606
+ ```
607
+ <!-- End Debugging [debug] -->
608
+
609
+ <!-- Placeholder for Future Speakeasy SDK Sections -->
610
+
611
+ # Development
612
+
613
+ ## Maturity
614
+
615
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
616
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
617
+ looking for the latest version.
618
+
619
+ ## Contributions
620
+
621
+ 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.
622
+ 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.
623
+
624
+