@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.
- package/codeSamples_typescript.yaml +1 -1
- package/dist/commonjs/funcs/earnEarnManage.d.ts +4 -1
- package/dist/commonjs/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/commonjs/funcs/earnEarnManage.js +4 -1
- package/dist/commonjs/funcs/earnEarnManage.js.map +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 -4
- package/dist/commonjs/models/components/aaveposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/aaveposition.js +2 -1
- package/dist/commonjs/models/components/aaveposition.js.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/commonjs/models/components/depositevent.d.ts +32 -0
- package/dist/commonjs/models/components/depositevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/depositevent.js +63 -0
- package/dist/commonjs/models/components/depositevent.js.map +1 -0
- package/dist/commonjs/models/components/fee.d.ts +6 -5
- package/dist/commonjs/models/components/fee.d.ts.map +1 -1
- package/dist/commonjs/models/components/fee.js +2 -1
- package/dist/commonjs/models/components/fee.js.map +1 -1
- 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 +40 -0
- package/dist/commonjs/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/commonjs/models/components/withdrawalevent.js +67 -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 +5 -2
- package/dist/commonjs/sdk/earn.d.ts.map +1 -1
- package/dist/commonjs/sdk/earn.js +5 -2
- package/dist/commonjs/sdk/earn.js.map +1 -1
- package/dist/esm/funcs/earnEarnManage.d.ts +4 -1
- package/dist/esm/funcs/earnEarnManage.d.ts.map +1 -1
- package/dist/esm/funcs/earnEarnManage.js +4 -1
- package/dist/esm/funcs/earnEarnManage.js.map +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 -4
- package/dist/esm/models/components/aaveposition.d.ts.map +1 -1
- package/dist/esm/models/components/aaveposition.js +2 -1
- package/dist/esm/models/components/aaveposition.js.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts +5 -4
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.d.ts.map +1 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js +2 -1
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.js.map +1 -1
- package/dist/esm/models/components/depositevent.d.ts +32 -0
- package/dist/esm/models/components/depositevent.d.ts.map +1 -0
- package/dist/esm/models/components/depositevent.js +26 -0
- package/dist/esm/models/components/depositevent.js.map +1 -0
- package/dist/esm/models/components/fee.d.ts +6 -5
- package/dist/esm/models/components/fee.d.ts.map +1 -1
- package/dist/esm/models/components/fee.js +2 -1
- package/dist/esm/models/components/fee.js.map +1 -1
- 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 +40 -0
- package/dist/esm/models/components/withdrawalevent.d.ts.map +1 -0
- package/dist/esm/models/components/withdrawalevent.js +30 -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 +5 -2
- package/dist/esm/sdk/earn.d.ts.map +1 -1
- package/dist/esm/sdk/earn.js +5 -2
- package/dist/esm/sdk/earn.js.map +1 -1
- package/docs/models/components/aaveliquiditychangeresponse.md +2 -2
- package/docs/models/components/aaveposition.md +8 -9
- package/docs/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.md +8 -9
- package/docs/models/components/cooldownend.md +1 -1
- package/docs/models/components/cooldownposition.md +1 -1
- package/docs/models/components/denomination.md +2 -2
- package/docs/models/components/depositevent.md +27 -0
- package/docs/models/components/fee.md +5 -5
- package/docs/models/components/feeamount.md +1 -1
- 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/userposition.md +0 -2
- package/docs/models/components/withdrawalevent.md +31 -0
- package/docs/models/operations/v2earnpositionsrequest.md +1 -3
- package/docs/sdks/earn/README.md +5 -4
- package/package.json +1 -1
- package/src/funcs/earnEarnManage.ts +4 -1
- package/src/funcs/earnEarnPositions.ts +1 -2
- package/src/lib/config.ts +2 -2
- package/src/models/components/aaveposition.ts +6 -5
- package/src/models/components/compassapibackendv2modelsearnreadresponsepositionsvaultposition.ts +6 -5
- package/src/models/components/depositevent.ts +66 -0
- package/src/models/components/fee.ts +6 -5
- package/src/models/components/index.ts +3 -0
- package/src/models/components/positionpnl.ts +93 -0
- package/src/models/components/withdrawalevent.ts +78 -0
- package/src/models/operations/v2earnpositions.ts +0 -6
- 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
|
|
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
|
*/
|