compass_api_sdk 0.6.0__py3-none-any.whl → 0.6.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.

Files changed (69) hide show
  1. compass_api_sdk/_version.py +2 -2
  2. compass_api_sdk/aave_v3.py +38 -104
  3. compass_api_sdk/aerodrome_slipstream.py +8 -28
  4. compass_api_sdk/models/__init__.py +107 -230
  5. compass_api_sdk/models/aave_avg_rateop.py +44 -16
  6. compass_api_sdk/models/aave_historical_transactionsop.py +45 -20
  7. compass_api_sdk/models/aave_liquidity_changeop.py +44 -18
  8. compass_api_sdk/models/aave_rateop.py +44 -16
  9. compass_api_sdk/models/aave_reserve_overviewop.py +44 -18
  10. compass_api_sdk/models/aave_std_rateop.py +44 -16
  11. compass_api_sdk/models/aave_token_priceop.py +44 -18
  12. compass_api_sdk/models/aave_user_position_per_tokenop.py +44 -20
  13. compass_api_sdk/models/aave_user_position_summaryop.py +44 -20
  14. compass_api_sdk/models/aerodrome_slipstream_liquidity_provision_positionsop.py +45 -20
  15. compass_api_sdk/models/aerodrome_slipstream_pool_priceop.py +45 -20
  16. compass_api_sdk/models/{tokenbalance.py → compass_api_backend_models_generic_read_response_portfolio_tokenbalance.py} +4 -2
  17. compass_api_sdk/models/compass_api_backend_models_pendle_read_response_positions_tokenbalance.py +18 -0
  18. compass_api_sdk/models/details.py +39 -0
  19. compass_api_sdk/models/generic_allowanceop.py +45 -18
  20. compass_api_sdk/models/generic_ensop.py +45 -16
  21. compass_api_sdk/models/generic_portfolioop.py +45 -18
  22. compass_api_sdk/models/generic_supported_tokensop.py +44 -20
  23. compass_api_sdk/models/generic_visualize_portfolioop.py +45 -20
  24. compass_api_sdk/models/increaseallowanceparams.py +20 -16
  25. compass_api_sdk/models/increaseallowancerequest.py +20 -16
  26. compass_api_sdk/models/lpbalance.py +20 -0
  27. compass_api_sdk/models/morpho_market_positionop.py +44 -18
  28. compass_api_sdk/models/morpho_marketop.py +44 -18
  29. compass_api_sdk/models/morpho_marketsop.py +7 -18
  30. compass_api_sdk/models/morpho_user_positionop.py +44 -18
  31. compass_api_sdk/models/morpho_vault_positionop.py +44 -18
  32. compass_api_sdk/models/morpho_vaultop.py +44 -16
  33. compass_api_sdk/models/morpho_vaultsop.py +7 -18
  34. compass_api_sdk/models/movement10percent.py +23 -0
  35. compass_api_sdk/models/multicallactiontype.py +0 -1
  36. compass_api_sdk/models/multicallauthorizationrequest.py +1 -15
  37. compass_api_sdk/models/openposition.py +28 -0
  38. compass_api_sdk/models/pendle_marketop.py +45 -19
  39. compass_api_sdk/models/pendle_marketsop.py +73 -0
  40. compass_api_sdk/models/pendle_positionop.py +45 -19
  41. compass_api_sdk/models/pendle_positionsop.py +80 -0
  42. compass_api_sdk/models/pendlelistmarketsresponse.py +17 -0
  43. compass_api_sdk/models/pendlelistuserpositionsresponse.py +17 -0
  44. compass_api_sdk/models/pendlemarket.py +46 -0
  45. compass_api_sdk/models/portfolio.py +10 -3
  46. compass_api_sdk/models/position.py +41 -0
  47. compass_api_sdk/models/sky_positionop.py +45 -16
  48. compass_api_sdk/models/syposition.py +17 -0
  49. compass_api_sdk/models/token_addressop.py +44 -18
  50. compass_api_sdk/models/token_balanceop.py +44 -17
  51. compass_api_sdk/models/uniswap_liquidity_provision_in_rangeop.py +44 -20
  52. compass_api_sdk/models/uniswap_liquidity_provision_positionsop.py +45 -20
  53. compass_api_sdk/models/uniswap_pool_priceop.py +44 -18
  54. compass_api_sdk/models/uniswap_quote_buy_exactlyop.py +44 -19
  55. compass_api_sdk/models/uniswap_quote_sell_exactlyop.py +44 -19
  56. compass_api_sdk/models/useroperation.py +20 -26
  57. compass_api_sdk/models/yieldrange.py +16 -0
  58. compass_api_sdk/morpho.py +28 -72
  59. compass_api_sdk/pendle.py +423 -21
  60. compass_api_sdk/sky.py +4 -8
  61. compass_api_sdk/token_sdk.py +8 -16
  62. compass_api_sdk/transaction_batching.py +0 -6
  63. compass_api_sdk/uniswap_v3.py +20 -64
  64. compass_api_sdk/universal.py +34 -60
  65. {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/METADATA +5 -3
  66. {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/RECORD +67 -56
  67. compass_api_sdk/models/contractname.py +0 -41
  68. compass_api_sdk/models/increaseallowanceanyparams.py +0 -58
  69. {compass_api_sdk-0.6.0.dist-info → compass_api_sdk-0.6.2.dist-info}/WHEEL +0 -0
@@ -1,11 +1,18 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from compass_api_sdk.types import BaseModel
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
5
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
6
12
  from enum import Enum
7
- from typing import Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
13
+ from pydantic import model_serializer
14
+ from typing import Optional
15
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
16
 
10
17
 
11
18
  class GenericPortfolioChain(str, Enum):
@@ -16,21 +23,11 @@ class GenericPortfolioChain(str, Enum):
16
23
  ARBITRUM_MAINNET = "arbitrum:mainnet"
17
24
 
18
25
 
19
- GenericPortfolioBlockTypedDict = TypeAliasType(
20
- "GenericPortfolioBlockTypedDict", Union[int, str]
21
- )
22
- r"""The block number you want to get this data at."""
23
-
24
-
25
- GenericPortfolioBlock = TypeAliasType("GenericPortfolioBlock", Union[int, str])
26
- r"""The block number you want to get this data at."""
27
-
28
-
29
26
  class GenericPortfolioRequestTypedDict(TypedDict):
30
27
  chain: GenericPortfolioChain
31
28
  r"""The chain to use."""
32
- block: NotRequired[GenericPortfolioBlockTypedDict]
33
- r"""The block number you want to get this data at."""
29
+ block: NotRequired[Nullable[int]]
30
+ r"""Optional block number (defaults to latest)."""
34
31
  user: NotRequired[str]
35
32
  r"""The user to get portfolio for."""
36
33
 
@@ -43,13 +40,43 @@ class GenericPortfolioRequest(BaseModel):
43
40
  r"""The chain to use."""
44
41
 
45
42
  block: Annotated[
46
- Optional[GenericPortfolioBlock],
43
+ OptionalNullable[int],
47
44
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
48
- ] = None
49
- r"""The block number you want to get this data at."""
45
+ ] = UNSET
46
+ r"""Optional block number (defaults to latest)."""
50
47
 
51
48
  user: Annotated[
52
49
  Optional[str],
53
50
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
54
51
  ] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B"
55
52
  r"""The user to get portfolio for."""
53
+
54
+ @model_serializer(mode="wrap")
55
+ def serialize_model(self, handler):
56
+ optional_fields = ["block", "user"]
57
+ nullable_fields = ["block"]
58
+ null_default_fields = []
59
+
60
+ serialized = handler(self)
61
+
62
+ m = {}
63
+
64
+ for n, f in type(self).model_fields.items():
65
+ k = f.alias or n
66
+ val = serialized.get(k)
67
+ serialized.pop(k, None)
68
+
69
+ optional_nullable = k in optional_fields and k in nullable_fields
70
+ is_set = (
71
+ self.__pydantic_fields_set__.intersection({n})
72
+ or k in null_default_fields
73
+ ) # pylint: disable=no-member
74
+
75
+ if val is not None and val != UNSET_SENTINEL:
76
+ m[k] = val
77
+ elif val != UNSET_SENTINEL and (
78
+ not k in optional_fields or (optional_nullable and is_set)
79
+ ):
80
+ m[k] = val
81
+
82
+ return m
@@ -1,11 +1,17 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from compass_api_sdk.types import BaseModel
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
5
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
6
12
  from enum import Enum
7
- from typing import Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
13
+ from pydantic import model_serializer
14
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
15
 
10
16
 
11
17
  class GenericSupportedTokensChain(str, Enum):
@@ -16,23 +22,11 @@ class GenericSupportedTokensChain(str, Enum):
16
22
  ARBITRUM_MAINNET = "arbitrum:mainnet"
17
23
 
18
24
 
19
- GenericSupportedTokensBlockTypedDict = TypeAliasType(
20
- "GenericSupportedTokensBlockTypedDict", Union[int, str]
21
- )
22
- r"""The block number you want to get this data at."""
23
-
24
-
25
- GenericSupportedTokensBlock = TypeAliasType(
26
- "GenericSupportedTokensBlock", Union[int, str]
27
- )
28
- r"""The block number you want to get this data at."""
29
-
30
-
31
25
  class GenericSupportedTokensRequestTypedDict(TypedDict):
32
26
  chain: GenericSupportedTokensChain
33
27
  r"""The chain to use."""
34
- block: NotRequired[GenericSupportedTokensBlockTypedDict]
35
- r"""The block number you want to get this data at."""
28
+ block: NotRequired[Nullable[int]]
29
+ r"""Optional block number (defaults to latest)."""
36
30
 
37
31
 
38
32
  class GenericSupportedTokensRequest(BaseModel):
@@ -43,7 +37,37 @@ class GenericSupportedTokensRequest(BaseModel):
43
37
  r"""The chain to use."""
44
38
 
45
39
  block: Annotated[
46
- Optional[GenericSupportedTokensBlock],
40
+ OptionalNullable[int],
47
41
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
48
- ] = None
49
- r"""The block number you want to get this data at."""
42
+ ] = UNSET
43
+ r"""Optional block number (defaults to latest)."""
44
+
45
+ @model_serializer(mode="wrap")
46
+ def serialize_model(self, handler):
47
+ optional_fields = ["block"]
48
+ nullable_fields = ["block"]
49
+ null_default_fields = []
50
+
51
+ serialized = handler(self)
52
+
53
+ m = {}
54
+
55
+ for n, f in type(self).model_fields.items():
56
+ k = f.alias or n
57
+ val = serialized.get(k)
58
+ serialized.pop(k, None)
59
+
60
+ optional_nullable = k in optional_fields and k in nullable_fields
61
+ is_set = (
62
+ self.__pydantic_fields_set__.intersection({n})
63
+ or k in null_default_fields
64
+ ) # pylint: disable=no-member
65
+
66
+ if val is not None and val != UNSET_SENTINEL:
67
+ m[k] = val
68
+ elif val != UNSET_SENTINEL and (
69
+ not k in optional_fields or (optional_nullable and is_set)
70
+ ):
71
+ m[k] = val
72
+
73
+ return m
@@ -1,11 +1,18 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from compass_api_sdk.types import BaseModel
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
5
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
6
12
  from enum import Enum
