@compass-labs/api-sdk 2.1.35 → 2.1.36-rc.0

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 (72) hide show
  1. package/dist/commonjs/models/components/aaveposition.d.ts +27 -7
  2. package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
  3. package/dist/commonjs/models/components/aaveposition.js +9 -8
  4. package/dist/commonjs/models/components/aaveposition.js.map +1 -1
  5. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +20 -7
  6. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  7. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +7 -4
  8. package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  9. package/dist/commonjs/models/components/depositevent.d.ts +17 -14
  10. package/dist/commonjs/models/components/depositevent.d.ts.map +1 -1
  11. package/dist/commonjs/models/components/depositevent.js +8 -10
  12. package/dist/commonjs/models/components/depositevent.js.map +1 -1
  13. package/dist/commonjs/models/components/earnpositionsresponse.d.ts +18 -6
  14. package/dist/commonjs/models/components/earnpositionsresponse.d.ts.map +1 -1
  15. package/dist/commonjs/models/components/earnpositionsresponse.js +5 -17
  16. package/dist/commonjs/models/components/earnpositionsresponse.js.map +1 -1
  17. package/dist/commonjs/models/components/pendleptposition.d.ts +16 -10
  18. package/dist/commonjs/models/components/pendleptposition.d.ts.map +1 -1
  19. package/dist/commonjs/models/components/pendleptposition.js +6 -4
  20. package/dist/commonjs/models/components/pendleptposition.js.map +1 -1
  21. package/dist/commonjs/models/components/positionpnl.d.ts +12 -21
  22. package/dist/commonjs/models/components/positionpnl.d.ts.map +1 -1
  23. package/dist/commonjs/models/components/positionpnl.js +6 -12
  24. package/dist/commonjs/models/components/positionpnl.js.map +1 -1
  25. package/dist/commonjs/models/components/withdrawalevent.d.ts +17 -10
  26. package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -1
  27. package/dist/commonjs/models/components/withdrawalevent.js +8 -8
  28. package/dist/commonjs/models/components/withdrawalevent.js.map +1 -1
  29. package/dist/esm/models/components/aaveposition.d.ts +27 -7
  30. package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
  31. package/dist/esm/models/components/aaveposition.js +9 -8
  32. package/dist/esm/models/components/aaveposition.js.map +1 -1
  33. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +20 -7
  34. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
  35. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +7 -4
  36. package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
  37. package/dist/esm/models/components/depositevent.d.ts +17 -14
  38. package/dist/esm/models/components/depositevent.d.ts.map +1 -1
  39. package/dist/esm/models/components/depositevent.js +8 -10
  40. package/dist/esm/models/components/depositevent.js.map +1 -1
  41. package/dist/esm/models/components/earnpositionsresponse.d.ts +18 -6
  42. package/dist/esm/models/components/earnpositionsresponse.d.ts.map +1 -1
  43. package/dist/esm/models/components/earnpositionsresponse.js +4 -15
  44. package/dist/esm/models/components/earnpositionsresponse.js.map +1 -1
  45. package/dist/esm/models/components/pendleptposition.d.ts +16 -10
  46. package/dist/esm/models/components/pendleptposition.d.ts.map +1 -1
  47. package/dist/esm/models/components/pendleptposition.js +6 -4
  48. package/dist/esm/models/components/pendleptposition.js.map +1 -1
  49. package/dist/esm/models/components/positionpnl.d.ts +12 -21
  50. package/dist/esm/models/components/positionpnl.d.ts.map +1 -1
  51. package/dist/esm/models/components/positionpnl.js +6 -12
  52. package/dist/esm/models/components/positionpnl.js.map +1 -1
  53. package/dist/esm/models/components/withdrawalevent.d.ts +17 -10
  54. package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -1
  55. package/dist/esm/models/components/withdrawalevent.js +8 -8
  56. package/dist/esm/models/components/withdrawalevent.js.map +1 -1
  57. package/docs/models/components/aaveposition.md +19 -10
  58. package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +16 -10
  59. package/docs/models/components/depositevent.md +18 -12
  60. package/docs/models/components/earnpositionsresponse.md +13 -4
  61. package/docs/models/components/pendleptposition.md +16 -14
  62. package/docs/models/components/positionpnl.md +15 -16
  63. package/docs/models/components/withdrawalevent.md +18 -13
  64. package/package.json +1 -1
  65. package/src/models/components/aaveposition.ts +37 -15
  66. package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +28 -11
  67. package/src/models/components/depositevent.ts +25 -24
  68. package/src/models/components/earnpositionsresponse.ts +26 -40
  69. package/src/models/components/pendleptposition.ts +23 -14
  70. package/src/models/components/positionpnl.ts +18 -34
  71. package/src/models/components/withdrawalevent.ts +25 -18
  72. package/docs/models/components/userposition.md +0 -42
