@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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as z from "zod/v3";
|
|
2
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
/**
|
|
5
|
+
* Historical withdrawal event with realized PnL.
|
|
6
|
+
*/
|
|
7
|
+
export type WithdrawalEvent = {
|
|
8
|
+
/**
|
|
9
|
+
* Block number when withdrawal occurred
|
|
10
|
+
*/
|
|
11
|
+
blockNumber: number;
|
|
12
|
+
/**
|
|
13
|
+
* Timestamp of the withdrawal
|
|
14
|
+
*/
|
|
15
|
+
blockTimestamp: Date;
|
|
16
|
+
/**
|
|
17
|
+
* Transaction hash of the withdrawal
|
|
18
|
+
*/
|
|
19
|
+
transactionHash: string;
|
|
20
|
+
/**
|
|
21
|
+
* Amount of underlying asset received
|
|
22
|
+
*/
|
|
23
|
+
assetsReceived: string;
|
|
24
|
+
/**
|
|
25
|
+
* Shares (vault) or aTokens (Aave) burned
|
|
26
|
+
*/
|
|
27
|
+
unitsWithdrawn: string;
|
|
28
|
+
/**
|
|
29
|
+
* FIFO cost basis of units withdrawn
|
|
30
|
+
*/
|
|
31
|
+
costBasisConsumed: string;
|
|
32
|
+
/**
|
|
33
|
+
* Profit/loss: assets_received - cost_basis_consumed
|
|
34
|
+
*/
|
|
35
|
+
realizedPnl: string;
|
|
36
|
+
/**
|
|
37
|
+
* Performance fee charged on this withdrawal
|
|
38
|
+
*/
|
|
39
|
+
feeCharged: string;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const WithdrawalEvent$inboundSchema: z.ZodType<WithdrawalEvent, z.ZodTypeDef, unknown>;
|
|
43
|
+
export declare function withdrawalEventFromJSON(jsonString: string): SafeParseResult<WithdrawalEvent, SDKValidationError>;
|
|
44
|
+
//# sourceMappingURL=withdrawalevent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawalevent.d.ts","sourceRoot":"","sources":["../../../../src/models/components/withdrawalevent.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,IAAI,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,6BAA6B,EAAE,CAAC,CAAC,OAAO,CACnD,eAAe,EACf,CAAC,CAAC,UAAU,EACZ,OAAO,CAuBP,CAAC;AAEH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,GACjB,eAAe,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAMtD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v3";
|
|
5
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const WithdrawalEvent$inboundSchema = z.object({
|
|
9
|
+
block_number: z.number().int(),
|
|
10
|
+
block_timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
11
|
+
transaction_hash: z.string(),
|
|
12
|
+
assets_received: z.string(),
|
|
13
|
+
units_withdrawn: z.string(),
|
|
14
|
+
cost_basis_consumed: z.string(),
|
|
15
|
+
realized_pnl: z.string(),
|
|
16
|
+
fee_charged: z.string(),
|
|
17
|
+
}).transform((v) => {
|
|
18
|
+
return remap$(v, {
|
|
19
|
+
"block_number": "blockNumber",
|
|
20
|
+
"block_timestamp": "blockTimestamp",
|
|
21
|
+
"transaction_hash": "transactionHash",
|
|
22
|
+
"assets_received": "assetsReceived",
|
|
23
|
+
"units_withdrawn": "unitsWithdrawn",
|
|
24
|
+
"cost_basis_consumed": "costBasisConsumed",
|
|
25
|
+
"realized_pnl": "realizedPnl",
|
|
26
|
+
"fee_charged": "feeCharged",
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
export function withdrawalEventFromJSON(jsonString) {
|
|
30
|
+
return safeParse(jsonString, (x) => WithdrawalEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WithdrawalEvent' from JSON`);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=withdrawalevent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withdrawalevent.js","sourceRoot":"","sources":["../../../../src/models/components/withdrawalevent.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA0CjD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAItC,CAAC,CAAC,MAAM,CAAC;IACX,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC9B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CACnE,IAAI,IAAI,CAAC,CAAC,CAAC,CACZ;IACD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC5B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC/B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,cAAc,EAAE,aAAa;QAC7B,iBAAiB,EAAE,gBAAgB;QACnC,kBAAkB,EAAE,iBAAiB;QACrC,iBAAiB,EAAE,gBAAgB;QACnC,iBAAiB,EAAE,gBAAgB;QACnC,qBAAqB,EAAE,mBAAmB;QAC1C,cAAc,EAAE,aAAa;QAC7B,aAAa,EAAE,YAAY;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,uBAAuB,CACrC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACzD,6CAA6C,CAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -20,10 +20,6 @@ export type V2EarnPositionsRequest = {
|
|
|
20
20
|
* The address of the user to get vault positions for.
|
|
21
21
|
*/
|
|
22
22
|
userAddress: string;
|
|
23
|
-
/**
|
|
24
|
-
* How many days back from the current time to include in the blockchain scan.
|
|
25
|
-
*/
|
|
26
|
-
days?: number | undefined;
|
|
27
23
|
};
|
|
28
24
|
/** @internal */
|
|
29
25
|
export declare const V2EarnPositionsChain$outboundSchema: z.ZodNativeEnum<typeof V2EarnPositionsChain>;
|
|
@@ -33,7 +29,6 @@ export type V2EarnPositionsRequest$Outbound = {
|
|
|
33
29
|
limit?: number | undefined;
|
|
34
30
|
chain: string;
|
|
35
31
|
user_address: string;
|
|
36
|
-
days?: number | undefined;
|
|
37
32
|
};
|
|
38
33
|
/** @internal */
|
|
39
34
|
export declare const V2EarnPositionsRequest$outboundSchema: z.ZodType<V2EarnPositionsRequest$Outbound, z.ZodTypeDef, V2EarnPositionsRequest>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2earnpositions.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/v2earnpositions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE3E,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"v2earnpositions.d.ts","sourceRoot":"","sources":["../../../../src/models/operations/v2earnpositions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE3E,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,mCAAmC,EAAE,CAAC,CAAC,aAAa,CAC/D,OAAO,oBAAoB,CACS,CAAC;AAEvC,gBAAgB;AAChB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,qCAAqC,EAAE,CAAC,CAAC,OAAO,CAC3D,+BAA+B,EAC/B,CAAC,CAAC,UAAU,EACZ,sBAAsB,CAUtB,CAAC;AAEH,wBAAgB,4BAA4B,CAC1C,sBAAsB,EAAE,sBAAsB,GAC7C,MAAM,CAIR"}
|
|
@@ -16,7 +16,6 @@ export const V2EarnPositionsRequest$outboundSchema = z.object({
|
|
|
16
16
|
limit: z.number().int().optional(),
|
|
17
17
|
chain: V2EarnPositionsChain$outboundSchema,
|
|
18
18
|
userAddress: z.string(),
|
|
19
|
-
days: z.number().int().optional(),
|
|
20
19
|
}).transform((v) => {
|
|
21
20
|
return remap$(v, {
|
|
22
21
|
userAddress: "user_address",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2earnpositions.js","sourceRoot":"","sources":["../../../../src/models/operations/v2earnpositions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAG1D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC;
|
|
1
|
+
{"version":3,"file":"v2earnpositions.js","sourceRoot":"","sources":["../../../../src/models/operations/v2earnpositions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAG1D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC;AAmBX,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAE5C,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAUvC,gBAAgB;AAChB,MAAM,CAAC,MAAM,qCAAqC,GAI9C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,mCAAmC;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,MAAM,CAAC,CAAC,EAAE;QACf,WAAW,EAAE,cAAc;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,4BAA4B,CAC1C,sBAA8C;IAE9C,OAAO,IAAI,CAAC,SAAS,CACnB,qCAAqC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CACpE,CAAC;AACJ,CAAC"}
|
package/dist/esm/sdk/earn.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class Earn extends ClientSDK {
|
|
|
6
6
|
* List earn positions
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* This endpoint fetches all Compass Earn positions.
|
|
9
|
+
* This endpoint fetches all Compass Earn positions with PnL information.
|
|
10
10
|
*/
|
|
11
11
|
earnPositions(request: operations.V2EarnPositionsRequest, options?: RequestOptions): Promise<components.EarnPositionsResponse>;
|
|
12
12
|
/**
|
package/dist/esm/sdk/earn.js
CHANGED
|
@@ -16,7 +16,7 @@ export class Earn extends ClientSDK {
|
|
|
16
16
|
* List earn positions
|
|
17
17
|
*
|
|
18
18
|
* @remarks
|
|
19
|
-
* This endpoint fetches all Compass Earn positions.
|
|
19
|
+
* This endpoint fetches all Compass Earn positions with PnL information.
|
|
20
20
|
*/
|
|
21
21
|
async earnPositions(request, options) {
|
|
22
22
|
return unwrapAsync(earnEarnPositions(this, request, options));
|
|
@@ -7,8 +7,8 @@ import { AaveLiquidityChangeResponse } from "@compass-labs/api-sdk/models/compon
|
|
|
7
7
|
|
|
8
8
|
let value: AaveLiquidityChangeResponse = {
|
|
9
9
|
liquidityChange: "<value>",
|
|
10
|
-
startTime: new Date("
|
|
11
|
-
endTime: new Date("
|
|
10
|
+
startTime: new Date("2024-12-19T02:39:56.491Z"),
|
|
11
|
+
endTime: new Date("2024-08-17T07:37:51.082Z"),
|
|
12
12
|
};
|
|
13
13
|
```
|
|
14
14
|
|
|
@@ -15,11 +15,12 @@ let value: AavePosition = {
|
|
|
15
15
|
|
|
16
16
|
## Fields
|
|
17
17
|
|
|
18
|
-
| Field
|
|
19
|
-
|
|
|
20
|
-
| `type`
|
|
21
|
-
| `id`
|
|
22
|
-
| `vaultAddress`
|
|
23
|
-
| `amountInUnderlyingToken`
|
|
24
|
-
| `tokenName`
|
|
25
|
-
| `vaultName`
|
|
18
|
+
| Field | Type | Required | Description | Example |
|
|
19
|
+
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
20
|
+
| `type` | *"AAVE"* | :heavy_check_mark: | The market type discriminator. | |
|
|
21
|
+
| `id` | *string* | :heavy_check_mark: | Base64-encoded position identifier. | |
|
|
22
|
+
| `vaultAddress` | *"None"* | :heavy_minus_sign: | N/A | None |
|
|
23
|
+
| `amountInUnderlyingToken` | *string* | :heavy_check_mark: | The user's position value denominated in the supplied asset. | |
|
|
24
|
+
| `tokenName` | *string* | :heavy_check_mark: | Symbol of the Aave reserve asset (e.g., USDC). | |
|
|
25
|
+
| `vaultName` | *"None"* | :heavy_minus_sign: | N/A | None |
|
|
26
|
+
| `pnl` | [components.PositionPnL](../../models/components/positionpnl.md) | :heavy_minus_sign: | PnL breakdown with full deposit/withdrawal history. | |
|
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 |
|
|
@@ -10,7 +10,6 @@ let value: V2EarnPositionsRequest = {
|
|
|
10
10
|
limit: 100,
|
|
11
11
|
chain: "base",
|
|
12
12
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
13
|
-
days: 30,
|
|
14
13
|
};
|
|
15
14
|
```
|
|
16
15
|
|
|
@@ -21,5 +20,4 @@ let value: V2EarnPositionsRequest = {
|
|
|
21
20
|
| `offset` | *number* | :heavy_minus_sign: | The offset of the first item to return. | 0 |
|
|
22
21
|
| `limit` | *number* | :heavy_minus_sign: | The number of items to return. | 100 |
|
|
23
22
|
| `chain` | [operations.V2EarnPositionsChain](../../models/operations/v2earnpositionschain.md) | :heavy_check_mark: | N/A | base |
|
|
24
|
-
| `userAddress` | *string* | :heavy_check_mark: | The address of the user to get vault positions for. | 0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c |
|
|
25
|
-
| `days` | *number* | :heavy_minus_sign: | How many days back from the current time to include in the blockchain scan. | 30 |
|
|
23
|
+
| `userAddress` | *string* | :heavy_check_mark: | The address of the user to get vault positions for. | 0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c |
|
package/docs/sdks/earn/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## earnPositions
|
|
17
17
|
|
|
18
|
-
This endpoint fetches all Compass Earn positions.
|
|
18
|
+
This endpoint fetches all Compass Earn positions with PnL information.
|
|
19
19
|
|
|
20
20
|
### Example Usage
|
|
21
21
|
|
|
@@ -33,7 +33,6 @@ async function run() {
|
|
|
33
33
|
limit: 100,
|
|
34
34
|
chain: "base",
|
|
35
35
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
36
|
-
days: 30,
|
|
37
36
|
});
|
|
38
37
|
|
|
39
38
|
console.log(result);
|
|
@@ -62,7 +61,6 @@ async function run() {
|
|
|
62
61
|
limit: 100,
|
|
63
62
|
chain: "base",
|
|
64
63
|
userAddress: "0x7fD8D98Afe730c9aE9b584f1D815f8dA1B4B4d4c",
|
|
65
|
-
days: 30,
|
|
66
64
|
});
|
|
67
65
|
if (res.ok) {
|
|
68
66
|
const { value: result } = res;
|
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,
|
|
@@ -93,7 +93,6 @@ async function $do(
|
|
|
93
93
|
|
|
94
94
|
const query = encodeFormQuery({
|
|
95
95
|
"chain": payload.chain,
|
|
96
|
-
"days": payload.days,
|
|
97
96
|
"limit": payload.limit,
|
|
98
97
|
"offset": payload.offset,
|
|
99
98
|
"user_address": payload.user_address,
|
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
|
+
}
|