compass_api_sdk 0.3.0__py3-none-any.whl → 0.3.2__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.

@@ -0,0 +1,39 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from compassapisdk.types import BaseModel
5
+ from enum import Enum
6
+ from typing import Union
7
+ from typing_extensions import TypeAliasType, TypedDict
8
+
9
+
10
+ class SkySellParamsTokenOut(str, Enum):
11
+ r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
12
+
13
+ DAI = "DAI"
14
+ USDC = "USDC"
15
+
16
+
17
+ SkySellParamsAmountTypedDict = TypeAliasType(
18
+ "SkySellParamsAmountTypedDict", Union[float, str]
19
+ )
20
+ r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
21
+
22
+
23
+ SkySellParamsAmount = TypeAliasType("SkySellParamsAmount", Union[float, str])
24
+ r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
25
+
26
+
27
+ class SkySellParamsTypedDict(TypedDict):
28
+ token_out: SkySellParamsTokenOut
29
+ r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
30
+ amount: SkySellParamsAmountTypedDict
31
+ r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
32
+
33
+
34
+ class SkySellParams(BaseModel):
35
+ token_out: SkySellParamsTokenOut
36
+ r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
37
+
38
+ amount: SkySellParamsAmount
39
+ r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
@@ -10,7 +10,7 @@ from typing import Literal, Optional, Union
10
10
  from typing_extensions import Annotated, TypeAliasType, TypedDict
11
11
 
12
12
 
13
- class TokenOut(str, Enum):
13
+ class SkySellRequestTokenOut(str, Enum):
14
14
  r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
15
15
 
16
16
  DAI = "DAI"
@@ -28,7 +28,7 @@ r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
28
28
 
29
29
 
30
30
  class SkySellRequestTypedDict(TypedDict):
31
- token_out: TokenOut
31
+ token_out: SkySellRequestTokenOut
32
32
  r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
33
33
  amount: SkySellRequestAmountTypedDict
34
34
  r"""The amount of USDS you would like to sell 1:1 for 'token_out'."""
@@ -38,7 +38,7 @@ class SkySellRequestTypedDict(TypedDict):
38
38
 
39
39
 
40
40
  class SkySellRequest(BaseModel):
41
- token_out: TokenOut
41
+ token_out: SkySellRequestTokenOut
42
42
  r"""The token you would like to swap 1:1 with USDS. Choose from DAI or USDC."""
43
43
 
44
44
  amount: SkySellRequestAmount
@@ -0,0 +1,58 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from compassapisdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
11
+ from pydantic import model_serializer
12
+ from typing import Any
13
+ from typing_extensions import NotRequired, TypedDict
14
+
15
+
16
+ class SkyWithdrawParamsTypedDict(TypedDict):
17
+ amount: Any
18
+ r"""The amount of USDS you would like to withdraw. If set to 'ALL', your total deposited USDS amount will be withdrawn."""
19
+ receiver: NotRequired[Nullable[str]]
20
+ r"""The address which will receive the withdrawn USDS. Defaults to the sender."""
21
+
22
+
23
+ class SkyWithdrawParams(BaseModel):
24
+ amount: Any
25
+ r"""The amount of USDS you would like to withdraw. If set to 'ALL', your total deposited USDS amount will be withdrawn."""
26
+
27
+ receiver: OptionalNullable[str] = UNSET
28
+ r"""The address which will receive the withdrawn USDS. Defaults to the sender."""
29
+
30
+ @model_serializer(mode="wrap")
31
+ def serialize_model(self, handler):
32
+ optional_fields = ["receiver"]
33
+ nullable_fields = ["receiver"]
34
+ null_default_fields = []
35
+
36
+ serialized = handler(self)
37
+
38
+ m = {}
39
+
40
+ for n, f in type(self).model_fields.items():
41
+ k = f.alias or n
42
+ val = serialized.get(k)
43
+ serialized.pop(k, None)
44
+
45
+ optional_nullable = k in optional_fields and k in nullable_fields
46
+ is_set = (
47
+ self.__pydantic_fields_set__.intersection({n})
48
+ or k in null_default_fields
49
+ ) # pylint: disable=no-member
50
+
51
+ if val is not None and val != UNSET_SENTINEL:
52
+ m[k] = val
53
+ elif val != UNSET_SENTINEL and (
54
+ not k in optional_fields or (optional_nullable and is_set)
55
+ ):
56
+ m[k] = val
57
+
58
+ return m
compassapisdk/morpho.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from .basesdk import BaseSDK
4
4
  from compassapisdk import errors, models, utils
5
5
  from compassapisdk._hooks import HookContext
6
- from compassapisdk.types import OptionalNullable, UNSET
6
+ from compassapisdk.types import Nullable, OptionalNullable, UNSET
7
7
  from typing import Any, Mapping, Optional, Union