@@ -7,27 +7,50 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { DepositEvent, DepositEvent$inboundSchema } from "./depositevent.js";
10
11
  import { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
12
+ import {
13
+ WithdrawalEvent,
14
+ WithdrawalEvent$inboundSchema,
15
+ } from "./withdrawalevent.js";
11
16
 
17
+ /**
18
+ * Aave V3 lending position.
19
+ *
20
+ * @remarks
21
+ *
22
+ * Note: Unlike the old model, this no longer has vault_address/vault_name fields
23
+ * as they were nonsensical for Aave positions.
24
+ */
12
25
  export type AavePosition = {
13
26
  /**
14
27
  * The market type discriminator.
15
28
  */
16
29
  type: "AAVE";
17
- vaultAddress?: "None" | undefined;
18
30
  /**
19
- * The user's position value denominated in the supplied asset.
31
+ * The reserve (underlying token) address.
32
+ */
33
+ reserveAddress: string;
34
+ /**
35
+ * Symbol of the reserve asset (e.g., USDC).
20
36
  */
21
- amountInUnderlyingToken: string;
37
+ reserveSymbol: string;
22
38
  /**
23
- * Symbol of the Aave reserve asset (e.g., USDC).
39
+ * The user's position value (aToken balance).
24
40
  */
25
- tokenName: string;
26
- vaultName?: "None" | undefined;
41
+ balance: string;
27
42
  /**
28
- * PnL breakdown with full deposit/withdrawal history.
43
+ * PnL metrics for this position.
29
44
  */
30
45
  pnl?: PositionPnL | null | undefined;
46
+ /**
47
+ * All deposit events for this position.
48
+ */
49
+ deposits?: Array<DepositEvent> | undefined;
50
+ /**
51
+ * All withdrawal events for this position.
52
+ */
53
+ withdrawals?: Array<WithdrawalEvent> | undefined;
31
54
  };
32
55
 
33
56
  /** @internal */
@@ -37,17 +60,16 @@ export const AavePosition$inboundSchema: z.ZodType<
37
60
  unknown
38
61
  > = z.object({
39
62
  type: z.literal("AAVE"),
40
- vault_address: z.literal("None").optional(),
41
- amount_in_underlying_token: z.string(),
42
- token_name: z.string(),
43
- vault_name: z.literal("None").optional(),
63
+ reserve_address: z.string(),
64
+ reserve_symbol: z.string(),
65
+ balance: z.string(),
44
66
  pnl: z.nullable(PositionPnL$inboundSchema).optional(),
67
+ deposits: z.array(DepositEvent$inboundSchema).optional(),
68
+ withdrawals: z.array(WithdrawalEvent$inboundSchema).optional(),
45
69
  }).transform((v) => {
46
70
  return remap$(v, {
47
- "vault_address": "vaultAddress",
48
- "amount_in_underlying_token": "amountInUnderlyingToken",
49
- "token_name": "tokenName",
50
- "vault_name": "vaultName",
71
+ "reserve_address": "reserveAddress",
72
+ "reserve_symbol": "reserveSymbol",
51
73
  });
52
74
  });
53
75
 
@@ -7,33 +7,49 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { DepositEvent, DepositEvent$inboundSchema } from "./depositevent.js";
10
11
  import { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
12
+ import {
13
+ WithdrawalEvent,
14
+ WithdrawalEvent$inboundSchema,
15
+ } from "./withdrawalevent.js";
11
16
 
17
+ /**
18
+ * ERC-4626 vault position.
19
+ */
12
20
  export type CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
13
21
  /**
14
22
  * The market type discriminator.
15
23
  */
16
24
  type: "VAULT";
17
25
  /**
18
- * The vault address you are depositing to.
26
+ * The vault address.
19
27
  */
20
28
  vaultAddress: string;
21
29
  /**
22
- * The user's position value denominated in the underlying token.
30
+ * Name of the vault token (share token).
23
31
  */
24
- amountInUnderlyingToken: string;
32
+ vaultName: string;
25
33
  /**
26
34
  * Symbol of the underlying token (e.g., USDC).
27
35
  */
28
- tokenName: string;
36
+ underlyingSymbol: string;
29
37
  /**
30
- * Name of the vault token (share token).
38
+ * The user's position value in underlying token.
31
39
  */
32
- vaultName: string;
40
+ balance: string;
33
41
  /**
34
- * PnL breakdown with full deposit/withdrawal history.
42
+ * PnL metrics for this position.
35
43
  */
36
44
  pnl?: PositionPnL | null | undefined;
45
+ /**
46
+ * All deposit events for this position.
47
+ */
48
+ deposits?: Array<DepositEvent> | undefined;
49
+ /**
50
+ * All withdrawal events for this position.
51
+ */
52
+ withdrawals?: Array<WithdrawalEvent> | undefined;
37
53
  };
38
54
 
39
55
  /** @internal */
@@ -45,16 +61,17 @@ export const CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inb
45
61
  > = z.object({
46
62
  type: z.literal("VAULT"),
47
63
  vault_address: z.string(),
48
- amount_in_underlying_token: z.string(),
49
- token_name: z.string(),
50
64
  vault_name: z.string(),
65
+ underlying_symbol: z.string(),
66
+ balance: z.string(),
51
67
  pnl: z.nullable(PositionPnL$inboundSchema).optional(),
68
+ deposits: z.array(DepositEvent$inboundSchema).optional(),
69
+ withdrawals: z.array(WithdrawalEvent$inboundSchema).optional(),
52
70
  }).transform((v) => {
53
71
  return remap$(v, {
54
72
  "vault_address": "vaultAddress",
55
- "amount_in_underlying_token": "amountInUnderlyingToken",
56
- "token_name": "tokenName",
57
73
  "vault_name": "vaultName",
74
+ "underlying_symbol": "underlyingSymbol",
58
75
  });
59
76
  });
60
77
 
@@ -10,6 +10,13 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
10
 
11
11
  /**
12
12
  * Historical deposit event for position transparency.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Uses generic input/output format that works across all protocols:
17
+ * - Vault: input=underlying, output=shares
18
+ * - Aave: input=underlying, output=aTokens
19
+ * - Pendle: input=token (varies), output=PT
13
20
  */
14
21
  export type DepositEvent = {
15
22
  /**
@@ -21,29 +28,25 @@ export type DepositEvent = {
21
28
  */
22
29
  transactionHash: string;
23
30
  /**
24
- * Amount of underlying asset deposited (for Pendle: SY-denominated cost basis)
31
+ * Amount deposited (underlying asset or swap token)
25
32
  */
26
- assetsDeposited: string;
33
+ inputAmount: string;
27
34
  /**
28
- * Shares (vault), aTokens (Aave), or PT tokens (Pendle) received
35
+ * Symbol of token deposited
29
36
  */
30
- unitsReceived: string;
37
+ inputSymbol: string;
31
38
  /**
32
- * Cost basis per unit at time of deposit
33
- */
34
- costPerUnit: string;
35
- /**
36
- * Address of token used for deposit (for Pendle swaps)
39
+ * Units received (shares, aTokens, or PT)
37
40
  */
38
- tokenAddress?: string | null | undefined;
41
+ outputAmount: string;
39
42
  /**
40
- * Symbol of token used for deposit (for Pendle swaps)
43
+ * Symbol of units received
41
44
  */
42
- tokenSymbol?: string | null | undefined;
45
+ outputSymbol: string;
43
46
  /**
44
- * Amount of token spent in native decimals (for Pendle swaps)
47
+ * Cost basis per unit at time of deposit
45
48
  */
46
- tokenAmount?: string | null | undefined;
49
+ costPerUnit: string;
47
50
  };
48
51
 
49
52
  /** @internal */
@@ -54,22 +57,20 @@ export const DepositEvent$inboundSchema: z.ZodType<
54
57
  > = z.object({
55
58
  block_number: z.number().int(),
56
59
  transaction_hash: z.string(),
57
- assets_deposited: z.string(),
58
- units_received: z.string(),
60
+ input_amount: z.string(),
61
+ input_symbol: z.string(),
62
+ output_amount: z.string(),
63
+ output_symbol: z.string(),
59
64
  cost_per_unit: z.string(),
60
- token_address: z.nullable(z.string()).optional(),
61
- token_symbol: z.nullable(z.string()).optional(),
62
- token_amount: z.nullable(z.string()).optional(),
63
65
  }).transform((v) => {
64
66
  return remap$(v, {
65
67
  "block_number": "blockNumber",
66
68
  "transaction_hash": "transactionHash",
67
- "assets_deposited": "assetsDeposited",
68
- "units_received": "unitsReceived",
69
+ "input_amount": "inputAmount",
70
+ "input_symbol": "inputSymbol",
71
+ "output_amount": "outputAmount",
72
+ "output_symbol": "outputSymbol",
69
73
  "cost_per_unit": "costPerUnit",
70
- "token_address": "tokenAddress",
71
- "token_symbol": "tokenSymbol",
72
- "token_amount": "tokenAmount",
73
74
  });
74
75
  });
75
76
 
@@ -17,59 +17,45 @@ import {
17
17
  PendlePTPosition$inboundSchema,
18
18
  } from "./pendleptposition.js";
19
19
 
20
- export type UserPosition =
21
- | AavePosition
22
- | PendlePTPosition
23
- | CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition;
24
-
20
+ /**
21
+ * Grouped positions by protocol.
22
+ *
23
+ * @remarks
24
+ *
25
+ * This new structure groups positions by protocol type for better organization and
26
+ * removes the need for a discriminated union in SDK consumers.
27
+ */
25
28
  export type EarnPositionsResponse = {
26
29
  /**
27
- * A list of the user's earn positions.
30
+ * Aave V3 lending positions.
28
31
  */
29
- userPositions: Array<
30
- | AavePosition
31
- | PendlePTPosition
32
- | CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition
33
- >;
32
+ aave?: Array<AavePosition> | undefined;
33
+ /**
34
+ * ERC-4626 vault positions.
35
+ */
36
+ vaults?:
37
+ | Array<CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition>
38
+ | undefined;
39
+ /**
40
+ * Pendle Principal Token positions.
41
+ */
42
+ pendlePt?: Array<PendlePTPosition> | undefined;
34
43
  };
35
44
 
36
- /** @internal */
37
- export const UserPosition$inboundSchema: z.ZodType<
38
- UserPosition,
39
- z.ZodTypeDef,
40
- unknown
41
- > = z.union([
42
- AavePosition$inboundSchema,
43
- PendlePTPosition$inboundSchema,
44
- CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inboundSchema,
45
- ]);
46
-
47
- export function userPositionFromJSON(
48
- jsonString: string,
49
- ): SafeParseResult<UserPosition, SDKValidationError> {
50
- return safeParse(
51
- jsonString,
52
- (x) => UserPosition$inboundSchema.parse(JSON.parse(x)),
53
- `Failed to parse 'UserPosition' from JSON`,
54
- );
55
- }
56
-
57
45
  /** @internal */
58
46
  export const EarnPositionsResponse$inboundSchema: z.ZodType<
59
47
  EarnPositionsResponse,
60
48
  z.ZodTypeDef,
61
49
  unknown
62
50
  > = z.object({
63
- user_positions: z.array(
64
- z.union([
65
- AavePosition$inboundSchema,
66
- PendlePTPosition$inboundSchema,
67
- CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inboundSchema,
68
- ]),
69
- ),
51
+ aave: z.array(AavePosition$inboundSchema).optional(),
52
+ vaults: z.array(
53
+ CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inboundSchema,
54
+ ).optional(),
55
+ pendle_pt: z.array(PendlePTPosition$inboundSchema).optional(),
70
56
  }).transform((v) => {
71
57
  return remap$(v, {
72
- "user_positions": "userPositions",
58
+ "pendle_pt": "pendlePt",
73
59
  });
74
60
  });
75
61
 
@@ -7,10 +7,15 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { DepositEvent, DepositEvent$inboundSchema } from "./depositevent.js";
10
11
  import { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
12
+ import {
13
+ WithdrawalEvent,
14
+ WithdrawalEvent$inboundSchema,
15
+ } from "./withdrawalevent.js";
11
16
 
12
17
  /**
13
- * Position in Pendle Principal Tokens (PT).
18
+ * Pendle Principal Token position.
14
19
  */
15
20
  export type PendlePTPosition = {
16
21
  /**
@@ -25,26 +30,30 @@ export type PendlePTPosition = {
25
30
  * The PT (Principal Token) contract address.
26
31
  */
27
32
  ptAddress: string;
28
- /**
29
- * The user's PT token balance.
30
- */
31
- amountInPt: string;
32
- /**
33
- * The underlying asset address.
34
- */
35
- underlyingAsset: string;
36
33
  /**
37
34
  * Symbol of the underlying asset (e.g., rsETH, weETH).
38
35
  */
39
36
  underlyingSymbol: string;
37
+ /**
38
+ * The user's PT token balance.
39
+ */
40
+ ptBalance: string;
40
41
  /**
41
42
  * Market expiry timestamp (Unix seconds).
42
43
  */
43
44
  expiry: number;
44
45
  /**
45
- * PnL breakdown with full buy/sell history.
46
+ * PnL metrics (in SY terms) for this position.
46
47
  */
47
48
  pnl?: PositionPnL | null | undefined;
49
+ /**
50
+ * All buy PT events for this position.
51
+ */
52
+ deposits?: Array<DepositEvent> | undefined;
53
+ /**
54
+ * All sell/redeem PT events for this position.
55
+ */
56
+ withdrawals?: Array<WithdrawalEvent> | undefined;
48
57
  };
49
58
 
50
59
  /** @internal */
@@ -56,18 +65,18 @@ export const PendlePTPosition$inboundSchema: z.ZodType<
56
65
  type: z.literal("PENDLE_PT"),
57
66
  market_address: z.string(),
58
67
  pt_address: z.string(),
59
- amount_in_pt: z.string(),
60
- underlying_asset: z.string(),
61
68
  underlying_symbol: z.string(),
69
+ pt_balance: z.string(),
62
70
  expiry: z.number().int(),
63
71
  pnl: z.nullable(PositionPnL$inboundSchema).optional(),
72
+ deposits: z.array(DepositEvent$inboundSchema).optional(),
73
+ withdrawals: z.array(WithdrawalEvent$inboundSchema).optional(),
64
74
  }).transform((v) => {
65
75
  return remap$(v, {
66
76
  "market_address": "marketAddress",
67
77
  "pt_address": "ptAddress",
68
- "amount_in_pt": "amountInPt",
69
- "underlying_asset": "underlyingAsset",
70
78
  "underlying_symbol": "underlyingSymbol",
79
+ "pt_balance": "ptBalance",
71
80
  });
72
81
  });
