@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.
- package/codeSamples_typescript.yaml +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.d.ts +1 -1
- package/dist/commonjs/funcs/earnEarnPositions.js +1 -2
- package/dist/commonjs/funcs/earnEarnPositions.js.map +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/models/operations/v2earnpositions.d.ts +0 -5
- package/dist/commonjs/models/operations/v2earnpositions.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnpositions.js +0 -1
- package/dist/commonjs/models/operations/v2earnpositions.js.map +1 -1
- 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 -2
- package/dist/esm/funcs/earnEarnPositions.js.map +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/models/operations/v2earnpositions.d.ts +0 -5
- package/dist/esm/models/operations/v2earnpositions.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnpositions.js +0 -1
- package/dist/esm/models/operations/v2earnpositions.js.map +1 -1
- 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/models/operations/v2earnpositionsrequest.md +1 -3
- package/docs/sdks/earn/README.md +1 -3
- package/package.json +1 -1
- package/src/funcs/earnEarnPositions.ts +1 -2
- 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/models/operations/v2earnpositions.ts +0 -6
- 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,
|