@compass-labs/api-sdk 2.2.24 → 2.2.25-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/codeSamples_typescript.yaml +6 -0
- package/dist/commonjs/funcs/earnEarnPositionsAll.d.ts +26 -0
- package/dist/commonjs/funcs/earnEarnPositionsAll.d.ts.map +1 -0
- package/dist/commonjs/funcs/earnEarnPositionsAll.js +129 -0
- package/dist/commonjs/funcs/earnEarnPositionsAll.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/earnpositionsallresponse.d.ts +28 -0
- package/dist/commonjs/models/components/earnpositionsallresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/earnpositionsallresponse.js +57 -0
- package/dist/commonjs/models/components/earnpositionsallresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/v2earnpositionsall.d.ts +15 -0
- package/dist/commonjs/models/operations/v2earnpositionsall.d.ts.map +1 -0
- package/dist/commonjs/models/operations/v2earnpositionsall.js +49 -0
- package/dist/commonjs/models/operations/v2earnpositionsall.js.map +1 -0
- package/dist/commonjs/sdk/earn.d.ts +14 -0
- package/dist/commonjs/sdk/earn.d.ts.map +1 -1
- package/dist/commonjs/sdk/earn.js +17 -0
- package/dist/commonjs/sdk/earn.js.map +1 -1
- package/dist/esm/funcs/earnEarnPositionsAll.d.ts +26 -0
- package/dist/esm/funcs/earnEarnPositionsAll.d.ts.map +1 -0
- package/dist/esm/funcs/earnEarnPositionsAll.js +93 -0
- package/dist/esm/funcs/earnEarnPositionsAll.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/earnpositionsallresponse.d.ts +28 -0
- package/dist/esm/models/components/earnpositionsallresponse.d.ts.map +1 -0
- package/dist/esm/models/components/earnpositionsallresponse.js +20 -0
- package/dist/esm/models/components/earnpositionsallresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/v2earnpositionsall.d.ts +15 -0
- package/dist/esm/models/operations/v2earnpositionsall.d.ts.map +1 -0
- package/dist/esm/models/operations/v2earnpositionsall.js +12 -0
- package/dist/esm/models/operations/v2earnpositionsall.js.map +1 -0
- package/dist/esm/sdk/earn.d.ts +14 -0
- package/dist/esm/sdk/earn.d.ts.map +1 -1
- package/dist/esm/sdk/earn.js +17 -0
- package/dist/esm/sdk/earn.js.map +1 -1
- package/docs/models/components/earnpositionsallresponse.md +29 -0
- package/docs/models/operations/v2earnpositionsallrequest.md +17 -0
- package/docs/sdks/earn/README.md +82 -0
- package/package.json +1 -1
- package/src/funcs/earnEarnPositionsAll.ts +181 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/earnpositionsallresponse.ts +56 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/v2earnpositionsall.ts +34 -0
- package/src/sdk/earn.ts +25 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* List earn positions across all chains
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* List all Earn positions across all supported chains (Ethereum, Base, Arbitrum).
|
|
34
|
+
*
|
|
35
|
+
* Returns positions grouped by chain, with per-chain and total USD values.
|
|
36
|
+
* Each chain includes Aave, vault, and Pendle PT positions. Chains where
|
|
37
|
+
* the user has no earn account return empty position lists.
|
|
38
|
+
*
|
|
39
|
+
* Use this endpoint for a cross-chain portfolio overview instead of making
|
|
40
|
+
* separate calls per chain to /positions.
|
|
41
|
+
*/
|
|
42
|
+
export function earnEarnPositionsAll(
|
|
43
|
+
client: CompassApiSDKCore,
|
|
44
|
+
request: operations.V2EarnPositionsAllRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
components.EarnPositionsAllResponse,
|
|
49
|
+
| errors.HTTPValidationError
|
|
50
|
+
| CompassAPISDKError
|
|
51
|
+
| ResponseValidationError
|
|
52
|
+
| ConnectionError
|
|
53
|
+
| RequestAbortedError
|
|
54
|
+
| RequestTimeoutError
|
|
55
|
+
| InvalidRequestError
|
|
56
|
+
| UnexpectedClientError
|
|
57
|
+
| SDKValidationError
|
|
58
|
+
>
|
|
59
|
+
> {
|
|
60
|
+
return new APIPromise($do(
|
|
61
|
+
client,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function $do(
|
|
68
|
+
client: CompassApiSDKCore,
|
|
69
|
+
request: operations.V2EarnPositionsAllRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
components.EarnPositionsAllResponse,
|
|
75
|
+
| errors.HTTPValidationError
|
|
76
|
+
| CompassAPISDKError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>,
|
|
85
|
+
APICall,
|
|
86
|
+
]
|
|
87
|
+
> {
|
|
88
|
+
const parsed = safeParse(
|
|
89
|
+
request,
|
|
90
|
+
(value) => operations.V2EarnPositionsAllRequest$outboundSchema.parse(value),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = null;
|
|
98
|
+
|
|
99
|
+
const path = pathToFunc("/v2/earn/positions_all")();
|
|
100
|
+
|
|
101
|
+
const query = encodeFormQuery({
|
|
102
|
+
"owner": payload.owner,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
Accept: "application/json",
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
110
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
111
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
112
|
+
|
|
113
|
+
const context = {
|
|
114
|
+
options: client._options,
|
|
115
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
+
operationID: "v2_earn_positions_all",
|
|
117
|
+
oAuth2Scopes: null,
|
|
118
|
+
|
|
119
|
+
resolvedSecurity: requestSecurity,
|
|
120
|
+
|
|
121
|
+
securitySource: client._options.apiKeyAuth,
|
|
122
|
+
retryConfig: options?.retries
|
|
123
|
+
|| client._options.retryConfig
|
|
124
|
+
|| { strategy: "none" },
|
|
125
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const requestRes = client._createRequest(context, {
|
|
129
|
+
security: requestSecurity,
|
|
130
|
+
method: "GET",
|
|
131
|
+
baseURL: options?.serverURL,
|
|
132
|
+
path: path,
|
|
133
|
+
headers: headers,
|
|
134
|
+
query: query,
|
|
135
|
+
body: body,
|
|
136
|
+
userAgent: client._options.userAgent,
|
|
137
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
138
|
+
}, options);
|
|
139
|
+
if (!requestRes.ok) {
|
|
140
|
+
return [requestRes, { status: "invalid" }];
|
|
141
|
+
}
|
|
142
|
+
const req = requestRes.value;
|
|
143
|
+
|
|
144
|
+
const doResult = await client._do(req, {
|
|
145
|
+
context,
|
|
146
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
147
|
+
retryConfig: context.retryConfig,
|
|
148
|
+
retryCodes: context.retryCodes,
|
|
149
|
+
});
|
|
150
|
+
if (!doResult.ok) {
|
|
151
|
+
return [doResult, { status: "request-error", request: req }];
|
|
152
|
+
}
|
|
153
|
+
const response = doResult.value;
|
|
154
|
+
|
|
155
|
+
const responseFields = {
|
|
156
|
+
HttpMeta: { Response: response, Request: req },
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const [result] = await M.match<
|
|
160
|
+
components.EarnPositionsAllResponse,
|
|
161
|
+
| errors.HTTPValidationError
|
|
162
|
+
| CompassAPISDKError
|
|
163
|
+
| ResponseValidationError
|
|
164
|
+
| ConnectionError
|
|
165
|
+
| RequestAbortedError
|
|
166
|
+
| RequestTimeoutError
|
|
167
|
+
| InvalidRequestError
|
|
168
|
+
| UnexpectedClientError
|
|
169
|
+
| SDKValidationError
|
|
170
|
+
>(
|
|
171
|
+
M.json(200, components.EarnPositionsAllResponse$inboundSchema),
|
|
172
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
173
|
+
M.fail("4XX"),
|
|
174
|
+
M.fail("5XX"),
|
|
175
|
+
)(response, req, { extraFields: responseFields });
|
|
176
|
+
if (!result.ok) {
|
|
177
|
+
return [result, { status: "complete", request: req, response }];
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
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.
|
|
65
|
+
genVersion: "2.859.2",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.859.2 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 {
|
|
11
|
+
EarnPositionsResponse,
|
|
12
|
+
EarnPositionsResponse$inboundSchema,
|
|
13
|
+
} from "./earnpositionsresponse.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Positions across all chains, grouped by chain name.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
*
|
|
20
|
+
* Each chain key maps to an EarnPositionsResponse containing that chain's
|
|
21
|
+
* aave, vaults, and pendle_pt positions with per-chain total_usd_value.
|
|
22
|
+
*/
|
|
23
|
+
export type EarnPositionsAllResponse = {
|
|
24
|
+
/**
|
|
25
|
+
* Positions grouped by chain. Keys: 'ethereum', 'base', 'arbitrum'.
|
|
26
|
+
*/
|
|
27
|
+
chains: { [k: string]: EarnPositionsResponse };
|
|
28
|
+
/**
|
|
29
|
+
* Total USD value of all positions across all chains.
|
|
30
|
+
*/
|
|
31
|
+
totalUsdValue?: string | null | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const EarnPositionsAllResponse$inboundSchema: z.ZodType<
|
|
36
|
+
EarnPositionsAllResponse,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
unknown
|
|
39
|
+
> = z.object({
|
|
40
|
+
chains: z.record(EarnPositionsResponse$inboundSchema),
|
|
41
|
+
total_usd_value: z.nullable(z.string()).optional(),
|
|
42
|
+
}).transform((v) => {
|
|
43
|
+
return remap$(v, {
|
|
44
|
+
"total_usd_value": "totalUsdValue",
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export function earnPositionsAllResponseFromJSON(
|
|
49
|
+
jsonString: string,
|
|
50
|
+
): SafeParseResult<EarnPositionsAllResponse, SDKValidationError> {
|
|
51
|
+
return safeParse(
|
|
52
|
+
jsonString,
|
|
53
|
+
(x) => EarnPositionsAllResponse$inboundSchema.parse(JSON.parse(x)),
|
|
54
|
+
`Failed to parse 'EarnPositionsAllResponse' from JSON`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -109,6 +109,7 @@ export * from "./earnbalancesresponse.js";
|
|
|
109
109
|
export * from "./earnmanageparams.js";
|
|
110
110
|
export * from "./earnmanagerequest.js";
|
|
111
111
|
export * from "./earnmanageresponse.js";
|
|
112
|
+
export * from "./earnpositionsallresponse.js";
|
|
112
113
|
export * from "./earnpositionsresponse.js";
|
|
113
114
|
export * from "./earnswapparams.js";
|
|
114
115
|
export * from "./earnswaprequest.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type V2EarnPositionsAllRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* The address of the owner of the earn account.
|
|
10
|
+
*/
|
|
11
|
+
owner: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type V2EarnPositionsAllRequest$Outbound = {
|
|
16
|
+
owner: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const V2EarnPositionsAllRequest$outboundSchema: z.ZodType<
|
|
21
|
+
V2EarnPositionsAllRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
V2EarnPositionsAllRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
owner: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function v2EarnPositionsAllRequestToJSON(
|
|
29
|
+
v2EarnPositionsAllRequest: V2EarnPositionsAllRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
V2EarnPositionsAllRequest$outboundSchema.parse(v2EarnPositionsAllRequest),
|
|
33
|
+
);
|
|
34
|
+
}
|
package/src/sdk/earn.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { earnEarnCreateAccount } from "../funcs/earnEarnCreateAccount.js";
|
|
|
9
9
|
import { earnEarnManage } from "../funcs/earnEarnManage.js";
|
|
10
10
|
import { earnEarnPendleMarkets } from "../funcs/earnEarnPendleMarkets.js";
|
|
11
11
|
import { earnEarnPositions } from "../funcs/earnEarnPositions.js";
|
|
12
|
+
import { earnEarnPositionsAll } from "../funcs/earnEarnPositionsAll.js";
|
|
12
13
|
import { earnEarnSwap } from "../funcs/earnEarnSwap.js";
|
|
13
14
|
import { earnEarnTransfer } from "../funcs/earnEarnTransfer.js";
|
|
14
15
|
import { earnEarnVaults } from "../funcs/earnEarnVaults.js";
|
|
@@ -42,6 +43,30 @@ export class Earn extends ClientSDK {
|
|
|
42
43
|
));
|
|
43
44
|
}
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* List earn positions across all chains
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* List all Earn positions across all supported chains (Ethereum, Base, Arbitrum).
|
|
51
|
+
*
|
|
52
|
+
* Returns positions grouped by chain, with per-chain and total USD values.
|
|
53
|
+
* Each chain includes Aave, vault, and Pendle PT positions. Chains where
|
|
54
|
+
* the user has no earn account return empty position lists.
|
|
55
|
+
*
|
|
56
|
+
* Use this endpoint for a cross-chain portfolio overview instead of making
|
|
57
|
+
* separate calls per chain to /positions.
|
|
58
|
+
*/
|
|
59
|
+
async earnPositionsAll(
|
|
60
|
+
request: operations.V2EarnPositionsAllRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<components.EarnPositionsAllResponse> {
|
|
63
|
+
return unwrapAsync(earnEarnPositionsAll(
|
|
64
|
+
this,
|
|
65
|
+
request,
|
|
66
|
+
options,
|
|
67
|
+
));
|
|
68
|
+
}
|
|
69
|
+
|
|
45
70
|
/**
|
|
46
71
|
* List vaults
|
|
47
72
|
*
|