compass_api_sdk 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of compass_api_sdk might be problematic. Click here for more details.

Files changed (195) hide show
  1. {compass_api_sdk-0.2.0.dist-info → compass_api_sdk-0.3.0.dist-info}/METADATA +34 -33
  2. compass_api_sdk-0.3.0.dist-info/RECORD +180 -0
  3. {compass_api_sdk → compassapisdk}/_hooks/sdkhooks.py +1 -1
  4. {compass_api_sdk → compassapisdk}/_hooks/types.py +1 -1
  5. {compass_api_sdk → compassapisdk}/_version.py +3 -3
  6. {compass_api_sdk → compassapisdk}/aave_v3.py +27 -27
  7. {compass_api_sdk → compassapisdk}/aerodrome_slipstream.py +11 -11
  8. {compass_api_sdk → compassapisdk}/basesdk.py +3 -3
  9. {compass_api_sdk → compassapisdk}/errors/httpvalidationerror.py +3 -3
  10. {compass_api_sdk → compassapisdk}/httpclient.py +7 -37
  11. {compass_api_sdk → compassapisdk}/models/__init__.py +46 -25
  12. {compass_api_sdk → compassapisdk}/models/aave_historical_transactionsop.py +8 -2
  13. {compass_api_sdk → compassapisdk}/models/aave_liquidity_changeop.py +8 -12
  14. {compass_api_sdk → compassapisdk}/models/aave_rateop.py +4 -12
  15. {compass_api_sdk → compassapisdk}/models/aave_reserve_overviewop.py +4 -12
  16. {compass_api_sdk → compassapisdk}/models/aave_token_priceop.py +4 -12
  17. {compass_api_sdk → compassapisdk}/models/aave_user_position_per_tokenop.py +6 -12
  18. {compass_api_sdk → compassapisdk}/models/aave_user_position_summaryop.py +4 -2
  19. {compass_api_sdk → compassapisdk}/models/aaveborrowparams.py +1 -1
  20. {compass_api_sdk → compassapisdk}/models/aaveborrowrequest.py +1 -1
  21. compassapisdk/models/aavehistoricaltransactionsresponse.py +65 -0
  22. {compass_api_sdk → compassapisdk}/models/aaveliquiditychangeresponse.py +1 -1
  23. compassapisdk/models/aavelooprequest.py +87 -0
  24. {compass_api_sdk → compassapisdk}/models/aaverateresponse.py +1 -1
  25. {compass_api_sdk → compassapisdk}/models/aaverepayparams.py +1 -1
  26. {compass_api_sdk → compassapisdk}/models/aaverepayrequest.py +1 -1
  27. {compass_api_sdk → compassapisdk}/models/aavereserveoverviewresponse.py +1 -1
  28. {compass_api_sdk → compassapisdk}/models/aavesupplyparams.py +1 -1
  29. {compass_api_sdk → compassapisdk}/models/aavesupplyrequest.py +1 -1
  30. {compass_api_sdk → compassapisdk}/models/aavetokenpriceresponse.py +1 -1
  31. {compass_api_sdk → compassapisdk}/models/aaveuserpositionpertokenresponse.py +1 -1
  32. {compass_api_sdk → compassapisdk}/models/aaveuserpositionsummaryresponse.py +1 -1
  33. {compass_api_sdk → compassapisdk}/models/aavewithdrawparams.py +1 -1
  34. {compass_api_sdk → compassapisdk}/models/aavewithdrawrequest.py +1 -1
  35. {compass_api_sdk → compassapisdk}/models/aerodrome_slipstream_liquidity_provision_positionsop.py +4 -2
  36. {compass_api_sdk → compassapisdk}/models/aerodrome_slipstream_pool_priceop.py +8 -22
  37. {compass_api_sdk → compassapisdk}/models/aerodromelppositionsresponse.py +1 -1
  38. {compass_api_sdk → compassapisdk}/models/aerodromeposition.py +1 -1
  39. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreambuyexactlyparams.py +1 -1
  40. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreambuyexactlyrequest.py +1 -1
  41. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamincreaseliquidityprovisionparams.py +1 -1
  42. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamincreaseliquidityprovisionrequest.py +1 -1
  43. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreammintliquidityprovisionparams.py +1 -1
  44. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreammintliquidityprovisionrequest.py +1 -1
  45. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreampoolpriceresponse.py +1 -1
  46. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamsellexactlyparams.py +1 -1
  47. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamsellexactlyrequest.py +1 -1
  48. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamwithdrawliquidityprovisionparams.py +1 -1
  49. {compass_api_sdk → compassapisdk}/models/aerodromeslipstreamwithdrawliquidityprovisionrequest.py +1 -1
  50. {compass_api_sdk → compassapisdk}/models/allowanceinforesponse.py +1 -1
  51. compassapisdk/models/borrow.py +67 -0
  52. {compass_api_sdk → compassapisdk}/models/chaininfo.py +1 -1
  53. {compass_api_sdk → compassapisdk}/models/compass_api_backend_models_morpho_read_response_get_markets_asset.py +1 -1
  54. {compass_api_sdk → compassapisdk}/models/compass_api_backend_models_morpho_read_response_get_vaults_asset.py +1 -1
  55. {compass_api_sdk → compassapisdk}/models/ensnameinforesponse.py +1 -1
  56. {compass_api_sdk → compassapisdk}/models/generic_allowanceop.py +10 -12
  57. {compass_api_sdk → compassapisdk}/models/generic_ensop.py +4 -2
  58. {compass_api_sdk → compassapisdk}/models/generic_portfolioop.py +4 -2
  59. {compass_api_sdk → compassapisdk}/models/generic_supported_tokensop.py +2 -2
  60. {compass_api_sdk → compassapisdk}/models/generic_visualize_portfolioop.py +4 -2
  61. {compass_api_sdk → compassapisdk}/models/image.py +1 -1
  62. {compass_api_sdk → compassapisdk}/models/increaseallowanceanyparams.py +1 -1
  63. {compass_api_sdk → compassapisdk}/models/increaseallowanceparams.py +1 -1
  64. {compass_api_sdk → compassapisdk}/models/increaseallowancerequest.py +1 -1
  65. compassapisdk/models/liquidationcall.py +64 -0
  66. {compass_api_sdk → compassapisdk}/models/marketstate.py +1 -1
  67. {compass_api_sdk → compassapisdk}/models/morpho_market_positionop.py +11 -11
  68. {compass_api_sdk → compassapisdk}/models/morpho_marketsop.py +11 -11
  69. {compass_api_sdk → compassapisdk}/models/morpho_vault_positionop.py +11 -11
  70. {compass_api_sdk → compassapisdk}/models/morpho_vaultsop.py +22 -18
  71. {compass_api_sdk → compassapisdk}/models/morphoborrowrequest.py +9 -6
  72. {compass_api_sdk → compassapisdk}/models/morphocheckmarketpositionresponse.py +1 -1
  73. {compass_api_sdk → compassapisdk}/models/morphocheckvaultpositionresponse.py +1 -1
  74. {compass_api_sdk → compassapisdk}/models/morphodepositrequest.py +9 -6
  75. {compass_api_sdk → compassapisdk}/models/morphogetmarketsresponse.py +1 -1
  76. {compass_api_sdk → compassapisdk}/models/morphogetvaultsresponse.py +1 -1
  77. {compass_api_sdk → compassapisdk}/models/morphomarket.py +1 -1
  78. {compass_api_sdk → compassapisdk}/models/morphorepayrequest.py +9 -6
  79. {compass_api_sdk → compassapisdk}/models/morphosetvaultallowancerequest.py +9 -6
  80. {compass_api_sdk → compassapisdk}/models/morphosupplycollateralrequest.py +9 -6
  81. {compass_api_sdk → compassapisdk}/models/morphovault.py +1 -1
  82. {compass_api_sdk → compassapisdk}/models/morphowithdrawcollateralrequest.py +9 -6
  83. {compass_api_sdk → compassapisdk}/models/morphowithdrawrequest.py +9 -6
  84. {compass_api_sdk → compassapisdk}/models/multicallaction.py +1 -1
  85. {compass_api_sdk → compassapisdk}/models/multicallauthorizationrequest.py +1 -1
  86. {compass_api_sdk → compassapisdk}/models/multicallauthorizationresponse.py +1 -1
  87. {compass_api_sdk → compassapisdk}/models/multicallexecuterequest.py +1 -1
  88. {compass_api_sdk → compassapisdk}/models/portfolio.py +1 -1
  89. compassapisdk/models/redeemunderlying.py +48 -0
  90. compassapisdk/models/repay.py +52 -0
  91. compassapisdk/models/reserve.py +77 -0
  92. {compass_api_sdk → compassapisdk}/models/security.py +2 -2
  93. {compass_api_sdk → compassapisdk}/models/signedauthorization.py +1 -1
  94. {compass_api_sdk → compassapisdk}/models/sky_positionop.py +4 -2
  95. {compass_api_sdk → compassapisdk}/models/skybuyrequest.py +2 -2
  96. {compass_api_sdk → compassapisdk}/models/skycheckpositionresponse.py +1 -1
  97. {compass_api_sdk → compassapisdk}/models/skydepositrequest.py +2 -2
  98. {compass_api_sdk → compassapisdk}/models/skysellrequest.py +2 -2
  99. {compass_api_sdk → compassapisdk}/models/skywithdrawrequest.py +2 -2
  100. compassapisdk/models/supply.py +54 -0
  101. compassapisdk/models/swapborrowrate.py +56 -0
  102. {compass_api_sdk → compassapisdk}/models/token_addressop.py +4 -12
  103. {compass_api_sdk → compassapisdk}/models/token_balanceop.py +8 -2
  104. {compass_api_sdk → compassapisdk}/models/token_priceop.py +4 -12
  105. {compass_api_sdk → compassapisdk}/models/tokenaddressresponse.py +1 -1
  106. {compass_api_sdk → compassapisdk}/models/tokenbalance.py +1 -1
  107. {compass_api_sdk → compassapisdk}/models/tokenbalanceresponse.py +1 -1
  108. {compass_api_sdk → compassapisdk}/models/tokeninfo.py +1 -1
  109. {compass_api_sdk → compassapisdk}/models/tokenpriceresponse.py +1 -1
  110. {compass_api_sdk → compassapisdk}/models/tokentransfererc20params.py +1 -1
  111. {compass_api_sdk → compassapisdk}/models/tokentransferrequest.py +1 -1
  112. {compass_api_sdk → compassapisdk}/models/uniswap_liquidity_provision_in_rangeop.py +4 -2
  113. {compass_api_sdk → compassapisdk}/models/uniswap_liquidity_provision_positionsop.py +4 -2
  114. {compass_api_sdk → compassapisdk}/models/uniswap_pool_priceop.py +8 -30
  115. {compass_api_sdk → compassapisdk}/models/uniswap_quote_buy_exactlyop.py +12 -30
  116. {compass_api_sdk → compassapisdk}/models/uniswap_quote_sell_exactlyop.py +12 -30
  117. {compass_api_sdk → compassapisdk}/models/uniswapbuyexactlyparams.py +7 -7
  118. {compass_api_sdk → compassapisdk}/models/uniswapbuyexactlyrequest.py +7 -7
  119. {compass_api_sdk → compassapisdk}/models/uniswapbuyquoteinforesponse.py +1 -1
  120. {compass_api_sdk → compassapisdk}/models/uniswapcheckinrangeresponse.py +1 -1
  121. {compass_api_sdk → compassapisdk}/models/uniswapincreaseliquidityprovisionparams.py +1 -1
  122. {compass_api_sdk → compassapisdk}/models/uniswapincreaseliquidityprovisionrequest.py +1 -1
  123. {compass_api_sdk → compassapisdk}/models/uniswaplppositionsinforesponse.py +1 -1
  124. {compass_api_sdk → compassapisdk}/models/uniswapmintliquidityprovisionparams.py +1 -1
  125. {compass_api_sdk → compassapisdk}/models/uniswapmintliquidityprovisionrequest.py +1 -1
  126. {compass_api_sdk → compassapisdk}/models/uniswappoolpriceresponse.py +1 -1
  127. {compass_api_sdk → compassapisdk}/models/uniswappositionssolidityresponse.py +1 -1
  128. {compass_api_sdk → compassapisdk}/models/uniswapsellexactlyparams.py +1 -1
  129. {compass_api_sdk → compassapisdk}/models/uniswapsellexactlyrequest.py +1 -1
  130. {compass_api_sdk → compassapisdk}/models/uniswapsellquoteinforesponse.py +1 -1
  131. {compass_api_sdk → compassapisdk}/models/uniswapwithdrawliquidityprovisionparams.py +1 -1
  132. {compass_api_sdk → compassapisdk}/models/uniswapwithdrawliquidityprovisionrequest.py +1 -1
  133. {compass_api_sdk → compassapisdk}/models/unsignedmulticalltransaction.py +1 -1
  134. {compass_api_sdk → compassapisdk}/models/unsignedtransaction.py +1 -1
  135. {compass_api_sdk → compassapisdk}/models/unwrapwethparams.py +1 -1
  136. {compass_api_sdk → compassapisdk}/models/unwrapwethrequest.py +1 -1
  137. compassapisdk/models/usageascollateral.py +53 -0
  138. {compass_api_sdk → compassapisdk}/models/validationerror.py +1 -1
  139. {compass_api_sdk → compassapisdk}/models/vaultstate.py +1 -1
  140. {compass_api_sdk → compassapisdk}/models/weeklyapys.py +1 -1
  141. {compass_api_sdk → compassapisdk}/models/wrapethparams.py +1 -1
  142. {compass_api_sdk → compassapisdk}/models/wrapethrequest.py +1 -1
  143. {compass_api_sdk → compassapisdk}/morpho.py +79 -63
  144. {compass_api_sdk → compassapisdk}/sdk.py +11 -11
  145. {compass_api_sdk → compassapisdk}/sdkconfiguration.py +2 -2
  146. {compass_api_sdk → compassapisdk}/sky.py +5 -5
  147. {compass_api_sdk → compassapisdk}/token_sdk.py +11 -11
  148. {compass_api_sdk → compassapisdk}/transaction_batching.py +287 -3
  149. {compass_api_sdk → compassapisdk}/uniswap_v3.py +39 -39
  150. {compass_api_sdk → compassapisdk}/universal.py +15 -15
  151. compass_api_sdk/_hooks/registration.py +0 -13
  152. compass_api_sdk/models/aavehistoricaltransactionbase.py +0 -113
  153. compass_api_sdk/models/aavehistoricaltransactionsresponse.py +0 -31
  154. compass_api_sdk/models/action.py +0 -14
  155. compass_api_sdk/models/borrow.py +0 -33
  156. compass_api_sdk/models/collateralreserve.py +0 -16
  157. compass_api_sdk/models/liquidationcall.py +0 -37
  158. compass_api_sdk/models/principalreserve.py +0 -16
  159. compass_api_sdk/models/redeemunderlying.py +0 -21
  160. compass_api_sdk/models/repay.py +0 -21
  161. compass_api_sdk/models/reserve.py +0 -16
  162. compass_api_sdk/models/supply.py +0 -21
  163. compass_api_sdk/models/swapborrowrate.py +0 -27
  164. compass_api_sdk/models/usageascollateral.py +0 -21
  165. compass_api_sdk-0.2.0.dist-info/RECORD +0 -184
  166. {compass_api_sdk-0.2.0.dist-info → compass_api_sdk-0.3.0.dist-info}/WHEEL +0 -0
  167. {compass_api_sdk → compassapisdk}/__init__.py +0 -0
  168. {compass_api_sdk → compassapisdk}/_hooks/__init__.py +0 -0
  169. {compass_api_sdk → compassapisdk}/errors/__init__.py +0 -0
  170. {compass_api_sdk → compassapisdk}/errors/apierror.py +0 -0
  171. {compass_api_sdk → compassapisdk}/models/chain.py +0 -0
  172. {compass_api_sdk → compassapisdk}/models/contractname.py +0 -0
  173. {compass_api_sdk → compassapisdk}/models/feeenum.py +0 -0
  174. {compass_api_sdk → compassapisdk}/models/interestratemode.py +0 -0
  175. {compass_api_sdk → compassapisdk}/models/multicallactiontype.py +0 -0
  176. {compass_api_sdk → compassapisdk}/models/token_enum.py +0 -0
  177. {compass_api_sdk → compassapisdk}/py.typed +0 -0
  178. {compass_api_sdk → compassapisdk}/types/__init__.py +0 -0
  179. {compass_api_sdk → compassapisdk}/types/basemodel.py +0 -0
  180. {compass_api_sdk → compassapisdk}/utils/__init__.py +0 -0
  181. {compass_api_sdk → compassapisdk}/utils/annotations.py +0 -0
  182. {compass_api_sdk → compassapisdk}/utils/datetimes.py +0 -0
  183. {compass_api_sdk → compassapisdk}/utils/enums.py +0 -0
  184. {compass_api_sdk → compassapisdk}/utils/eventstreaming.py +0 -0
  185. {compass_api_sdk → compassapisdk}/utils/forms.py +0 -0
  186. {compass_api_sdk → compassapisdk}/utils/headers.py +0 -0
  187. {compass_api_sdk → compassapisdk}/utils/logger.py +0 -0
  188. {compass_api_sdk → compassapisdk}/utils/metadata.py +0 -0
  189. {compass_api_sdk → compassapisdk}/utils/queryparams.py +0 -0
  190. {compass_api_sdk → compassapisdk}/utils/requestbodies.py +0 -0
  191. {compass_api_sdk → compassapisdk}/utils/retries.py +0 -0
  192. {compass_api_sdk → compassapisdk}/utils/security.py +0 -0
  193. {compass_api_sdk → compassapisdk}/utils/serializers.py +0 -0
  194. {compass_api_sdk → compassapisdk}/utils/url.py +0 -0
  195. {compass_api_sdk → compassapisdk}/utils/values.py +0 -0
