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

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 (99) hide show
  1. package/codeSamples_typescript.yaml +1 -1
  2. package/dist/commonjs/funcs/earnEarnPositions.d.ts +1 -1
  3. package/dist/commonjs/funcs/earnEarnPositions.js +1 -2
  4. package/dist/commonjs/funcs/earnEarnPositions.js.map +1 -1
  5. package/dist/commonjs/lib/config.d.ts +2 -2
  6. package/dist/commonjs/lib/config.js +2 -2
  7. package/dist/commonjs/lib/config.js.map +1 -1
  8. package/dist/commonjs/models/components/aaveposition.d.ts +5 -0
  9. package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
  10. package/dist/commonjs/models/components/aaveposition.js +2 -0
  11. package/dist/commonjs/models/components/aaveposition.js.map +1 -1
  12. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -0
  13. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  14. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -0
  15. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  16. package/dist/commonjs/models/components/depositevent.d.ts +36 -0
  17. package/dist/commonjs/models/components/depositevent.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/depositevent.js +65 -0
  19. package/dist/commonjs/models/components/depositevent.js.map +1 -0
  20. package/dist/commonjs/models/components/index.d.ts +3 -0
  21. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/index.js +3 -0
  23. package/dist/commonjs/models/components/index.js.map +1 -1
  24. package/dist/commonjs/models/components/positionpnl.d.ts +50 -0
  25. package/dist/commonjs/models/components/positionpnl.d.ts.map +1 -0
  26. package/dist/commonjs/models/components/positionpnl.js +71 -0
  27. package/dist/commonjs/models/components/positionpnl.js.map +1 -0
  28. package/dist/commonjs/models/components/withdrawalevent.d.ts +44 -0
  29. package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -0
  30. package/dist/commonjs/models/components/withdrawalevent.js +69 -0
  31. package/dist/commonjs/models/components/withdrawalevent.js.map +1 -0
  32. package/dist/commonjs/models/operations/v2earnpositions.d.ts +0 -5
  33. package/dist/commonjs/models/operations/v2earnpositions.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/v2earnpositions.js +0 -1
  35. package/dist/commonjs/models/operations/v2earnpositions.js.map +1 -1
  36. package/dist/commonjs/sdk/earn.d.ts +1 -1
  37. package/dist/commonjs/sdk/earn.js +1 -1
  38. package/dist/esm/funcs/earnEarnPositions.d.ts +1 -1
  39. package/dist/esm/funcs/earnEarnPositions.js +1 -2
  40. package/dist/esm/funcs/earnEarnPositions.js.map +1 -1
  41. package/dist/esm/lib/config.d.ts +2 -2
  42. package/dist/esm/lib/config.js +2 -2
  43. package/dist/esm/lib/config.js.map +1 -1
  44. package/dist/esm/models/components/aaveposition.d.ts +5 -0
  45. package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
  46. package/dist/esm/models/components/aaveposition.js +2 -0
  47. package/dist/esm/models/components/aaveposition.js.map +1 -1
  48. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -0
  49. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  50. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -0
  51. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  52. package/dist/esm/models/components/depositevent.d.ts +36 -0
  53. package/dist/esm/models/components/depositevent.d.ts.map +1 -0
  54. package/dist/esm/models/components/depositevent.js +28 -0
  55. package/dist/esm/models/components/depositevent.js.map +1 -0
  56. package/dist/esm/models/components/index.d.ts +3 -0
  57. package/dist/esm/models/components/index.d.ts.map +1 -1
  58. package/dist/esm/models/components/index.js +3 -0
  59. package/dist/esm/models/components/index.js.map +1 -1
  60. package/dist/esm/models/components/positionpnl.d.ts +50 -0
  61. package/dist/esm/models/components/positionpnl.d.ts.map +1 -0
  62. package/dist/esm/models/components/positionpnl.js +34 -0
  63. package/dist/esm/models/components/positionpnl.js.map +1 -0
  64. package/dist/esm/models/components/withdrawalevent.d.ts +44 -0
  65. package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -0
  66. package/dist/esm/models/components/withdrawalevent.js +32 -0
  67. package/dist/esm/models/components/withdrawalevent.js.map +1 -0
  68. package/dist/esm/models/operations/v2earnpositions.d.ts +0 -5
  69. package/dist/esm/models/operations/v2earnpositions.d.ts.map +1 -1
  70. package/dist/esm/models/operations/v2earnpositions.js +0 -1
  71. package/dist/esm/models/operations/v2earnpositions.js.map +1 -1
  72. package/dist/esm/sdk/earn.d.ts +1 -1
  73. package/dist/esm/sdk/earn.js +1 -1
  74. package/docs/models/components/aaveliquiditychangeresponse.md +2 -2
  75. package/docs/models/components/aaveposition.md +9 -8
  76. package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +9 -8
  77. package/docs/models/components/cooldownend.md +1 -1
  78. package/docs/models/components/cooldownposition.md +1 -1
  79. package/docs/models/components/depositevent.md +29 -0
  80. package/docs/models/components/pendlegetmarketresponse.md +1 -1
  81. package/docs/models/components/pendlelistmarketsresponse.md +2 -2
  82. package/docs/models/components/pendlelistuserpositionsresponse.md +1 -1
  83. package/docs/models/components/pendlemarket.md +2 -2
  84. package/docs/models/components/position.md +1 -1
  85. package/docs/models/components/positionpnl.md +33 -0
  86. package/docs/models/components/withdrawalevent.md +33 -0
  87. package/docs/models/operations/v2earnpositionsrequest.md +1 -3
  88. package/docs/sdks/earn/README.md +1 -3
  89. package/package.json +1 -1
  90. package/src/funcs/earnEarnPositions.ts +1 -2
  91. package/src/lib/config.ts +2 -2
  92. package/src/models/components/aaveposition.ts +6 -0
  93. package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +6 -0
  94. package/src/models/components/depositevent.ts +74 -0
  95. package/src/models/components/index.ts +3 -0
  96. package/src/models/components/positionpnl.ts +93 -0
  97. package/src/models/components/withdrawalevent.ts +86 -0
  98. package/src/models/operations/v2earnpositions.ts +0 -6
  99. package/src/sdk/earn.ts +1 -1