7
- from typing import Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
13
+ from pydantic import model_serializer
14
+ from typing import Optional
15
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
16
 
10
17
 
11
18
  class GenericVisualizePortfolioChain(str, Enum):
@@ -16,23 +23,11 @@ class GenericVisualizePortfolioChain(str, Enum):
16
23
  ARBITRUM_MAINNET = "arbitrum:mainnet"
17
24
 
18
25
 
19
- GenericVisualizePortfolioBlockTypedDict = TypeAliasType(
20
- "GenericVisualizePortfolioBlockTypedDict", Union[int, str]
21
- )
22
- r"""The block number you want to get this data at."""
23
-
24
-
25
- GenericVisualizePortfolioBlock = TypeAliasType(
26
- "GenericVisualizePortfolioBlock", Union[int, str]
27
- )
28
- r"""The block number you want to get this data at."""
29
-
30
-
31
26
  class GenericVisualizePortfolioRequestTypedDict(TypedDict):
32
27
  chain: GenericVisualizePortfolioChain
33
28
  r"""The chain to use."""
34
- block: NotRequired[GenericVisualizePortfolioBlockTypedDict]
35
- r"""The block number you want to get this data at."""
29
+ block: NotRequired[Nullable[int]]
30
+ r"""Optional block number (defaults to latest)."""
36
31
  user: NotRequired[str]
