@compass-labs/api-sdk 2.1.26-rc.0 → 2.1.26-rc.10

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 (125) hide show
  1. package/codeSamples_typescript.yaml +1 -1
  2. package/dist/commonjs/funcs/earnEarnManage.d.ts +4 -1
  3. package/dist/commonjs/funcs/earnEarnManage.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/earnEarnManage.js +4 -1
  5. package/dist/commonjs/funcs/earnEarnManage.js.map +1 -1
  6. package/dist/commonjs/funcs/earnEarnPositions.d.ts +1 -1
  7. package/dist/commonjs/funcs/earnEarnPositions.js +1 -2
  8. package/dist/commonjs/funcs/earnEarnPositions.js.map +1 -1
  9. package/dist/commonjs/lib/config.d.ts +2 -2
  10. package/dist/commonjs/lib/config.js +2 -2
  11. package/dist/commonjs/lib/config.js.map +1 -1
  12. package/dist/commonjs/models/components/aaveposition.d.ts +5 -4
  13. package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/aaveposition.js +2 -1
  15. package/dist/commonjs/models/components/aaveposition.js.map +1 -1
  16. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
  17. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
  19. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  20. package/dist/commonjs/models/components/depositevent.d.ts +32 -0
  21. package/dist/commonjs/models/components/depositevent.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/depositevent.js +63 -0
  23. package/dist/commonjs/models/components/depositevent.js.map +1 -0
  24. package/dist/commonjs/models/components/fee.d.ts +6 -5
  25. package/dist/commonjs/models/components/fee.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/fee.js +2 -1
  27. package/dist/commonjs/models/components/fee.js.map +1 -1
  28. package/dist/commonjs/models/components/index.d.ts +3 -0
  29. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/index.js +3 -0
  31. package/dist/commonjs/models/components/index.js.map +1 -1
  32. package/dist/commonjs/models/components/positionpnl.d.ts +50 -0
  33. package/dist/commonjs/models/components/positionpnl.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/positionpnl.js +71 -0
  35. package/dist/commonjs/models/components/positionpnl.js.map +1 -0
  36. package/dist/commonjs/models/components/withdrawalevent.d.ts +40 -0
  37. package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -0
  38. package/dist/commonjs/models/components/withdrawalevent.js +67 -0
  39. package/dist/commonjs/models/components/withdrawalevent.js.map +1 -0
  40. package/dist/commonjs/models/operations/v2earnpositions.d.ts +0 -5
  41. package/dist/commonjs/models/operations/v2earnpositions.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/v2earnpositions.js +0 -1
  43. package/dist/commonjs/models/operations/v2earnpositions.js.map +1 -1
  44. package/dist/commonjs/sdk/earn.d.ts +5 -2
  45. package/dist/commonjs/sdk/earn.d.ts.map +1 -1
  46. package/dist/commonjs/sdk/earn.js +5 -2
  47. package/dist/commonjs/sdk/earn.js.map +1 -1
  48. package/dist/esm/funcs/earnEarnManage.d.ts +4 -1
  49. package/dist/esm/funcs/earnEarnManage.d.ts.map +1 -1
  50. package/dist/esm/funcs/earnEarnManage.js +4 -1
  51. package/dist/esm/funcs/earnEarnManage.js.map +1 -1
  52. package/dist/esm/funcs/earnEarnPositions.d.ts +1 -1
  53. package/dist/esm/funcs/earnEarnPositions.js +1 -2
  54. package/dist/esm/funcs/earnEarnPositions.js.map +1 -1
  55. package/dist/esm/lib/config.d.ts +2 -2
  56. package/dist/esm/lib/config.js +2 -2
  57. package/dist/esm/lib/config.js.map +1 -1
  58. package/dist/esm/models/components/aaveposition.d.ts +5 -4
  59. package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
  60. package/dist/esm/models/components/aaveposition.js +2 -1
  61. package/dist/esm/models/components/aaveposition.js.map +1 -1
  62. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
  63. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  64. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
  65. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  66. package/dist/esm/models/components/depositevent.d.ts +32 -0
  67. package/dist/esm/models/components/depositevent.d.ts.map +1 -0
  68. package/dist/esm/models/components/depositevent.js +26 -0
  69. package/dist/esm/models/components/depositevent.js.map +1 -0
  70. package/dist/esm/models/components/fee.d.ts +6 -5
  71. package/dist/esm/models/components/fee.d.ts.map +1 -1
  72. package/dist/esm/models/components/fee.js +2 -1
  73. package/dist/esm/models/components/fee.js.map +1 -1
  74. package/dist/esm/models/components/index.d.ts +3 -0
  75. package/dist/esm/models/components/index.d.ts.map +1 -1
  76. package/dist/esm/models/components/index.js +3 -0
  77. package/dist/esm/models/components/index.js.map +1 -1
  78. package/dist/esm/models/components/positionpnl.d.ts +50 -0
  79. package/dist/esm/models/components/positionpnl.d.ts.map +1 -0
  80. package/dist/esm/models/components/positionpnl.js +34 -0
  81. package/dist/esm/models/components/positionpnl.js.map +1 -0
  82. package/dist/esm/models/components/withdrawalevent.d.ts +40 -0
  83. package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -0
  84. package/dist/esm/models/components/withdrawalevent.js +30 -0
  85. package/dist/esm/models/components/withdrawalevent.js.map +1 -0
  86. package/dist/esm/models/operations/v2earnpositions.d.ts +0 -5
  87. package/dist/esm/models/operations/v2earnpositions.d.ts.map +1 -1
  88. package/dist/esm/models/operations/v2earnpositions.js +0 -1
  89. package/dist/esm/models/operations/v2earnpositions.js.map +1 -1
  90. package/dist/esm/sdk/earn.d.ts +5 -2
  91. package/dist/esm/sdk/earn.d.ts.map +1 -1
  92. package/dist/esm/sdk/earn.js +5 -2
  93. package/dist/esm/sdk/earn.js.map +1 -1
  94. package/docs/models/components/aaveliquiditychangeresponse.md +2 -2
  95. package/docs/models/components/aaveposition.md +8 -9
  96. package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +8 -9
  97. package/docs/models/components/cooldownend.md +1 -1
  98. package/docs/models/components/cooldownposition.md +1 -1
  99. package/docs/models/components/denomination.md +2 -2
  100. package/docs/models/components/depositevent.md +27 -0
  101. package/docs/models/components/fee.md +5 -5
  102. package/docs/models/components/feeamount.md +1 -1
  103. package/docs/models/components/pendlegetmarketresponse.md +1 -1
  104. package/docs/models/components/pendlelistmarketsresponse.md +2 -2
  105. package/docs/models/components/pendlelistuserpositionsresponse.md +1 -1
  106. package/docs/models/components/pendlemarket.md +2 -2
  107. package/docs/models/components/position.md +1 -1
  108. package/docs/models/components/positionpnl.md +33 -0
  109. package/docs/models/components/userposition.md +0 -2
  110. package/docs/models/components/withdrawalevent.md +31 -0
  111. package/docs/models/operations/v2earnpositionsrequest.md +1 -3
  112. package/docs/sdks/earn/README.md +5 -4
  113. package/package.json +1 -1
  114. package/src/funcs/earnEarnManage.ts +4 -1
  115. package/src/funcs/earnEarnPositions.ts +1 -2
  116. package/src/lib/config.ts +2 -2
  117. package/src/models/components/aaveposition.ts +6 -5
  118. package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +6 -5
  119. package/src/models/components/depositevent.ts +66 -0
  120. package/src/models/components/fee.ts +6 -5
  121. package/src/models/components/index.ts +3 -0
  122. package/src/models/components/positionpnl.ts +93 -0
  123. package/src/models/components/withdrawalevent.ts +78 -0
  124. package/src/models/operations/v2earnpositions.ts +0 -6
  125. package/src/sdk/earn.ts +5 -2
