compass_api_sdk 2.0.21rc1__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 (36) hide show
  1. compass_api_sdk/_version.py +2 -2
  2. compass_api_sdk/earn.py +360 -114
  3. compass_api_sdk/gas_sponsorship.py +38 -26
  4. compass_api_sdk/models/__init__.py +65 -9
  5. compass_api_sdk/models/aaveposition.py +80 -25
  6. compass_api_sdk/models/approvetransferrequest.py +2 -2
  7. compass_api_sdk/models/batchedsafeoperationsresponse_input.py +4 -4
  8. compass_api_sdk/models/batchedsafeoperationsresponse_output.py +4 -4
  9. compass_api_sdk/models/compass_api_backend_v2_models_earn_read_response_positions_vaultposition.py +72 -18
  10. compass_api_sdk/models/compass_api_backend_v2_models_safe_transact_response_batched_safe_operations_eip712domain.py +6 -6
  11. compass_api_sdk/models/depositevent.py +61 -0
  12. compass_api_sdk/models/earnmanageparams.py +8 -6
  13. compass_api_sdk/models/earnmanagerequest.py +6 -4
  14. compass_api_sdk/models/earnpositionsresponse.py +31 -22
  15. compass_api_sdk/models/fee.py +8 -7
  16. compass_api_sdk/models/pendledepositevent.py +49 -0
  17. compass_api_sdk/models/pendlemarketinfo.py +138 -0
  18. compass_api_sdk/models/pendlemarketsresponse.py +30 -0
  19. compass_api_sdk/models/pendleptposition.py +111 -0
  20. compass_api_sdk/models/pendleptvenue.py +78 -0
  21. compass_api_sdk/models/pendlewithdrawalevent.py +54 -0
  22. compass_api_sdk/models/positionpnl.py +52 -0
  23. compass_api_sdk/models/safetxmessage.py +6 -6
  24. compass_api_sdk/models/sponsorgasrequest.py +2 -2
  25. compass_api_sdk/models/v2_earn_pendle_marketsop.py +105 -0
  26. compass_api_sdk/models/v2_earn_positionsop.py +5 -30
  27. compass_api_sdk/models/v2_earn_vaultsop.py +3 -3
  28. compass_api_sdk/models/withdrawalevent.py +61 -0
  29. compass_api_sdk/types/basemodel.py +41 -3
  30. compass_api_sdk/utils/__init__.py +0 -3
  31. compass_api_sdk/utils/enums.py +60 -0
  32. compass_api_sdk/utils/requestbodies.py +3 -3
  33. compass_api_sdk/utils/serializers.py +0 -20
  34. {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/METADATA +3 -2
  35. {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/RECORD +36 -26
  36. {compass_api_sdk-2.0.21rc1.dist-info → compass_api_sdk-2.2.1rc3.dist-info}/WHEEL +0 -0
@@ -1,49 +1,103 @@
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 .depositevent import DepositEvent, DepositEventTypedDict
5
+ from .positionpnl import PositionPnL, PositionPnLTypedDict
6
+ from .withdrawalevent import WithdrawalEvent, WithdrawalEventTypedDict
7
+ from compass_api_sdk.types import (
8
+ BaseModel,
9
+ Nullable,
10
+ OptionalNullable,
11
+ UNSET,
12
+ UNSET_SENTINEL,
13
+ )
5
14
  from compass_api_sdk.utils import validate_const
6
15
  import pydantic
16
+ from pydantic import model_serializer
7
17
  from pydantic.functional_validators import AfterValidator
8
- from typing import Literal
9
- from typing_extensions import Annotated, TypedDict
18
+ from typing import List, Literal, Optional
19
+ from typing_extensions import Annotated, NotRequired, TypedDict
10
20
 
11
21
 
12
22
  class CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPositionTypedDict(
13
23
  TypedDict
14
24
  ):
15
- id: str
16
- r"""Base64-encoded position identifier."""
25
+ r"""ERC-4626 vault position."""
26
+
17
27
  vault_address: str
18
- r"""The vault address you are depositing to."""
19
- amount_in_underlying_token: str
20
- r"""The user's position value denominated in the underlying token."""
21
- token_name: str
22
- r"""Symbol of the underlying token (e.g., USDC)."""
28
+ r"""The vault address."""
23
29
  vault_name: str
24
30
  r"""Name of the vault token (share token)."""
31
+ underlying_symbol: str
32
+ r"""Symbol of the underlying token (e.g., USDC)."""
33
+ balance: str
34
+ r"""The user's position value in underlying token."""
25
35
  type: Literal["VAULT"]
26
36
  r"""The market type discriminator."""
37
+ pnl: NotRequired[Nullable[PositionPnLTypedDict]]
38
+ r"""PnL metrics for this position."""
39
+ deposits: NotRequired[List[DepositEventTypedDict]]
40
+ r"""All deposit events for this position."""
41
+ withdrawals: NotRequired[List[WithdrawalEventTypedDict]]
42
+ r"""All withdrawal events for this position."""
27
43
 
28
44
 
29
45
  class CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition(BaseModel):
30
- id: str
31
- r"""Base64-encoded position identifier."""
46
+ r"""ERC-4626 vault position."""
32
47
 
33
48
  vault_address: str
34
- r"""The vault address you are depositing to."""
49
+ r"""The vault address."""
35
50
 
36
- amount_in_underlying_token: str
37
- r"""The user's position value denominated in the underlying token."""
51
+ vault_name: str
52
+ r"""Name of the vault token (share token)."""
38
53
 
39
- token_name: str
54
+ underlying_symbol: str
40
55
  r"""Symbol of the underlying token (e.g., USDC)."""
41
56
 
42
- vault_name: str
43
- r"""Name of the vault token (share token)."""
57
+ balance: str
58
+ r"""The user's position value in underlying token."""
44
59
 
45
60
  TYPE: Annotated[
46
61
  Annotated[Literal["VAULT"], AfterValidator(validate_const("VAULT"))],
47
62
  pydantic.Field(alias="type"),
48
63
  ] = "VAULT"
49
64
  r"""The market type discriminator."""
65
+
66
+ pnl: OptionalNullable[PositionPnL] = UNSET
67
+ r"""PnL metrics for this position."""
68
+
69
+ deposits: Optional[List[DepositEvent]] = None
70
+ r"""All deposit events for this position."""
71
+
72
+ withdrawals: Optional[List[WithdrawalEvent]] = None
73
+ r"""All withdrawal events for this position."""
74
+
75
+ @model_serializer(mode="wrap")
76
+ def serialize_model(self, handler):
77
+ optional_fields = ["pnl", "deposits", "withdrawals"]
78
+ nullable_fields = ["pnl"]
79
+ null_default_fields = []
80
+
81
+ serialized = handler(self)
82
+
83
+ m = {}
84
+
85
+ for n, f in type(self).model_fields.items():
86
+ k = f.alias or n
87
+ val = serialized.get(k)
88
+ serialized.pop(k, None)
89
+
90
+ optional_nullable = k in optional_fields and k in nullable_fields
91
+ is_set = (
92
+ self.__pydantic_fields_set__.intersection({n})
93
+ or k in null_default_fields
94
+ ) # pylint: disable=no-member
95
+
96
+ if val is not None and val != UNSET_SENTINEL:
97
+ m[k] = val
98
+ elif val != UNSET_SENTINEL and (
99
+ not k in optional_fields or (optional_nullable and is_set)
100
+ ):
101
+ m[k] = val
102
+
103
+ return m
@@ -9,21 +9,21 @@ from typing_extensions import Annotated, TypedDict
9
9
  class CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712DomainTypedDict(
10
10
  TypedDict
11
11
  ):
12
- r"""The EIP-712 domain separator for Safe transactions."""
12
+ r"""The EIP-712 domain separator."""
13
13
 
14
14
  chain_id: int
15
- r"""Chain ID for the Safe transaction"""
15
+ r"""Chain ID"""
16
16
  verifying_contract: str
17
- r"""Address of the Safe contract"""
17
+ r"""Address of the Product Account"""
18
18
 
19
19
 
20
20
  class CompassAPIBackendV2ModelsSafeTransactResponseBatchedSafeOperationsEip712Domain(
21
21
  BaseModel
22
22
  ):
23
- r"""The EIP-712 domain separator for Safe transactions."""
23
+ r"""The EIP-712 domain separator."""
24
24
 
25
25
  chain_id: Annotated[int, pydantic.Field(alias="chainId")]
26
- r"""Chain ID for the Safe transaction"""
26
+ r"""Chain ID"""
27
27
 
28
28
  verifying_contract: Annotated[str, pydantic.Field(alias="verifyingContract")]
29
- r"""Address of the Safe contract"""
29
+ r"""Address of the Product Account"""
@@ -0,0 +1,61 @@
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
+ from typing_extensions import TypedDict
6
+
7
+
8
+ class DepositEventTypedDict(TypedDict):
9
+ r"""Historical deposit event for position transparency.
10
+
11
+ Uses generic input/output format that works across all protocols:
12
+ - Vault: input=underlying, output=shares
13
+ - Aave: input=underlying, output=aTokens
14
+ - Pendle: input=token (varies), output=PT
15
+ """
16
+
17
+ block_number: int
18
+ r"""Block number when deposit occurred"""
19
+ transaction_hash: str
20
+ r"""Transaction hash of the deposit"""
21
+ input_amount: str
22
+ r"""Amount deposited (underlying asset or swap token)"""
23
+ input_symbol: str
24
+ r"""Symbol of token deposited"""
25
+ output_amount: str
26
+ r"""Units received (shares, aTokens, or PT)"""
27
+ output_symbol: str
28
+ r"""Symbol of units received"""
29
+ cost_per_unit: str
30
+ r"""Cost basis per unit at time of deposit"""
31
+
32
+
33
+ class DepositEvent(BaseModel):
34
+ r"""Historical deposit event for position transparency.
35
+
36
+ Uses generic input/output format that works across all protocols:
37
+ - Vault: input=underlying, output=shares
38
+ - Aave: input=underlying, output=aTokens
39
+ - Pendle: input=token (varies), output=PT
40
+ """
41
+
42
+ block_number: int
43
+ r"""Block number when deposit occurred"""
44
+
45
+ transaction_hash: str
46
+ r"""Transaction hash of the deposit"""
47
+
48
+ input_amount: str
49
+ r"""Amount deposited (underlying asset or swap token)"""
50
+
51
+ input_symbol: str
52
+ r"""Symbol of token deposited"""
53
+
54
+ output_amount: str
55
+ r"""Units received (shares, aTokens, or PT)"""
56
+
57
+ output_symbol: str
58
+ r"""Symbol of units received"""
59
+
60
+ cost_per_unit: str
61
+ r"""Cost basis per unit at time of deposit"""
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from .aavevenue import AaveVenue, AaveVenueTypedDict
5
+ from .pendleptvenue import PendlePTVenue, PendlePTVenueTypedDict
5
6
  from .vaultvenue import VaultVenue, VaultVenueTypedDict
6
7
  from compass_api_sdk.types import BaseModel
7
8
  from compass_api_sdk.utils import validate_const
@@ -14,13 +15,14 @@ from typing_extensions import Annotated, TypeAliasType, TypedDict
14
15
 
15
16
 
16
17
  EarnManageParamsVenueTypedDict = TypeAliasType(
17
- "EarnManageParamsVenueTypedDict", Union[VaultVenueTypedDict, AaveVenueTypedDict]
18
+ "EarnManageParamsVenueTypedDict",
19
+ Union[VaultVenueTypedDict, AaveVenueTypedDict, PendlePTVenueTypedDict],
18
20
  )
19
21
  r"""The earn venue."""
20
22
 
21
23
 
22
24
  EarnManageParamsVenue = Annotated[
23
- Union[AaveVenue, VaultVenue], Field(discriminator="TYPE")
25
+ Union[AaveVenue, PendlePTVenue, VaultVenue], Field(discriminator="TYPE")
24
26
  ]
25
27
  r"""The earn venue."""
26
28
 
@@ -33,7 +35,7 @@ class EarnManageParamsAction(str, Enum):
33
35
 
34
36
 
35
37
  class EarnManageParamsTypedDict(TypedDict):
36
- r"""Parameters for earn manage operations (deposit/withdraw to vault/Aave).
38
+ r"""Parameters for earn manage operations (deposit/withdraw to vault/Aave/Pendle PT).
37
39
 
38
40
  Used by multicall/bundle endpoint to specify manage actions. EarnManageRequest
39
41
  inherits from this class.
@@ -44,13 +46,13 @@ class EarnManageParamsTypedDict(TypedDict):
44
46
  action: EarnManageParamsAction
45
47
  r"""Whether you are depositing into or withdrawing from the given Earn `venue`."""
46
48
  amount: Any
47
- r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0."""
49
+ r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0."""
48
50
  action_type: Literal["V2_MANAGE"]
49
51
  r"""Action type identifier for manage operations."""
50
52
 
51
53
 
52
54
  class EarnManageParams(BaseModel):
53
- r"""Parameters for earn manage operations (deposit/withdraw to vault/Aave).
55
+ r"""Parameters for earn manage operations (deposit/withdraw to vault/Aave/Pendle PT).
54
56
 
55
57
  Used by multicall/bundle endpoint to specify manage actions. EarnManageRequest
56
58
  inherits from this class.
@@ -63,7 +65,7 @@ class EarnManageParams(BaseModel):
63
65
  r"""Whether you are depositing into or withdrawing from the given Earn `venue`."""
64
66
 
65
67
  amount: Any
66
- r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0."""
68
+ r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0."""
67
69
 
68
70
  ACTION_TYPE: Annotated[
69
71
  Annotated[
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
  from .aavevenue import AaveVenue, AaveVenueTypedDict
5
5
  from .chain import Chain
6
6
  from .fee import Fee, FeeTypedDict
7
+ from .pendleptvenue import PendlePTVenue, PendlePTVenueTypedDict
7
8
  from .vaultvenue import VaultVenue, VaultVenueTypedDict
8
9
  from compass_api_sdk.types import (
9
10
  BaseModel,
@@ -22,13 +23,14 @@ from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
22
23
 
23
24
 
24
25
  EarnManageRequestVenueTypedDict = TypeAliasType(
25
- "EarnManageRequestVenueTypedDict", Union[VaultVenueTypedDict, AaveVenueTypedDict]
26
+ "EarnManageRequestVenueTypedDict",
27
+ Union[VaultVenueTypedDict, AaveVenueTypedDict, PendlePTVenueTypedDict],
26
28
  )
27
29
  r"""The earn venue."""
28
30
 
29
31
 
30
32
  EarnManageRequestVenue = Annotated[
31
- Union[AaveVenue, VaultVenue], Field(discriminator="TYPE")
33
+ Union[AaveVenue, PendlePTVenue, VaultVenue], Field(discriminator="TYPE")
32
34
  ]
33
35
  r"""The earn venue."""
34
36
 
@@ -51,7 +53,7 @@ class EarnManageRequestTypedDict(TypedDict):
51
53
  action: EarnManageRequestAction
52
54
  r"""Whether you are depositing into or withdrawing from the given Earn `venue`."""
53
55
  amount: Any
54
- r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0."""
56
+ r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0."""
55
57
  owner: str
56
58
  r"""The primary wallet address that owns and controls the Earn Account."""
57
59
  chain: Chain
@@ -77,7 +79,7 @@ class EarnManageRequest(BaseModel):
77
79
  r"""Whether you are depositing into or withdrawing from the given Earn `venue`."""
78
80
 
79
81
  amount: Any
80
- r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset. Provide as a decimal in token units (not wei); must be > 0."""
82
+ r"""Amount of the underlying asset to act on (deposit or withdraw). For VAULT, this is the vault's underlying token; for AAVE, this is the Aave reserve asset; for PENDLE_PT, this is the amount of `token` to spend (DEPOSIT) or PT to sell (WITHDRAW). Provide as a decimal in token units (not wei); must be > 0."""
81
83
 
82
84
  owner: str
83
85
  r"""The primary wallet address that owns and controls the Earn Account."""
@@ -6,34 +6,43 @@ from .compass_api_backend_v2_models_earn_read_response_positions_vaultposition i
6
6
  CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition,
7
7
  CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPositionTypedDict,
8
8
  )
9
+ from .pendleptposition import PendlePTPosition, PendlePTPositionTypedDict
9
10
  from compass_api_sdk.types import BaseModel
10
- from pydantic import Field
11
- from typing import List, Union
12
- from typing_extensions import Annotated, TypeAliasType, TypedDict
11
+ from typing import List, Optional
12
+ from typing_extensions import NotRequired, TypedDict
13
13
 
14
14
 
15
- UserPositionTypedDict = TypeAliasType(
16
- "UserPositionTypedDict",
17
- Union[
18
- CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPositionTypedDict,
19
- AavePositionTypedDict,
20
- ],
21
- )
15
+ class EarnPositionsResponseTypedDict(TypedDict):
16
+ r"""Grouped positions by protocol.
22
17
 
18
+ This new structure groups positions by protocol type for better organization and
19
+ removes the need for a discriminated union in SDK consumers.
20
+ """
23
21
 
24
- UserPosition = Annotated[
25
- Union[
26
- AavePosition, CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition
27
- ],
28
- Field(discriminator="TYPE"),
29
- ]
22
+ aave: NotRequired[List[AavePositionTypedDict]]
23
+ r"""Aave V3 lending positions."""
24
+ vaults: NotRequired[
25
+ List[CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPositionTypedDict]
26
+ ]
27
+ r"""ERC-4626 vault positions."""
28
+ pendle_pt: NotRequired[List[PendlePTPositionTypedDict]]
29
+ r"""Pendle Principal Token positions."""
30
30
 
31
31
 
32
- class EarnPositionsResponseTypedDict(TypedDict):
33
- user_positions: List[UserPositionTypedDict]
34
- r"""A list of the user's earn positions."""
32
+ class EarnPositionsResponse(BaseModel):
33
+ r"""Grouped positions by protocol.
35
34
 
35
+ This new structure groups positions by protocol type for better organization and
36
+ removes the need for a discriminated union in SDK consumers.
37
+ """
36
38
 
37
- class EarnPositionsResponse(BaseModel):
38
- user_positions: List[UserPosition]
39
- r"""A list of the user's earn positions."""
39
+ aave: Optional[List[AavePosition]] = None
40
+ r"""Aave V3 lending positions."""
41
+
42
+ vaults: Optional[
43
+ List[CompassAPIBackendV2ModelsEarnReadResponsePositionsVaultPosition]
44
+ ] = None
45
+ r"""ERC-4626 vault positions."""
46
+
47
+ pendle_pt: Optional[List[PendlePTPosition]] = None
48
+ r"""Pendle Principal Token positions."""
@@ -8,27 +8,28 @@ from typing_extensions import NotRequired, TypeAliasType, TypedDict
8
8
 
9
9
 
10
10
  FeeAmountTypedDict = TypeAliasType("FeeAmountTypedDict", Union[float, str])
11
- r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens)."""
11
+ r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit)."""
12
12
 
13
13
 
14
14
  FeeAmount = TypeAliasType("FeeAmount", Union[float, str])
15
- r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens)."""
15
+ r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit)."""
16
16
 
17
17
 
18
18
  class Denomination(str, Enum):
19
- r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount) or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens)."""
19
+ r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit)."""
20
20
 