@@ -1,9 +1,9 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
- from compass_api_sdk import errors, models, utils
5
- from compass_api_sdk._hooks import HookContext
6
- from compass_api_sdk.types import OptionalNullable, UNSET
4
+ from compassapisdk import errors, models, utils
5
+ from compassapisdk._hooks import HookContext
6
+ from compassapisdk.types import OptionalNullable, UNSET
7
7
  from typing import Any, List, Mapping, Optional, Union
8
8
 
9
9
 
@@ -471,3 +471,287 @@ class TransactionBatching(BaseSDK):
471
471
  http_res_text,
472
472
  http_res,
473
473
  )
474
+
475
+ def aave_loop(
476
+ self,
477
+ *,
478
+ chain: models.Chain,
479
+ sender: str,
480
+ signed_authorization: Union[
481
+ models.SignedAuthorization, models.SignedAuthorizationTypedDict
482
+ ],
483
+ collateral_token: models.TokenEnum,
484
+ borrow_token: models.TokenEnum,
485
+ collateral_amount: Union[
486
+ models.CollateralAmount, models.CollateralAmountTypedDict
487
+ ],
488
+ loop_count: int,
489
+ max_slippage_percent: float,
490
+ loan_to_value: float,
491
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
492
+ server_url: Optional[str] = None,
493
+ timeout_ms: Optional[int] = None,
494
+ http_headers: Optional[Mapping[str, str]] = None,
495
+ ) -> models.UnsignedMulticallTransaction:
496
+ r"""Execute Aave Loop Strategy
497
+
498
+ Execute an Aave looping strategy that involves repeated supply and borrow
499
+ operations.
500
+
501
+ This endpoint creates a multicall transaction that performs a series of operations:
502
+ 1. Approves and supplies initial token
503
+ 2. For each loop:
504
+ - Borrows another token
505
+ - Swaps borrowed token back to supply token
506
+ - Supplies the swapped tokens
507
+
508
+ The transaction must be authorized using the /authorization endpoint to prevent replay attacks.
509
+
510
+ :param chain: The chain to use.
511
+ :param sender: The address of the transaction sender.
512
+ :param signed_authorization:
513
+ :param collateral_token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
514
+ :param borrow_token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
515
+ :param collateral_amount: Amount of collateral token to supply to Aave
516
+ :param loop_count: Number of times to perform the supply-borrow loop
517
+ :param max_slippage_percent: Maximum allowed slippage for token swaps in percentage
518
+ :param loan_to_value: Loan To Value percentage of the loop
519
+ :param retries: Override the default retry configuration for this method
520
+ :param server_url: Override the default server URL for this method
521
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
522
+ :param http_headers: Additional headers to set or replace on requests.
523
+ """
524
+ base_url = None
525
+ url_variables = None
526
+ if timeout_ms is None:
527
+ timeout_ms = self.sdk_configuration.timeout_ms
528
+
529
+ if server_url is not None:
530
+ base_url = server_url
531
+ else:
532
+ base_url = self._get_url(base_url, url_variables)
533
+
534
+ request = models.AaveLoopRequest(
535
+ chain=chain,
536
+ sender=sender,
537
+ signed_authorization=utils.get_pydantic_model(
538
+ signed_authorization, models.SignedAuthorization
539
+ ),
540
+ collateral_token=collateral_token,
541
+ borrow_token=borrow_token,
542
+ collateral_amount=collateral_amount,
543
+ loop_count=loop_count,
544
+ max_slippage_percent=max_slippage_percent,
545
+ loan_to_value=loan_to_value,
546
+ )
547
+
548
+ req = self._build_request(
549
+ method="POST",
550
+ path="/v0/multicall/aave/loop",
551
+ base_url=base_url,
552
+ url_variables=url_variables,
553
+ request=request,
554
+ request_body_required=True,
555
+ request_has_path_params=False,
556
+ request_has_query_params=True,
557
+ user_agent_header="user-agent",
558
+ accept_header_value="application/json",
559
+ http_headers=http_headers,
560
+ security=self.sdk_configuration.security,
561
+ get_serialized_body=lambda: utils.serialize_request_body(
562
+ request, False, False, "json", models.AaveLoopRequest
563
+ ),
564
+ timeout_ms=timeout_ms,
565
+ )
566
+
567
+ if retries == UNSET:
568
+ if self.sdk_configuration.retry_config is not UNSET:
569
+ retries = self.sdk_configuration.retry_config
570
+
571
+ retry_config = None
572
+ if isinstance(retries, utils.RetryConfig):
573
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
574
+
575
+ http_res = self.do_request(
576
+ hook_ctx=HookContext(
577
+ base_url=base_url or "",
578
+ operation_id="multicall_aave_loop",
579
+ oauth2_scopes=[],
580
+ security_source=self.sdk_configuration.security,
581
+ ),
582
+ request=req,
583
+ error_status_codes=["422", "4XX", "5XX"],
584
+ retry_config=retry_config,
585
+ )
586
+
587
+ response_data: Any = None
588
+ if utils.match_response(http_res, "200", "application/json"):
589
+ return utils.unmarshal_json(
590
+ http_res.text, models.UnsignedMulticallTransaction
591
+ )
592
+ if utils.match_response(http_res, "422", "application/json"):
593
+ response_data = utils.unmarshal_json(
594
+ http_res.text, errors.HTTPValidationErrorData
595
+ )
596
+ raise errors.HTTPValidationError(data=response_data)
597
+ if utils.match_response(http_res, "4XX", "*"):
598
+ http_res_text = utils.stream_to_text(http_res)
599
+ raise errors.APIError(
600
+ "API error occurred", http_res.status_code, http_res_text, http_res
601
+ )
602
+ if utils.match_response(http_res, "5XX", "*"):
603
+ http_res_text = utils.stream_to_text(http_res)
604
+ raise errors.APIError(
605
+ "API error occurred", http_res.status_code, http_res_text, http_res
606
+ )
607
+
608
+ content_type = http_res.headers.get("Content-Type")
609
+ http_res_text = utils.stream_to_text(http_res)
610
+ raise errors.APIError(
611
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
612
+ http_res.status_code,
613
+ http_res_text,
614
+ http_res,
615
+ )
616
+
617
+ async def aave_loop_async(
618
+ self,
619
+ *,
620
+ chain: models.Chain,
621
+ sender: str,
622
+ signed_authorization: Union[
623
+ models.SignedAuthorization, models.SignedAuthorizationTypedDict
624
+ ],
625
+ collateral_token: models.TokenEnum,
626
+ borrow_token: models.TokenEnum,
627
+ collateral_amount: Union[
628
+ models.CollateralAmount, models.CollateralAmountTypedDict
629
+ ],
630
+ loop_count: int,
631
+ max_slippage_percent: float,
632
+ loan_to_value: float,
633
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
634
+ server_url: Optional[str] = None,
635
+ timeout_ms: Optional[int] = None,
636
+ http_headers: Optional[Mapping[str, str]] = None,
637
+ ) -> models.UnsignedMulticallTransaction:
638
+ r"""Execute Aave Loop Strategy
639
+
640
+ Execute an Aave looping strategy that involves repeated supply and borrow
641
+ operations.
642
+
643
+ This endpoint creates a multicall transaction that performs a series of operations:
644
+ 1. Approves and supplies initial token
645
+ 2. For each loop:
646
+ - Borrows another token
647
+ - Swaps borrowed token back to supply token
648
+ - Supplies the swapped tokens
649
+
650
+ The transaction must be authorized using the /authorization endpoint to prevent replay attacks.
651
+
652
+ :param chain: The chain to use.
653
+ :param sender: The address of the transaction sender.
654
+ :param signed_authorization:
655
+ :param collateral_token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
656
+ :param borrow_token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
657
+ :param collateral_amount: Amount of collateral token to supply to Aave
658
+ :param loop_count: Number of times to perform the supply-borrow loop
659
+ :param max_slippage_percent: Maximum allowed slippage for token swaps in percentage
660
+ :param loan_to_value: Loan To Value percentage of the loop
661
+ :param retries: Override the default retry configuration for this method
662
+ :param server_url: Override the default server URL for this method
663
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
664
+ :param http_headers: Additional headers to set or replace on requests.
665
+ """
666
+ base_url = None
667
+ url_variables = None
668
+ if timeout_ms is None:
669
+ timeout_ms = self.sdk_configuration.timeout_ms
670
+
671
+ if server_url is not None:
672
+ base_url = server_url
673
+ else:
674
+ base_url = self._get_url(base_url, url_variables)
675
+
676
+ request = models.AaveLoopRequest(
677
+ chain=chain,
678
+ sender=sender,
679
+ signed_authorization=utils.get_pydantic_model(
680
+ signed_authorization, models.SignedAuthorization
681
+ ),
682
+ collateral_token=collateral_token,
683
+ borrow_token=borrow_token,
684
+ collateral_amount=collateral_amount,
685
+ loop_count=loop_count,
686
+ max_slippage_percent=max_slippage_percent,
687
+ loan_to_value=loan_to_value,
688
+ )
689
+
690
+ req = self._build_request_async(
691
+ method="POST",
692
+ path="/v0/multicall/aave/loop",
693
+ base_url=base_url,
694
+ url_variables=url_variables,
695
+ request=request,
696
+ request_body_required=True,
697
+ request_has_path_params=False,
698
+ request_has_query_params=True,
699
+ user_agent_header="user-agent",
700
+ accept_header_value="application/json",
701
+ http_headers=http_headers,
702
+ security=self.sdk_configuration.security,
703
+ get_serialized_body=lambda: utils.serialize_request_body(
704
+ request, False, False, "json", models.AaveLoopRequest
705
+ ),
706
+ timeout_ms=timeout_ms,
707
+ )
708
+
709
+ if retries == UNSET:
710
+ if self.sdk_configuration.retry_config is not UNSET:
711
+ retries = self.sdk_configuration.retry_config
712
+
713
+ retry_config = None
714
+ if isinstance(retries, utils.RetryConfig):
715
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
716
+
717
+ http_res = await self.do_request_async(
718
+ hook_ctx=HookContext(
719
+ base_url=base_url or "",
720
+ operation_id="multicall_aave_loop",
721
+ oauth2_scopes=[],
722
+ security_source=self.sdk_configuration.security,
723
+ ),
724
+ request=req,
725
+ error_status_codes=["422", "4XX", "5XX"],
726
+ retry_config=retry_config,
727
+ )
728
+
729
+ response_data: Any = None
730
+ if utils.match_response(http_res, "200", "application/json"):
731
+ return utils.unmarshal_json(
732
+ http_res.text, models.UnsignedMulticallTransaction
733
+ )
734
+ if utils.match_response(http_res, "422", "application/json"):
735
+ response_data = utils.unmarshal_json(
736
+ http_res.text, errors.HTTPValidationErrorData
737
+ )
738
+ raise errors.HTTPValidationError(data=response_data)
739
+ if utils.match_response(http_res, "4XX", "*"):
740
+ http_res_text = await utils.stream_to_text_async(http_res)
741
+ raise errors.APIError(
742
+ "API error occurred", http_res.status_code, http_res_text, http_res
743
+ )
744
+ if utils.match_response(http_res, "5XX", "*"):
745
+ http_res_text = await utils.stream_to_text_async(http_res)
746
+ raise errors.APIError(
747
+ "API error occurred", http_res.status_code, http_res_text, http_res
748
+ )
749
+
750
+ content_type = http_res.headers.get("Content-Type")
751
+ http_res_text = await utils.stream_to_text_async(http_res)
752
+ raise errors.APIError(
753
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
754
+ http_res.status_code,
755
+ http_res_text,
756
+ http_res,
757
+ )
@@ -1,9 +1,9 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
- from compass_api_sdk import errors, models, utils
5
- from compass_api_sdk._hooks import HookContext
6
- from compass_api_sdk.types import OptionalNullable, UNSET
4
+ from compassapisdk import errors, models, utils
5
+ from compassapisdk._hooks import HookContext
6
+ from compassapisdk.types import OptionalNullable, UNSET
7
7
  from typing import Any, Mapping, Optional, Union