73
82
 
@@ -7,14 +7,14 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
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
10
 
16
11
  /**
17
- * PnL breakdown for a position.
12
+ * Simplified PnL metrics for API response.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Historical events (deposits/withdrawals) are now at the position level, not inside
17
+ * PnL.
18
18
  */
19
19
  export type PositionPnL = {
20
20
  /**
@@ -22,15 +22,11 @@ export type PositionPnL = {
22
22
  */
23
23
  totalDeposited: string;
24
24
  /**
25
- * Total assets withdrawn over all time
25
+ * Current position value in underlying
26
26
  */
27
- totalWithdrawn: string;
27
+ currentValue: string;
28
28
  /**
29
- * FIFO cost basis of remaining position
30
- */
31
- costBasis: string;
32
- /**
33
- * current_value - cost_basis
29
+ * current_value - cost_basis_remaining
34
30
  */
35
31
  unrealizedPnl: string;
36
32
  /**
@@ -40,19 +36,11 @@ export type PositionPnL = {
40
36
  /**
41
37
  * unrealized_pnl + realized_pnl
42
38
  */
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;
39
+ totalPnl: string;
52
40
  /**
53
- * All withdrawal events for this position
41
+ * (total_pnl / total_deposited) * 100
54
42
  */
55
- withdrawals?: Array<WithdrawalEvent> | undefined;
43
+ totalPnlPercent: string;
56
44
  };
