@compass-labs/api-sdk 2.1.25 → 2.1.26-rc.1
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.
- package/dist/commonjs/funcs/earnEarnPositions.d.ts +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.js +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/components/aaveposition.d.ts +5 -0
- package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/aaveposition.js +2 -0
- package/dist/commonjs/models/components/aaveposition.js.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/commonjs/models/components/depositevent.d.ts +36 -0
- package/dist/commonjs/models/components/depositevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/depositevent.js +65 -0
- package/dist/commonjs/models/components/depositevent.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +3 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +3 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/positionpnl.d.ts +50 -0
- package/dist/commonjs/models/components/positionpnl.d.ts.map +1 -0
- package/dist/commonjs/models/components/positionpnl.js +71 -0
- package/dist/commonjs/models/components/positionpnl.js.map +1 -0
- package/dist/commonjs/models/components/withdrawalevent.d.ts +44 -0
- package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/withdrawalevent.js +69 -0
- package/dist/commonjs/models/components/withdrawalevent.js.map +1 -0
- package/dist/commonjs/sdk/earn.d.ts +1 -1
- package/dist/commonjs/sdk/earn.js +1 -1
- package/dist/esm/funcs/earnEarnPositions.d.ts +1 -1
- package/dist/esm/funcs/earnEarnPositions.js +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/components/aaveposition.d.ts +5 -0
- package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
- package/dist/esm/models/components/aaveposition.js +2 -0
- package/dist/esm/models/components/aaveposition.js.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -0
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -0
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/esm/models/components/depositevent.d.ts +36 -0
- package/dist/esm/models/components/depositevent.d.ts.map +1 -0
- package/dist/esm/models/components/depositevent.js +28 -0
- package/dist/esm/models/components/depositevent.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +3 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +3 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/positionpnl.d.ts +50 -0
- package/dist/esm/models/components/positionpnl.d.ts.map +1 -0
- package/dist/esm/models/components/positionpnl.js +34 -0
- package/dist/esm/models/components/positionpnl.js.map +1 -0
- package/dist/esm/models/components/withdrawalevent.d.ts +44 -0
- package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/esm/models/components/withdrawalevent.js +32 -0
- package/dist/esm/models/components/withdrawalevent.js.map +1 -0
- package/dist/esm/sdk/earn.d.ts +1 -1
- package/dist/esm/sdk/earn.js +1 -1
- package/docs/models/components/aaveliquiditychangeresponse.md +2 -2
- package/docs/models/components/aaveposition.md +9 -8
- package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +9 -8
- package/docs/models/components/cooldownend.md +1 -1
- package/docs/models/components/cooldownposition.md +1 -1
- package/docs/models/components/depositevent.md +29 -0
- package/docs/models/components/pendlegetmarketresponse.md +1 -1
- package/docs/models/components/pendlelistmarketsresponse.md +2 -2
- package/docs/models/components/pendlelistuserpositionsresponse.md +1 -1
- package/docs/models/components/pendlemarket.md +2 -2
- package/docs/models/components/position.md +1 -1
- package/docs/models/components/positionpnl.md +33 -0
- package/docs/models/components/withdrawalevent.md +33 -0
- package/docs/sdks/earn/README.md +1 -1
- package/package.json +1 -1
- package/src/funcs/earnEarnPositions.ts +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/aaveposition.ts +6 -0
- package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +6 -0
- package/src/models/components/depositevent.ts +74 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/positionpnl.ts +93 -0
- package/src/models/components/withdrawalevent.ts +86 -0
- package/src/sdk/earn.ts +1 -1
package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md
CHANGED
|
@@ -17,11 +17,12 @@ let value: CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
|
17
17
|
|
|
18
18
|
## Fields
|
|
19
19
|
|
|
20
|
-
| Field
|
|
21
|
-
|
|
|
22
|
-
| `type`
|
|
23
|
-
| `id`
|
|
24
|
-
| `vaultAddress`
|
|
25
|
-
| `amountInUnderlyingToken`
|
|
26
|
-
| `tokenName`
|
|
27
|
-
| `vaultName`
|
|
20
|
+
| Field | Type | Required | Description |
|
|
21
|
+
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
22
|
+
| `type` | *"VAULT"* | :heavy_check_mark: | The market type discriminator. |
|
|
23
|
+
| `id` | *string* | :heavy_check_mark: | Base64-encoded position identifier. |
|
|
24
|
+
| `vaultAddress` | *string* | :heavy_check_mark: | The vault address you are depositing to. |
|
|
25
|
+
| `amountInUnderlyingToken` | *string* | :heavy_check_mark: | The user's position value denominated in the underlying token. |
|
|
26
|
+
| `tokenName` | *string* | :heavy_check_mark: | Symbol of the underlying token (e.g., USDC). |
|
|
27
|
+
| `vaultName` | *string* | :heavy_check_mark: | Name of the vault token (share token). |
|
|
28
|
+
| `pnl` | [components.PositionPnL](../../models/components/positionpnl.md) | :heavy_minus_sign: | PnL breakdown with full deposit/withdrawal history. |
|
|
@@ -7,7 +7,7 @@ import { CooldownPosition } from "@compass-labs/api-sdk/models/components";
|
|
|
7
7
|
|
|
8
8
|
let value: CooldownPosition = {
|
|
9
9
|
amountInUnderlyingAsset: "<value>",
|
|
10
|
-
cooldownEnd: new Date("
|
|
10
|
+
cooldownEnd: new Date("2025-06-19T22:17:27.773Z"),
|
|
11
11
|
canBeWithdrawn: false,
|
|
12
12
|
};
|
|
13
13
|
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DepositEvent
|
|
2
|
+
|
|
3
|
+
Historical deposit event for position transparency.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DepositEvent } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: DepositEvent = {
|
|
11
|
+
blockNumber: 328246,
|
|
12
|
+
blockTimestamp: new Date("2026-02-17T17:21:39.534Z"),
|
|
13
|
+
transactionHash: "<value>",
|
|
14
|
+
assetsDeposited: "<value>",
|
|
15
|
+
unitsReceived: "<value>",
|
|
16
|
+
costPerUnit: "<value>",
|
|
17
|
+
};
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Fields
|
|
21
|
+
|
|
22
|
+
| Field | Type | Required | Description |
|
|
23
|
+
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
24
|
+
| `blockNumber` | *number* | :heavy_check_mark: | Block number when deposit occurred |
|
|
25
|
+
| `blockTimestamp` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Timestamp of the deposit |
|
|
26
|
+
| `transactionHash` | *string* | :heavy_check_mark: | Transaction hash of the deposit |
|
|
27
|
+
| `assetsDeposited` | *string* | :heavy_check_mark: | Amount of underlying asset deposited |
|
|
28
|
+
| `unitsReceived` | *string* | :heavy_check_mark: | Shares (vault) or aTokens (Aave) received |
|
|
29
|
+
| `costPerUnit` | *string* | :heavy_check_mark: | Cost basis per unit at time of deposit |
|
|
@@ -8,7 +8,7 @@ import { PendleGetMarketResponse } from "@compass-labs/api-sdk/models/components
|
|
|
8
8
|
let value: PendleGetMarketResponse = {
|
|
9
9
|
marketAddress: "<value>",
|
|
10
10
|
impliedApy: "<value>",
|
|
11
|
-
maturityDate: new Date("
|
|
11
|
+
maturityDate: new Date("2024-10-17T22:09:52.103Z"),
|
|
12
12
|
tokens: {
|
|
13
13
|
underlyingToken: {
|
|
14
14
|
address: "46793 Schneider Mount",
|
|
@@ -10,7 +10,7 @@ let value: PendleListMarketsResponse = {
|
|
|
10
10
|
{
|
|
11
11
|
name: "<value>",
|
|
12
12
|
address: "9178 Rebeca Burgs",
|
|
13
|
-
expiry: new Date("
|
|
13
|
+
expiry: new Date("2026-11-13T22:39:31.641Z"),
|
|
14
14
|
pt: "<value>",
|
|
15
15
|
yt: "<value>",
|
|
16
16
|
sy: "<value>",
|
|
@@ -29,7 +29,7 @@ let value: PendleListMarketsResponse = {
|
|
|
29
29
|
},
|
|
30
30
|
isNew: true,
|
|
31
31
|
isPrime: false,
|
|
32
|
-
timestamp: new Date("
|
|
32
|
+
timestamp: new Date("2025-03-28T12:44:40.088Z"),
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
35
|
};
|
|
@@ -8,7 +8,7 @@ import { PendleMarket } from "@compass-labs/api-sdk/models/components";
|
|
|
8
8
|
let value: PendleMarket = {
|
|
9
9
|
name: "<value>",
|
|
10
10
|
address: "22458 Abshire Plains",
|
|
11
|
-
expiry: new Date("
|
|
11
|
+
expiry: new Date("2024-04-17T01:20:41.264Z"),
|
|
12
12
|
pt: "<value>",
|
|
13
13
|
yt: "<value>",
|
|
14
14
|
sy: "<value>",
|
|
@@ -27,7 +27,7 @@ let value: PendleMarket = {
|
|
|
27
27
|
},
|
|
28
28
|
isNew: true,
|
|
29
29
|
isPrime: false,
|
|
30
|
-
timestamp: new Date("
|
|
30
|
+
timestamp: new Date("2026-09-13T17:20:16.991Z"),
|
|
31
31
|
};
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# PositionPnL
|
|
2
|
+
|
|
3
|
+
PnL breakdown for a position.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { PositionPnL } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: PositionPnL = {
|
|
11
|
+
totalDeposited: "<value>",
|
|
12
|
+
totalWithdrawn: "<value>",
|
|
13
|
+
costBasis: "<value>",
|
|
14
|
+
unrealizedPnl: "<value>",
|
|
15
|
+
realizedPnl: "<value>",
|
|
16
|
+
totalYield: "<value>",
|
|
17
|
+
totalFeesPaid: "<id>",
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Fields
|
|
22
|
+
|
|
23
|
+
| Field | Type | Required | Description |
|
|
24
|
+
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
25
|
+
| `totalDeposited` | *string* | :heavy_check_mark: | Total assets deposited over all time |
|
|
26
|
+
| `totalWithdrawn` | *string* | :heavy_check_mark: | Total assets withdrawn over all time |
|
|
27
|
+
| `costBasis` | *string* | :heavy_check_mark: | FIFO cost basis of remaining position |
|
|
28
|
+
| `unrealizedPnl` | *string* | :heavy_check_mark: | current_value - cost_basis |
|
|
29
|
+
| `realizedPnl` | *string* | :heavy_check_mark: | Sum of profits/losses from all withdrawals |
|
|
30
|
+
| `totalYield` | *string* | :heavy_check_mark: | unrealized_pnl + realized_pnl |
|
|
31
|
+
| `totalFeesPaid` | *string* | :heavy_check_mark: | Sum of performance fees paid |
|
|
32
|
+
| `deposits` | [components.DepositEvent](../../models/components/depositevent.md)[] | :heavy_minus_sign: | All deposit events for this position |
|
|
33
|
+
| `withdrawals` | [components.WithdrawalEvent](../../models/components/withdrawalevent.md)[] | :heavy_minus_sign: | All withdrawal events for this position |
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# WithdrawalEvent
|
|
2
|
+
|
|
3
|
+
Historical withdrawal event with realized PnL.
|
|
4
|
+
|
|
5
|
+
## Example Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { WithdrawalEvent } from "@compass-labs/api-sdk/models/components";
|
|
9
|
+
|
|
10
|
+
let value: WithdrawalEvent = {
|
|
11
|
+
blockNumber: 460436,
|
|
12
|
+
blockTimestamp: new Date("2026-06-27T20:19:44.790Z"),
|
|
13
|
+
transactionHash: "<value>",
|
|
14
|
+
assetsReceived: "<value>",
|
|
15
|
+
unitsWithdrawn: "<value>",
|
|
16
|
+
costBasisConsumed: "<value>",
|
|
17
|
+
realizedPnl: "<value>",
|
|
18
|
+
feeCharged: "<value>",
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Fields
|
|
23
|
+
|
|
24
|
+
| Field | Type | Required | Description |
|
|
25
|
+
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `blockNumber` | *number* | :heavy_check_mark: | Block number when withdrawal occurred |
|
|
27
|
+
| `blockTimestamp` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | Timestamp of the withdrawal |
|
|
28
|
+
| `transactionHash` | *string* | :heavy_check_mark: | Transaction hash of the withdrawal |
|
|
29
|
+
| `assetsReceived` | *string* | :heavy_check_mark: | Amount of underlying asset received |
|
|
30
|
+
| `unitsWithdrawn` | *string* | :heavy_check_mark: | Shares (vault) or aTokens (Aave) burned |
|
|
31
|
+
| `costBasisConsumed` | *string* | :heavy_check_mark: | FIFO cost basis of units withdrawn |
|
|
32
|
+
| `realizedPnl` | *string* | :heavy_check_mark: | Profit/loss: assets_received - cost_basis_consumed |
|
|
33
|
+
| `feeCharged` | *string* | :heavy_check_mark: | Performance fee charged on this withdrawal |
|
package/docs/sdks/earn/README.md
CHANGED
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ import { Result } from "../types/fp.js";
|
|
|
30
30
|
* List earn positions
|
|
31
31
|
*
|
|
32
32
|
* @remarks
|
|
33
|
-
* This endpoint fetches all Compass Earn positions.
|
|
33
|
+
* This endpoint fetches all Compass Earn positions with PnL information.
|
|
34
34
|
*/
|
|
35
35
|
export function earnEarnPositions(
|
|
36
36
|
client: CompassApiSDKCore,
|
package/src/lib/config.ts
CHANGED
|
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
|
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
64
|
sdkVersion: "2.0.0",
|
|
65
|
-
genVersion: "2.788.
|
|
65
|
+
genVersion: "2.788.15",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.788.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.788.15 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -7,6 +7,7 @@ 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 { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
|
|
10
11
|
|
|
11
12
|
export type AavePosition = {
|
|
12
13
|
/**
|
|
@@ -27,6 +28,10 @@ export type AavePosition = {
|
|
|
27
28
|
*/
|
|
28
29
|
tokenName: string;
|
|
29
30
|
vaultName?: "None" | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* PnL breakdown with full deposit/withdrawal history.
|
|
33
|
+
*/
|
|
34
|
+
pnl?: PositionPnL | null | undefined;
|
|
30
35
|
};
|
|
31
36
|
|
|
32
37
|
/** @internal */
|
|
@@ -41,6 +46,7 @@ export const AavePosition$inboundSchema: z.ZodType<
|
|
|
41
46
|
amount_in_underlying_token: z.string(),
|
|
42
47
|
token_name: z.string(),
|
|
43
48
|
vault_name: z.literal("None").optional(),
|
|
49
|
+
pnl: z.nullable(PositionPnL$inboundSchema).optional(),
|
|
44
50
|
}).transform((v) => {
|
|
45
51
|
return remap$(v, {
|
|
46
52
|
"vault_address": "vaultAddress",
|
package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts
CHANGED
|
@@ -7,6 +7,7 @@ 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 { PositionPnL, PositionPnL$inboundSchema } from "./positionpnl.js";
|
|
10
11
|
|
|
11
12
|
export type CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
12
13
|
/**
|
|
@@ -33,6 +34,10 @@ export type CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition = {
|
|
|
33
34
|
* Name of the vault token (share token).
|
|
34
35
|
*/
|
|
35
36
|
vaultName: string;
|
|
37
|
+
/**
|
|
38
|
+
* PnL breakdown with full deposit/withdrawal history.
|
|
39
|
+
*/
|
|
40
|
+
pnl?: PositionPnL | null | undefined;
|
|
36
41
|
};
|
|
37
42
|
|
|
38
43
|
/** @internal */
|
|
@@ -48,6 +53,7 @@ export const CompassApiBackendV2ModelsEarnReadResponsePositionsVaultPosition$inb
|
|
|
48
53
|
amount_in_underlying_token: z.string(),
|
|
49
54
|
token_name: z.string(),
|
|
50
55
|
vault_name: z.string(),
|
|
56
|
+
pnl: z.nullable(PositionPnL$inboundSchema).optional(),
|
|
51
57
|
}).transform((v) => {
|
|
52
58
|
return remap$(v, {
|
|
53
59
|
"vault_address": "vaultAddress",
|
|
@@ -0,0 +1,74 @@
|
|
|
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 deposit event for position transparency.
|
|
13
|
+
*/
|
|
14
|
+
export type DepositEvent = {
|
|
15
|
+
/**
|
|
16
|
+
* Block number when deposit occurred
|
|
17
|
+
*/
|
|
18
|
+
blockNumber: number;
|
|
19
|
+
/**
|
|
20
|
+
* Timestamp of the deposit
|
|
21
|
+
*/
|
|
22
|
+
blockTimestamp: Date;
|
|
23
|
+
/**
|
|
24
|
+
* Transaction hash of the deposit
|
|
25
|
+
*/
|
|
26
|
+
transactionHash: string;
|
|
27
|
+
/**
|
|
28
|
+
* Amount of underlying asset deposited
|
|
29
|
+
*/
|
|
30
|
+
assetsDeposited: string;
|
|
31
|
+
/**
|
|
32
|
+
* Shares (vault) or aTokens (Aave) received
|
|
33
|
+
*/
|
|
34
|
+
unitsReceived: string;
|
|
35
|
+
/**
|
|
36
|
+
* Cost basis per unit at time of deposit
|
|
37
|
+
*/
|
|
38
|
+
costPerUnit: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const DepositEvent$inboundSchema: z.ZodType<
|
|
43
|
+
DepositEvent,
|
|
44
|
+
z.ZodTypeDef,
|
|
45
|
+
unknown
|
|
46
|
+
> = z.object({
|
|
47
|
+
block_number: z.number().int(),
|
|
48
|
+
block_timestamp: z.string().datetime({ offset: true }).transform(v =>
|
|
49
|
+
new Date(v)
|
|
50
|
+
),
|
|
51
|
+
transaction_hash: z.string(),
|
|
52
|
+
assets_deposited: z.string(),
|
|
53
|
+
units_received: z.string(),
|
|
54
|
+
cost_per_unit: z.string(),
|
|
55
|
+
}).transform((v) => {
|
|
56
|
+
return remap$(v, {
|
|
57
|
+
"block_number": "blockNumber",
|
|
58
|
+
"block_timestamp": "blockTimestamp",
|
|
59
|
+
"transaction_hash": "transactionHash",
|
|
60
|
+
"assets_deposited": "assetsDeposited",
|
|
61
|
+
"units_received": "unitsReceived",
|
|
62
|
+
"cost_per_unit": "costPerUnit",
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export function depositEventFromJSON(
|
|
67
|
+
jsonString: string,
|
|
68
|
+
): SafeParseResult<DepositEvent, SDKValidationError> {
|
|
69
|
+
return safeParse(
|
|
70
|
+
jsonString,
|
|
71
|
+
(x) => DepositEvent$inboundSchema.parse(JSON.parse(x)),
|
|
72
|
+
`Failed to parse 'DepositEvent' from JSON`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -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
|
+
}
|
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,
|