37
32
  r"""The user to get portfolio for."""
38
33
 
@@ -45,13 +40,43 @@ class GenericVisualizePortfolioRequest(BaseModel):
45
40
  r"""The chain to use."""
46
41
 
47
42
  block: Annotated[
48
- Optional[GenericVisualizePortfolioBlock],
43
+ OptionalNullable[int],
49
44
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
50
- ] = None
51
- r"""The block number you want to get this data at."""
45
+ ] = UNSET
46
+ r"""Optional block number (defaults to latest)."""
52
47
 
53
48
  user: Annotated[
54
49
  Optional[str],
55
50
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
56
51
  ] = "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B"
57
52
  r"""The user to get portfolio for."""
53
+
54
+ @model_serializer(mode="wrap")
55
+ def serialize_model(self, handler):
56
+ optional_fields = ["block", "user"]
57
+ nullable_fields = ["block"]
58
+ null_default_fields = []
59
+
60
+ serialized = handler(self)
61
+
62
+ m = {}
63
+
64
+ for n, f in type(self).model_fields.items():
65
+ k = f.alias or n
66
+ val = serialized.get(k)
67
+ serialized.pop(k, None)
68
+
69
+ optional_nullable = k in optional_fields and k in nullable_fields
70
+ is_set = (
71
+ self.__pydantic_fields_set__.intersection({n})
72
+ or k in null_default_fields
73
+ ) # pylint: disable=no-member
74
+
75
+ if val is not None and val != UNSET_SENTINEL:
76
+ m[k] = val
77
+ elif val != UNSET_SENTINEL and (
78
+ not k in optional_fields or (optional_nullable and is_set)
79
+ ):
80
+ m[k] = val
81
+
82
+ return m
@@ -8,6 +8,18 @@ from typing import Union
8
8
  from typing_extensions import TypeAliasType, TypedDict