57
45
 
58
46
  /** @internal */
@@ -62,23 +50,19 @@ export const PositionPnL$inboundSchema: z.ZodType<
62
50
  unknown
63
51
  > = z.object({
64
52
  total_deposited: z.string(),
65
- total_withdrawn: z.string(),
66
- cost_basis: z.string(),
53
+ current_value: z.string(),
67
54
  unrealized_pnl: z.string(),
68
55
  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(),
56
+ total_pnl: z.string(),
57
+ total_pnl_percent: z.string(),
73
58
  }).transform((v) => {
74
59
  return remap$(v, {
75
60
  "total_deposited": "totalDeposited",
76
- "total_withdrawn": "totalWithdrawn",
77
- "cost_basis": "costBasis",
61
+ "current_value": "currentValue",
78
62
  "unrealized_pnl": "unrealizedPnl",
79
63
  "realized_pnl": "realizedPnl",
80
- "total_yield": "totalYield",
81
- "total_fees_paid": "totalFeesPaid",
64
+ "total_pnl": "totalPnl",
65
+ "total_pnl_percent": "totalPnlPercent",
82
66
  });
83
67
  });
84
68
 
@@ -10,6 +10,13 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
10
 
11
11
  /**
12
12
  * Historical withdrawal event with realized PnL.
13
+ *
14
+ * @remarks
15
+ *
16
+ * Uses generic input/output format:
17
+ * - Vault: input=shares, output=underlying
18
+ * - Aave: input=aTokens, output=underlying
19
+ * - Pendle: input=PT, output=token (varies)
13
20
  */
