@compass-labs/api-sdk 0.5.13 → 0.5.14
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 +9 -0
- package/bin/mcp-server.js +751 -264
- package/bin/mcp-server.js.map +20 -10
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts +28 -0
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts.map +1 -0
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.js +128 -0
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.js.map +1 -0
- package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts +23 -0
- package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts.map +1 -0
- package/dist/commonjs/funcs/transactionBatchingAuthorization.js +123 -0
- package/dist/commonjs/funcs/transactionBatchingAuthorization.js.map +1 -0
- package/dist/commonjs/funcs/transactionBatchingExecute.d.ts +24 -0
- package/dist/commonjs/funcs/transactionBatchingExecute.d.ts.map +1 -0
- package/dist/commonjs/funcs/transactionBatchingExecute.js +124 -0
- package/dist/commonjs/funcs/transactionBatchingExecute.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/files.d.ts +5 -0
- package/dist/commonjs/lib/files.d.ts.map +1 -1
- package/dist/commonjs/lib/files.js +41 -0
- package/dist/commonjs/lib/files.js.map +1 -1
- 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 +7 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js +74 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js +69 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js +70 -0
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js.map +1 -0
- package/dist/commonjs/models/components/aavelooprequest.d.ts +181 -0
- package/dist/commonjs/models/components/aavelooprequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/aavelooprequest.js +199 -0
- package/dist/commonjs/models/components/aavelooprequest.js.map +1 -0
- package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts +8 -8
- package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts.map +1 -1
- package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js +8 -8
- package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +4 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +4 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/metadata.d.ts +0 -4
- package/dist/commonjs/models/components/metadata.d.ts.map +1 -1
- package/dist/commonjs/models/components/metadata.js +0 -4
- package/dist/commonjs/models/components/metadata.js.map +1 -1
- package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts +49 -0
- package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/multicallauthorizationrequest.js +72 -0
- package/dist/commonjs/models/components/multicallauthorizationrequest.js.map +1 -0
- package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts +45 -0
- package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/multicallauthorizationresponse.js +73 -0
- package/dist/commonjs/models/components/multicallauthorizationresponse.js.map +1 -0
- package/dist/commonjs/models/components/multicallexecuterequest.d.ts +50 -0
- package/dist/commonjs/models/components/multicallexecuterequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/multicallexecuterequest.js +87 -0
- package/dist/commonjs/models/components/multicallexecuterequest.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/transactionbatching.d.ts +47 -0
- package/dist/commonjs/sdk/transactionbatching.d.ts.map +1 -0
- package/dist/commonjs/sdk/transactionbatching.js +63 -0
- package/dist/commonjs/sdk/transactionbatching.js.map +1 -0
- package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts +28 -0
- package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts.map +1 -0
- package/dist/esm/funcs/transactionBatchingAaveLoop.js +92 -0
- package/dist/esm/funcs/transactionBatchingAaveLoop.js.map +1 -0
- package/dist/esm/funcs/transactionBatchingAuthorization.d.ts +23 -0
- package/dist/esm/funcs/transactionBatchingAuthorization.d.ts.map +1 -0
- package/dist/esm/funcs/transactionBatchingAuthorization.js +87 -0
- package/dist/esm/funcs/transactionBatchingAuthorization.js.map +1 -0
- package/dist/esm/funcs/transactionBatchingExecute.d.ts +24 -0
- package/dist/esm/funcs/transactionBatchingExecute.d.ts.map +1 -0
- package/dist/esm/funcs/transactionBatchingExecute.js +88 -0
- package/dist/esm/funcs/transactionBatchingExecute.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/files.d.ts +5 -0
- package/dist/esm/lib/files.d.ts.map +1 -1
- package/dist/esm/lib/files.js +40 -0
- package/dist/esm/lib/files.js.map +1 -1
- 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 +7 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts +8 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js +38 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js.map +1 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts +8 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js +33 -0
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -0
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts +8 -0
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.js +34 -0
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.js.map +1 -0
- package/dist/esm/models/components/aavelooprequest.d.ts +181 -0
- package/dist/esm/models/components/aavelooprequest.d.ts.map +1 -0
- package/dist/esm/models/components/aavelooprequest.js +153 -0
- package/dist/esm/models/components/aavelooprequest.js.map +1 -0
- package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts +8 -8
- package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts.map +1 -1
- package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js +8 -8
- package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +4 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +4 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/metadata.d.ts +0 -4
- package/dist/esm/models/components/metadata.d.ts.map +1 -1
- package/dist/esm/models/components/metadata.js +0 -4
- package/dist/esm/models/components/metadata.js.map +1 -1
- package/dist/esm/models/components/multicallauthorizationrequest.d.ts +49 -0
- package/dist/esm/models/components/multicallauthorizationrequest.d.ts.map +1 -0
- package/dist/esm/models/components/multicallauthorizationrequest.js +34 -0
- package/dist/esm/models/components/multicallauthorizationrequest.js.map +1 -0
- package/dist/esm/models/components/multicallauthorizationresponse.d.ts +45 -0
- package/dist/esm/models/components/multicallauthorizationresponse.d.ts.map +1 -0
- package/dist/esm/models/components/multicallauthorizationresponse.js +35 -0
- package/dist/esm/models/components/multicallauthorizationresponse.js.map +1 -0
- package/dist/esm/models/components/multicallexecuterequest.d.ts +50 -0
- package/dist/esm/models/components/multicallexecuterequest.d.ts.map +1 -0
- package/dist/esm/models/components/multicallexecuterequest.js +49 -0
- package/dist/esm/models/components/multicallexecuterequest.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/transactionbatching.d.ts +47 -0
- package/dist/esm/sdk/transactionbatching.d.ts.map +1 -0
- package/dist/esm/sdk/transactionbatching.js +59 -0
- package/dist/esm/sdk/transactionbatching.js.map +1 -0
- package/docs/sdks/transactionbatching/README.md +318 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/transactionBatchingAaveLoop.ts +179 -0
- package/src/funcs/transactionBatchingAuthorization.ts +175 -0
- package/src/funcs/transactionBatchingExecute.ts +175 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/files.ts +42 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +7 -1
- package/src/mcp-server/tools/transactionBatchingAaveLoop.ts +47 -0
- package/src/mcp-server/tools/transactionBatchingAuthorization.ts +44 -0
- package/src/mcp-server/tools/transactionBatchingExecute.ts +43 -0
- package/src/models/components/aavelooprequest.ts +368 -0
- package/src/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.ts +16 -16
- package/src/models/components/index.ts +4 -0
- package/src/models/components/metadata.ts +0 -8
- package/src/models/components/multicallauthorizationrequest.ts +90 -0
- package/src/models/components/multicallauthorizationresponse.ts +88 -0
- package/src/models/components/multicallexecuterequest.ts +112 -0
- package/src/sdk/sdk.ts +8 -0
- package/src/sdk/transactionbatching.ts +84 -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 { encodeJSON } 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 { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Enable transaction bundling.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Get authorization for bundling transactions.
|
|
33
|
+
*
|
|
34
|
+
* Currently this is required for every transaction bundle to prevent replay attacks
|
|
35
|
+
* and ensure transaction ordering when batching multiple actions into a single
|
|
36
|
+
* transaction. The authorization includes a nonce and chain ID to guarantee
|
|
37
|
+
* transaction uniqueness and proper network targeting.
|
|
38
|
+
*/
|
|
39
|
+
export function transactionBatchingAuthorization(
|
|
40
|
+
client: CompassApiSDKCore,
|
|
41
|
+
request: components.MulticallAuthorizationRequest,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): APIPromise<
|
|
44
|
+
Result<
|
|
45
|
+
components.MulticallAuthorizationResponse,
|
|
46
|
+
| errors.HTTPValidationError
|
|
47
|
+
| CompassAPISDKError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: CompassApiSDKCore,
|
|
66
|
+
request: components.MulticallAuthorizationRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
components.MulticallAuthorizationResponse,
|
|
72
|
+
| errors.HTTPValidationError
|
|
73
|
+
| CompassAPISDKError
|
|
74
|
+
| ResponseValidationError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
| RequestAbortedError
|
|
77
|
+
| RequestTimeoutError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| UnexpectedClientError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
>,
|
|
82
|
+
APICall,
|
|
83
|
+
]
|
|
84
|
+
> {
|
|
85
|
+
const parsed = safeParse(
|
|
86
|
+
request,
|
|
87
|
+
(value) =>
|
|
88
|
+
components.MulticallAuthorizationRequest$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
96
|
+
|
|
97
|
+
const path = pathToFunc("/v0/multicall/authorization")();
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
Accept: "application/json",
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
105
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
106
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
107
|
+
|
|
108
|
+
const context = {
|
|
109
|
+
options: client._options,
|
|
110
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
111
|
+
operationID: "multicall_authorization",
|
|
112
|
+
oAuth2Scopes: [],
|
|
113
|
+
|
|
114
|
+
resolvedSecurity: requestSecurity,
|
|
115
|
+
|
|
116
|
+
securitySource: client._options.apiKeyAuth,
|
|
117
|
+
retryConfig: options?.retries
|
|
118
|
+
|| client._options.retryConfig
|
|
119
|
+
|| { strategy: "none" },
|
|
120
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const requestRes = client._createRequest(context, {
|
|
124
|
+
security: requestSecurity,
|
|
125
|
+
method: "POST",
|
|
126
|
+
baseURL: options?.serverURL,
|
|
127
|
+
path: path,
|
|
128
|
+
headers: headers,
|
|
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.MulticallAuthorizationResponse,
|
|
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.MulticallAuthorizationResponse$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
|
+
}
|
|
@@ -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 { encodeJSON } 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 { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Construct Bundled Transaction
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Bundle arbitrary transactions together into a single multicall transaction using
|
|
33
|
+
* EIP-7702.
|
|
34
|
+
*
|
|
35
|
+
* This endpoint allows bundling multiple contract calls into a single atomic
|
|
36
|
+
* transaction, reducing gas costs and ensuring all operations succeed or fail
|
|
37
|
+
* together. The transaction must be authorized using the /authorization endpoint to
|
|
38
|
+
* prevent replay attacks.
|
|
39
|
+
*/
|
|
40
|
+
export function transactionBatchingExecute(
|
|
41
|
+
client: CompassApiSDKCore,
|
|
42
|
+
request: components.MulticallExecuteRequest,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
Result<
|
|
46
|
+
components.UnsignedMulticallTransaction,
|
|
47
|
+
| errors.HTTPValidationError
|
|
48
|
+
| CompassAPISDKError
|
|
49
|
+
| ResponseValidationError
|
|
50
|
+
| ConnectionError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| InvalidRequestError
|
|
54
|
+
| UnexpectedClientError
|
|
55
|
+
| SDKValidationError
|
|
56
|
+
>
|
|
57
|
+
> {
|
|
58
|
+
return new APIPromise($do(
|
|
59
|
+
client,
|
|
60
|
+
request,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: CompassApiSDKCore,
|
|
67
|
+
request: components.MulticallExecuteRequest,
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): Promise<
|
|
70
|
+
[
|
|
71
|
+
Result<
|
|
72
|
+
components.UnsignedMulticallTransaction,
|
|
73
|
+
| errors.HTTPValidationError
|
|
74
|
+
| CompassAPISDKError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) => components.MulticallExecuteRequest$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
96
|
+
|
|
97
|
+
const path = pathToFunc("/v0/multicall/execute")();
|
|
98
|
+
|
|
99
|
+
const headers = new Headers(compactMap({
|
|
100
|
+
"Content-Type": "application/json",
|
|
101
|
+
Accept: "application/json",
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
105
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
106
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
107
|
+
|
|
108
|
+
const context = {
|
|
109
|
+
options: client._options,
|
|
110
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
111
|
+
operationID: "multicall_execute",
|
|
112
|
+
oAuth2Scopes: [],
|
|
113
|
+
|
|
114
|
+
resolvedSecurity: requestSecurity,
|
|
115
|
+
|
|
116
|
+
securitySource: client._options.apiKeyAuth,
|
|
117
|
+
retryConfig: options?.retries
|
|
118
|
+
|| client._options.retryConfig
|
|
119
|
+
|| { strategy: "none" },
|
|
120
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const requestRes = client._createRequest(context, {
|
|
124
|
+
security: requestSecurity,
|
|
125
|
+
method: "POST",
|
|
126
|
+
baseURL: options?.serverURL,
|
|
127
|
+
path: path,
|
|
128
|
+
headers: headers,
|
|
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.UnsignedMulticallTransaction,
|
|
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.UnsignedMulticallTransaction$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.
|
|
65
|
-
genVersion: "2.
|
|
64
|
+
sdkVersion: "0.5.14",
|
|
65
|
+
genVersion: "2.628.0",
|
|
66
66
|
userAgent:
|
|
67
|
-
"speakeasy-sdk/typescript 0.5.
|
|
67
|
+
"speakeasy-sdk/typescript 0.5.14 2.628.0 0.0.1 @compass-labs/api-sdk",
|
|
68
68
|
} as const;
|
package/src/lib/files.ts
CHANGED
|
@@ -38,3 +38,45 @@ export async function readableStreamToArrayBuffer(
|
|
|
38
38
|
|
|
39
39
|
return concatenatedChunks.buffer as ArrayBuffer;
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Determines the MIME content type based on a file's extension.
|
|
44
|
+
* Returns null if the extension is not recognized.
|
|
45
|
+
*/
|
|
46
|
+
export function getContentTypeFromFileName(fileName: string): string | null {
|
|
47
|
+
if (!fileName) return null;
|
|
48
|
+
|
|
49
|
+
const ext = fileName.toLowerCase().split(".").pop();
|
|
50
|
+
if (!ext) return null;
|
|
51
|
+
|
|
52
|
+
const mimeTypes: Record<string, string> = {
|
|
53
|
+
json: "application/json",
|
|
54
|
+
xml: "application/xml",
|
|
55
|
+
html: "text/html",
|
|
56
|
+
htm: "text/html",
|
|
57
|
+
txt: "text/plain",
|
|
58
|
+
csv: "text/csv",
|
|
59
|
+
pdf: "application/pdf",
|
|
60
|
+
png: "image/png",
|
|
61
|
+
jpg: "image/jpeg",
|
|
62
|
+
jpeg: "image/jpeg",
|
|
63
|
+
gif: "image/gif",
|
|
64
|
+
svg: "image/svg+xml",
|
|
65
|
+
js: "application/javascript",
|
|
66
|
+
css: "text/css",
|
|
67
|
+
zip: "application/zip",
|
|
68
|
+
tar: "application/x-tar",
|
|
69
|
+
gz: "application/gzip",
|
|
70
|
+
mp4: "video/mp4",
|
|
71
|
+
mp3: "audio/mpeg",
|
|
72
|
+
wav: "audio/wav",
|
|
73
|
+
webp: "image/webp",
|
|
74
|
+
ico: "image/x-icon",
|
|
75
|
+
woff: "font/woff",
|
|
76
|
+
woff2: "font/woff2",
|
|
77
|
+
ttf: "font/ttf",
|
|
78
|
+
otf: "font/otf",
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return mimeTypes[ext] || null;
|
|
82
|
+
}
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -68,6 +68,9 @@ import { tool$tokenAddress } from "./tools/tokenAddress.js";
|
|
|
68
68
|
import { tool$tokenBalance } from "./tools/tokenBalance.js";
|
|
69
69
|
import { tool$tokenPrice } from "./tools/tokenPrice.js";
|
|
70
70
|
import { tool$tokenTransfer } from "./tools/tokenTransfer.js";
|
|
71
|
+
import { tool$transactionBatchingAaveLoop } from "./tools/transactionBatchingAaveLoop.js";
|
|
72
|
+
import { tool$transactionBatchingAuthorization } from "./tools/transactionBatchingAuthorization.js";
|
|
73
|
+
import { tool$transactionBatchingExecute } from "./tools/transactionBatchingExecute.js";
|
|
71
74
|
import { tool$uniswapV3LiquidityProvisionIncrease } from "./tools/uniswapV3LiquidityProvisionIncrease.js";
|
|
72
75
|
import { tool$uniswapV3LiquidityProvisionInRange } from "./tools/uniswapV3LiquidityProvisionInRange.js";
|
|
73
76
|
import { tool$uniswapV3LiquidityProvisionMint } from "./tools/uniswapV3LiquidityProvisionMint.js";
|
|
@@ -97,7 +100,7 @@ export function createMCPServer(deps: {
|
|
|
97
100
|
}) {
|
|
98
101
|
const server = new McpServer({
|
|
99
102
|
name: "CompassApiSDK",
|
|
100
|
-
version: "0.5.
|
|
103
|
+
version: "0.5.14",
|
|
101
104
|
});
|
|
102
105
|
|
|
103
106
|
const client = new CompassApiSDKCore({
|
|
@@ -199,6 +202,9 @@ export function createMCPServer(deps: {
|
|
|
199
202
|
tool(tool$pendleRedeemYield);
|
|
200
203
|
tool(tool$pendleAddLiquidity);
|
|
201
204
|
tool(tool$pendleRemoveLiquidity);
|
|
205
|
+
tool(tool$transactionBatchingAuthorization);
|
|
206
|
+
tool(tool$transactionBatchingExecute);
|
|
207
|
+
tool(tool$transactionBatchingAaveLoop);
|
|
202
208
|
tool(tool$smartAccountAccountBatchedUserOperations);
|
|
203
209
|
|
|
204
210
|
return server;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { transactionBatchingAaveLoop } from "../../funcs/transactionBatchingAaveLoop.js";
|
|
6
|
+
import * as components from "../../models/components/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: components.AaveLoopRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$transactionBatchingAaveLoop: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "transaction-batching-aave-loop",
|
|
15
|
+
description: `AAVE leverage long/short
|
|
16
|
+
|
|
17
|
+
Execute an Aave looping strategy that involves repeated supply and borrow
|
|
18
|
+
operations.
|
|
19
|
+
|
|
20
|
+
This endpoint creates a multicall transaction that performs a series of operations:
|
|
21
|
+
1. Approves and supplies initial token
|
|
22
|
+
2. For each loop:
|
|
23
|
+
- Borrows another token
|
|
24
|
+
- Swaps borrowed token back to supply token
|
|
25
|
+
- Supplies the swapped tokens
|
|
26
|
+
|
|
27
|
+
The transaction must be authorized using the /authorization endpoint to prevent replay attacks.`,
|
|
28
|
+
args,
|
|
29
|
+
tool: async (client, args, ctx) => {
|
|
30
|
+
const [result, apiCall] = await transactionBatchingAaveLoop(
|
|
31
|
+
client,
|
|
32
|
+
args.request,
|
|
33
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
34
|
+
).$inspect();
|
|
35
|
+
|
|
36
|
+
if (!result.ok) {
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: result.error.message }],
|
|
39
|
+
isError: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const value = result.value;
|
|
44
|
+
|
|
45
|
+
return formatResult(value, apiCall);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { transactionBatchingAuthorization } from "../../funcs/transactionBatchingAuthorization.js";
|
|
6
|
+
import * as components from "../../models/components/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: components.MulticallAuthorizationRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$transactionBatchingAuthorization: ToolDefinition<
|
|
14
|
+
typeof args
|
|
15
|
+
> = {
|
|
16
|
+
name: "transaction-batching-authorization",
|
|
17
|
+
description: `Enable transaction bundling.
|
|
18
|
+
|
|
19
|
+
Get authorization for bundling transactions.
|
|
20
|
+
|
|
21
|
+
Currently this is required for every transaction bundle to prevent replay attacks
|
|
22
|
+
and ensure transaction ordering when batching multiple actions into a single
|
|
23
|
+
transaction. The authorization includes a nonce and chain ID to guarantee
|
|
24
|
+
transaction uniqueness and proper network targeting.`,
|
|
25
|
+
args,
|
|
26
|
+
tool: async (client, args, ctx) => {
|
|
27
|
+
const [result, apiCall] = await transactionBatchingAuthorization(
|
|
28
|
+
client,
|
|
29
|
+
args.request,
|
|
30
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
31
|
+
).$inspect();
|
|
32
|
+
|
|
33
|
+
if (!result.ok) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: "text", text: result.error.message }],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const value = result.value;
|
|
41
|
+
|
|
42
|
+
return formatResult(value, apiCall);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { transactionBatchingExecute } from "../../funcs/transactionBatchingExecute.js";
|
|
6
|
+
import * as components from "../../models/components/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: components.MulticallExecuteRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$transactionBatchingExecute: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "transaction-batching-execute",
|
|
15
|
+
description: `Construct Bundled Transaction
|
|
16
|
+
|
|
17
|
+
Bundle arbitrary transactions together into a single multicall transaction using
|
|
18
|
+
EIP-7702.
|
|
19
|
+
|
|
20
|
+
This endpoint allows bundling multiple contract calls into a single atomic
|
|
21
|
+
transaction, reducing gas costs and ensuring all operations succeed or fail
|
|
22
|
+
together. The transaction must be authorized using the /authorization endpoint to
|
|
23
|
+
prevent replay attacks.`,
|
|
24
|
+
args,
|
|
25
|
+
tool: async (client, args, ctx) => {
|
|
26
|
+
const [result, apiCall] = await transactionBatchingExecute(
|
|
27
|
+
client,
|
|
28
|
+
args.request,
|
|
29
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
30
|
+
).$inspect();
|
|
31
|
+
|
|
32
|
+
if (!result.ok) {
|
|
33
|
+
return {
|
|
34
|
+
content: [{ type: "text", text: result.error.message }],
|
|
35
|
+
isError: true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const value = result.value;
|
|
40
|
+
|
|
41
|
+
return formatResult(value, apiCall);
|
|
42
|
+
},
|
|
43
|
+
};
|