9
9
 
10
10
 
11
+ IncreaseAllowanceParamsTokenTypedDict = TypeAliasType(
12
+ "IncreaseAllowanceParamsTokenTypedDict", Union[TokenEnum, str]
13
+ )
14
+ r"""The symbol or address of the token for which the allowance is increased.."""
15
+
16
+
17
+ IncreaseAllowanceParamsToken = TypeAliasType(
18
+ "IncreaseAllowanceParamsToken", Union[TokenEnum, str]
19
+ )
20
+ r"""The symbol or address of the token for which the allowance is increased.."""
21
+
22
+
11
23
  class IncreaseAllowanceParamsContractName(str, Enum):
12
24
  r"""The name of the contract to increase allowance for."""
13
25
 
@@ -29,42 +41,34 @@ class IncreaseAllowanceParamsContractName(str, Enum):
29
41
  IncreaseAllowanceParamsAmountTypedDict = TypeAliasType(
30
42
  "IncreaseAllowanceParamsAmountTypedDict", Union[float, str]
31
43
  )
32
- r"""The amount of tokens to increase the allowance by."""
44
+ r"""The amount to increase the allowance to."""
33
45
 
34
46
 
35
47
  IncreaseAllowanceParamsAmount = TypeAliasType(
36
48
  "IncreaseAllowanceParamsAmount", Union[float, str]
37
49
  )