21
21
  PERCENTAGE = "PERCENTAGE"
22
22
  FIXED = "FIXED"
23
+ PERFORMANCE = "PERFORMANCE"
23
24
 
24
25
 
25
26
  class FeeTypedDict(TypedDict):
26
27
  recipient: str
27
28
  r"""The wallet address that will receive the fee."""
28
29
  amount: FeeAmountTypedDict
29
- r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens)."""
30
+ r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit)."""
30
31
  denomination: NotRequired[Denomination]
31
- r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount) or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens)."""
32
+ r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit)."""
32
33
 
33
34
 
34
35
  class Fee(BaseModel):
@@ -36,7 +37,7 @@ class Fee(BaseModel):
36
37
  r"""The wallet address that will receive the fee."""
37
38
 
38
39
  amount: FeeAmount
39
- r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens)."""
40
+ r"""The fee amount. If `denomination` is 'PERCENTAGE', this is a percentage of the transaction amount (e.g., 1.5 for 1.5%). If `denomination` is 'FIXED', this is a fixed amount in token units (e.g., 0.1 for 0.1 tokens). If `denomination` is 'PERFORMANCE', this is a percentage of realized profit calculated using FIFO cost basis (e.g., 10 for 10% of profit)."""
40
41
 
41
42
  denomination: Optional[Denomination] = None
42
- r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount) or 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens)."""
43
+ r"""The unit type for the fee amount. Use 'PERCENTAGE' for a percentage-based fee (e.g., 1.5 means 1.5% of the transaction amount), 'FIXED' for a fixed token amount (e.g., 0.1 means 0.1 tokens), or 'PERFORMANCE' for a fee based on realized profit using FIFO cost basis (e.g., 10 means 10% of profit)."""
@@ -0,0 +1,49 @@
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
+ from typing_extensions import TypedDict
6
+
7
+
8
+ class PendleDepositEventTypedDict(TypedDict):
9
+ r"""Pendle PT deposit event with cost basis at time of deposit."""
10
+
11
+ block_number: int
12
+ r"""Block number when deposit occurred"""
13
+ transaction_hash: str
14
+ r"""Transaction hash of the deposit"""
15
+ input_amount: str
16
+ r"""Amount deposited (token spent)"""
17
+ input_symbol: str
18
+ r"""Symbol of token deposited"""
19
+ output_amount: str
20
+ r"""PT tokens received"""
21
+ output_symbol: str
22
+ r"""Symbol (PT)"""
23
+ cost_per_unit: str
24
+ r"""Cost basis per PT at deposit (SY spent per PT acquired)"""
25
+
26
+
27
+ class PendleDepositEvent(BaseModel):
28
+ r"""Pendle PT deposit event with cost basis at time of deposit."""
29
+
30
+ block_number: int
31
+ r"""Block number when deposit occurred"""
32
+
33
+ transaction_hash: str
34
+ r"""Transaction hash of the deposit"""
35
+
36
+ input_amount: str
37
+ r"""Amount deposited (token spent)"""
38
+
39
+ input_symbol: str
40
+ r"""Symbol of token deposited"""
41
+
42
+ output_amount: str
43
+ r"""PT tokens received"""
44
+
45
+ output_symbol: str
46
+ r"""Symbol (PT)"""
47
+
48
+ cost_per_unit: str
49
+ r"""Cost basis per PT at deposit (SY spent per PT acquired)"""
@@ -0,0 +1,138 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from compass_api_sdk.types import (
5
+ BaseModel,
6
+ Nullable,
7
+ OptionalNullable,
8
+ UNSET,
9
+ UNSET_SENTINEL,
10
+ )
11
+ from pydantic import model_serializer
12
+ from typing_extensions import NotRequired, TypedDict
13
+
14
+
15
+ class PendleMarketInfoTypedDict(TypedDict):
16
+ r"""Information about a single Pendle market from the database."""
17
+
18
+ market_address: str
19
+ r"""The Pendle market contract address."""
20
+ chain: str
21
+ r"""Blockchain name (e.g., 'ethereum', 'arbitrum')."""
22
+ pt_address: str
23
+ r"""The Principal Token (PT) address."""
24
+ sy_address: NotRequired[Nullable[str]]
25
+ r"""The Standardized Yield (SY) token address."""
26
+ yt_address: NotRequired[Nullable[str]]
27
+ r"""The Yield Token (YT) address."""
28
+ expiry: NotRequired[Nullable[int]]
29
+ r"""The market maturity timestamp (Unix epoch seconds)."""
30
+ underlying_asset: NotRequired[Nullable[str]]
31
+ r"""The underlying asset contract address."""
32
+ underlying_name: NotRequired[Nullable[str]]
33
+ r"""The name of the underlying asset."""
34
+ underlying_symbol: NotRequired[Nullable[str]]
35
+ r"""The symbol of the underlying asset (e.g., 'USDC')."""
36
+ pt_name: NotRequired[Nullable[str]]
37
+ r"""The name of the Principal Token."""
38
+ pt_symbol: NotRequired[Nullable[str]]
39
+ r"""The symbol of the Principal Token."""
40
+ tvl_usd: NotRequired[Nullable[str]]
41
+ r"""Total Value Locked in USD."""
42
+ implied_apy: NotRequired[Nullable[str]]
43
+ r"""Implied APY as a percentage (e.g., 5.25 = 5.25%)."""
44
+
45
+
46
+ class PendleMarketInfo(BaseModel):
47
+ r"""Information about a single Pendle market from the database."""
48
+
49
+ market_address: str
50
+ r"""The Pendle market contract address."""
51
+
52
+ chain: str
53
+ r"""Blockchain name (e.g., 'ethereum', 'arbitrum')."""
54
+
55
+ pt_address: str
56
+ r"""The Principal Token (PT) address."""
57
+
58
+ sy_address: OptionalNullable[str] = UNSET
59
+ r"""The Standardized Yield (SY) token address."""
60
+
61
+ yt_address: OptionalNullable[str] = UNSET
62
+ r"""The Yield Token (YT) address."""
63
+
64
+ expiry: OptionalNullable[int] = UNSET
65
+ r"""The market maturity timestamp (Unix epoch seconds)."""
66
+
67
+ underlying_asset: OptionalNullable[str] = UNSET
68
+ r"""The underlying asset contract address."""
69
+
70
+ underlying_name: OptionalNullable[str] = UNSET
71
+ r"""The name of the underlying asset."""
72
+
73
+ underlying_symbol: OptionalNullable[str] = UNSET
74
+ r"""The symbol of the underlying asset (e.g., 'USDC')."""
75
+
76
+ pt_name: OptionalNullable[str] = UNSET
77
+ r"""The name of the Principal Token."""
78
+
79
+ pt_symbol: OptionalNullable[str] = UNSET
80
+ r"""The symbol of the Principal Token."""
81
+
82
+ tvl_usd: OptionalNullable[str] = UNSET
83
+ r"""Total Value Locked in USD."""
84
+
85
+ implied_apy: OptionalNullable[str] = UNSET
86
+ r"""Implied APY as a percentage (e.g., 5.25 = 5.25%)."""
87
+
88
+ @model_serializer(mode="wrap")
89
+ def serialize_model(self, handler):
90
+ optional_fields = [
91
+ "sy_address",
92
+ "yt_address",
93
+ "expiry",
94
+ "underlying_asset",
95
+ "underlying_name",
96
+ "underlying_symbol",
97
+ "pt_name",
98
+ "pt_symbol",
99
+ "tvl_usd",
100
+ "implied_apy",
101
+ ]
102
+ nullable_fields = [
103
+ "sy_address",
104
+ "yt_address",
105
+ "expiry",
106
+ "underlying_asset",
107
+ "underlying_name",
108
+ "underlying_symbol",
109
+ "pt_name",
110
+ "pt_symbol",
111
+ "tvl_usd",
112
+ "implied_apy",
113
+ ]
114
+ null_default_fields = []
115
+
116
+ serialized = handler(self)
117
+
118
+ m = {}
119
+
120
+ for n, f in type(self).model_fields.items():
121
+ k = f.alias or n
122
+ val = serialized.get(k)
123
+ serialized.pop(k, None)
124
+
125
+ optional_nullable = k in optional_fields and k in nullable_fields
126
+ is_set = (
127
+ self.__pydantic_fields_set__.intersection({n})
128
+ or k in null_default_fields
129
+ ) # pylint: disable=no-member
130
+
131
+ if val is not None and val != UNSET_SENTINEL:
132
+ m[k] = val
133
+ elif val != UNSET_SENTINEL and (
134
+ not k in optional_fields or (optional_nullable and is_set)
135
+ ):
136
+ m[k] = val
137
+
138
+ return m
@@ -0,0 +1,30 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .pendlemarketinfo import PendleMarketInfo, PendleMarketInfoTypedDict
5
+ from compass_api_sdk.types import BaseModel
6
+ from typing import List
7
+ from typing_extensions import TypedDict
8
+
9
+
10
+ class PendleMarketsResponseTypedDict(TypedDict):
11
+ r"""Response model for a paginated list of Pendle markets."""
12
+
13
+ total: int
14
+ offset: int
15
+ limit: int
16
+ markets: List[PendleMarketInfoTypedDict]
17
+ r"""A list of Pendle market information objects."""
18
+
19
+
20
+ class PendleMarketsResponse(BaseModel):
21
+ r"""Response model for a paginated list of Pendle markets."""
22
+
23
+ total: int
24
+
25
+ offset: int
26
+
27
+ limit: int
28
+
29
+ markets: List[PendleMarketInfo]
30
+ r"""A list of Pendle market information objects."""