@@ -79,6 +79,7 @@ export * from "./compassapibackendv2modelssafetransactresponsebatchedsafeoperati
79
79
  export * from "./cooldownposition.js";
80
80
  export * from "./createaccountrequest.js";
81
81
  export * from "./createaccountresponse.js";
82
+ export * from "./depositevent.js";
82
83
  export * from "./depositforburnrequest.js";
83
84
  export * from "./depositforburnresponse.js";
84
85
  export * from "./details.js";
@@ -168,6 +169,7 @@ export * from "./permittypeddataresponseinput.js";
168
169
  export * from "./permittypeddataresponseoutput.js";
169
170
  export * from "./portfolio.js";
170
171
  export * from "./position.js";
172
+ export * from "./positionpnl.js";
171
173
  export * from "./protocol.js";
172
174
  export * from "./repay.js";
173
175
  export * from "./reserve.js";
@@ -246,6 +248,7 @@ export * from "./vaultwithdrawrequest.js";
246
248
  export * from "./weeklyapys.js";
247
249
  export * from "./wildcatgetmarketresponse.js";
248
250
  export * from "./withdraw.js";
251
+ export * from "./withdrawalevent.js";
249
252
  export * from "./wrapethparams.js";
250
253
  export * from "./wrapethrequest.js";
251
254
  export * from "./yieldrange.js";
@@ -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,86 @@
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
+ * Timestamp of the withdrawal
21
+ */
22
+ blockTimestamp: Date;
23
+ /**
24
+ * Transaction hash of the withdrawal
25
+ */
26
+ transactionHash: string;
27
+ /**
28
+ * Amount of underlying asset received
29
+ */
30
+ assetsReceived: string;
31
+ /**
32
+ * Shares (vault) or aTokens (Aave) burned
33
+ */
34
+ unitsWithdrawn: string;
35
+ /**
36
+ * FIFO cost basis of units withdrawn
37
+ */
38
+ costBasisConsumed: string;
39
+ /**
40
+ * Profit/loss: assets_received - cost_basis_consumed
41
+ */
42
+ realizedPnl: string;
43
+ /**
44
+ * Performance fee charged on this withdrawal
45
+ */
46
+ feeCharged: string;
47
+ };
48
+
49
+ /** @internal */
50
+ export const WithdrawalEvent$inboundSchema: z.ZodType<
51
+ WithdrawalEvent,
52
+ z.ZodTypeDef,
53
+ unknown
54
+ > = z.object({
55
+ block_number: z.number().int(),
56
+ block_timestamp: z.string().datetime({ offset: true }).transform(v =>
57
+ new Date(v)
58
+ ),
59
+ transaction_hash: z.string(),
60
+ assets_received: z.string(),
61
+ units_withdrawn: z.string(),
62
+ cost_basis_consumed: z.string(),
63
+ realized_pnl: z.string(),
64
+ fee_charged: z.string(),
65
+ }).transform((v) => {
66
+ return remap$(v, {
67
+ "block_number": "blockNumber",
68
+ "block_timestamp": "blockTimestamp",
69
+ "transaction_hash": "transactionHash",
70
+ "assets_received": "assetsReceived",
71
+ "units_withdrawn": "unitsWithdrawn",
72
+ "cost_basis_consumed": "costBasisConsumed",
73
+ "realized_pnl": "realizedPnl",
74
+ "fee_charged": "feeCharged",
75
+ });
76
+ });
77
+
78
+ export function withdrawalEventFromJSON(
79
+ jsonString: string,
80
+ ): SafeParseResult<WithdrawalEvent, SDKValidationError> {
81
+ return safeParse(
82
+ jsonString,
83
+ (x) => WithdrawalEvent$inboundSchema.parse(JSON.parse(x)),
84
+ `Failed to parse 'WithdrawalEvent' from JSON`,
85
+ );
86
+ }
@@ -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,