@compass-labs/api-sdk 0.5.49 → 0.5.51
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 +2 -0
- package/bin/mcp-server.js +229 -43
- package/bin/mcp-server.js.map +16 -11
- package/dist/commonjs/funcs/universalSupportedChains.d.ts +19 -0
- package/dist/commonjs/funcs/universalSupportedChains.d.ts.map +1 -0
- package/dist/commonjs/funcs/universalSupportedChains.js +122 -0
- package/dist/commonjs/funcs/universalSupportedChains.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/universalSupportedChains.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/universalSupportedChains.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/universalSupportedChains.js +64 -0
- package/dist/commonjs/mcp-server/tools/universalSupportedChains.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/protocol.d.ts +40 -0
- package/dist/commonjs/models/components/protocol.d.ts.map +1 -0
- package/dist/commonjs/models/components/protocol.js +65 -0
- package/dist/commonjs/models/components/protocol.js.map +1 -0
- package/dist/commonjs/models/components/supportedchaininfo.d.ts +33 -0
- package/dist/commonjs/models/components/supportedchaininfo.d.ts.map +1 -0
- package/dist/commonjs/models/components/supportedchaininfo.js +70 -0
- package/dist/commonjs/models/components/supportedchaininfo.js.map +1 -0
- package/dist/commonjs/models/components/userstate.d.ts +2 -2
- package/dist/commonjs/models/components/userstate.d.ts.map +1 -1
- package/dist/commonjs/models/components/userstate.js +2 -2
- package/dist/commonjs/models/components/userstate.js.map +1 -1
- package/dist/commonjs/models/operations/genericsupportedchains.d.ts +33 -0
- package/dist/commonjs/models/operations/genericsupportedchains.d.ts.map +1 -0
- package/dist/commonjs/models/operations/genericsupportedchains.js +70 -0
- package/dist/commonjs/models/operations/genericsupportedchains.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/morphomarkets.d.ts +53 -4
- package/dist/commonjs/models/operations/morphomarkets.d.ts.map +1 -1
- package/dist/commonjs/models/operations/morphomarkets.js +52 -5
- package/dist/commonjs/models/operations/morphomarkets.js.map +1 -1
- package/dist/commonjs/models/operations/morphovaults.d.ts +27 -2
- package/dist/commonjs/models/operations/morphovaults.d.ts.map +1 -1
- package/dist/commonjs/models/operations/morphovaults.js +27 -3
- package/dist/commonjs/models/operations/morphovaults.js.map +1 -1
- package/dist/commonjs/sdk/universal.d.ts +7 -0
- package/dist/commonjs/sdk/universal.d.ts.map +1 -1
- package/dist/commonjs/sdk/universal.js +10 -0
- package/dist/commonjs/sdk/universal.js.map +1 -1
- package/dist/esm/funcs/universalSupportedChains.d.ts +19 -0
- package/dist/esm/funcs/universalSupportedChains.d.ts.map +1 -0
- package/dist/esm/funcs/universalSupportedChains.js +86 -0
- package/dist/esm/funcs/universalSupportedChains.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/universalSupportedChains.d.ts +8 -0
- package/dist/esm/mcp-server/tools/universalSupportedChains.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/universalSupportedChains.js +28 -0
- package/dist/esm/mcp-server/tools/universalSupportedChains.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/protocol.d.ts +40 -0
- package/dist/esm/models/components/protocol.d.ts.map +1 -0
- package/dist/esm/models/components/protocol.js +29 -0
- package/dist/esm/models/components/protocol.js.map +1 -0
- package/dist/esm/models/components/supportedchaininfo.d.ts +33 -0
- package/dist/esm/models/components/supportedchaininfo.d.ts.map +1 -0
- package/dist/esm/models/components/supportedchaininfo.js +32 -0
- package/dist/esm/models/components/supportedchaininfo.js.map +1 -0
- package/dist/esm/models/components/userstate.d.ts +2 -2
- package/dist/esm/models/components/userstate.d.ts.map +1 -1
- package/dist/esm/models/components/userstate.js +2 -2
- package/dist/esm/models/components/userstate.js.map +1 -1
- package/dist/esm/models/operations/genericsupportedchains.d.ts +33 -0
- package/dist/esm/models/operations/genericsupportedchains.d.ts.map +1 -0
- package/dist/esm/models/operations/genericsupportedchains.js +32 -0
- package/dist/esm/models/operations/genericsupportedchains.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/morphomarkets.d.ts +53 -4
- package/dist/esm/models/operations/morphomarkets.d.ts.map +1 -1
- package/dist/esm/models/operations/morphomarkets.js +47 -4
- package/dist/esm/models/operations/morphomarkets.js.map +1 -1
- package/dist/esm/models/operations/morphovaults.d.ts +27 -2
- package/dist/esm/models/operations/morphovaults.d.ts.map +1 -1
- package/dist/esm/models/operations/morphovaults.js +24 -2
- package/dist/esm/models/operations/morphovaults.js.map +1 -1
- package/dist/esm/sdk/universal.d.ts +7 -0
- package/dist/esm/sdk/universal.d.ts.map +1 -1
- package/dist/esm/sdk/universal.js +10 -0
- package/dist/esm/sdk/universal.js.map +1 -1
- package/docs/sdks/universal/README.md +70 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/universalSupportedChains.ts +175 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/universalSupportedChains.ts +37 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/protocol.ts +35 -0
- package/src/models/components/supportedchaininfo.ts +70 -0
- package/src/models/components/userstate.ts +4 -4
- package/src/models/operations/genericsupportedchains.ts +72 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/morphomarkets.ts +117 -8
- package/src/models/operations/morphovaults.ts +58 -4
- package/src/sdk/universal.ts +18 -0
|
@@ -0,0 +1,175 @@
|
|
|
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 Supported Chains
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Get the list of supported chains by the Compass API.
|
|
34
|
+
*/
|
|
35
|
+
export function universalSupportedChains(
|
|
36
|
+
client: CompassApiSDKCore,
|
|
37
|
+
request: operations.GenericSupportedChainsRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
components.SupportedChainInfo,
|
|
42
|
+
| errors.HTTPValidationError
|
|
43
|
+
| CompassAPISDKError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: CompassApiSDKCore,
|
|
62
|
+
request: operations.GenericSupportedChainsRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
components.SupportedChainInfo,
|
|
68
|
+
| errors.HTTPValidationError
|
|
69
|
+
| CompassAPISDKError
|
|
70
|
+
| ResponseValidationError
|
|
71
|
+
| ConnectionError
|
|
72
|
+
| RequestAbortedError
|
|
73
|
+
| RequestTimeoutError
|
|
74
|
+
| InvalidRequestError
|
|
75
|
+
| UnexpectedClientError
|
|
76
|
+
| SDKValidationError
|
|
77
|
+
>,
|
|
78
|
+
APICall,
|
|
79
|
+
]
|
|
80
|
+
> {
|
|
81
|
+
const parsed = safeParse(
|
|
82
|
+
request,
|
|
83
|
+
(value) =>
|
|
84
|
+
operations.GenericSupportedChainsRequest$outboundSchema.parse(value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const path = pathToFunc("/v0/generic/supported_chains/get")();
|
|
94
|
+
|
|
95
|
+
const query = encodeFormQuery({
|
|
96
|
+
"protocol": payload.protocol,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
Accept: "application/json",
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
104
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
105
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
106
|
+
|
|
107
|
+
const context = {
|
|
108
|
+
options: client._options,
|
|
109
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
110
|
+
operationID: "generic_supported_chains",
|
|
111
|
+
oAuth2Scopes: [],
|
|
112
|
+
|
|
113
|
+
resolvedSecurity: requestSecurity,
|
|
114
|
+
|
|
115
|
+
securitySource: client._options.apiKeyAuth,
|
|
116
|
+
retryConfig: options?.retries
|
|
117
|
+
|| client._options.retryConfig
|
|
118
|
+
|| { strategy: "none" },
|
|
119
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const requestRes = client._createRequest(context, {
|
|
123
|
+
security: requestSecurity,
|
|
124
|
+
method: "GET",
|
|
125
|
+
baseURL: options?.serverURL,
|
|
126
|
+
path: path,
|
|
127
|
+
headers: headers,
|
|
128
|
+
query: query,
|
|
129
|
+
body: body,
|
|
130
|
+
userAgent: client._options.userAgent,
|
|
131
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
132
|
+
}, options);
|
|
133
|
+
if (!requestRes.ok) {
|
|
134
|
+
return [requestRes, { status: "invalid" }];
|
|
135
|
+
}
|
|
136
|
+
const req = requestRes.value;
|
|
137
|
+
|
|
138
|
+
const doResult = await client._do(req, {
|
|
139
|
+
context,
|
|
140
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
141
|
+
retryConfig: context.retryConfig,
|
|
142
|
+
retryCodes: context.retryCodes,
|
|
143
|
+
});
|
|
144
|
+
if (!doResult.ok) {
|
|
145
|
+
return [doResult, { status: "request-error", request: req }];
|
|
146
|
+
}
|
|
147
|
+
const response = doResult.value;
|
|
148
|
+
|
|
149
|
+
const responseFields = {
|
|
150
|
+
HttpMeta: { Response: response, Request: req },
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const [result] = await M.match<
|
|
154
|
+
components.SupportedChainInfo,
|
|
155
|
+
| errors.HTTPValidationError
|
|
156
|
+
| CompassAPISDKError
|
|
157
|
+
| ResponseValidationError
|
|
158
|
+
| ConnectionError
|
|
159
|
+
| RequestAbortedError
|
|
160
|
+
| RequestTimeoutError
|
|
161
|
+
| InvalidRequestError
|
|
162
|
+
| UnexpectedClientError
|
|
163
|
+
| SDKValidationError
|
|
164
|
+
>(
|
|
165
|
+
M.json(200, components.SupportedChainInfo$inboundSchema),
|
|
166
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
167
|
+
M.fail("4XX"),
|
|
168
|
+
M.fail("5XX"),
|
|
169
|
+
)(response, req, { extraFields: responseFields });
|
|
170
|
+
if (!result.ok) {
|
|
171
|
+
return [result, { status: "complete", request: req, response }];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return [result, { status: "complete", request: req, response }];
|
|
175
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -61,8 +61,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
61
61
|
export const SDK_METADATA = {
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "0.0.1",
|
|
64
|
-
sdkVersion: "0.5.
|
|
64
|
+
sdkVersion: "0.5.51",
|
|
65
65
|
genVersion: "2.657.1",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 0.5.
|
|
67
|
+
"speakeasy-sdk/typescript 0.5.51 2.657.1 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -88,6 +88,7 @@ import { tool$universalAllowance } from "./tools/universalAllowance.js";
|
|
|
88
88
|
import { tool$universalAllowanceSet } from "./tools/universalAllowanceSet.js";
|
|
89
89
|
import { tool$universalEns } from "./tools/universalEns.js";
|
|
90
90
|
import { tool$universalPortfolio } from "./tools/universalPortfolio.js";
|
|
91
|
+
import { tool$universalSupportedChains } from "./tools/universalSupportedChains.js";
|
|
91
92
|
import { tool$universalSupportedTokens } from "./tools/universalSupportedTokens.js";
|
|
92
93
|
import { tool$universalUnwrapWeth } from "./tools/universalUnwrapWeth.js";
|
|
93
94
|
import { tool$universalVisualizePortfolio } from "./tools/universalVisualizePortfolio.js";
|
|
@@ -103,7 +104,7 @@ export function createMCPServer(deps: {
|
|
|
103
104
|
}) {
|
|
104
105
|
const server = new McpServer({
|
|
105
106
|
name: "CompassApiSDK",
|
|
106
|
-
version: "0.5.
|
|
107
|
+
version: "0.5.51",
|
|
107
108
|
});
|
|
108
109
|
|
|
109
110
|
const client = new CompassApiSDKCore({
|
|
@@ -188,6 +189,7 @@ export function createMCPServer(deps: {
|
|
|
188
189
|
tool(tool$universalPortfolio);
|
|
189
190
|
tool(tool$universalVisualizePortfolio);
|
|
190
191
|
tool(tool$universalSupportedTokens);
|
|
192
|
+
tool(tool$universalSupportedChains);
|
|
191
193
|
tool(tool$universalAllowance);
|
|
192
194
|
tool(tool$universalEns);
|
|
193
195
|
tool(tool$universalWrapEth);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { universalSupportedChains } from "../../funcs/universalSupportedChains.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GenericSupportedChainsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$universalSupportedChains: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "universal-supported-chains",
|
|
15
|
+
description: `List Supported Chains
|
|
16
|
+
|
|
17
|
+
Get the list of supported chains by the Compass API.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await universalSupportedChains(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -116,6 +116,7 @@ export * from "./pendlesellytparams.js";
|
|
|
116
116
|
export * from "./pendlesellytrequest.js";
|
|
117
117
|
export * from "./portfolio.js";
|
|
118
118
|
export * from "./position.js";
|
|
119
|
+
export * from "./protocol.js";
|
|
119
120
|
export * from "./redeemunderlying.js";
|
|
120
121
|
export * from "./repay.js";
|
|
121
122
|
export * from "./reserve.js";
|
|
@@ -133,6 +134,7 @@ export * from "./skysellrequest.js";
|
|
|
133
134
|
export * from "./skywithdrawparams.js";
|
|
134
135
|
export * from "./skywithdrawrequest.js";
|
|
135
136
|
export * from "./supply.js";
|
|
137
|
+
export * from "./supportedchaininfo.js";
|
|
136
138
|
export * from "./swapborrowrate.js";
|
|
137
139
|
export * from "./syposition.js";
|
|
138
140
|
export * from "./tokenaddressresponse.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const Protocol = {
|
|
9
|
+
Aave: "aave",
|
|
10
|
+
Aerodrome: "aerodrome",
|
|
11
|
+
Morpho: "morpho",
|
|
12
|
+
Sky: "sky",
|
|
13
|
+
Uniswap: "uniswap",
|
|
14
|
+
Pendle: "pendle",
|
|
15
|
+
} as const;
|
|
16
|
+
export type Protocol = ClosedEnum<typeof Protocol>;
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const Protocol$inboundSchema: z.ZodNativeEnum<typeof Protocol> = z
|
|
20
|
+
.nativeEnum(Protocol);
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const Protocol$outboundSchema: z.ZodNativeEnum<typeof Protocol> =
|
|
24
|
+
Protocol$inboundSchema;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
29
|
+
*/
|
|
30
|
+
export namespace Protocol$ {
|
|
31
|
+
/** @deprecated use `Protocol$inboundSchema` instead. */
|
|
32
|
+
export const inboundSchema = Protocol$inboundSchema;
|
|
33
|
+
/** @deprecated use `Protocol$outboundSchema` instead. */
|
|
34
|
+
export const outboundSchema = Protocol$outboundSchema;
|
|
35
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import { Chain, Chain$inboundSchema, Chain$outboundSchema } from "./chain.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Response model for a chain.
|
|
13
|
+
*/
|
|
14
|
+
export type SupportedChainInfo = {
|
|
15
|
+
chains: Array<Chain>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const SupportedChainInfo$inboundSchema: z.ZodType<
|
|
20
|
+
SupportedChainInfo,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
chains: z.array(Chain$inboundSchema),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export type SupportedChainInfo$Outbound = {
|
|
29
|
+
chains: Array<string>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const SupportedChainInfo$outboundSchema: z.ZodType<
|
|
34
|
+
SupportedChainInfo$Outbound,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
SupportedChainInfo
|
|
37
|
+
> = z.object({
|
|
38
|
+
chains: z.array(Chain$outboundSchema),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
44
|
+
*/
|
|
45
|
+
export namespace SupportedChainInfo$ {
|
|
46
|
+
/** @deprecated use `SupportedChainInfo$inboundSchema` instead. */
|
|
47
|
+
export const inboundSchema = SupportedChainInfo$inboundSchema;
|
|
48
|
+
/** @deprecated use `SupportedChainInfo$outboundSchema` instead. */
|
|
49
|
+
export const outboundSchema = SupportedChainInfo$outboundSchema;
|
|
50
|
+
/** @deprecated use `SupportedChainInfo$Outbound` instead. */
|
|
51
|
+
export type Outbound = SupportedChainInfo$Outbound;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function supportedChainInfoToJSON(
|
|
55
|
+
supportedChainInfo: SupportedChainInfo,
|
|
56
|
+
): string {
|
|
57
|
+
return JSON.stringify(
|
|
58
|
+
SupportedChainInfo$outboundSchema.parse(supportedChainInfo),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function supportedChainInfoFromJSON(
|
|
63
|
+
jsonString: string,
|
|
64
|
+
): SafeParseResult<SupportedChainInfo, SDKValidationError> {
|
|
65
|
+
return safeParse(
|
|
66
|
+
jsonString,
|
|
67
|
+
(x) => SupportedChainInfo$inboundSchema.parse(JSON.parse(x)),
|
|
68
|
+
`Failed to parse 'SupportedChainInfo' from JSON`,
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -8,7 +8,7 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
9
|
|
|
10
10
|
export type UserState = {
|
|
11
|
-
vaultsPnlUsd: string;
|
|
11
|
+
vaultsPnlUsd: string | null;
|
|
12
12
|
vaultsAssetsUsd: string;
|
|
13
13
|
marketsPnlUsd: string | null;
|
|
14
14
|
marketsBorrowAssetsUsd: string;
|
|
@@ -22,7 +22,7 @@ export const UserState$inboundSchema: z.ZodType<
|
|
|
22
22
|
z.ZodTypeDef,
|
|
23
23
|
unknown
|
|
24
24
|
> = z.object({
|
|
25
|
-
vaultsPnlUsd: z.string(),
|
|
25
|
+
vaultsPnlUsd: z.nullable(z.string()),
|
|
26
26
|
vaultsAssetsUsd: z.string(),
|
|
27
27
|
marketsPnlUsd: z.nullable(z.string()),
|
|
28
28
|
marketsBorrowAssetsUsd: z.string(),
|
|
@@ -32,7 +32,7 @@ export const UserState$inboundSchema: z.ZodType<
|
|
|
32
32
|
|
|
33
33
|
/** @internal */
|
|
34
34
|
export type UserState$Outbound = {
|
|
35
|
-
vaultsPnlUsd: string;
|
|
35
|
+
vaultsPnlUsd: string | null;
|
|
36
36
|
vaultsAssetsUsd: string;
|
|
37
37
|
marketsPnlUsd: string | null;
|
|
38
38
|
marketsBorrowAssetsUsd: string;
|
|
@@ -46,7 +46,7 @@ export const UserState$outboundSchema: z.ZodType<
|
|
|
46
46
|
z.ZodTypeDef,
|
|
47
47
|
UserState
|
|
48
48
|
> = z.object({
|
|
49
|
-
vaultsPnlUsd: z.string(),
|
|
49
|
+
vaultsPnlUsd: z.nullable(z.string()),
|
|
50
50
|
vaultsAssetsUsd: z.string(),
|
|
51
51
|
marketsPnlUsd: z.nullable(z.string()),
|
|
52
52
|
marketsBorrowAssetsUsd: z.string(),
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as components from "../components/index.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type GenericSupportedChainsRequest = {
|
|
12
|
+
/**
|
|
13
|
+
* The protocol to get the supported chains for.
|
|
14
|
+
*/
|
|
15
|
+
protocol?: components.Protocol | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const GenericSupportedChainsRequest$inboundSchema: z.ZodType<
|
|
20
|
+
GenericSupportedChainsRequest,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
protocol: z.nullable(components.Protocol$inboundSchema).optional(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export type GenericSupportedChainsRequest$Outbound = {
|
|
29
|
+
protocol?: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const GenericSupportedChainsRequest$outboundSchema: z.ZodType<
|
|
34
|
+
GenericSupportedChainsRequest$Outbound,
|
|
35
|
+
z.ZodTypeDef,
|
|
36
|
+
GenericSupportedChainsRequest
|
|
37
|
+
> = z.object({
|
|
38
|
+
protocol: z.nullable(components.Protocol$outboundSchema).optional(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
44
|
+
*/
|
|
45
|
+
export namespace GenericSupportedChainsRequest$ {
|
|
46
|
+
/** @deprecated use `GenericSupportedChainsRequest$inboundSchema` instead. */
|
|
47
|
+
export const inboundSchema = GenericSupportedChainsRequest$inboundSchema;
|
|
48
|
+
/** @deprecated use `GenericSupportedChainsRequest$outboundSchema` instead. */
|
|
49
|
+
export const outboundSchema = GenericSupportedChainsRequest$outboundSchema;
|
|
50
|
+
/** @deprecated use `GenericSupportedChainsRequest$Outbound` instead. */
|
|
51
|
+
export type Outbound = GenericSupportedChainsRequest$Outbound;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function genericSupportedChainsRequestToJSON(
|
|
55
|
+
genericSupportedChainsRequest: GenericSupportedChainsRequest,
|
|
56
|
+
): string {
|
|
57
|
+
return JSON.stringify(
|
|
58
|
+
GenericSupportedChainsRequest$outboundSchema.parse(
|
|
59
|
+
genericSupportedChainsRequest,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function genericSupportedChainsRequestFromJSON(
|
|
65
|
+
jsonString: string,
|
|
66
|
+
): SafeParseResult<GenericSupportedChainsRequest, SDKValidationError> {
|
|
67
|
+
return safeParse(
|
|
68
|
+
jsonString,
|
|
69
|
+
(x) => GenericSupportedChainsRequest$inboundSchema.parse(JSON.parse(x)),
|
|
70
|
+
`Failed to parse 'GenericSupportedChainsRequest' from JSON`,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -17,6 +17,7 @@ export * from "./aerodromeslipstreampoolprice.js";
|
|
|
17
17
|
export * from "./genericallowance.js";
|
|
18
18
|
export * from "./genericens.js";
|
|
19
19
|
export * from "./genericportfolio.js";
|
|
20
|
+
export * from "./genericsupportedchains.js";
|
|
20
21
|
export * from "./genericsupportedtokens.js";
|
|
21
22
|
export * from "./genericvisualizeportfolio.js";
|
|
22
23
|
export * from "./morphomarket.js";
|
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { ClosedEnum } from "../../types/enums.js";
|
|
9
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import * as components from "../components/index.js";
|
|
10
11
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
12
|
|
|
12
13
|
export const MorphoMarketsChain = {
|
|
@@ -15,16 +16,26 @@ export const MorphoMarketsChain = {
|
|
|
15
16
|
} as const;
|
|
16
17
|
export type MorphoMarketsChain = ClosedEnum<typeof MorphoMarketsChain>;
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Collateral token to identify the market.
|
|
21
|
+
*/
|
|
22
|
+
export type CollateralToken = components.TokenEnum | string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Loan token to identify the market.
|
|
26
|
+
*/
|
|
27
|
+
export type LoanToken = components.TokenEnum | string;
|
|
28
|
+
|
|
18
29
|
export type MorphoMarketsRequest = {
|
|
19
30
|
chain?: MorphoMarketsChain | undefined;
|
|
20
31
|
/**
|
|
21
32
|
* Collateral token to identify the market.
|
|
22
33
|
*/
|
|
23
|
-
collateralToken?: string | null | undefined;
|
|
34
|
+
collateralToken?: components.TokenEnum | string | null | undefined;
|
|
24
35
|
/**
|
|
25
36
|
* Loan token to identify the market.
|
|
26
37
|
*/
|
|
27
|
-
loanToken?: string | null | undefined;
|
|
38
|
+
loanToken?: components.TokenEnum | string | null | undefined;
|
|
28
39
|
};
|
|
29
40
|
|
|
30
41
|
/** @internal */
|
|
@@ -48,6 +59,96 @@ export namespace MorphoMarketsChain$ {
|
|
|
48
59
|
export const outboundSchema = MorphoMarketsChain$outboundSchema;
|
|
49
60
|
}
|
|
50
61
|
|
|
62
|
+
/** @internal */
|
|
63
|
+
export const CollateralToken$inboundSchema: z.ZodType<
|
|
64
|
+
CollateralToken,
|
|
65
|
+
z.ZodTypeDef,
|
|
66
|
+
unknown
|
|
67
|
+
> = z.union([components.TokenEnum$inboundSchema, z.string()]);
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export type CollateralToken$Outbound = string | string;
|
|
71
|
+
|
|
72
|
+
/** @internal */
|
|
73
|
+
export const CollateralToken$outboundSchema: z.ZodType<
|
|
74
|
+
CollateralToken$Outbound,
|
|
75
|
+
z.ZodTypeDef,
|
|
76
|
+
CollateralToken
|
|
77
|
+
> = z.union([components.TokenEnum$outboundSchema, z.string()]);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
82
|
+
*/
|
|
83
|
+
export namespace CollateralToken$ {
|
|
84
|
+
/** @deprecated use `CollateralToken$inboundSchema` instead. */
|
|
85
|
+
export const inboundSchema = CollateralToken$inboundSchema;
|
|
86
|
+
/** @deprecated use `CollateralToken$outboundSchema` instead. */
|
|
87
|
+
export const outboundSchema = CollateralToken$outboundSchema;
|
|
88
|
+
/** @deprecated use `CollateralToken$Outbound` instead. */
|
|
89
|
+
export type Outbound = CollateralToken$Outbound;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function collateralTokenToJSON(
|
|
93
|
+
collateralToken: CollateralToken,
|
|
94
|
+
): string {
|
|
95
|
+
return JSON.stringify(CollateralToken$outboundSchema.parse(collateralToken));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function collateralTokenFromJSON(
|
|
99
|
+
jsonString: string,
|
|
100
|
+
): SafeParseResult<CollateralToken, SDKValidationError> {
|
|
101
|
+
return safeParse(
|
|
102
|
+
jsonString,
|
|
103
|
+
(x) => CollateralToken$inboundSchema.parse(JSON.parse(x)),
|
|
104
|
+
`Failed to parse 'CollateralToken' from JSON`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @internal */
|
|
109
|
+
export const LoanToken$inboundSchema: z.ZodType<
|
|
110
|
+
LoanToken,
|
|
111
|
+
z.ZodTypeDef,
|
|
112
|
+
unknown
|
|
113
|
+
> = z.union([components.TokenEnum$inboundSchema, z.string()]);
|
|
114
|
+
|
|
115
|
+
/** @internal */
|
|
116
|
+
export type LoanToken$Outbound = string | string;
|
|
117
|
+
|
|
118
|
+
/** @internal */
|
|
119
|
+
export const LoanToken$outboundSchema: z.ZodType<
|
|
120
|
+
LoanToken$Outbound,
|
|
121
|
+
z.ZodTypeDef,
|
|
122
|
+
LoanToken
|
|
123
|
+
> = z.union([components.TokenEnum$outboundSchema, z.string()]);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
128
|
+
*/
|
|
129
|
+
export namespace LoanToken$ {
|
|
130
|
+
/** @deprecated use `LoanToken$inboundSchema` instead. */
|
|
131
|
+
export const inboundSchema = LoanToken$inboundSchema;
|
|
132
|
+
/** @deprecated use `LoanToken$outboundSchema` instead. */
|
|
133
|
+
export const outboundSchema = LoanToken$outboundSchema;
|
|
134
|
+
/** @deprecated use `LoanToken$Outbound` instead. */
|
|
135
|
+
export type Outbound = LoanToken$Outbound;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function loanTokenToJSON(loanToken: LoanToken): string {
|
|
139
|
+
return JSON.stringify(LoanToken$outboundSchema.parse(loanToken));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function loanTokenFromJSON(
|
|
143
|
+
jsonString: string,
|
|
144
|
+
): SafeParseResult<LoanToken, SDKValidationError> {
|
|
145
|
+
return safeParse(
|
|
146
|
+
jsonString,
|
|
147
|
+
(x) => LoanToken$inboundSchema.parse(JSON.parse(x)),
|
|
148
|
+
`Failed to parse 'LoanToken' from JSON`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
51
152
|
/** @internal */
|
|
52
153
|
export const MorphoMarketsRequest$inboundSchema: z.ZodType<
|
|
53
154
|
MorphoMarketsRequest,
|
|
@@ -55,8 +156,12 @@ export const MorphoMarketsRequest$inboundSchema: z.ZodType<
|
|
|
55
156
|
unknown
|
|
56
157
|
> = z.object({
|
|
57
158
|
chain: MorphoMarketsChain$inboundSchema.default("base:mainnet"),
|
|
58
|
-
collateral_token: z.nullable(
|
|
59
|
-
|
|
159
|
+
collateral_token: z.nullable(
|
|
160
|
+
z.union([components.TokenEnum$inboundSchema, z.string()]),
|
|
161
|
+
).optional(),
|
|
162
|
+
loan_token: z.nullable(
|
|
163
|
+
z.union([components.TokenEnum$inboundSchema, z.string()]),
|
|
164
|
+
).optional(),
|
|
60
165
|
}).transform((v) => {
|
|
61
166
|
return remap$(v, {
|
|
62
167
|
"collateral_token": "collateralToken",
|
|
@@ -67,8 +172,8 @@ export const MorphoMarketsRequest$inboundSchema: z.ZodType<
|
|
|
67
172
|
/** @internal */
|
|
68
173
|
export type MorphoMarketsRequest$Outbound = {
|
|
69
174
|
chain: string;
|
|
70
|
-
collateral_token?: string | null | undefined;
|
|
71
|
-
loan_token?: string | null | undefined;
|
|
175
|
+
collateral_token?: string | string | null | undefined;
|
|
176
|
+
loan_token?: string | string | null | undefined;
|
|
72
177
|
};
|
|
73
178
|
|
|
74
179
|
/** @internal */
|
|
@@ -78,8 +183,12 @@ export const MorphoMarketsRequest$outboundSchema: z.ZodType<
|
|
|
78
183
|
MorphoMarketsRequest
|
|
79
184
|
> = z.object({
|
|
80
185
|
chain: MorphoMarketsChain$outboundSchema.default("base:mainnet"),
|
|
81
|
-
collateralToken: z.nullable(
|
|
82
|
-
|
|
186
|
+
collateralToken: z.nullable(
|
|
187
|
+
z.union([components.TokenEnum$outboundSchema, z.string()]),
|
|
188
|
+
).optional(),
|
|
189
|
+
loanToken: z.nullable(
|
|
190
|
+
z.union([components.TokenEnum$outboundSchema, z.string()]),
|
|
191
|
+
).optional(),
|
|
83
192
|
}).transform((v) => {
|
|
84
193
|
return remap$(v, {
|
|
85
194
|
collateralToken: "collateral_token",
|