14
21
  export type WithdrawalEvent = {
15
22
  /**
@@ -21,25 +28,25 @@ export type WithdrawalEvent = {
21
28
  */
22
29
  transactionHash: string;
23
30
  /**
24
- * Amount of underlying asset received
31
+ * Units withdrawn (shares, aTokens, PT)
25
32
  */
26
- assetsReceived: string;
33
+ inputAmount: string;
27
34
  /**
28
- * Shares (vault) or aTokens (Aave) burned
35
+ * Symbol of units withdrawn
29
36
  */
30
- unitsWithdrawn: string;
37
+ inputSymbol: string;
31
38
  /**
32
- * FIFO cost basis of units withdrawn
39
+ * Amount received (underlying or token)
33
40
  */
34
- costBasisConsumed: string;
41
+ outputAmount: string;
35
42
  /**
36
- * Profit/loss: assets_received - cost_basis_consumed
43
+ * Symbol of token received
37
44
  */
38
- realizedPnl: string;
45
+ outputSymbol: string;
39
46
  /**
40
- * Performance fee charged on this withdrawal
47
+ * Profit/loss: output value - cost basis consumed
41
48
  */
42
- feeCharged: string;
49
+ realizedPnl: string;
43
50
  };
44
51
 
45
52
  /** @internal */