8
8
 
9
9
 
@@ -33,10 +33,10 @@ class UniswapV3(BaseSDK):
33
33
  into account the current pool state and the specified fee tier.
34
34
 
35
35
  :param chain: The chain to use.
36
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
37
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
38
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
39
- :param amount_out:
36
+ :param token_in: The symbol of the token to swap from.
37
+ :param token_out: The symbol of the token to swap to.
38
+ :param fee: The fee to pay for the swap
39
+ :param amount_out: The amount of the token to swap to
40
40
  :param retries: Override the default retry configuration for this method
41
41
  :param server_url: Override the default server URL for this method
42
42
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -151,10 +151,10 @@ class UniswapV3(BaseSDK):
151
151
  into account the current pool state and the specified fee tier.
152
152
 
153
153
  :param chain: The chain to use.
154
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
155
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
156
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
157
- :param amount_out:
154
+ :param token_in: The symbol of the token to swap from.
155
+ :param token_out: The symbol of the token to swap to.
156
+ :param fee: The fee to pay for the swap
157
+ :param amount_out: The amount of the token to swap to
158
158
  :param retries: Override the default retry configuration for this method
159
159
  :param server_url: Override the default server URL for this method
160
160
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -269,10 +269,10 @@ class UniswapV3(BaseSDK):
269
269
  into account the current pool state and the specified fee tier.