8
8
 
9
9
 
@@ -11,10 +11,8 @@ class Morpho(BaseSDK):
11
11
  def vaults(
12
12
  self,
13
13
  *,
14
- chain: Optional[
15
- models.MorphoVaultsChain
16
- ] = models.MorphoVaultsChain.ETHEREUM_MAINNET,
17
- deposit_token: OptionalNullable[str] = UNSET,
14
+ chain: models.MorphoVaultsChain = models.MorphoVaultsChain.ETHEREUM_MAINNET,
15
+ deposit_token: Nullable[str],
18
16
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
19
17
  server_url: Optional[str] = None,
20
18
  timeout_ms: Optional[int] = None,
@@ -117,10 +115,8 @@ class Morpho(BaseSDK):
117
115
  async def vaults_async(
118
116
  self,
119
117
  *,
120
- chain: Optional[
121
- models.MorphoVaultsChain
122
- ] = models.MorphoVaultsChain.ETHEREUM_MAINNET,
123
- deposit_token: OptionalNullable[str] = UNSET,
118
+ chain: models.MorphoVaultsChain = models.MorphoVaultsChain.ETHEREUM_MAINNET,
119
+ deposit_token: Nullable[str],
124
120
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
125
121
  server_url: Optional[str] = None,
126
122
  timeout_ms: Optional[int] = None,
@@ -223,11 +219,9 @@ class Morpho(BaseSDK):
223
219
  def vault_position(
224
220
  self,
225
221
  *,
222
+ chain: models.MorphoVaultPositionChain = models.MorphoVaultPositionChain.ETHEREUM_MAINNET,
226
223
  user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
227
224
  vault_address: str = "0xbEef047a543E45807105E51A8BBEFCc5950fcfBa",
228
- chain: Optional[
229
- models.MorphoVaultPositionChain
230
- ] = models.MorphoVaultPositionChain.ETHEREUM_MAINNET,
231
225
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
232
226
  server_url: Optional[str] = None,
233
227
  timeout_ms: Optional[int] = None,
@@ -238,9 +232,9 @@ class Morpho(BaseSDK):
238
232
  Check how many shares you own and the equivalent token amount of a given
239
233
  vault.
240
234
 
235
+ :param chain:
241
236
  :param user_address: The user address of the desired vault position.
242
237
  :param vault_address: The vault address of the desired vault position.
243
- :param chain:
244
238
  :param retries: Override the default retry configuration for this method
245
239
  :param server_url: Override the default server URL for this method
246
240
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -331,11 +325,9 @@ class Morpho(BaseSDK):
331
325
  async def vault_position_async(
332
326
  self,
333
327
  *,
328
+ chain: models.MorphoVaultPositionChain = models.MorphoVaultPositionChain.ETHEREUM_MAINNET,
334
329
  user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
335
330
  vault_address: str = "0xbEef047a543E45807105E51A8BBEFCc5950fcfBa",
336
- chain: Optional[
337
- models.MorphoVaultPositionChain
338
- ] = models.MorphoVaultPositionChain.ETHEREUM_MAINNET,
339
331
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
340
332
  server_url: Optional[str] = None,
341
333
  timeout_ms: Optional[int] = None,
@@ -346,9 +338,9 @@ class Morpho(BaseSDK):
346
338
  Check how many shares you own and the equivalent token amount of a given
347
339
  vault.
348
340
 
341
+ :param chain:
349
342
  :param user_address: The user address of the desired vault position.
350
343
  :param vault_address: The vault address of the desired vault position.
351
- :param chain:
352
344
  :param retries: Override the default retry configuration for this method
353
345
  :param server_url: Override the default server URL for this method
354
346
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -439,11 +431,9 @@ class Morpho(BaseSDK):
439
431
  def markets(
440
432
  self,
441
433
  *,
442
- chain: Optional[
443
- models.MorphoMarketsChain
444
- ] = models.MorphoMarketsChain.ETHEREUM_MAINNET,
445
- collateral_token: OptionalNullable[str] = UNSET,
446
- loan_token: OptionalNullable[str] = UNSET,
434
+ chain: models.MorphoMarketsChain = models.MorphoMarketsChain.ETHEREUM_MAINNET,
435
+ collateral_token: Nullable[str],
436
+ loan_token: Nullable[str],
447
437
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
448
438
  server_url: Optional[str] = None,
449
439
  timeout_ms: Optional[int] = None,
@@ -547,11 +537,9 @@ class Morpho(BaseSDK):
547
537
  async def markets_async(
548
538
  self,
549
539
  *,
550
- chain: Optional[
551
- models.MorphoMarketsChain
552
- ] = models.MorphoMarketsChain.ETHEREUM_MAINNET,
553
- collateral_token: OptionalNullable[str] = UNSET,
554
- loan_token: OptionalNullable[str] = UNSET,
540
+ chain: models.MorphoMarketsChain = models.MorphoMarketsChain.ETHEREUM_MAINNET,
541
+ collateral_token: Nullable[str],
542
+ loan_token: Nullable[str],
555
543
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
556
544
  server_url: Optional[str] = None,
557
545
  timeout_ms: Optional[int] = None,
@@ -655,11 +643,9 @@ class Morpho(BaseSDK):
655
643
  def market_position(
656
644
  self,
657
645
  *,
646
+ chain: models.MorphoMarketPositionChain = models.MorphoMarketPositionChain.ETHEREUM_MAINNET,
658
647
  user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
659
648
  unique_market_key: str = "0xe7399fdebc318d76dfec7356caafcf8cd4b91287e139a3ec423f09aeeb656fc4",
660
- chain: Optional[
661
- models.MorphoMarketPositionChain
662
- ] = models.MorphoMarketPositionChain.ETHEREUM_MAINNET,
663
649
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
664
650
  server_url: Optional[str] = None,
665
651
  timeout_ms: Optional[int] = None,
@@ -670,9 +656,9 @@ class Morpho(BaseSDK):
670
656
  Check how many shares you've borrowed and the equivalent token amount of a given
671
657
  market.
672
658
 
659
+ :param chain:
673
660
  :param user_address: The user address of the desired market position.
674
661
  :param unique_market_key: The key that uniquely identifies the market. This can be found using the 'Get Markets' endpoint.
675
- :param chain:
676
662
  :param retries: Override the default retry configuration for this method
677
663
  :param server_url: Override the default server URL for this method
678
664
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
@@ -763,11 +749,9 @@ class Morpho(BaseSDK):
763
749
  async def market_position_async(
764
750
  self,
765
751
  *,
752
+ chain: models.MorphoMarketPositionChain = models.MorphoMarketPositionChain.ETHEREUM_MAINNET,
766
753
  user_address: str = "0xa829B388A3DF7f581cE957a95edbe419dd146d1B",
767
754
  unique_market_key: str = "0xe7399fdebc318d76dfec7356caafcf8cd4b91287e139a3ec423f09aeeb656fc4",
768
- chain: Optional[
769
- models.MorphoMarketPositionChain
770
- ] = models.MorphoMarketPositionChain.ETHEREUM_MAINNET,
771
755
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
772
756
  server_url: Optional[str] = None,
773
757
  timeout_ms: Optional[int] = None,
@@ -778,9 +762,9 @@ class Morpho(BaseSDK):
778
762
  Check how many shares you've borrowed and the equivalent token amount of a given
779
763
  market.
780
764
 
765
+ :param chain:
781
766
  :param user_address: The user address of the desired market position.
782
767
  :param unique_market_key: The key that uniquely identifies the market. This can be found using the 'Get Markets' endpoint.
783
- :param chain:
784
768
  :param retries: Override the default retry configuration for this method
785
769
  :param server_url: Override the default server URL for this method
786
770
  :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
compassapisdk/sky.py CHANGED
@@ -205,7 +205,7 @@ class Sky(BaseSDK):
205
205
  def buy(
206
206
  self,
207
207
  *,
208
- token_in: models.TokenIn,
208
+ token_in: models.SkyBuyRequestTokenIn,
209
209
  amount: Union[models.SkyBuyRequestAmount, models.SkyBuyRequestAmountTypedDict],
210
210
  sender: str,
211
211
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -317,7 +317,7 @@ class Sky(BaseSDK):
317
317
  async def buy_async(
318
318
  self,
319
319
  *,
320
- token_in: models.TokenIn,
320
+ token_in: models.SkyBuyRequestTokenIn,
321
321
  amount: Union[models.SkyBuyRequestAmount, models.SkyBuyRequestAmountTypedDict],
322
322
  sender: str,
323
323
  retries: OptionalNullable[utils.RetryConfig] = UNSET,
@@ -429,7 +429,7 @@ class Sky(BaseSDK):
429
429
  def sell(
430
430
  self,
431
431
  *,
432
- token_out: models.TokenOut,
432
+ token_out: models.SkySellRequestTokenOut,
433
433
  amount: Union[
434
434
  models.SkySellRequestAmount, models.SkySellRequestAmountTypedDict
435
435
  ],
@@ -543,7 +543,7 @@ class Sky(BaseSDK):
543
543
  async def sell_async(
544
544
  self,
545
545
  *,
546
- token_out: models.TokenOut,
546
+ token_out: models.SkySellRequestTokenOut,
547
547
  amount: Union[
548
548
  models.SkySellRequestAmount, models.SkySellRequestAmountTypedDict
549
549
  ],