38
- r"""The amount of tokens to increase the allowance by."""
50
+ r"""The amount to increase the allowance to."""
39
51
 
40
52
 
41
53
  class IncreaseAllowanceParamsTypedDict(TypedDict):
42
54
  r"""Parameters model for increasing token allowance for a contract."""
43
55
 
44
- token: TokenEnum
45
- r"""A class representing the token.
46
-
47
- This class is used to represent the token in the system. Notice individual
48
- endpoints' documentation where per chain tokens are presented.
49
- """
56
+ token: IncreaseAllowanceParamsTokenTypedDict
57
+ r"""The symbol or address of the token for which the allowance is increased.."""
50
58
  contract_name: IncreaseAllowanceParamsContractName
51
59
  r"""The name of the contract to increase allowance for."""
52
60
  amount: IncreaseAllowanceParamsAmountTypedDict
53
- r"""The amount of tokens to increase the allowance by."""
61
+ r"""The amount to increase the allowance to."""
54
62
 
55
63
 
56
64
  class IncreaseAllowanceParams(BaseModel):
57
65
  r"""Parameters model for increasing token allowance for a contract."""
58
66
 
59
- token: TokenEnum
60
- r"""A class representing the token.
61
-
62
- This class is used to represent the token in the system. Notice individual
63
- endpoints' documentation where per chain tokens are presented.
64
- """
67
+ token: IncreaseAllowanceParamsToken
68
+ r"""The symbol or address of the token for which the allowance is increased.."""
65
69
 
66
70
  contract_name: IncreaseAllowanceParamsContractName
67
71
  r"""The name of the contract to increase allowance for."""
68
72
 
69
73
  amount: IncreaseAllowanceParamsAmount
70
- r"""The amount of tokens to increase the allowance by."""
74
+ r"""The amount to increase the allowance to."""
@@ -9,6 +9,18 @@ from typing import Union
9
9
  from typing_extensions import TypeAliasType, TypedDict
10
10
 
11
11
 
12
+ IncreaseAllowanceRequestTokenTypedDict = TypeAliasType(
13
+ "IncreaseAllowanceRequestTokenTypedDict", Union[TokenEnum, str]
14
+ )
15
+ r"""The symbol or address of the token for which the allowance is increased.."""
16
+
17
+
18
+ IncreaseAllowanceRequestToken = TypeAliasType(
19
+ "IncreaseAllowanceRequestToken", Union[TokenEnum, str]
20
+ )
21
+ r"""The symbol or address of the token for which the allowance is increased.."""
22
+
23
+
12
24
  class IncreaseAllowanceRequestContractName(str, Enum):
13
25
  r"""The name of the contract to increase allowance for."""
14
26
 
@@ -30,28 +42,24 @@ class IncreaseAllowanceRequestContractName(str, Enum):
30
42
  IncreaseAllowanceRequestAmountTypedDict = TypeAliasType(
31
43
  "IncreaseAllowanceRequestAmountTypedDict", Union[float, str]
32
44
  )
33
- r"""The amount of tokens to increase the allowance by."""
45
+ r"""The amount to increase the allowance to."""
34
46
 
35
47
 
36
48
  IncreaseAllowanceRequestAmount = TypeAliasType(
37
49
  "IncreaseAllowanceRequestAmount", Union[float, str]
38
50
  )