270
270
 
271
271
  :param chain: The chain to use.
272
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
273
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
274
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
275
- :param amount_in:
272
+ :param token_in: The symbol of the token to swap from.
273
+ :param token_out: The symbol of the token to swap to.
274
+ :param fee: The fee to pay for the swap
275
+ :param amount_in: The amount of the token to swap from
276
276
  :param retries: Override the default retry configuration for this method
277
277
  :param server_url: Override the default server URL for this method
278
278
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -387,10 +387,10 @@ class UniswapV3(BaseSDK):
387
387
  into account the current pool state and the specified fee tier.
388
388
 
389
389
  :param chain: The chain to use.
390
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
391
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
392
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
393
- :param amount_in:
390
+ :param token_in: The symbol of the token to swap from.
391
+ :param token_out: The symbol of the token to swap to.
392
+ :param fee: The fee to pay for the swap
393
+ :param amount_in: The amount of the token to swap from
394
394
  :param retries: Override the default retry configuration for this method
395
395
  :param server_url: Override the default server URL for this method
396
396
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -499,9 +499,9 @@ class UniswapV3(BaseSDK):
499
499
  The price is calculated based on the current pool state and the specified fee tier.
500
500
 
501
501
  :param chain: The chain to use.
502
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
503
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
504
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
502
+ :param token_in: The symbol of a token in the pool
503
+ :param token_out: The symbol of a token in the pool
504
+ :param fee: The fee of the pool
505
505
  :param retries: Override the default retry configuration for this method