@@ -0,0 +1,93 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { DepositEvent, DepositEvent$inboundSchema } from "./depositevent.js";
11
+ import {
12
+ WithdrawalEvent,
13
+ WithdrawalEvent$inboundSchema,
14
+ } from "./withdrawalevent.js";
15
+
16
+ /**
17
+ * PnL breakdown for a position.
18
+ */
19
+ export type PositionPnL = {
20
+ /**
21
+ * Total assets deposited over all time
22
+ */
23
+ totalDeposited: string;
24
+ /**
25
+ * Total assets withdrawn over all time
26
+ */
27
+ totalWithdrawn: string;
28
+ /**
29
+ * FIFO cost basis of remaining position
30
+ */
31
+ costBasis: string;
32
+ /**
33
+ * current_value - cost_basis
34
+ */
35
+ unrealizedPnl: string;
36
+ /**
37
+ * Sum of profits/losses from all withdrawals
38
+ */
39
+ realizedPnl: string;
40
+ /**
41
+ * unrealized_pnl + realized_pnl
42
+ */
43
+ totalYield: string;
44
+ /**
45
+ * Sum of performance fees paid
46
+ */
47
+ totalFeesPaid: string;
48
+ /**
49
+ * All deposit events for this position
50
+ */
51
+ deposits?: Array<DepositEvent> | undefined;
52
+ /**
53
+ * All withdrawal events for this position
54
+ */
55
+ withdrawals?: Array<WithdrawalEvent> | undefined;
56
+ };
57
+
58
+ /** @internal */
59
+ export const PositionPnL$inboundSchema: z.ZodType<
60
+ PositionPnL,
61
+ z.ZodTypeDef,
62
+ unknown
63
+ > = z.object({
64
+ total_deposited: z.string(),
65
+ total_withdrawn: z.string(),
66
+ cost_basis: z.string(),
67
+ unrealized_pnl: z.string(),
68
+ realized_pnl: z.string(),
69
+ total_yield: z.string(),
70
+ total_fees_paid: z.string(),
71
+ deposits: z.array(DepositEvent$inboundSchema).optional(),
72
+ withdrawals: z.array(WithdrawalEvent$inboundSchema).optional(),
73
+ }).transform((v) => {
74
+ return remap$(v, {
75
+ "total_deposited": "totalDeposited",
76
+ "total_withdrawn": "totalWithdrawn",
77
+ "cost_basis": "costBasis",
78
+ "unrealized_pnl": "unrealizedPnl",
79
+ "realized_pnl": "realizedPnl",
80
+ "total_yield": "totalYield",
81
+ "total_fees_paid": "totalFeesPaid",
82
+ });
83
+ });
84
+
85
+ export function positionPnLFromJSON(
86
+ jsonString: string,
87
+ ): SafeParseResult<PositionPnL, SDKValidationError> {
88
+ return safeParse(
89
+ jsonString,
90
+ (x) => PositionPnL$inboundSchema.parse(JSON.parse(x)),
91
+ `Failed to parse 'PositionPnL' from JSON`,
92
+ );
93
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * Historical withdrawal event with realized PnL.
13
+ */
14
+ export type WithdrawalEvent = {
15
+ /**
16
+ * Block number when withdrawal occurred
17
+ */
18
+ blockNumber: number;
19
+ /**
20
+ * Transaction hash of the withdrawal
21
+ */
22
+ transactionHash: string;
23
+ /**
24
+ * Amount of underlying asset received
25
+ */
26
+ assetsReceived: string;
27
+ /**
28
+ * Shares (vault) or aTokens (Aave) burned
29
+ */
30
+ unitsWithdrawn: string;
31
+ /**
32
+ * FIFO cost basis of units withdrawn
33
+ */
34
+ costBasisConsumed: string;
35
+ /**
36
+ * Profit/loss: assets_received - cost_basis_consumed
37
+ */
38
+ realizedPnl: string;
39
+ /**
40
+ * Performance fee charged on this withdrawal
41
+ */
42
+ feeCharged: string;
43
+ };
44
+
45
+ /** @internal */
46
+ export const WithdrawalEvent$inboundSchema: z.ZodType<
47
+ WithdrawalEvent,
48
+ z.ZodTypeDef,
49
+ unknown
50
+ > = z.object({
51
+ block_number: z.number().int(),
52
+ transaction_hash: z.string(),
53
+ assets_received: z.string(),
54
+ units_withdrawn: z.string(),
55
+ cost_basis_consumed: z.string(),
56
+ realized_pnl: z.string(),
57
+ fee_charged: z.string(),
58
+ }).transform((v) => {
59
+ return remap$(v, {
60
+ "block_number": "blockNumber",
61
+ "transaction_hash": "transactionHash",
62
+ "assets_received": "assetsReceived",
63
+ "units_withdrawn": "unitsWithdrawn",
64
+ "cost_basis_consumed": "costBasisConsumed",
65
+ "realized_pnl": "realizedPnl",
66
+ "fee_charged": "feeCharged",
67
+ });
68
+ });
69
+
70
+ export function withdrawalEventFromJSON(
71
+ jsonString: string,
72
+ ): SafeParseResult<WithdrawalEvent, SDKValidationError> {
73
+ return safeParse(
74
+ jsonString,
75
+ (x) => WithdrawalEvent$inboundSchema.parse(JSON.parse(x)),
76
+ `Failed to parse 'WithdrawalEvent' from JSON`,
77
+ );
78
+ }
@@ -27,10 +27,6 @@ export type V2EarnPositionsRequest = {
27
27
  * The address of the user to get vault positions for.
28
28
  */
29
29
  userAddress: string;
30
- /**
31
- * How many days back from the current time to include in the blockchain scan.
32
- */
33
- days?: number | undefined;
34
30
  };
35
31
 
36
32
  /** @internal */
@@ -44,7 +40,6 @@ export type V2EarnPositionsRequest$Outbound = {
44
40
  limit?: number | undefined;
45
41
  chain: string;
46
42
  user_address: string;
47
- days?: number | undefined;
48
43
  };
49
44
 
50
45
  /** @internal */
@@ -57,7 +52,6 @@ export const V2EarnPositionsRequest$outboundSchema: z.ZodType<
57
52
  limit: z.number().int().optional(),
58
53
  chain: V2EarnPositionsChain$outboundSchema,
59
54
  userAddress: z.string(),
60
- days: z.number().int().optional(),
61
55
  }).transform((v) => {
62
56
  return remap$(v, {
63
57
  userAddress: "user_address",
package/src/sdk/earn.ts CHANGED
@@ -20,7 +20,7 @@ export class Earn extends ClientSDK {
20
20
  * List earn positions
21
21
  *
22
22
  * @remarks
23
- * This endpoint fetches all Compass Earn positions.
23
+ * This endpoint fetches all Compass Earn positions with PnL information.
24
24
  */
25
25
  async earnPositions(
26
26
  request: operations.V2EarnPositionsRequest,
@@ -145,7 +145,10 @@ export class Earn extends ClientSDK {
145
145
  *
146
146
  * If `WITHDRAW` is selected for `action`, tokens will be withdrawn from the selected venue address back into the Earn Account associated with the `owner` wallet.
147
147
  *
148
- * A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as a `FIXED` amount or a `PERCENTAGE` of `amount`.
148
+ * A fee can be configured. This fee is deducted from the total `amount`. It can be expressed as:
149
+ * - `FIXED`: a fixed token amount (e.g., 0.1 means 0.1 tokens)
150
+ * - `PERCENTAGE`: a percentage of the transaction amount (e.g., 1.5 means 1.5%)
151
+ * - `PERFORMANCE`: a percentage of realized profit using FIFO cost basis (e.g., 10 means 10% of profit). Only applicable for withdrawals.
149
152
  *
150
153
  * The transaction can be gas-sponsored by an arbitrary wallet address which will sign, submit and pay the required gas for the transaction. If `gas_sponsorship` is set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`) where the `sender` of the transaction can be set.
151
154
  */