@@ -50,20 +57,20 @@ export const WithdrawalEvent$inboundSchema: z.ZodType<
50
57
  > = z.object({
51
58
  block_number: z.number().int(),
52
59
  transaction_hash: z.string(),
53
- assets_received: z.string(),
54
- units_withdrawn: z.string(),
55
- cost_basis_consumed: z.string(),
60
+ input_amount: z.string(),
61
+ input_symbol: z.string(),
62
+ output_amount: z.string(),
63
+ output_symbol: z.string(),
56
64
  realized_pnl: z.string(),
57
- fee_charged: z.string(),
58
65
  }).transform((v) => {
59
66
  return remap$(v, {
60
67
  "block_number": "blockNumber",
61
68
  "transaction_hash": "transactionHash",
62
- "assets_received": "assetsReceived",
63
- "units_withdrawn": "unitsWithdrawn",
64
- "cost_basis_consumed": "costBasisConsumed",
69
+ "input_amount": "inputAmount",
70
+ "input_symbol": "inputSymbol",
71
+ "output_amount": "outputAmount",
72
+ "output_symbol": "outputSymbol",
65
73
  "realized_pnl": "realizedPnl",
66
- "fee_charged": "feeCharged",
67
74
  });
68
75
  });
69
76
 
@@ -1,42 +0,0 @@
1
- # UserPosition
2
-
3
-
4
- ## Supported Types
5
-
6
- ### `components.AavePosition`
7
-
8
- ```typescript
9
- const value: components.AavePosition = {
10
- type: "AAVE",
11
- amountInUnderlyingToken: "<value>",
12
- tokenName: "<value>",
13
- };
14
- ```
15
-
16
- ### `components.PendlePTPosition`
17
-
18
- ```typescript
19
- const value: components.PendlePTPosition = {
20
- type: "PENDLE_PT",
21
- marketAddress: "<value>",
22
- ptAddress: "<value>",
23
- amountInPt: "<value>",
24
- underlyingAsset: "<value>",
25
- underlyingSymbol: "<value>",
26
- expiry: 858301,
27
- };
28
- ```
29
-
30
- ### `components.CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition`
31
-
32
- ```typescript
33
- const value:
34
- components.CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
35
- type: "VAULT",
36
- vaultAddress: "<value>",
37
- amountInUnderlyingToken: "<value>",
38
- tokenName: "<value>",
39
- vaultName: "<value>",
40
- };
41
- ```
42
-