39
- r"""The amount of tokens to increase the allowance by."""
51
+ r"""The amount to increase the allowance to."""
40
52
 
41
53
 
42
54
  class IncreaseAllowanceRequestTypedDict(TypedDict):
43
55
  r"""Request model for increasing token allowance for a contract."""
44
56
 
45
- token: TokenEnum
46
- r"""A class representing the token.
47
-
48
- This class is used to represent the token in the system. Notice individual
49
- endpoints' documentation where per chain tokens are presented.
50
- """
57
+ token: IncreaseAllowanceRequestTokenTypedDict
58
+ r"""The symbol or address of the token for which the allowance is increased.."""
51
59
  contract_name: IncreaseAllowanceRequestContractName
52
60
  r"""The name of the contract to increase allowance for."""
53
61
  amount: IncreaseAllowanceRequestAmountTypedDict
54
- r"""The amount of tokens to increase the allowance by."""
62
+ r"""The amount to increase the allowance to."""
55
63
  chain: Chain
56
64
  r"""The chain to use."""
57
65
  sender: str
@@ -61,18 +69,14 @@ class IncreaseAllowanceRequestTypedDict(TypedDict):
61
69
  class IncreaseAllowanceRequest(BaseModel):
62
70
  r"""Request model for increasing token allowance for a contract."""
63
71
 
64
- token: TokenEnum
65
- r"""A class representing the token.
66
-
67
- This class is used to represent the token in the system. Notice individual
68
- endpoints' documentation where per chain tokens are presented.
69
- """
72
+ token: IncreaseAllowanceRequestToken
73
+ r"""The symbol or address of the token for which the allowance is increased.."""
70
74
 
71
75
  contract_name: IncreaseAllowanceRequestContractName
72
76
  r"""The name of the contract to increase allowance for."""
73
77
 
74
78
  amount: IncreaseAllowanceRequestAmount
75
- r"""The amount of tokens to increase the allowance by."""
79
+ r"""The amount to increase the allowance to."""
76
80
 
77
81
  chain: Chain
78
82
  r"""The chain to use."""
@@ -0,0 +1,20 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from compass_api_sdk.types import BaseModel
5
+ import pydantic
6
+ from typing_extensions import Annotated, TypedDict
7
+
8
+
9
+ class LpBalanceTypedDict(TypedDict):
10
+ valuation: float
11
+ balance: str
12
+ active_balance: str
13
+
14
+
15
+ class LpBalance(BaseModel):
16
+ valuation: float
17
+
18
+ balance: str
19
+
20
+ active_balance: Annotated[str, pydantic.Field(alias="activeBalance")]
@@ -1,11 +1,17 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from compass_api_sdk.types import BaseModel
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
5
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
6
12
  from enum import Enum
7
- from typing import Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
13
+ from pydantic import model_serializer
14
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
15
 
10
16
 
11
17
  class MorphoMarketPositionChain(str, Enum):
@@ -13,20 +19,10 @@ class MorphoMarketPositionChain(str, Enum):
13
19
  BASE_MAINNET = "base:mainnet"
14
20
 
15
21
 
16
- MorphoMarketPositionBlockTypedDict = TypeAliasType(
17
- "MorphoMarketPositionBlockTypedDict", Union[int, str]
18
- )
19
- r"""The block number you want to get this data at."""
20
-
21
-
22
- MorphoMarketPositionBlock = TypeAliasType("MorphoMarketPositionBlock", Union[int, str])
23
- r"""The block number you want to get this data at."""
24
-
25
-
26
22
  class MorphoMarketPositionRequestTypedDict(TypedDict):
27
23
  chain: MorphoMarketPositionChain
28
- block: NotRequired[MorphoMarketPositionBlockTypedDict]
29
- r"""The block number you want to get this data at."""
24
+ block: NotRequired[Nullable[int]]
25
+ r"""Optional block number (defaults to latest)."""
30
26
  user_address: str
31
27
  r"""The user address of the desired market position."""
