@compass-labs/api-sdk 2.2.5 → 2.2.6
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/earnEarnBalances.d.ts +26 -0
- package/dist/commonjs/funcs/earnEarnBalances.d.ts.map +1 -0
- package/dist/commonjs/funcs/earnEarnBalances.js +130 -0
- package/dist/commonjs/funcs/earnEarnBalances.js.map +1 -0
- package/dist/commonjs/funcs/earnEarnPendleMarkets.js +1 -0
- package/dist/commonjs/funcs/earnEarnPendleMarkets.js.map +1 -1
- package/dist/commonjs/funcs/earnEarnVaults.js +1 -0
- package/dist/commonjs/funcs/earnEarnVaults.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts +37 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts.map +1 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js +65 -0
- package/dist/commonjs/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js.map +1 -0
- package/dist/commonjs/models/components/earnbalancesresponse.d.ts +23 -0
- package/dist/commonjs/models/components/earnbalancesresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/earnbalancesresponse.js +57 -0
- package/dist/commonjs/models/components/earnbalancesresponse.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/tokentransfer.d.ts +58 -0
- package/dist/commonjs/models/components/tokentransfer.d.ts.map +1 -0
- package/dist/commonjs/models/components/tokentransfer.js +77 -0
- package/dist/commonjs/models/components/tokentransfer.js.map +1 -0
- 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/v2earnbalances.d.ts +26 -0
- package/dist/commonjs/models/operations/v2earnbalances.d.ts.map +1 -0
- package/dist/commonjs/models/operations/v2earnbalances.js +57 -0
- package/dist/commonjs/models/operations/v2earnbalances.js.map +1 -0
- package/dist/commonjs/models/operations/v2earnpendlemarkets.d.ts +14 -0
- package/dist/commonjs/models/operations/v2earnpendlemarkets.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnpendlemarkets.js +9 -1
- package/dist/commonjs/models/operations/v2earnpendlemarkets.js.map +1 -1
- package/dist/commonjs/models/operations/v2earnvaults.d.ts +14 -0
- package/dist/commonjs/models/operations/v2earnvaults.d.ts.map +1 -1
- package/dist/commonjs/models/operations/v2earnvaults.js +9 -1
- package/dist/commonjs/models/operations/v2earnvaults.js.map +1 -1
- 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/earnEarnBalances.d.ts +26 -0
- package/dist/esm/funcs/earnEarnBalances.d.ts.map +1 -0
- package/dist/esm/funcs/earnEarnBalances.js +94 -0
- package/dist/esm/funcs/earnEarnBalances.js.map +1 -0
- package/dist/esm/funcs/earnEarnPendleMarkets.js +1 -0
- package/dist/esm/funcs/earnEarnPendleMarkets.js.map +1 -1
- package/dist/esm/funcs/earnEarnVaults.js +1 -0
- package/dist/esm/funcs/earnEarnVaults.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts +37 -0
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.d.ts.map +1 -0
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js +28 -0
- package/dist/esm/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.js.map +1 -0
- package/dist/esm/models/components/earnbalancesresponse.d.ts +23 -0
- package/dist/esm/models/components/earnbalancesresponse.d.ts.map +1 -0
- package/dist/esm/models/components/earnbalancesresponse.js +20 -0
- package/dist/esm/models/components/earnbalancesresponse.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/tokentransfer.d.ts +58 -0
- package/dist/esm/models/components/tokentransfer.d.ts.map +1 -0
- package/dist/esm/models/components/tokentransfer.js +40 -0
- package/dist/esm/models/components/tokentransfer.js.map +1 -0
- 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/v2earnbalances.d.ts +26 -0
- package/dist/esm/models/operations/v2earnbalances.d.ts.map +1 -0
- package/dist/esm/models/operations/v2earnbalances.js +20 -0
- package/dist/esm/models/operations/v2earnbalances.js.map +1 -0
- package/dist/esm/models/operations/v2earnpendlemarkets.d.ts +14 -0
- package/dist/esm/models/operations/v2earnpendlemarkets.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnpendlemarkets.js +7 -0
- package/dist/esm/models/operations/v2earnpendlemarkets.js.map +1 -1
- package/dist/esm/models/operations/v2earnvaults.d.ts +14 -0
- package/dist/esm/models/operations/v2earnvaults.d.ts.map +1 -1
- package/dist/esm/models/operations/v2earnvaults.js +7 -0
- package/dist/esm/models/operations/v2earnvaults.js.map +1 -1
- 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/compassapibackendv2modelsearnreadresponsebalancestokenbalance.md +28 -0
- package/docs/models/components/direction.md +17 -0
- package/docs/models/components/earnbalancesresponse.md +20 -0
- package/docs/models/components/tokentransfer.md +33 -0
- package/docs/models/operations/v2earnbalanceschain.md +15 -0
- package/docs/models/operations/v2earnbalancesrequest.md +19 -0
- package/docs/models/operations/v2earnpendlemarketsmintvlusd.md +19 -0
- package/docs/models/operations/v2earnpendlemarketsrequest.md +2 -1
- package/docs/models/operations/v2earnvaultsmintvlusd.md +19 -0
- package/docs/models/operations/v2earnvaultsrequest.md +2 -1
- package/docs/sdks/earn/README.md +84 -0
- package/package.json +1 -1
- package/src/funcs/earnEarnBalances.ts +182 -0
- package/src/funcs/earnEarnPendleMarkets.ts +1 -0
- package/src/funcs/earnEarnVaults.ts +1 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.ts +77 -0
- package/src/models/components/earnbalancesresponse.ts +55 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/tokentransfer.ts +101 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/v2earnbalances.ts +50 -0
- package/src/models/operations/v2earnpendlemarkets.ts +32 -0
- package/src/models/operations/v2earnvaults.ts +30 -0
- package/src/sdk/earn.ts +25 -0
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
* Get token balances
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Get token balances and transfer history for an earn account.
|
|
34
|
+
*
|
|
35
|
+
* Returns on-chain token balances for all tokens the earn account has interacted with,
|
|
36
|
+
* along with the complete transfer history for each token. Balances are keyed by token
|
|
37
|
+
* symbol for easy access.
|
|
38
|
+
*
|
|
39
|
+
* Use this endpoint to display account balances, track token movements, or build
|
|
40
|
+
* transaction history interfaces.
|
|
41
|
+
*/
|
|
42
|
+
export function earnEarnBalances(
|
|
43
|
+
client: CompassApiSDKCore,
|
|
44
|
+
request: operations.V2EarnBalancesRequest,
|
|
45
|
+
options?: RequestOptions,
|
|
46
|
+
): APIPromise<
|
|
47
|
+
Result<
|
|
48
|
+
components.EarnBalancesResponse,
|
|
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.V2EarnBalancesRequest,
|
|
70
|
+
options?: RequestOptions,
|
|
71
|
+
): Promise<
|
|
72
|
+
[
|
|
73
|
+
Result<
|
|
74
|
+
components.EarnBalancesResponse,
|
|
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.V2EarnBalancesRequest$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/balances")();
|
|
100
|
+
|
|
101
|
+
const query = encodeFormQuery({
|
|
102
|
+
"chain": payload.chain,
|
|
103
|
+
"owner": payload.owner,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const headers = new Headers(compactMap({
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
111
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
112
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
113
|
+
|
|
114
|
+
const context = {
|
|
115
|
+
options: client._options,
|
|
116
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
117
|
+
operationID: "v2_earn_balances",
|
|
118
|
+
oAuth2Scopes: null,
|
|
119
|
+
|
|
120
|
+
resolvedSecurity: requestSecurity,
|
|
121
|
+
|
|
122
|
+
securitySource: client._options.apiKeyAuth,
|
|
123
|
+
retryConfig: options?.retries
|
|
124
|
+
|| client._options.retryConfig
|
|
125
|
+
|| { strategy: "none" },
|
|
126
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const requestRes = client._createRequest(context, {
|
|
130
|
+
security: requestSecurity,
|
|
131
|
+
method: "GET",
|
|
132
|
+
baseURL: options?.serverURL,
|
|
133
|
+
path: path,
|
|
134
|
+
headers: headers,
|
|
135
|
+
query: query,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
148
|
+
retryConfig: context.retryConfig,
|
|
149
|
+
retryCodes: context.retryCodes,
|
|
150
|
+
});
|
|
151
|
+
if (!doResult.ok) {
|
|
152
|
+
return [doResult, { status: "request-error", request: req }];
|
|
153
|
+
}
|
|
154
|
+
const response = doResult.value;
|
|
155
|
+
|
|
156
|
+
const responseFields = {
|
|
157
|
+
HttpMeta: { Response: response, Request: req },
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const [result] = await M.match<
|
|
161
|
+
components.EarnBalancesResponse,
|
|
162
|
+
| errors.HTTPValidationError
|
|
163
|
+
| CompassAPISDKError
|
|
164
|
+
| ResponseValidationError
|
|
165
|
+
| ConnectionError
|
|
166
|
+
| RequestAbortedError
|
|
167
|
+
| RequestTimeoutError
|
|
168
|
+
| InvalidRequestError
|
|
169
|
+
| UnexpectedClientError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
>(
|
|
172
|
+
M.json(200, components.EarnBalancesResponse$inboundSchema),
|
|
173
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, req, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
@@ -105,6 +105,7 @@ async function $do(
|
|
|
105
105
|
"chain": payload.chain,
|
|
106
106
|
"direction": payload.direction,
|
|
107
107
|
"limit": payload.limit,
|
|
108
|
+
"min_tvl_usd": payload.min_tvl_usd,
|
|
108
109
|
"offset": payload.offset,
|
|
109
110
|
"order_by": payload.order_by,
|
|
110
111
|
"underlying_symbol": payload.underlying_symbol,
|
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.801.2",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 2.0.0 2.
|
|
67
|
+
"speakeasy-sdk/typescript 2.0.0 2.801.2 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
package/src/models/components/compassapibackendv2modelsearnreadresponsebalancestokenbalance.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
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 { TokenTransfer, TokenTransfer$inboundSchema } from "./tokentransfer.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Balance and transfer history for a single token.
|
|
14
|
+
*/
|
|
15
|
+
export type CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance = {
|
|
16
|
+
/**
|
|
17
|
+
* The token contract address.
|
|
18
|
+
*/
|
|
19
|
+
tokenAddress: string;
|
|
20
|
+
/**
|
|
21
|
+
* The token symbol (e.g., 'USDC').
|
|
22
|
+
*/
|
|
23
|
+
tokenSymbol: string;
|
|
24
|
+
/**
|
|
25
|
+
* The token's decimal places.
|
|
26
|
+
*/
|
|
27
|
+
tokenDecimals: number;
|
|
28
|
+
/**
|
|
29
|
+
* The current on-chain balance (raw).
|
|
30
|
+
*/
|
|
31
|
+
balance: string;
|
|
32
|
+
/**
|
|
33
|
+
* The human-readable balance.
|
|
34
|
+
*/
|
|
35
|
+
balanceFormatted: string;
|
|
36
|
+
/**
|
|
37
|
+
* List of all transfers involving this token.
|
|
38
|
+
*/
|
|
39
|
+
transfers?: Array<TokenTransfer> | undefined;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance$inboundSchema:
|
|
44
|
+
z.ZodType<
|
|
45
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance,
|
|
46
|
+
z.ZodTypeDef,
|
|
47
|
+
unknown
|
|
48
|
+
> = z.object({
|
|
49
|
+
token_address: z.string(),
|
|
50
|
+
token_symbol: z.string(),
|
|
51
|
+
token_decimals: z.number().int(),
|
|
52
|
+
balance: z.string(),
|
|
53
|
+
balance_formatted: z.string(),
|
|
54
|
+
transfers: z.array(TokenTransfer$inboundSchema).optional(),
|
|
55
|
+
}).transform((v) => {
|
|
56
|
+
return remap$(v, {
|
|
57
|
+
"token_address": "tokenAddress",
|
|
58
|
+
"token_symbol": "tokenSymbol",
|
|
59
|
+
"token_decimals": "tokenDecimals",
|
|
60
|
+
"balance_formatted": "balanceFormatted",
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export function compassApiBackendV2ModelsEarnReadResponseBalancesTokenBalanceFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<
|
|
67
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance,
|
|
68
|
+
SDKValidationError
|
|
69
|
+
> {
|
|
70
|
+
return safeParse(
|
|
71
|
+
jsonString,
|
|
72
|
+
(x) =>
|
|
73
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance$inboundSchema
|
|
74
|
+
.parse(JSON.parse(x)),
|
|
75
|
+
`Failed to parse 'CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance' from JSON`,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance,
|
|
12
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance$inboundSchema,
|
|
13
|
+
} from "./compassapibackendv2modelsearnreadresponsebalancestokenbalance.js";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Response containing earn account balances and transfer history.
|
|
17
|
+
*/
|
|
18
|
+
export type EarnBalancesResponse = {
|
|
19
|
+
/**
|
|
20
|
+
* The derived earn account (Safe) address.
|
|
21
|
+
*/
|
|
22
|
+
earnAccountAddress: string;
|
|
23
|
+
/**
|
|
24
|
+
* Token balances keyed by token symbol.
|
|
25
|
+
*/
|
|
26
|
+
balances?: {
|
|
27
|
+
[k: string]: CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const EarnBalancesResponse$inboundSchema: z.ZodType<
|
|
33
|
+
EarnBalancesResponse,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
unknown
|
|
36
|
+
> = z.object({
|
|
37
|
+
earn_account_address: z.string(),
|
|
38
|
+
balances: z.record(
|
|
39
|
+
CompassApiBackendV2ModelsEarnReadResponseBalancesTokenBalance$inboundSchema,
|
|
40
|
+
).optional(),
|
|
41
|
+
}).transform((v) => {
|
|
42
|
+
return remap$(v, {
|
|
43
|
+
"earn_account_address": "earnAccountAddress",
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export function earnBalancesResponseFromJSON(
|
|
48
|
+
jsonString: string,
|
|
49
|
+
): SafeParseResult<EarnBalancesResponse, SDKValidationError> {
|
|
50
|
+
return safeParse(
|
|
51
|
+
jsonString,
|
|
52
|
+
(x) => EarnBalancesResponse$inboundSchema.parse(JSON.parse(x)),
|
|
53
|
+
`Failed to parse 'EarnBalancesResponse' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -69,6 +69,7 @@ export * from "./compassapibackendv1modelspendlereadresponsemarketuserposition.j
|
|
|
69
69
|
export * from "./compassapibackendv1modelspendlereadresponsepositionstokenbalance.js";
|
|
70
70
|
export * from "./compassapibackendv1modelsvaultsreadresponsevaultuserposition.js";
|
|
71
71
|
export * from "./compassapibackendv1modelswildcatreadresponsemarketuserposition.js";
|
|
72
|
+
export * from "./compassapibackendv2modelsearnreadresponsebalancestokenbalance.js";
|
|
72
73
|
export * from "./compassapibackendv2modelsearnreadresponsepositionsvaultposition.js";
|
|
73
74
|
export * from "./compassapibackendv2modelsgassponsorshippermit2typeddataeip712domain.js";
|
|
74
75
|
export * from "./compassapibackendv2modelsgassponsorshippermit2typeddataeip712types.js";
|
|
@@ -83,6 +84,7 @@ export * from "./depositevent.js";
|
|
|
83
84
|
export * from "./depositforburnrequest.js";
|
|
84
85
|
export * from "./depositforburnresponse.js";
|
|
85
86
|
export * from "./details.js";
|
|
87
|
+
export * from "./earnbalancesresponse.js";
|
|
86
88
|
export * from "./earnmanageparams.js";
|
|
87
89
|
export * from "./earnmanagerequest.js";
|
|
88
90
|
export * from "./earnmanageresponse.js";
|
|
@@ -210,6 +212,7 @@ export * from "./tokenlistresponse.js";
|
|
|
210
212
|
export * from "./tokenmarketdata.js";
|
|
211
213
|
export * from "./tokenpermissions.js";
|
|
212
214
|
export * from "./tokenpriceresponse.js";
|
|
215
|
+
export * from "./tokentransfer.js";
|
|
213
216
|
export * from "./tokentransferparams.js";
|
|
214
217
|
export * from "./tokentransferrequest.js";
|
|
215
218
|
export * from "./transactionresponse.js";
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Direction relative to the earn account: 'in' for received, 'out' for sent.
|
|
14
|
+
*/
|
|
15
|
+
export const Direction = {
|
|
16
|
+
In: "in",
|
|
17
|
+
Out: "out",
|
|
18
|
+
} as const;
|
|
19
|
+
/**
|
|
20
|
+
* Direction relative to the earn account: 'in' for received, 'out' for sent.
|
|
21
|
+
*/
|
|
22
|
+
export type Direction = ClosedEnum<typeof Direction>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A single ERC20 token transfer event.
|
|
26
|
+
*/
|
|
27
|
+
export type TokenTransfer = {
|
|
28
|
+
/**
|
|
29
|
+
* The address tokens were sent from.
|
|
30
|
+
*/
|
|
31
|
+
fromAddress: string;
|
|
32
|
+
/**
|
|
33
|
+
* The address tokens were sent to.
|
|
34
|
+
*/
|
|
35
|
+
toAddress: string;
|
|
36
|
+
/**
|
|
37
|
+
* The raw transfer amount (in token's smallest unit).
|
|
38
|
+
*/
|
|
39
|
+
amount: string;
|
|
40
|
+
/**
|
|
41
|
+
* The human-readable transfer amount.
|
|
42
|
+
*/
|
|
43
|
+
amountFormatted: string;
|
|
44
|
+
/**
|
|
45
|
+
* The block number of the transfer.
|
|
46
|
+
*/
|
|
47
|
+
blockNumber: number;
|
|
48
|
+
/**
|
|
49
|
+
* The timestamp of the transfer.
|
|
50
|
+
*/
|
|
51
|
+
blockTimestamp: Date;
|
|
52
|
+
/**
|
|
53
|
+
* The transaction hash of the transfer.
|
|
54
|
+
*/
|
|
55
|
+
transactionHash: string;
|
|
56
|
+
/**
|
|
57
|
+
* Direction relative to the earn account: 'in' for received, 'out' for sent.
|
|
58
|
+
*/
|
|
59
|
+
direction: Direction;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const Direction$inboundSchema: z.ZodNativeEnum<typeof Direction> = z
|
|
64
|
+
.nativeEnum(Direction);
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const TokenTransfer$inboundSchema: z.ZodType<
|
|
68
|
+
TokenTransfer,
|
|
69
|
+
z.ZodTypeDef,
|
|
70
|
+
unknown
|
|
71
|
+
> = z.object({
|
|
72
|
+
from_address: z.string(),
|
|
73
|
+
to_address: z.string(),
|
|
74
|
+
amount: z.string(),
|
|
75
|
+
amount_formatted: z.string(),
|
|
76
|
+
block_number: z.number().int(),
|
|
77
|
+
block_timestamp: z.string().datetime({ offset: true }).transform(v =>
|
|
78
|
+
new Date(v)
|
|
79
|
+
),
|
|
80
|
+
transaction_hash: z.string(),
|
|
81
|
+
direction: Direction$inboundSchema,
|
|
82
|
+
}).transform((v) => {
|
|
83
|
+
return remap$(v, {
|
|
84
|
+
"from_address": "fromAddress",
|
|
85
|
+
"to_address": "toAddress",
|
|
86
|
+
"amount_formatted": "amountFormatted",
|
|
87
|
+
"block_number": "blockNumber",
|
|
88
|
+
"block_timestamp": "blockTimestamp",
|
|
89
|
+
"transaction_hash": "transactionHash",
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export function tokenTransferFromJSON(
|
|
94
|
+
jsonString: string,
|
|
95
|
+
): SafeParseResult<TokenTransfer, SDKValidationError> {
|
|
96
|
+
return safeParse(
|
|
97
|
+
jsonString,
|
|
98
|
+
(x) => TokenTransfer$inboundSchema.parse(JSON.parse(x)),
|
|
99
|
+
`Failed to parse 'TokenTransfer' from JSON`,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -42,6 +42,7 @@ export * from "./v1vaultsvault.js";
|
|
|
42
42
|
export * from "./v1wildcatmarket.js";
|
|
43
43
|
export * from "./v2cctpmint.js";
|
|
44
44
|
export * from "./v2earnaavemarkets.js";
|
|
45
|
+
export * from "./v2earnbalances.js";
|
|
45
46
|
export * from "./v2earnpendlemarkets.js";
|
|
46
47
|
export * from "./v2earnpositions.js";
|
|
47
48
|
export * from "./v2earnvaults.js";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const V2EarnBalancesChain = {
|
|
9
|
+
Arbitrum: "arbitrum",
|
|
10
|
+
Base: "base",
|
|
11
|
+
Ethereum: "ethereum",
|
|
12
|
+
} as const;
|
|
13
|
+
export type V2EarnBalancesChain = ClosedEnum<typeof V2EarnBalancesChain>;
|
|
14
|
+
|
|
15
|
+
export type V2EarnBalancesRequest = {
|
|
16
|
+
chain: V2EarnBalancesChain;
|
|
17
|
+
/**
|
|
18
|
+
* The address of the owner of the earn account.
|
|
19
|
+
*/
|
|
20
|
+
owner: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const V2EarnBalancesChain$outboundSchema: z.ZodNativeEnum<
|
|
25
|
+
typeof V2EarnBalancesChain
|
|
26
|
+
> = z.nativeEnum(V2EarnBalancesChain);
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export type V2EarnBalancesRequest$Outbound = {
|
|
30
|
+
chain: string;
|
|
31
|
+
owner: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const V2EarnBalancesRequest$outboundSchema: z.ZodType<
|
|
36
|
+
V2EarnBalancesRequest$Outbound,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
V2EarnBalancesRequest
|
|
39
|
+
> = z.object({
|
|
40
|
+
chain: V2EarnBalancesChain$outboundSchema,
|
|
41
|
+
owner: z.string(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export function v2EarnBalancesRequestToJSON(
|
|
45
|
+
v2EarnBalancesRequest: V2EarnBalancesRequest,
|
|
46
|
+
): string {
|
|
47
|
+
return JSON.stringify(
|
|
48
|
+
V2EarnBalancesRequest$outboundSchema.parse(v2EarnBalancesRequest),
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -21,6 +21,11 @@ export type V2EarnPendleMarketsDirection = ClosedEnum<
|
|
|
21
21
|
typeof V2EarnPendleMarketsDirection
|
|
22
22
|
>;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Minimum TVL in USD. Markets with TVL below this value will be excluded.
|
|
26
|
+
*/
|
|
27
|
+
export type V2EarnPendleMarketsMinTvlUsd = number | string;
|
|
28
|
+
|
|
24
29
|
export type V2EarnPendleMarketsRequest = {
|
|
25
30
|
/**
|
|
26
31
|
* The field to order the results by.
|
|
@@ -46,6 +51,10 @@ export type V2EarnPendleMarketsRequest = {
|
|
|
46
51
|
* Filter markets by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
47
52
|
*/
|
|
48
53
|
underlyingSymbol?: string | null | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Minimum TVL in USD. Markets with TVL below this value will be excluded.
|
|
56
|
+
*/
|
|
57
|
+
minTvlUsd?: number | string | null | undefined;
|
|
49
58
|
};
|
|
50
59
|
|
|
51
60
|
/** @internal */
|
|
@@ -53,6 +62,26 @@ export const V2EarnPendleMarketsDirection$outboundSchema: z.ZodNativeEnum<
|
|
|
53
62
|
typeof V2EarnPendleMarketsDirection
|
|
54
63
|
> = z.nativeEnum(V2EarnPendleMarketsDirection);
|
|
55
64
|
|
|
65
|
+
/** @internal */
|
|
66
|
+
export type V2EarnPendleMarketsMinTvlUsd$Outbound = number | string;
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export const V2EarnPendleMarketsMinTvlUsd$outboundSchema: z.ZodType<
|
|
70
|
+
V2EarnPendleMarketsMinTvlUsd$Outbound,
|
|
71
|
+
z.ZodTypeDef,
|
|
72
|
+
V2EarnPendleMarketsMinTvlUsd
|
|
73
|
+
> = z.union([z.number(), z.string()]);
|
|
74
|
+
|
|
75
|
+
export function v2EarnPendleMarketsMinTvlUsdToJSON(
|
|
76
|
+
v2EarnPendleMarketsMinTvlUsd: V2EarnPendleMarketsMinTvlUsd,
|
|
77
|
+
): string {
|
|
78
|
+
return JSON.stringify(
|
|
79
|
+
V2EarnPendleMarketsMinTvlUsd$outboundSchema.parse(
|
|
80
|
+
v2EarnPendleMarketsMinTvlUsd,
|
|
81
|
+
),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
56
85
|
/** @internal */
|
|
57
86
|
export type V2EarnPendleMarketsRequest$Outbound = {
|
|
58
87
|
order_by: string;
|
|
@@ -61,6 +90,7 @@ export type V2EarnPendleMarketsRequest$Outbound = {
|
|
|
61
90
|
limit?: number | undefined;
|
|
62
91
|
chain?: string | null | undefined;
|
|
63
92
|
underlying_symbol?: string | null | undefined;
|
|
93
|
+
min_tvl_usd?: number | string | null | undefined;
|
|
64
94
|
};
|
|
65
95
|
|
|
66
96
|
/** @internal */
|
|
@@ -75,10 +105,12 @@ export const V2EarnPendleMarketsRequest$outboundSchema: z.ZodType<
|
|
|
75
105
|
limit: z.number().int().optional(),
|
|
76
106
|
chain: z.nullable(components.Chain$outboundSchema).optional(),
|
|
77
107
|
underlyingSymbol: z.nullable(z.string()).optional(),
|
|
108
|
+
minTvlUsd: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
78
109
|
}).transform((v) => {
|
|
79
110
|
return remap$(v, {
|
|
80
111
|
orderBy: "order_by",
|
|
81
112
|
underlyingSymbol: "underlying_symbol",
|
|
113
|
+
minTvlUsd: "min_tvl_usd",
|
|
82
114
|
});
|
|
83
115
|
});
|
|
84
116
|
|
|
@@ -19,6 +19,11 @@ export const V2EarnVaultsDirection = {
|
|
|
19
19
|
*/
|
|
20
20
|
export type V2EarnVaultsDirection = ClosedEnum<typeof V2EarnVaultsDirection>;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Minimum TVL in USD. Vaults with TVL below this value will be excluded.
|
|
24
|
+
*/
|
|
25
|
+
export type V2EarnVaultsMinTvlUsd = number | string;
|
|
26
|
+
|
|
22
27
|
export type V2EarnVaultsRequest = {
|
|
23
28
|
/**
|
|
24
29
|
* The field to order the results by.
|
|
@@ -44,6 +49,10 @@ export type V2EarnVaultsRequest = {
|
|
|
44
49
|
* Filter vaults by underlying asset symbol (e.g., 'USDC', 'WETH').
|
|
45
50
|
*/
|
|
46
51
|
assetSymbol?: string | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Minimum TVL in USD. Vaults with TVL below this value will be excluded.
|
|
54
|
+
*/
|
|
55
|
+
minTvlUsd?: number | string | null | undefined;
|
|
47
56
|
};
|
|
48
57
|
|
|
49
58
|
/** @internal */
|
|
@@ -51,6 +60,24 @@ export const V2EarnVaultsDirection$outboundSchema: z.ZodNativeEnum<
|
|
|
51
60
|
typeof V2EarnVaultsDirection
|
|
52
61
|
> = z.nativeEnum(V2EarnVaultsDirection);
|
|
53
62
|
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type V2EarnVaultsMinTvlUsd$Outbound = number | string;
|
|
65
|
+
|
|
66
|
+
/** @internal */
|
|
67
|
+
export const V2EarnVaultsMinTvlUsd$outboundSchema: z.ZodType<
|
|
68
|
+
V2EarnVaultsMinTvlUsd$Outbound,
|
|
69
|
+
z.ZodTypeDef,
|
|
70
|
+
V2EarnVaultsMinTvlUsd
|
|
71
|
+
> = z.union([z.number(), z.string()]);
|
|
72
|
+
|
|
73
|
+
export function v2EarnVaultsMinTvlUsdToJSON(
|
|
74
|
+
v2EarnVaultsMinTvlUsd: V2EarnVaultsMinTvlUsd,
|
|
75
|
+
): string {
|
|
76
|
+
return JSON.stringify(
|
|
77
|
+
V2EarnVaultsMinTvlUsd$outboundSchema.parse(v2EarnVaultsMinTvlUsd),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
54
81
|
/** @internal */
|
|
55
82
|
export type V2EarnVaultsRequest$Outbound = {
|
|
56
83
|
order_by: string;
|
|
@@ -59,6 +86,7 @@ export type V2EarnVaultsRequest$Outbound = {
|
|
|
59
86
|
limit?: number | undefined;
|
|
60
87
|
chain?: string | null | undefined;
|
|
61
88
|
asset_symbol?: string | null | undefined;
|
|
89
|
+
min_tvl_usd?: number | string | null | undefined;
|
|
62
90
|
};
|
|
63
91
|
|
|
64
92
|
/** @internal */
|
|
@@ -73,10 +101,12 @@ export const V2EarnVaultsRequest$outboundSchema: z.ZodType<
|
|
|
73
101
|
limit: z.number().int().optional(),
|
|
74
102
|
chain: z.nullable(components.Chain$outboundSchema).optional(),
|
|
75
103
|
assetSymbol: z.nullable(z.string()).optional(),
|
|
104
|
+
minTvlUsd: z.nullable(z.union([z.number(), z.string()])).optional(),
|
|
76
105
|
}).transform((v) => {
|
|
77
106
|
return remap$(v, {
|
|
78
107
|
orderBy: "order_by",
|
|
79
108
|
assetSymbol: "asset_symbol",
|
|
109
|
+
minTvlUsd: "min_tvl_usd",
|
|
80
110
|
});
|
|
81
111
|
});
|
|
82
112
|
|