506
506
  :param server_url: Override the default server URL for this method
507
507
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -607,9 +607,9 @@ class UniswapV3(BaseSDK):
607
607
  The price is calculated based on the current pool state and the specified fee tier.
608
608
 
609
609
  :param chain: The chain to use.
610
- :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
611
- :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
612
- :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
610
+ :param token_in: The symbol of a token in the pool
611
+ :param token_out: The symbol of a token in the pool
612
+ :param fee: The fee of the pool
613
613
  :param retries: Override the default retry configuration for this method
614
614
  :param server_url: Override the default server URL for this method
615
615
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -718,7 +718,7 @@ class UniswapV3(BaseSDK):
718
718
  and earning trading fees.
719
719
 
720
720
  :param chain: The chain to use.
721
- :param token_id:
721
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
722
722
  :param retries: Override the default retry configuration for this method
723
723
  :param server_url: Override the default server URL for this method
724
724
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -827,7 +827,7 @@ class UniswapV3(BaseSDK):
827
827
  and earning trading fees.
828
828
 
829
829
  :param chain: The chain to use.
830
- :param token_id:
830
+ :param token_id: Token ID of the NFT representing the liquidity provisioned position.
831
831
  :param retries: Override the default retry configuration for this method
832
832
  :param server_url: Override the default server URL for this method