32
28
  unique_market_key: str
@@ -40,10 +36,10 @@ class MorphoMarketPositionRequest(BaseModel):
40
36
  ] = MorphoMarketPositionChain.ETHEREUM_MAINNET
41
37
 
42
38
  block: Annotated[
43
- Optional[MorphoMarketPositionBlock],
39
+ OptionalNullable[int],
44
40
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
45
- ] = None
46
- r"""The block number you want to get this data at."""
41
+ ] = UNSET
42
+ r"""Optional block number (defaults to latest)."""
47
43
 
48
44
  user_address: Annotated[
49
45
  str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
@@ -54,3 +50,33 @@ class MorphoMarketPositionRequest(BaseModel):
54
50
  str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
55
51
  ] = "0xe7399fdebc318d76dfec7356caafcf8cd4b91287e139a3ec423f09aeeb656fc4"
56
52
  r"""The key that uniquely identifies the market. This can be found using the 'Get Markets' endpoint."""
53
+
54
+ @model_serializer(mode="wrap")
55
+ def serialize_model(self, handler):
56
+ optional_fields = ["block"]
57
+ nullable_fields = ["block"]
58
+ null_default_fields = []
59
+
60
+ serialized = handler(self)
61
+
62
+ m = {}
63
+
64
+ for n, f in type(self).model_fields.items():
65
+ k = f.alias or n
66
+ val = serialized.get(k)
67
+ serialized.pop(k, None)
68
+
69
+ optional_nullable = k in optional_fields and k in nullable_fields
70
+ is_set = (
71
+ self.__pydantic_fields_set__.intersection({n})
72
+ or k in null_default_fields
73
+ ) # pylint: disable=no-member
74
+
75
+ if val is not None and val != UNSET_SENTINEL:
76
+ m[k] = val
77
+ elif val != UNSET_SENTINEL and (
78
+ not k in optional_fields or (optional_nullable and is_set)
79
+ ):
80
+ m[k] = val
81
+
82
+ return m
@@ -1,11 +1,17 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from compass_api_sdk.types import BaseModel
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
5
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
6
12
  from enum import Enum
7
- from typing import Optional, Union
8
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
13
+ from pydantic import model_serializer
14
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
15
 
10
16
 
11
17
  class MorphoMarketChain(str, Enum):
@@ -13,20 +19,10 @@ class MorphoMarketChain(str, Enum):
13
19
  BASE_MAINNET = "base:mainnet"
14
20
 
15
21
 
16
- MorphoMarketBlockTypedDict = TypeAliasType(
17
- "MorphoMarketBlockTypedDict", Union[int, str]
18
- )
19
- r"""The block number you want to get this data at."""
20
-
21
-
22
- MorphoMarketBlock = TypeAliasType("MorphoMarketBlock", Union[int, str])
23
- r"""The block number you want to get this data at."""
24
-
25
-
26
22
  class MorphoMarketRequestTypedDict(TypedDict):
27
23
  chain: MorphoMarketChain
28
- block: NotRequired[MorphoMarketBlockTypedDict]
29
- r"""The block number you want to get this data at."""
24
+ block: NotRequired[Nullable[int]]
25
+ r"""Optional block number (defaults to latest)."""
30
26
  unique_market_key: str
31
27
  r"""The key that uniquely identifies the market. This can be found using the 'Get Markets' endpoint."""
32
28
 
@@ -38,12 +34,42 @@ class MorphoMarketRequest(BaseModel):
38
34
  ] = MorphoMarketChain.ETHEREUM_MAINNET
39
35
 
40
36
  block: Annotated[
41
- Optional[MorphoMarketBlock],
37
+ OptionalNullable[int],
42
38
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
43
- ] = None
44
- r"""The block number you want to get this data at."""
39
+ ] = UNSET
40
+ r"""Optional block number (defaults to latest)."""
45
41
 
