@compass-labs/api-sdk 0.5.11 → 0.5.13
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 +0 -9
- package/bin/mcp-server.js +251 -742
- package/bin/mcp-server.js.map +9 -19
- 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 +1 -7
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +0 -4
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +0 -4
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/tokenprice.js +4 -4
- package/dist/commonjs/sdk/sdk.d.ts +0 -3
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +0 -4
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- 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 +1 -7
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +0 -4
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +0 -4
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/tokenprice.js +4 -4
- package/dist/esm/sdk/sdk.d.ts +0 -3
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +0 -4
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -7
- package/src/models/components/index.ts +0 -4
- package/src/models/operations/tokenprice.ts +4 -4
- package/src/sdk/sdk.ts +0 -8
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts +0 -28
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts.map +0 -1
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.js +0 -128
- package/dist/commonjs/funcs/transactionBatchingAaveLoop.js.map +0 -1
- package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts +0 -23
- package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts.map +0 -1
- package/dist/commonjs/funcs/transactionBatchingAuthorization.js +0 -123
- package/dist/commonjs/funcs/transactionBatchingAuthorization.js.map +0 -1
- package/dist/commonjs/funcs/transactionBatchingExecute.d.ts +0 -24
- package/dist/commonjs/funcs/transactionBatchingExecute.d.ts.map +0 -1
- package/dist/commonjs/funcs/transactionBatchingExecute.js +0 -124
- package/dist/commonjs/funcs/transactionBatchingExecute.js.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts +0 -8
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js +0 -74
- package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts +0 -8
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js +0 -69
- package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts +0 -8
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts.map +0 -1
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js +0 -70
- package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js.map +0 -1
- package/dist/commonjs/models/components/aavelooprequest.d.ts +0 -181
- package/dist/commonjs/models/components/aavelooprequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/aavelooprequest.js +0 -199
- package/dist/commonjs/models/components/aavelooprequest.js.map +0 -1
- package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts +0 -49
- package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/multicallauthorizationrequest.js +0 -72
- package/dist/commonjs/models/components/multicallauthorizationrequest.js.map +0 -1
- package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts +0 -45
- package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts.map +0 -1
- package/dist/commonjs/models/components/multicallauthorizationresponse.js +0 -73
- package/dist/commonjs/models/components/multicallauthorizationresponse.js.map +0 -1
- package/dist/commonjs/models/components/multicallexecuterequest.d.ts +0 -50
- package/dist/commonjs/models/components/multicallexecuterequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/multicallexecuterequest.js +0 -87
- package/dist/commonjs/models/components/multicallexecuterequest.js.map +0 -1
- package/dist/commonjs/sdk/transactionbatching.d.ts +0 -47
- package/dist/commonjs/sdk/transactionbatching.d.ts.map +0 -1
- package/dist/commonjs/sdk/transactionbatching.js +0 -63
- package/dist/commonjs/sdk/transactionbatching.js.map +0 -1
- package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts +0 -28
- package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts.map +0 -1
- package/dist/esm/funcs/transactionBatchingAaveLoop.js +0 -92
- package/dist/esm/funcs/transactionBatchingAaveLoop.js.map +0 -1
- package/dist/esm/funcs/transactionBatchingAuthorization.d.ts +0 -23
- package/dist/esm/funcs/transactionBatchingAuthorization.d.ts.map +0 -1
- package/dist/esm/funcs/transactionBatchingAuthorization.js +0 -87
- package/dist/esm/funcs/transactionBatchingAuthorization.js.map +0 -1
- package/dist/esm/funcs/transactionBatchingExecute.d.ts +0 -24
- package/dist/esm/funcs/transactionBatchingExecute.d.ts.map +0 -1
- package/dist/esm/funcs/transactionBatchingExecute.js +0 -88
- package/dist/esm/funcs/transactionBatchingExecute.js.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts +0 -8
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js +0 -38
- package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts +0 -8
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js +0 -33
- package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts +0 -8
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts.map +0 -1
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.js +0 -34
- package/dist/esm/mcp-server/tools/transactionBatchingExecute.js.map +0 -1
- package/dist/esm/models/components/aavelooprequest.d.ts +0 -181
- package/dist/esm/models/components/aavelooprequest.d.ts.map +0 -1
- package/dist/esm/models/components/aavelooprequest.js +0 -153
- package/dist/esm/models/components/aavelooprequest.js.map +0 -1
- package/dist/esm/models/components/multicallauthorizationrequest.d.ts +0 -49
- package/dist/esm/models/components/multicallauthorizationrequest.d.ts.map +0 -1
- package/dist/esm/models/components/multicallauthorizationrequest.js +0 -34
- package/dist/esm/models/components/multicallauthorizationrequest.js.map +0 -1
- package/dist/esm/models/components/multicallauthorizationresponse.d.ts +0 -45
- package/dist/esm/models/components/multicallauthorizationresponse.d.ts.map +0 -1
- package/dist/esm/models/components/multicallauthorizationresponse.js +0 -35
- package/dist/esm/models/components/multicallauthorizationresponse.js.map +0 -1
- package/dist/esm/models/components/multicallexecuterequest.d.ts +0 -50
- package/dist/esm/models/components/multicallexecuterequest.d.ts.map +0 -1
- package/dist/esm/models/components/multicallexecuterequest.js +0 -49
- package/dist/esm/models/components/multicallexecuterequest.js.map +0 -1
- package/dist/esm/sdk/transactionbatching.d.ts +0 -47
- package/dist/esm/sdk/transactionbatching.d.ts.map +0 -1
- package/dist/esm/sdk/transactionbatching.js +0 -59
- package/dist/esm/sdk/transactionbatching.js.map +0 -1
- package/docs/sdks/transactionbatching/README.md +0 -318
- package/src/funcs/transactionBatchingAaveLoop.ts +0 -179
- package/src/funcs/transactionBatchingAuthorization.ts +0 -175
- package/src/funcs/transactionBatchingExecute.ts +0 -175
- package/src/mcp-server/tools/transactionBatchingAaveLoop.ts +0 -47
- package/src/mcp-server/tools/transactionBatchingAuthorization.ts +0 -44
- package/src/mcp-server/tools/transactionBatchingExecute.ts +0 -43
- package/src/models/components/aavelooprequest.ts +0 -368
- package/src/models/components/multicallauthorizationrequest.ts +0 -90
- package/src/models/components/multicallauthorizationresponse.ts +0 -88
- package/src/models/components/multicallexecuterequest.ts +0 -112
- package/src/sdk/transactionbatching.ts +0 -84
|
@@ -1,175 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod";
|
|
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 { Chain, Chain$inboundSchema, Chain$outboundSchema } from "./chain.js";
|
|
11
|
-
import {
|
|
12
|
-
SignedAuthorization,
|
|
13
|
-
SignedAuthorization$inboundSchema,
|
|
14
|
-
SignedAuthorization$Outbound,
|
|
15
|
-
SignedAuthorization$outboundSchema,
|
|
16
|
-
} from "./signedauthorization.js";
|
|
17
|
-
import {
|
|
18
|
-
TokenEnum,
|
|
19
|
-
TokenEnum$inboundSchema,
|
|
20
|
-
TokenEnum$outboundSchema,
|
|
21
|
-
} from "./tokenenum.js";
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Amount of collateral token to supply to Aave
|
|
25
|
-
*/
|
|
26
|
-
export type InitialCollateralAmount = number | string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Total loop collateral will be calculated as `multiplier` x `initial_collateral_amount`
|
|
30
|
-
*/
|
|
31
|
-
export type Multiplier = number | string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Maximum allowed slippage for token swaps in percentage
|
|
35
|
-
*/
|
|
36
|
-
export type MaxSlippagePercent = number | string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Loan To Value percentage of the loop
|
|
40
|
-
*/
|
|
41
|
-
export type LoanToValue = number | string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Request model for executing an Aave loop strategy.
|
|
45
|
-
*/
|
|
46
|
-
export type AaveLoopRequest = {
|
|
47
|
-
/**
|
|
48
|
-
* The chain to use.
|
|
49
|
-
*/
|
|
50
|
-
chain: Chain;
|
|
51
|
-
/**
|
|
52
|
-
* The address of the transaction sender.
|
|
53
|
-
*/
|
|
54
|
-
sender: string;
|
|
55
|
-
signedAuthorization: SignedAuthorization;
|
|
56
|
-
/**
|
|
57
|
-
* A class representing the token.
|
|
58
|
-
*
|
|
59
|
-
* @remarks
|
|
60
|
-
*
|
|
61
|
-
* This class is used to represent the token in the system. Notice individual
|
|
62
|
-
* endpoints' documentation where per chain tokens are presented.
|
|
63
|
-
*/
|
|
64
|
-
collateralToken: TokenEnum;
|
|
65
|
-
/**
|
|
66
|
-
* A class representing the token.
|
|
67
|
-
*
|
|
68
|
-
* @remarks
|
|
69
|
-
*
|
|
70
|
-
* This class is used to represent the token in the system. Notice individual
|
|
71
|
-
* endpoints' documentation where per chain tokens are presented.
|
|
72
|
-
*/
|
|
73
|
-
borrowToken: TokenEnum;
|
|
74
|
-
/**
|
|
75
|
-
* Amount of collateral token to supply to Aave
|
|
76
|
-
*/
|
|
77
|
-
initialCollateralAmount: number | string;
|
|
78
|
-
/**
|
|
79
|
-
* Total loop collateral will be calculated as `multiplier` x `initial_collateral_amount`
|
|
80
|
-
*/
|
|
81
|
-
multiplier: number | string;
|
|
82
|
-
/**
|
|
83
|
-
* Maximum allowed slippage for token swaps in percentage
|
|
84
|
-
*/
|
|
85
|
-
maxSlippagePercent: number | string;
|
|
86
|
-
/**
|
|
87
|
-
* Loan To Value percentage of the loop
|
|
88
|
-
*/
|
|
89
|
-
loanToValue: number | string;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/** @internal */
|
|
93
|
-
export const InitialCollateralAmount$inboundSchema: z.ZodType<
|
|
94
|
-
InitialCollateralAmount,
|
|
95
|
-
z.ZodTypeDef,
|
|
96
|
-
unknown
|
|
97
|
-
> = z.union([z.number(), z.string()]);
|
|
98
|
-
|
|
99
|
-
/** @internal */
|
|
100
|
-
export type InitialCollateralAmount$Outbound = number | string;
|
|
101
|
-
|
|
102
|
-
/** @internal */
|
|
103
|
-
export const InitialCollateralAmount$outboundSchema: z.ZodType<
|
|
104
|
-
InitialCollateralAmount$Outbound,
|
|
105
|
-
z.ZodTypeDef,
|
|
106
|
-
InitialCollateralAmount
|
|
107
|
-
> = z.union([z.number(), z.string()]);
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @internal
|
|
111
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
112
|
-
*/
|
|
113
|
-
export namespace InitialCollateralAmount$ {
|
|
114
|
-
/** @deprecated use `InitialCollateralAmount$inboundSchema` instead. */
|
|
115
|
-
export const inboundSchema = InitialCollateralAmount$inboundSchema;
|
|
116
|
-
/** @deprecated use `InitialCollateralAmount$outboundSchema` instead. */
|
|
117
|
-
export const outboundSchema = InitialCollateralAmount$outboundSchema;
|
|
118
|
-
/** @deprecated use `InitialCollateralAmount$Outbound` instead. */
|
|
119
|
-
export type Outbound = InitialCollateralAmount$Outbound;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function initialCollateralAmountToJSON(
|
|
123
|
-
initialCollateralAmount: InitialCollateralAmount,
|
|
124
|
-
): string {
|
|
125
|
-
return JSON.stringify(
|
|
126
|
-
InitialCollateralAmount$outboundSchema.parse(initialCollateralAmount),
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function initialCollateralAmountFromJSON(
|
|
131
|
-
jsonString: string,
|
|
132
|
-
): SafeParseResult<InitialCollateralAmount, SDKValidationError> {
|
|
133
|
-
return safeParse(
|
|
134
|
-
jsonString,
|
|
135
|
-
(x) => InitialCollateralAmount$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
-
`Failed to parse 'InitialCollateralAmount' from JSON`,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** @internal */
|
|
141
|
-
export const Multiplier$inboundSchema: z.ZodType<
|
|
142
|
-
Multiplier,
|
|
143
|
-
z.ZodTypeDef,
|
|
144
|
-
unknown
|
|
145
|
-
> = z.union([z.number(), z.string()]);
|
|
146
|
-
|
|
147
|
-
/** @internal */
|
|
148
|
-
export type Multiplier$Outbound = number | string;
|
|
149
|
-
|
|
150
|
-
/** @internal */
|
|
151
|
-
export const Multiplier$outboundSchema: z.ZodType<
|
|
152
|
-
Multiplier$Outbound,
|
|
153
|
-
z.ZodTypeDef,
|
|
154
|
-
Multiplier
|
|
155
|
-
> = z.union([z.number(), z.string()]);
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* @internal
|
|
159
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
160
|
-
*/
|
|
161
|
-
export namespace Multiplier$ {
|
|
162
|
-
/** @deprecated use `Multiplier$inboundSchema` instead. */
|
|
163
|
-
export const inboundSchema = Multiplier$inboundSchema;
|
|
164
|
-
/** @deprecated use `Multiplier$outboundSchema` instead. */
|
|
165
|
-
export const outboundSchema = Multiplier$outboundSchema;
|
|
166
|
-
/** @deprecated use `Multiplier$Outbound` instead. */
|
|
167
|
-
export type Outbound = Multiplier$Outbound;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function multiplierToJSON(multiplier: Multiplier): string {
|
|
171
|
-
return JSON.stringify(Multiplier$outboundSchema.parse(multiplier));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function multiplierFromJSON(
|
|
175
|
-
jsonString: string,
|
|
176
|
-
): SafeParseResult<Multiplier, SDKValidationError> {
|
|
177
|
-
return safeParse(
|
|
178
|
-
jsonString,
|
|
179
|
-
(x) => Multiplier$inboundSchema.parse(JSON.parse(x)),
|
|
180
|
-
`Failed to parse 'Multiplier' from JSON`,
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/** @internal */
|
|
185
|
-
export const MaxSlippagePercent$inboundSchema: z.ZodType<
|
|
186
|
-
MaxSlippagePercent,
|
|
187
|
-
z.ZodTypeDef,
|
|
188
|
-
unknown
|
|
189
|
-
> = z.union([z.number(), z.string()]);
|
|
190
|
-
|
|
191
|
-
/** @internal */
|
|
192
|
-
export type MaxSlippagePercent$Outbound = number | string;
|
|
193
|
-
|
|
194
|
-
/** @internal */
|
|
195
|
-
export const MaxSlippagePercent$outboundSchema: z.ZodType<
|
|
196
|
-
MaxSlippagePercent$Outbound,
|
|
197
|
-
z.ZodTypeDef,
|
|
198
|
-
MaxSlippagePercent
|
|
199
|
-
> = z.union([z.number(), z.string()]);
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @internal
|
|
203
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
204
|
-
*/
|
|
205
|
-
export namespace MaxSlippagePercent$ {
|
|
206
|
-
/** @deprecated use `MaxSlippagePercent$inboundSchema` instead. */
|
|
207
|
-
export const inboundSchema = MaxSlippagePercent$inboundSchema;
|
|
208
|
-
/** @deprecated use `MaxSlippagePercent$outboundSchema` instead. */
|
|
209
|
-
export const outboundSchema = MaxSlippagePercent$outboundSchema;
|
|
210
|
-
/** @deprecated use `MaxSlippagePercent$Outbound` instead. */
|
|
211
|
-
export type Outbound = MaxSlippagePercent$Outbound;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export function maxSlippagePercentToJSON(
|
|
215
|
-
maxSlippagePercent: MaxSlippagePercent,
|
|
216
|
-
): string {
|
|
217
|
-
return JSON.stringify(
|
|
218
|
-
MaxSlippagePercent$outboundSchema.parse(maxSlippagePercent),
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export function maxSlippagePercentFromJSON(
|
|
223
|
-
jsonString: string,
|
|
224
|
-
): SafeParseResult<MaxSlippagePercent, SDKValidationError> {
|
|
225
|
-
return safeParse(
|
|
226
|
-
jsonString,
|
|
227
|
-
(x) => MaxSlippagePercent$inboundSchema.parse(JSON.parse(x)),
|
|
228
|
-
`Failed to parse 'MaxSlippagePercent' from JSON`,
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/** @internal */
|
|
233
|
-
export const LoanToValue$inboundSchema: z.ZodType<
|
|
234
|
-
LoanToValue,
|
|
235
|
-
z.ZodTypeDef,
|
|
236
|
-
unknown
|
|
237
|
-
> = z.union([z.number(), z.string()]);
|
|
238
|
-
|
|
239
|
-
/** @internal */
|
|
240
|
-
export type LoanToValue$Outbound = number | string;
|
|
241
|
-
|
|
242
|
-
/** @internal */
|
|
243
|
-
export const LoanToValue$outboundSchema: z.ZodType<
|
|
244
|
-
LoanToValue$Outbound,
|
|
245
|
-
z.ZodTypeDef,
|
|
246
|
-
LoanToValue
|
|
247
|
-
> = z.union([z.number(), z.string()]);
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* @internal
|
|
251
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
252
|
-
*/
|
|
253
|
-
export namespace LoanToValue$ {
|
|
254
|
-
/** @deprecated use `LoanToValue$inboundSchema` instead. */
|
|
255
|
-
export const inboundSchema = LoanToValue$inboundSchema;
|
|
256
|
-
/** @deprecated use `LoanToValue$outboundSchema` instead. */
|
|
257
|
-
export const outboundSchema = LoanToValue$outboundSchema;
|
|
258
|
-
/** @deprecated use `LoanToValue$Outbound` instead. */
|
|
259
|
-
export type Outbound = LoanToValue$Outbound;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
export function loanToValueToJSON(loanToValue: LoanToValue): string {
|
|
263
|
-
return JSON.stringify(LoanToValue$outboundSchema.parse(loanToValue));
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
export function loanToValueFromJSON(
|
|
267
|
-
jsonString: string,
|
|
268
|
-
): SafeParseResult<LoanToValue, SDKValidationError> {
|
|
269
|
-
return safeParse(
|
|
270
|
-
jsonString,
|
|
271
|
-
(x) => LoanToValue$inboundSchema.parse(JSON.parse(x)),
|
|
272
|
-
`Failed to parse 'LoanToValue' from JSON`,
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/** @internal */
|
|
277
|
-
export const AaveLoopRequest$inboundSchema: z.ZodType<
|
|
278
|
-
AaveLoopRequest,
|
|
279
|
-
z.ZodTypeDef,
|
|
280
|
-
unknown
|
|
281
|
-
> = z.object({
|
|
282
|
-
chain: Chain$inboundSchema,
|
|
283
|
-
sender: z.string(),
|
|
284
|
-
signed_authorization: SignedAuthorization$inboundSchema,
|
|
285
|
-
collateral_token: TokenEnum$inboundSchema,
|
|
286
|
-
borrow_token: TokenEnum$inboundSchema,
|
|
287
|
-
initial_collateral_amount: z.union([z.number(), z.string()]),
|
|
288
|
-
multiplier: z.union([z.number(), z.string()]),
|
|
289
|
-
max_slippage_percent: z.union([z.number(), z.string()]),
|
|
290
|
-
loan_to_value: z.union([z.number(), z.string()]),
|
|
291
|
-
}).transform((v) => {
|
|
292
|
-
return remap$(v, {
|
|
293
|
-
"signed_authorization": "signedAuthorization",
|
|
294
|
-
"collateral_token": "collateralToken",
|
|
295
|
-
"borrow_token": "borrowToken",
|
|
296
|
-
"initial_collateral_amount": "initialCollateralAmount",
|
|
297
|
-
"max_slippage_percent": "maxSlippagePercent",
|
|
298
|
-
"loan_to_value": "loanToValue",
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
/** @internal */
|
|
303
|
-
export type AaveLoopRequest$Outbound = {
|
|
304
|
-
chain: string;
|
|
305
|
-
sender: string;
|
|
306
|
-
signed_authorization: SignedAuthorization$Outbound;
|
|
307
|
-
collateral_token: string;
|
|
308
|
-
borrow_token: string;
|
|
309
|
-
initial_collateral_amount: number | string;
|
|
310
|
-
multiplier: number | string;
|
|
311
|
-
max_slippage_percent: number | string;
|
|
312
|
-
loan_to_value: number | string;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
/** @internal */
|
|
316
|
-
export const AaveLoopRequest$outboundSchema: z.ZodType<
|
|
317
|
-
AaveLoopRequest$Outbound,
|
|
318
|
-
z.ZodTypeDef,
|
|
319
|
-
AaveLoopRequest
|
|
320
|
-
> = z.object({
|
|
321
|
-
chain: Chain$outboundSchema,
|
|
322
|
-
sender: z.string(),
|
|
323
|
-
signedAuthorization: SignedAuthorization$outboundSchema,
|
|
324
|
-
collateralToken: TokenEnum$outboundSchema,
|
|
325
|
-
borrowToken: TokenEnum$outboundSchema,
|
|
326
|
-
initialCollateralAmount: z.union([z.number(), z.string()]),
|
|
327
|
-
multiplier: z.union([z.number(), z.string()]),
|
|
328
|
-
maxSlippagePercent: z.union([z.number(), z.string()]),
|
|
329
|
-
loanToValue: z.union([z.number(), z.string()]),
|
|
330
|
-
}).transform((v) => {
|
|
331
|
-
return remap$(v, {
|
|
332
|
-
signedAuthorization: "signed_authorization",
|
|
333
|
-
collateralToken: "collateral_token",
|
|
334
|
-
borrowToken: "borrow_token",
|
|
335
|
-
initialCollateralAmount: "initial_collateral_amount",
|
|
336
|
-
maxSlippagePercent: "max_slippage_percent",
|
|
337
|
-
loanToValue: "loan_to_value",
|
|
338
|
-
});
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @internal
|
|
343
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
344
|
-
*/
|
|
345
|
-
export namespace AaveLoopRequest$ {
|
|
346
|
-
/** @deprecated use `AaveLoopRequest$inboundSchema` instead. */
|
|
347
|
-
export const inboundSchema = AaveLoopRequest$inboundSchema;
|
|
348
|
-
/** @deprecated use `AaveLoopRequest$outboundSchema` instead. */
|
|
349
|
-
export const outboundSchema = AaveLoopRequest$outboundSchema;
|
|
350
|
-
/** @deprecated use `AaveLoopRequest$Outbound` instead. */
|
|
351
|
-
export type Outbound = AaveLoopRequest$Outbound;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
export function aaveLoopRequestToJSON(
|
|
355
|
-
aaveLoopRequest: AaveLoopRequest,
|
|
356
|
-
): string {
|
|
357
|
-
return JSON.stringify(AaveLoopRequest$outboundSchema.parse(aaveLoopRequest));
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
export function aaveLoopRequestFromJSON(
|
|
361
|
-
jsonString: string,
|
|
362
|
-
): SafeParseResult<AaveLoopRequest, SDKValidationError> {
|
|
363
|
-
return safeParse(
|
|
364
|
-
jsonString,
|
|
365
|
-
(x) => AaveLoopRequest$inboundSchema.parse(JSON.parse(x)),
|
|
366
|
-
`Failed to parse 'AaveLoopRequest' from JSON`,
|
|
367
|
-
);
|
|
368
|
-
}
|