833
833
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -935,7 +935,7 @@ class UniswapV3(BaseSDK):
935
935
  activities effectively.
936
936
 
937
937
  :param chain: The chain to use.
938
- :param user:
938
+ :param user: The user to get positions for.
939
939
  :param retries: Override the default retry configuration for this method
940
940
  :param server_url: Override the default server URL for this method
941
941
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1043,7 +1043,7 @@ class UniswapV3(BaseSDK):
1043
1043
  activities effectively.
1044
1044
 
1045
1045
  :param chain: The chain to use.
1046
- :param user:
1046
+ :param user: The user to get positions for.
1047
1047
  :param retries: Override the default retry configuration for this method
1048
1048
  :param server_url: Override the default server URL for this method
1049
1049
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1136,9 +1136,9 @@ class UniswapV3(BaseSDK):
1136
1136
  token_in: models.TokenEnum,
1137
1137
  token_out: models.TokenEnum,
1138
1138
  fee: models.FeeEnum,
1139
- amount_out: Union[
1140
- models.UniswapBuyExactlyRequestAmountOut,
1141
- models.UniswapBuyExactlyRequestAmountOutTypedDict,
1139
+ amount: Union[
1140
+ models.UniswapBuyExactlyRequestAmount,
1141
+ models.UniswapBuyExactlyRequestAmountTypedDict,
1142
1142
  ],
1143
1143
  max_slippage_percent: float,
1144
1144
  chain: models.Chain,
@@ -1162,7 +1162,7 @@ class UniswapV3(BaseSDK):
1162
1162
  :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1163
1163
  :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1164
1164
  :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
1165
- :param amount_out: The amount of the token to swap to
1165
+ :param amount: The amount of the token to swap to
1166
1166
  :param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1 %` slippage allowed.
1167
1167
  :param chain: The chain to use.
1168
1168
  :param sender: The address of the transaction sender.
@@ -1186,7 +1186,7 @@ class UniswapV3(BaseSDK):
1186
1186
  token_in=token_in,
1187
1187
  token_out=token_out,
1188
1188
  fee=fee,
1189
- amount_out=amount_out,
1189
+ amount=amount,
1190
1190
  max_slippage_percent=max_slippage_percent,
1191
1191
  wrap_eth=wrap_eth,
1192
1192
  chain=chain,
@@ -1266,9 +1266,9 @@ class UniswapV3(BaseSDK):
1266
1266
  token_in: models.TokenEnum,
1267
1267
  token_out: models.TokenEnum,
1268
1268
  fee: models.FeeEnum,
1269
- amount_out: Union[
1270
- models.UniswapBuyExactlyRequestAmountOut,
1271
- models.UniswapBuyExactlyRequestAmountOutTypedDict,
1269
+ amount: Union[
1270
+ models.UniswapBuyExactlyRequestAmount,
1271
+ models.UniswapBuyExactlyRequestAmountTypedDict,
1272
1272
  ],
1273
1273
  max_slippage_percent: float,
1274
1274
  chain: models.Chain,
@@ -1292,7 +1292,7 @@ class UniswapV3(BaseSDK):
1292
1292
  :param token_in: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1293
1293
  :param token_out: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
1294
1294
  :param fee: The transaction fee of a Uniswap pool in bips. Uniswap supports 4 different fee levels.
1295
- :param amount_out: The amount of the token to swap to
1295
+ :param amount: The amount of the token to swap to
1296
1296
  :param max_slippage_percent: The maximum slippage allowed in percent. e.g. `1` means `1 %` slippage allowed.
1297
1297
  :param chain: The chain to use.
1298
1298
  :param sender: The address of the transaction sender.
@@ -1316,7 +1316,7 @@ class UniswapV3(BaseSDK):
1316
1316
  token_in=token_in,
1317
1317
  token_out=token_out,
1318
1318
  fee=fee,
1319
- amount_out=amount_out,
1319
+ amount=amount,
1320
1320
  max_slippage_percent=max_slippage_percent,
1321
1321
  wrap_eth=wrap_eth,
1322
1322
  chain=chain,
@@ -1,9 +1,9 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from .basesdk import BaseSDK
4
- from compass_api_sdk import errors, models, utils
5
- from compass_api_sdk._hooks import HookContext
6
- from compass_api_sdk.types import OptionalNullable, UNSET
4
+ from compassapisdk import errors, models, utils
5
+ from compassapisdk._hooks import HookContext
6
+ from compassapisdk.types import OptionalNullable, UNSET
7
7
  from typing import Any, Mapping, Optional, Union
8
8
 
9
9
 
@@ -26,7 +26,7 @@ class Universal(BaseSDK):
26
26
  balances, including their respective values and quantities.
27
27
 
28
28
  :param chain: The chain to use.
29
- :param user:
29
+ :param user: The user to get portfolio for.
30
30
  :param retries: Override the default retry configuration for this method
31
31
  :param server_url: Override the default server URL for this method
32
32
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -129,7 +129,7 @@ class Universal(BaseSDK):
129
129
  balances, including their respective values and quantities.
130
130
 
131
131
  :param chain: The chain to use.
132
- :param user:
132
+ :param user: The user to get portfolio for.
133
133
  :param retries: Override the default retry configuration for this method
134
134
  :param server_url: Override the default server URL for this method
135
135
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -233,7 +233,7 @@ class Universal(BaseSDK):
233
233
  USD.
234
234
 
235
235
  :param chain: The chain to use.
236
- :param user:
236
+ :param user: The user to get portfolio for.
237
237
  :param retries: Override the default retry configuration for this method
238
238
  :param server_url: Override the default server URL for this method
239
239
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -337,7 +337,7 @@ class Universal(BaseSDK):
337
337
  USD.
338
338
 
339
339
  :param chain: The chain to use.
340
- :param user:
340
+ :param user: The user to get portfolio for.
341
341
  :param retries: Override the default retry configuration for this method
342
342
  :param server_url: Override the default server URL for this method
343
343
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -639,9 +639,9 @@ class Universal(BaseSDK):
639
639
  the user's tokens securely and efficiently.
640
640
 
641
641
  :param chain: The chain to use.
642
- :param token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
643
- :param contract_name:
644
- :param user:
642
+ :param token: The symbol of the token for which the allowance is checked..
643
+ :param contract_name: The name of the contract to check allowance for.
644
+ :param user: The user to get the ERC20 allowance of.
645
645
  :param retries: Override the default retry configuration for this method
646
646
  :param server_url: Override the default server URL for this method
647
647
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -751,9 +751,9 @@ class Universal(BaseSDK):
751
751
  the user's tokens securely and efficiently.
752
752
 
753
753
  :param chain: The chain to use.
754
- :param token: A class representing the token. This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.
755
- :param contract_name:
756
- :param user:
754
+ :param token: The symbol of the token for which the allowance is checked..
755
+ :param contract_name: The name of the contract to check allowance for.
756
+ :param user: The user to get the ERC20 allowance of.
757
757
  :param retries: Override the default retry configuration for this method
758
758
  :param server_url: Override the default server URL for this method
759
759
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -858,7 +858,7 @@ class Universal(BaseSDK):
858
858
  query the actual ethereum wallet address behind the ENS name.
859
859
 
860
860
  :param chain: The chain to use.
861
- :param ens_name:
861
+ :param ens_name: The ENS name to resolve.
862
862
  :param retries: Override the default retry configuration for this method
863
863
  :param server_url: Override the default server URL for this method
864
864
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -961,7 +961,7 @@ class Universal(BaseSDK):
961
961
  query the actual ethereum wallet address behind the ENS name.
962
962
 
963
963
  :param chain: The chain to use.
964
- :param ens_name:
964
+ :param ens_name: The ENS name to resolve.
965
965
  :param retries: Override the default retry configuration for this method
966
966
  :param server_url: Override the default server URL for this method
967
967
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -1,13 +0,0 @@
1
- from .types import Hooks
2
-
3
-
4
- # This file is only ever generated once on the first generation and then is free to be modified.
5
- # Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
6
- # in this file or in separate files in the hooks folder.
7
-
8
-
9
- def init_hooks(hooks: Hooks):
10
- # pylint: disable=unused-argument
11
- """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook
12
- with an instance of a hook that implements that specific Hook interface
13
- Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance"""