46
42
  unique_market_key: Annotated[
47
43
  str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
48
44
  ] = "0x83b7ad16905809ea36482f4fbf6cfee9c9f316d128de9a5da1952607d5e4df5e"
49
45
  r"""The key that uniquely identifies the market. This can be found using the 'Get Markets' endpoint."""
46
+
47
+ @model_serializer(mode="wrap")
48
+ def serialize_model(self, handler):
49
+ optional_fields = ["block"]
50
+ nullable_fields = ["block"]
51
+ null_default_fields = []
52
+
53
+ serialized = handler(self)
54
+
55
+ m = {}
56
+
57
+ for n, f in type(self).model_fields.items():
58
+ k = f.alias or n
59
+ val = serialized.get(k)
60
+ serialized.pop(k, None)
61
+
62
+ optional_nullable = k in optional_fields and k in nullable_fields
63
+ is_set = (
64
+ self.__pydantic_fields_set__.intersection({n})
65
+ or k in null_default_fields
66
+ ) # pylint: disable=no-member
67
+
68
+ if val is not None and val != UNSET_SENTINEL:
69
+ m[k] = val
70
+ elif val != UNSET_SENTINEL and (
71
+ not k in optional_fields or (optional_nullable and is_set)
72
+ ):
73
+ m[k] = val
74
+
75
+ return m
@@ -11,8 +11,7 @@ from compass_api_sdk.types import (
11
11
  from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
12
12
  from enum import Enum
13
13
  from pydantic import model_serializer
14
- from typing import Optional, Union
15
- from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
14
+ from typing_extensions import Annotated, NotRequired, TypedDict
16
15
 
17
16
 
18
17
  class MorphoMarketsChain(str, Enum):
@@ -20,20 +19,10 @@ class MorphoMarketsChain(str, Enum):
20
19
  BASE_MAINNET = "base:mainnet"
21
20
 
22
21
 
23
- MorphoMarketsBlockTypedDict = TypeAliasType(
24
- "MorphoMarketsBlockTypedDict", Union[int, str]
25
- )
26
- r"""The block number you want to get this data at"""
27
-
28
-
29
- MorphoMarketsBlock = TypeAliasType("MorphoMarketsBlock", Union[int, str])
30
- r"""The block number you want to get this data at"""
31
-
32
-
33
22
  class MorphoMarketsRequestTypedDict(TypedDict):
34
23
  chain: MorphoMarketsChain
35
- block: NotRequired[MorphoMarketsBlockTypedDict]
36
- r"""The block number you want to get this data at"""
24
+ block: NotRequired[Nullable[int]]
25
+ r"""Optional block number (defaults to latest)."""
37
26
  collateral_token: NotRequired[Nullable[str]]
38
27
  r"""Collateral token to identify the market."""
39
28
  loan_token: NotRequired[Nullable[str]]
@@ -47,10 +36,10 @@ class MorphoMarketsRequest(BaseModel):
47
36
  ] = MorphoMarketsChain.ETHEREUM_MAINNET
48
37
 
49
38
  block: Annotated[
50
- Optional[MorphoMarketsBlock],
39
+ OptionalNullable[int],
51
40
  FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
52
- ] = None
53
- r"""The block number you want to get this data at"""
41
+ ] = UNSET
42
+ r"""Optional block number (defaults to latest)."""
54
43
 
55
44
  collateral_token: Annotated[
56
45
  OptionalNullable[str],
@@ -67,7 +56,7 @@ class MorphoMarketsRequest(BaseModel):
67
56
  @model_serializer(mode="wrap")
68
57
  def serialize_model(self, handler):
69
58
  optional_fields = ["block", "collateral_token", "loan_token"]
70
- nullable_fields = ["collateral_token", "loan_token"]
59
+ nullable_fields = ["block", "collateral_token", "loan_token"]
71
60
  null_default_fields = []
72
61
 
73
62
  serialized = handler(self)