@continuumdao/ctm-mpc-defi 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/dist/agent/catalog.cjs +913 -142
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.cts +834 -12
- package/dist/agent/catalog.d.ts +834 -12
- package/dist/agent/catalog.js +863 -143
- package/dist/agent/catalog.js.map +1 -1
- package/dist/chains/evm/index.cjs +13 -0
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.d.cts +3 -1
- package/dist/chains/evm/index.d.ts +3 -1
- package/dist/chains/evm/index.js +13 -1
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/core/index.cjs +76 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +35 -2
- package/dist/core/index.d.ts +35 -2
- package/dist/core/index.js +70 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +934 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +927 -142
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +1987 -0
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -0
- package/dist/protocols/evm/aave-v4/index.d.cts +500 -0
- package/dist/protocols/evm/aave-v4/index.d.ts +500 -0
- package/dist/protocols/evm/aave-v4/index.js +1943 -0
- package/dist/protocols/evm/aave-v4/index.js.map +1 -0
- package/dist/protocols/evm/ethena/index.cjs +965 -0
- package/dist/protocols/evm/ethena/index.cjs.map +1 -0
- package/dist/protocols/evm/ethena/index.d.cts +161 -0
- package/dist/protocols/evm/ethena/index.d.ts +161 -0
- package/dist/protocols/evm/ethena/index.js +943 -0
- package/dist/protocols/evm/ethena/index.js.map +1 -0
- package/dist/protocols/evm/euler-v2/index.cjs +2263 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -0
- package/dist/protocols/evm/euler-v2/index.d.cts +317 -0
- package/dist/protocols/evm/euler-v2/index.d.ts +317 -0
- package/dist/protocols/evm/euler-v2/index.js +2238 -0
- package/dist/protocols/evm/euler-v2/index.js.map +1 -0
- package/dist/protocols/evm/lido/index.cjs +834 -0
- package/dist/protocols/evm/lido/index.cjs.map +1 -0
- package/dist/protocols/evm/lido/index.d.cts +120 -0
- package/dist/protocols/evm/lido/index.d.ts +120 -0
- package/dist/protocols/evm/lido/index.js +809 -0
- package/dist/protocols/evm/lido/index.js.map +1 -0
- package/dist/protocols/evm/maple/index.cjs +707 -0
- package/dist/protocols/evm/maple/index.cjs.map +1 -0
- package/dist/protocols/evm/maple/index.d.cts +109 -0
- package/dist/protocols/evm/maple/index.d.ts +109 -0
- package/dist/protocols/evm/maple/index.js +693 -0
- package/dist/protocols/evm/maple/index.js.map +1 -0
- package/dist/protocols/evm/sky/index.cjs +1254 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -0
- package/dist/protocols/evm/sky/index.d.cts +218 -0
- package/dist/protocols/evm/sky/index.d.ts +218 -0
- package/dist/protocols/evm/sky/index.js +1229 -0
- package/dist/protocols/evm/sky/index.js.map +1 -0
- package/dist/protocols/evm/uniswap-v4/index.cjs +31 -11
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.cts +2 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +2 -1
- package/dist/protocols/evm/uniswap-v4/index.js +31 -11
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +37 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getAddress, zeroAddress, defineChain, createPublicClient, http, formatUnits, parseGwei, serializeTransaction, keccak256, encodeFunctionData, erc20Abi, parseAbi, parseUnits, decodeFunctionData, isAddress } from 'viem';
|
|
2
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
|
+
import { z } from 'zod';
|
|
2
4
|
|
|
3
5
|
// src/core/keygen.ts
|
|
4
6
|
function firstClientIdFromKeyGen(data) {
|
|
@@ -112,6 +114,75 @@ function nodeFetchWithReadAuth(url, init, auth) {
|
|
|
112
114
|
}
|
|
113
115
|
return fetch(url, { ...init, headers });
|
|
114
116
|
}
|
|
117
|
+
|
|
118
|
+
// src/core/managementPostSig.ts
|
|
119
|
+
function normalizeManagementNodeKey(nodeKey) {
|
|
120
|
+
const nk = nodeKey?.trim().replace(/^0x/i, "");
|
|
121
|
+
if (!nk || !/^[0-9a-fA-F]{128}$/.test(nk)) {
|
|
122
|
+
throw new Error("nodeKey is required (128 hex from GET /getNodeKey).");
|
|
123
|
+
}
|
|
124
|
+
return nk.toLowerCase();
|
|
125
|
+
}
|
|
126
|
+
function managementSigFields(nonce, nodeKey) {
|
|
127
|
+
return { nonce, clientSig: "", nodeKey: normalizeManagementNodeKey(nodeKey) };
|
|
128
|
+
}
|
|
129
|
+
function buildManagementPostBody(nonce, nodeKey, fields = {}) {
|
|
130
|
+
return { ...managementSigFields(nonce, nodeKey), ...fields };
|
|
131
|
+
}
|
|
132
|
+
function messageToSignManagementBody(body) {
|
|
133
|
+
return JSON.stringify({ ...body, clientSig: "" });
|
|
134
|
+
}
|
|
135
|
+
function withManagementClientSig(body, clientSig) {
|
|
136
|
+
return { ...body, clientSig: clientSig.trim().replace(/^0x/i, "") };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/core/managementNonce.ts
|
|
140
|
+
function mpcAuthData(raw) {
|
|
141
|
+
const code = raw.Code ?? raw.code;
|
|
142
|
+
if (code !== 0 && code !== void 0) return void 0;
|
|
143
|
+
return raw.Data ?? raw.data;
|
|
144
|
+
}
|
|
145
|
+
async function fetchNodeKey(nodeUrl, readAuth = { bearerOnGet: false, jwt: null }) {
|
|
146
|
+
const base = nodeUrl.trim().replace(/\/$/, "");
|
|
147
|
+
const res = await nodeFetchWithReadAuth(`${base}/getNodeKey`, { cache: "no-store" }, readAuth);
|
|
148
|
+
const text = await res.text();
|
|
149
|
+
let raw;
|
|
150
|
+
try {
|
|
151
|
+
raw = JSON.parse(text);
|
|
152
|
+
} catch {
|
|
153
|
+
return { nodeKey: "", ok: false };
|
|
154
|
+
}
|
|
155
|
+
const data = mpcAuthData(raw);
|
|
156
|
+
const nk = typeof data === "string" ? data : data != null && typeof data === "object" && !Array.isArray(data) ? String(data.nodeKey ?? data.NodeKey ?? "") : data != null ? String(data) : "";
|
|
157
|
+
const trimmed = nk.trim().replace(/^0x/i, "");
|
|
158
|
+
if (!/^[0-9a-fA-F]{128}$/.test(trimmed)) {
|
|
159
|
+
return { nodeKey: "", ok: false };
|
|
160
|
+
}
|
|
161
|
+
return { nodeKey: trimmed.toLowerCase(), ok: res.ok };
|
|
162
|
+
}
|
|
163
|
+
async function fetchManagementNonce(nodeUrl, useEd25519, ed25519PublicKey, readAuth = { bearerOnGet: false, jwt: null }) {
|
|
164
|
+
const base = nodeUrl.trim().replace(/\/$/, "");
|
|
165
|
+
const path = useEd25519 ? "/getPublicMgtKeyNonce" : "/getNodeMgtKeyNonce";
|
|
166
|
+
const url = useEd25519 && ed25519PublicKey && /^[0-9a-fA-F]{64}$/.test(ed25519PublicKey.trim()) ? `${base}${path}?publicKey=${encodeURIComponent(ed25519PublicKey.trim())}` : `${base}${path}`;
|
|
167
|
+
const res = await nodeFetchWithReadAuth(url, { cache: "no-store" }, readAuth);
|
|
168
|
+
const text = await res.text();
|
|
169
|
+
let raw;
|
|
170
|
+
try {
|
|
171
|
+
raw = JSON.parse(text);
|
|
172
|
+
} catch {
|
|
173
|
+
return { nonce: 0, ok: false, code: -1 };
|
|
174
|
+
}
|
|
175
|
+
const code = raw.Code ?? raw.code;
|
|
176
|
+
const payload = mpcAuthData(raw) ?? raw.Data ?? raw.data;
|
|
177
|
+
let nonce = 0;
|
|
178
|
+
if (typeof payload === "number" && !Number.isNaN(payload)) {
|
|
179
|
+
nonce = payload;
|
|
180
|
+
} else if (payload && typeof payload === "object") {
|
|
181
|
+
const n = payload.nonce ?? payload.Nonce;
|
|
182
|
+
nonce = typeof n === "number" && !Number.isNaN(n) ? n : Number(n) || 0;
|
|
183
|
+
}
|
|
184
|
+
return { nonce, ok: res.ok && (code === 0 || code === void 0), code: code ?? -1 };
|
|
185
|
+
}
|
|
115
186
|
function isEvmNativeToken(address) {
|
|
116
187
|
try {
|
|
117
188
|
return getAddress(address) === zeroAddress;
|
|
@@ -494,6 +565,18 @@ function parseEvmChainIdToNumber(chainId) {
|
|
|
494
565
|
return Number.parseInt(t, 10);
|
|
495
566
|
}
|
|
496
567
|
|
|
568
|
+
// src/chains/evm/rpcUrl.ts
|
|
569
|
+
function isValidRpcUrl(url) {
|
|
570
|
+
const t = url.trim();
|
|
571
|
+
if (!t) return false;
|
|
572
|
+
try {
|
|
573
|
+
const u = new URL(t);
|
|
574
|
+
return u.protocol === "http:" || u.protocol === "https:";
|
|
575
|
+
} catch {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
497
580
|
// src/chains/solana/types.ts
|
|
498
581
|
var solanaChainCategoryModule = {
|
|
499
582
|
category: "solana"
|
|
@@ -2219,46 +2302,606 @@ var MULTISIGN_OUTPUT_DOC = {
|
|
|
2219
2302
|
}
|
|
2220
2303
|
}
|
|
2221
2304
|
};
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
if (d) out[k] = { type: d.type, description: d.description };
|
|
2229
|
-
}
|
|
2230
|
-
for (const [k, d] of Object.entries(params)) {
|
|
2231
|
-
out[k] = { type: d.type, description: d.description };
|
|
2232
|
-
}
|
|
2233
|
-
return out;
|
|
2234
|
-
}
|
|
2235
|
-
function requiredKeys(params, includeCommon = []) {
|
|
2236
|
-
const req = [];
|
|
2237
|
-
for (const k of includeCommon) {
|
|
2238
|
-
if (EVM_COMMON_PARAM_DOCS[k]?.required) req.push(k);
|
|
2239
|
-
}
|
|
2240
|
-
for (const [k, d] of Object.entries(params)) {
|
|
2241
|
-
if (d.required) req.push(k);
|
|
2242
|
-
}
|
|
2243
|
-
return req;
|
|
2244
|
-
}
|
|
2245
|
-
var multisignOutputSchema = {
|
|
2246
|
-
type: "object",
|
|
2247
|
-
description: MULTISIGN_OUTPUT_DOC.description,
|
|
2248
|
-
properties: {
|
|
2249
|
-
bodyForSign: {
|
|
2250
|
-
type: "object",
|
|
2251
|
-
description: MULTISIGN_OUTPUT_DOC.fields.bodyForSign.description
|
|
2305
|
+
var MANAGEMENT_SIG_DOC = {
|
|
2306
|
+
description: "Management POST bodies embed NodeMgtKeySig: { nonce, clientSig, nodeKey }. Sign JSON with clientSig cleared; POST with clientSig set to the Ed25519 128-hex or EIP-191 signature. Legacy Nonce/Sig/sig field names are not accepted.",
|
|
2307
|
+
fields: {
|
|
2308
|
+
nonce: {
|
|
2309
|
+
type: "number",
|
|
2310
|
+
description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey)."
|
|
2252
2311
|
},
|
|
2253
|
-
|
|
2312
|
+
clientSig: {
|
|
2313
|
+
type: "string",
|
|
2314
|
+
description: "Management signature; empty string in the message to sign."
|
|
2315
|
+
},
|
|
2316
|
+
nodeKey: {
|
|
2254
2317
|
type: "string",
|
|
2255
|
-
description:
|
|
2318
|
+
description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix)."
|
|
2256
2319
|
}
|
|
2257
2320
|
},
|
|
2258
|
-
|
|
2321
|
+
helpers: {
|
|
2322
|
+
managementSigFields: "Base envelope with clientSig cleared.",
|
|
2323
|
+
buildManagementPostBody: "Spread managementSigFields then endpoint fields.",
|
|
2324
|
+
messageToSignManagementBody: "Canonical JSON string to sign.",
|
|
2325
|
+
withManagementClientSig: "Attach signature to POST body.",
|
|
2326
|
+
fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.",
|
|
2327
|
+
fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key."
|
|
2328
|
+
}
|
|
2259
2329
|
};
|
|
2260
|
-
|
|
2261
|
-
{
|
|
2330
|
+
function zodSchemaToMcpJsonSchema(schema) {
|
|
2331
|
+
const raw = zodToJsonSchema(schema, {
|
|
2332
|
+
target: "openApi3",
|
|
2333
|
+
$refStrategy: "none"
|
|
2334
|
+
});
|
|
2335
|
+
if (raw.type === "object" || raw.type === "array" || raw.type === "string") {
|
|
2336
|
+
const { $schema: _s, ...rest } = raw;
|
|
2337
|
+
return rest;
|
|
2338
|
+
}
|
|
2339
|
+
const defs = raw.definitions;
|
|
2340
|
+
if (defs) {
|
|
2341
|
+
const first = Object.values(defs)[0];
|
|
2342
|
+
if (first?.type) {
|
|
2343
|
+
const { $schema: _s, ...rest } = first;
|
|
2344
|
+
return rest;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
return raw;
|
|
2348
|
+
}
|
|
2349
|
+
var evmAddressSchema = z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
|
|
2350
|
+
var keyGenSchema = z.object({
|
|
2351
|
+
pubkeyhex: z.string().min(1).describe("MPC secp256k1 public key hex (required for multiSignRequest pubKey)"),
|
|
2352
|
+
keylist: z.array(z.string()).optional().describe("Key list on the sign request"),
|
|
2353
|
+
ClientKeys: z.record(z.string()).optional().describe("Optional client key map from keyGen")
|
|
2354
|
+
}).describe(
|
|
2355
|
+
"MPC key slice: { pubkeyhex, keylist?, ClientKeys? }. Used for pubKey/keyList on POST /multiSignRequest."
|
|
2356
|
+
);
|
|
2357
|
+
var chainDetailSchema = z.object({
|
|
2358
|
+
legacy: z.boolean().optional(),
|
|
2359
|
+
gasLimit: z.number().optional(),
|
|
2360
|
+
gasMultiplier: z.number().optional(),
|
|
2361
|
+
gasPrice: z.number().optional(),
|
|
2362
|
+
baseFee: z.number().optional(),
|
|
2363
|
+
priorityFee: z.number().optional(),
|
|
2364
|
+
baseFeeMultiplier: z.number().optional()
|
|
2365
|
+
}).passthrough().describe(
|
|
2366
|
+
"Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
|
|
2367
|
+
);
|
|
2368
|
+
var evmMultisignCommonInputSchema = z.object({
|
|
2369
|
+
keyGen: keyGenSchema,
|
|
2370
|
+
purposeText: z.string().min(1).describe(
|
|
2371
|
+
"Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
|
|
2372
|
+
),
|
|
2373
|
+
useCustomGas: z.boolean().describe(
|
|
2374
|
+
"When true, apply chain gas settings from chainDetail / customGasChainDetails instead of raw RPC estimates only."
|
|
2375
|
+
),
|
|
2376
|
+
chainId: z.number().int().positive().describe("EVM chain id (decimal). Becomes destinationChainID on the sign request."),
|
|
2377
|
+
rpcUrl: z.string().min(1).describe("HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."),
|
|
2378
|
+
executorAddress: evmAddressSchema.describe(
|
|
2379
|
+
"MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
|
|
2380
|
+
),
|
|
2381
|
+
chainDetail: chainDetailSchema,
|
|
2382
|
+
customGasChainDetails: z.record(z.unknown()).optional().describe("Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.")
|
|
2383
|
+
});
|
|
2384
|
+
var multisignOutputSchema = z.object({
|
|
2385
|
+
bodyForSign: z.record(z.unknown()).describe(
|
|
2386
|
+
"POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
|
|
2387
|
+
),
|
|
2388
|
+
messageToSign: z.string().describe("JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig.")
|
|
2389
|
+
}).describe(
|
|
2390
|
+
"Unsigned mpc-auth multiSignRequest payload. Sign messageToSign and POST { ...bodyForSign, clientSig, signedMessage } to /multiSignRequest."
|
|
2391
|
+
);
|
|
2392
|
+
var jsonObjectSchema = z.record(z.unknown());
|
|
2393
|
+
var uniswapQuoteTradeTypeSchema = z.enum(["EXACT_INPUT", "EXACT_OUTPUT"]);
|
|
2394
|
+
var mcpUniswapV4QuoteInputSchema = z.object({
|
|
2395
|
+
type: uniswapQuoteTradeTypeSchema.describe("EXACT_INPUT or EXACT_OUTPUT"),
|
|
2396
|
+
amount: z.string().min(1).describe("Amount in token-in base units (wei string for ERC-20)"),
|
|
2397
|
+
tokenIn: z.string().min(1).describe("Input token; 0x0 for native ETH"),
|
|
2398
|
+
tokenOut: z.string().min(1).describe("Output token address"),
|
|
2399
|
+
chainId: z.union([z.number().int().positive(), z.string().min(1)]).describe("tokenInChainId / same-chain default"),
|
|
2400
|
+
uniswapApiKey: z.string().min(1).describe("Uniswap Trade API x-api-key"),
|
|
2401
|
+
swapper: evmAddressSchema.optional().describe("MPC executor; omit if keyGen + managementNodeUrl provided"),
|
|
2402
|
+
slippage: z.union([z.number(), z.string()]).optional().describe("Slippage percent; omit for API auto slippage"),
|
|
2403
|
+
keyGen: z.string().optional().describe("KeyGen id \u2014 resolves swapper via GET /getKeyGenResultById when swapper omitted"),
|
|
2404
|
+
managementNodeUrl: z.string().min(1).optional().describe("MPC node base URL; required with keyGen when swapper is omitted"),
|
|
2405
|
+
tokenInChainId: z.union([z.number(), z.string()]).optional(),
|
|
2406
|
+
tokenOutChainId: z.union([z.number(), z.string()]).optional(),
|
|
2407
|
+
permit2Disabled: z.boolean().optional(),
|
|
2408
|
+
baseUrl: z.string().optional(),
|
|
2409
|
+
universalRouterVersion: z.string().optional()
|
|
2410
|
+
});
|
|
2411
|
+
var mcpUniswapV4QuoteOutputSchema = jsonObjectSchema.describe(
|
|
2412
|
+
"Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
|
|
2413
|
+
);
|
|
2414
|
+
var mcpUniswapV4CreateSwapInputSchema = z.object({
|
|
2415
|
+
uniswapApiKey: z.string().min(1).describe("Uniswap Trade API key"),
|
|
2416
|
+
fullQuoteFromPermit: jsonObjectSchema.describe("Full quote JSON from ctm_uniswap_v4_quote"),
|
|
2417
|
+
swapTransactionDeadlineUnix: z.number().int().positive().optional().describe("On-chain deadline unix seconds; default ~30 min from now"),
|
|
2418
|
+
useServerProxy: z.boolean().optional().describe("Set false in Node/agents; true only in browser via Next API route"),
|
|
2419
|
+
baseUrl: z.string().optional(),
|
|
2420
|
+
universalRouterVersion: z.string().optional()
|
|
2421
|
+
});
|
|
2422
|
+
var mcpUniswapV4CreateSwapOutputSchema = z.object({
|
|
2423
|
+
swap: jsonObjectSchema.describe("Universal Router tx: { to, data, value, gasLimit? }"),
|
|
2424
|
+
requestId: z.string().optional(),
|
|
2425
|
+
gasFee: z.string().optional()
|
|
2426
|
+
}).passthrough().describe("{ swap: TransactionRequest, requestId?, gasFee? }");
|
|
2427
|
+
var swapTxRequestSchema = jsonObjectSchema.describe("swap field from create_swap response (to, data, value)");
|
|
2428
|
+
var mcpUniswapV4BuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
|
|
2429
|
+
tokenIn: evmAddressSchema.describe("Token in; 0x0 for native ETH"),
|
|
2430
|
+
swap: swapTxRequestSchema,
|
|
2431
|
+
createSwapResponse: z.object({
|
|
2432
|
+
swap: swapTxRequestSchema,
|
|
2433
|
+
requestId: z.string().optional(),
|
|
2434
|
+
gasFee: z.string().optional()
|
|
2435
|
+
}).passthrough().describe("Full create_swap response"),
|
|
2436
|
+
fullQuoteSnapshot: jsonObjectSchema.describe("Quote JSON used for the swap"),
|
|
2437
|
+
swapDeadlineUnix: z.number().describe("Same deadline passed to create_swap"),
|
|
2438
|
+
slippagePercent: z.number().optional().describe("Extra approve headroom for EXACT_OUTPUT")
|
|
2439
|
+
});
|
|
2440
|
+
var mcpCurveDaoBuildSwapMultisignInputSchema = evmMultisignCommonInputSchema.extend({
|
|
2441
|
+
tokenIn: evmAddressSchema.describe("ERC-20 sold (native in uses WETH path in UI)"),
|
|
2442
|
+
tokenOut: z.string().min(1).describe("Output token or 0xeeee\u2026 native placeholder"),
|
|
2443
|
+
amountHuman: z.string().min(1).describe("Human-readable amount of tokenIn"),
|
|
2444
|
+
slippagePercent: z.number().gt(0).lt(100).describe("Slippage 0\u2013100 exclusive")
|
|
2445
|
+
});
|
|
2446
|
+
function mcpMultisignInput(fields) {
|
|
2447
|
+
return evmMultisignCommonInputSchema.extend(fields);
|
|
2448
|
+
}
|
|
2449
|
+
var mcpLidoSubmitInputSchema = mcpMultisignInput({
|
|
2450
|
+
valueWei: z.string().min(1).describe("ETH to stake (wei decimal string)"),
|
|
2451
|
+
referral: evmAddressSchema.optional()
|
|
2452
|
+
});
|
|
2453
|
+
var mcpLidoRequestWithdrawalsInputSchema = mcpMultisignInput({
|
|
2454
|
+
stEthAmountsWei: z.array(z.string()).min(1).describe("stETH amounts per withdrawal request (wei strings)")
|
|
2455
|
+
});
|
|
2456
|
+
var mcpLidoClaimWithdrawalInputSchema = mcpMultisignInput({
|
|
2457
|
+
requestId: z.union([z.string(), z.number()]).describe("Withdrawal queue request id")
|
|
2458
|
+
});
|
|
2459
|
+
var mcpLidoWrapStEthInputSchema = mcpMultisignInput({
|
|
2460
|
+
stEthAmountWei: z.string().min(1)
|
|
2461
|
+
});
|
|
2462
|
+
var mcpLidoUnwrapWstEthInputSchema = mcpMultisignInput({
|
|
2463
|
+
wstEthAmountWei: z.string().min(1)
|
|
2464
|
+
});
|
|
2465
|
+
var mcpEthenaStakeInputSchema = mcpMultisignInput({
|
|
2466
|
+
usdeAmountHuman: z.string().min(1),
|
|
2467
|
+
susdeVault: evmAddressSchema.optional()
|
|
2468
|
+
});
|
|
2469
|
+
var mcpEthenaRedeemInputSchema = mcpMultisignInput({
|
|
2470
|
+
susdeSharesHuman: z.string().min(1),
|
|
2471
|
+
susdeVault: evmAddressSchema.optional()
|
|
2472
|
+
});
|
|
2473
|
+
var mcpEthenaCooldownInputSchema = mcpMultisignInput({
|
|
2474
|
+
susdeSharesHuman: z.string().min(1),
|
|
2475
|
+
susdeVault: evmAddressSchema.optional()
|
|
2476
|
+
});
|
|
2477
|
+
var mcpEthenaClaimInputSchema = mcpMultisignInput({
|
|
2478
|
+
susdeVault: evmAddressSchema.optional()
|
|
2479
|
+
});
|
|
2480
|
+
var mcpMapleDepositInputSchema = mcpMultisignInput({
|
|
2481
|
+
syrupRouter: evmAddressSchema,
|
|
2482
|
+
pool: evmAddressSchema,
|
|
2483
|
+
asset: evmAddressSchema,
|
|
2484
|
+
amountHuman: z.string().min(1),
|
|
2485
|
+
authorizeSig: jsonObjectSchema.optional()
|
|
2486
|
+
});
|
|
2487
|
+
var mcpMapleRequestRedeemInputSchema = mcpMultisignInput({
|
|
2488
|
+
pool: evmAddressSchema,
|
|
2489
|
+
sharesHuman: z.string().min(1),
|
|
2490
|
+
receiver: evmAddressSchema
|
|
2491
|
+
});
|
|
2492
|
+
var mcpSkyLockstakeStakeInputSchema = mcpMultisignInput({
|
|
2493
|
+
skyAmountHuman: z.string().min(1),
|
|
2494
|
+
usdsDrawHuman: z.string().optional(),
|
|
2495
|
+
farmRef: z.string().optional()
|
|
2496
|
+
});
|
|
2497
|
+
var mcpSkyLockstakeDrawInputSchema = mcpMultisignInput({
|
|
2498
|
+
usdsAmountHuman: z.string().min(1),
|
|
2499
|
+
urnIndex: z.number().int().nonnegative()
|
|
2500
|
+
});
|
|
2501
|
+
var mcpSkyLockstakeWipeInputSchema = mcpMultisignInput({
|
|
2502
|
+
usdsAmountHuman: z.string().min(1),
|
|
2503
|
+
urnIndex: z.number().int().nonnegative()
|
|
2504
|
+
});
|
|
2505
|
+
var mcpSkyLockstakeCloseInputSchema = mcpMultisignInput({
|
|
2506
|
+
urnIndex: z.number().int().nonnegative()
|
|
2507
|
+
});
|
|
2508
|
+
var mcpSkyLockstakeGetRewardInputSchema = mcpMultisignInput({
|
|
2509
|
+
urnIndex: z.number().int().nonnegative()
|
|
2510
|
+
});
|
|
2511
|
+
var mcpSkySusdsDepositInputSchema = mcpMultisignInput({
|
|
2512
|
+
usdsAmountHuman: z.string().min(1)
|
|
2513
|
+
});
|
|
2514
|
+
var mcpSkySusdsRedeemInputSchema = mcpMultisignInput({
|
|
2515
|
+
sharesHuman: z.string().min(1)
|
|
2516
|
+
});
|
|
2517
|
+
var mcpAaveV4DepositInputSchema = mcpMultisignInput({
|
|
2518
|
+
spoke: evmAddressSchema,
|
|
2519
|
+
underlying: evmAddressSchema,
|
|
2520
|
+
amountHuman: z.string().min(1),
|
|
2521
|
+
marketId: z.string().min(1)
|
|
2522
|
+
});
|
|
2523
|
+
var mcpAaveV4WithdrawInputSchema = mcpMultisignInput({
|
|
2524
|
+
spoke: evmAddressSchema,
|
|
2525
|
+
underlying: evmAddressSchema,
|
|
2526
|
+
amountHuman: z.string().min(1),
|
|
2527
|
+
marketId: z.string().min(1)
|
|
2528
|
+
});
|
|
2529
|
+
var mcpAaveV4BorrowInputSchema = mcpMultisignInput({
|
|
2530
|
+
spoke: evmAddressSchema,
|
|
2531
|
+
underlying: evmAddressSchema,
|
|
2532
|
+
amountHuman: z.string().min(1),
|
|
2533
|
+
marketId: z.string().min(1)
|
|
2534
|
+
});
|
|
2535
|
+
var mcpAaveV4RepayInputSchema = mcpMultisignInput({
|
|
2536
|
+
spoke: evmAddressSchema,
|
|
2537
|
+
underlying: evmAddressSchema,
|
|
2538
|
+
amountHuman: z.string().min(1),
|
|
2539
|
+
marketId: z.string().min(1)
|
|
2540
|
+
});
|
|
2541
|
+
var mcpEulerV2IsolatedLendInputSchema = mcpMultisignInput({
|
|
2542
|
+
vault: evmAddressSchema,
|
|
2543
|
+
assetAmountHuman: z.string().min(1)
|
|
2544
|
+
});
|
|
2545
|
+
var mcpEulerV2IsolatedBorrowInputSchema = mcpMultisignInput({
|
|
2546
|
+
vault: evmAddressSchema,
|
|
2547
|
+
collateralAsset: evmAddressSchema,
|
|
2548
|
+
borrowAsset: evmAddressSchema,
|
|
2549
|
+
collateralAmountHuman: z.string().min(1),
|
|
2550
|
+
loopBorrowWeis: z.array(z.string()).min(1)
|
|
2551
|
+
});
|
|
2552
|
+
var mcpEulerV2VaultWithdrawInputSchema = mcpMultisignInput({
|
|
2553
|
+
vault: evmAddressSchema,
|
|
2554
|
+
sharesHuman: z.string().min(1)
|
|
2555
|
+
});
|
|
2556
|
+
var mcpEulerV2BorrowRepayInputSchema = mcpMultisignInput({
|
|
2557
|
+
vault: evmAddressSchema,
|
|
2558
|
+
amountHuman: z.string().min(1)
|
|
2559
|
+
});
|
|
2560
|
+
var mcpEulerV2CollateralDepositInputSchema = mcpMultisignInput({
|
|
2561
|
+
vault: evmAddressSchema,
|
|
2562
|
+
collateralAsset: evmAddressSchema,
|
|
2563
|
+
amountHuman: z.string().min(1)
|
|
2564
|
+
});
|
|
2565
|
+
var mcpEulerV2CollateralWithdrawInputSchema = mcpMultisignInput({
|
|
2566
|
+
vault: evmAddressSchema,
|
|
2567
|
+
collateralAsset: evmAddressSchema,
|
|
2568
|
+
amountHuman: z.string().min(1)
|
|
2569
|
+
});
|
|
2570
|
+
|
|
2571
|
+
// src/agent/mcpProtocolTools.ts
|
|
2572
|
+
function defineProtocolMcpTool(def) {
|
|
2573
|
+
return {
|
|
2574
|
+
...def,
|
|
2575
|
+
outputZod: multisignOutputSchema,
|
|
2576
|
+
inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
|
|
2577
|
+
outputSchema: zodSchemaToMcpJsonSchema(multisignOutputSchema),
|
|
2578
|
+
parseInput: (data) => def.inputZod.parse(data),
|
|
2579
|
+
parseOutput: (data) => multisignOutputSchema.parse(data)
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
var MCP_PROTOCOL_TOOL_DEFINITIONS = [
|
|
2583
|
+
defineProtocolMcpTool({
|
|
2584
|
+
name: "ctm_lido_build_submit_multisign",
|
|
2585
|
+
actionId: "lido.submit",
|
|
2586
|
+
protocolId: "lido",
|
|
2587
|
+
chainCategory: "evm",
|
|
2588
|
+
description: "Build mpc-auth multiSignRequest for Lido ETH stake (submit).",
|
|
2589
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2590
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2591
|
+
handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoSubmit" },
|
|
2592
|
+
inputZod: mcpLidoSubmitInputSchema
|
|
2593
|
+
}),
|
|
2594
|
+
defineProtocolMcpTool({
|
|
2595
|
+
name: "ctm_lido_build_request_withdrawals_multisign",
|
|
2596
|
+
actionId: "lido.request-withdrawals",
|
|
2597
|
+
protocolId: "lido",
|
|
2598
|
+
chainCategory: "evm",
|
|
2599
|
+
description: "Build batch for Lido withdrawal queue (approve + requestWithdrawals).",
|
|
2600
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2601
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2602
|
+
handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoRequestWithdrawals" },
|
|
2603
|
+
inputZod: mcpLidoRequestWithdrawalsInputSchema
|
|
2604
|
+
}),
|
|
2605
|
+
defineProtocolMcpTool({
|
|
2606
|
+
name: "ctm_lido_build_claim_withdrawal_multisign",
|
|
2607
|
+
actionId: "lido.claim-withdrawal",
|
|
2608
|
+
protocolId: "lido",
|
|
2609
|
+
chainCategory: "evm",
|
|
2610
|
+
description: "Build tx for Lido claimWithdrawal.",
|
|
2611
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2612
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2613
|
+
handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoClaimWithdrawal" },
|
|
2614
|
+
inputZod: mcpLidoClaimWithdrawalInputSchema
|
|
2615
|
+
}),
|
|
2616
|
+
defineProtocolMcpTool({
|
|
2617
|
+
name: "ctm_lido_build_wrap_steth_multisign",
|
|
2618
|
+
actionId: "lido.wrap-steth",
|
|
2619
|
+
protocolId: "lido",
|
|
2620
|
+
chainCategory: "evm",
|
|
2621
|
+
description: "Build batch for wstETH wrap.",
|
|
2622
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2623
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2624
|
+
handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoWrapStEth" },
|
|
2625
|
+
inputZod: mcpLidoWrapStEthInputSchema
|
|
2626
|
+
}),
|
|
2627
|
+
defineProtocolMcpTool({
|
|
2628
|
+
name: "ctm_lido_build_unwrap_wsteth_multisign",
|
|
2629
|
+
actionId: "lido.unwrap-wsteth",
|
|
2630
|
+
protocolId: "lido",
|
|
2631
|
+
chainCategory: "evm",
|
|
2632
|
+
description: "Build tx for wstETH unwrap.",
|
|
2633
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2634
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2635
|
+
handler: { importPath: "protocols/evm/lido", exportName: "buildEvmMultisignBodyLidoUnwrapWstEth" },
|
|
2636
|
+
inputZod: mcpLidoUnwrapWstEthInputSchema
|
|
2637
|
+
}),
|
|
2638
|
+
defineProtocolMcpTool({
|
|
2639
|
+
name: "ctm_ethena_build_stake_multisign",
|
|
2640
|
+
actionId: "ethena.stake-usde",
|
|
2641
|
+
protocolId: "ethena",
|
|
2642
|
+
chainCategory: "evm",
|
|
2643
|
+
description: "Build batch: USDe approve + sUSDe deposit.",
|
|
2644
|
+
prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
|
|
2645
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2646
|
+
handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUsdeStakeToSusde" },
|
|
2647
|
+
inputZod: mcpEthenaStakeInputSchema
|
|
2648
|
+
}),
|
|
2649
|
+
defineProtocolMcpTool({
|
|
2650
|
+
name: "ctm_ethena_build_redeem_multisign",
|
|
2651
|
+
actionId: "ethena.redeem-susde",
|
|
2652
|
+
protocolId: "ethena",
|
|
2653
|
+
chainCategory: "evm",
|
|
2654
|
+
description: "Build sUSDe redeem when cooldown is off.",
|
|
2655
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2656
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2657
|
+
handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeRedeemToUsde" },
|
|
2658
|
+
inputZod: mcpEthenaRedeemInputSchema
|
|
2659
|
+
}),
|
|
2660
|
+
defineProtocolMcpTool({
|
|
2661
|
+
name: "ctm_ethena_build_cooldown_multisign",
|
|
2662
|
+
actionId: "ethena.cooldown-shares",
|
|
2663
|
+
protocolId: "ethena",
|
|
2664
|
+
chainCategory: "evm",
|
|
2665
|
+
description: "Build sUSDe cooldownShares batch step.",
|
|
2666
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2667
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2668
|
+
handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaSusdeCooldownShares" },
|
|
2669
|
+
inputZod: mcpEthenaCooldownInputSchema
|
|
2670
|
+
}),
|
|
2671
|
+
defineProtocolMcpTool({
|
|
2672
|
+
name: "ctm_ethena_build_claim_multisign",
|
|
2673
|
+
actionId: "ethena.claim-unstake",
|
|
2674
|
+
protocolId: "ethena",
|
|
2675
|
+
chainCategory: "evm",
|
|
2676
|
+
description: "Build unstake claim after cooldown.",
|
|
2677
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2678
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2679
|
+
handler: { importPath: "protocols/evm/ethena", exportName: "buildEvmMultisignBodyEthenaUnstakeClaim" },
|
|
2680
|
+
inputZod: mcpEthenaClaimInputSchema
|
|
2681
|
+
}),
|
|
2682
|
+
defineProtocolMcpTool({
|
|
2683
|
+
name: "ctm_maple_build_deposit_multisign",
|
|
2684
|
+
actionId: "maple-syrup.deposit",
|
|
2685
|
+
protocolId: "maple-syrup",
|
|
2686
|
+
chainCategory: "evm",
|
|
2687
|
+
description: "Build Maple Syrup router deposit batch.",
|
|
2688
|
+
prerequisites: ["keyGen", "executorAddress", "router + pool addresses"],
|
|
2689
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2690
|
+
handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMapleSyrupDeposit" },
|
|
2691
|
+
inputZod: mcpMapleDepositInputSchema
|
|
2692
|
+
}),
|
|
2693
|
+
defineProtocolMcpTool({
|
|
2694
|
+
name: "ctm_maple_build_request_redeem_multisign",
|
|
2695
|
+
actionId: "maple-syrup.request-redeem",
|
|
2696
|
+
protocolId: "maple-syrup",
|
|
2697
|
+
chainCategory: "evm",
|
|
2698
|
+
description: "Build Maple PoolV2 requestRedeem batch.",
|
|
2699
|
+
prerequisites: ["keyGen", "executorAddress", "pool address"],
|
|
2700
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2701
|
+
handler: { importPath: "protocols/evm/maple", exportName: "buildEvmMultisignBodyMaplePoolRequestRedeem" },
|
|
2702
|
+
inputZod: mcpMapleRequestRedeemInputSchema
|
|
2703
|
+
}),
|
|
2704
|
+
defineProtocolMcpTool({
|
|
2705
|
+
name: "ctm_sky_build_lockstake_stake_multisign",
|
|
2706
|
+
actionId: "sky.lockstake-stake",
|
|
2707
|
+
protocolId: "sky",
|
|
2708
|
+
chainCategory: "evm",
|
|
2709
|
+
description: "Build Sky Lockstake open/stake batch.",
|
|
2710
|
+
prerequisites: ["keyGen", "executorAddress", "Ethereum mainnet RPC"],
|
|
2711
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2712
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeStakePositionBatch" },
|
|
2713
|
+
inputZod: mcpSkyLockstakeStakeInputSchema
|
|
2714
|
+
}),
|
|
2715
|
+
defineProtocolMcpTool({
|
|
2716
|
+
name: "ctm_sky_build_lockstake_draw_multisign",
|
|
2717
|
+
actionId: "sky.lockstake-draw",
|
|
2718
|
+
protocolId: "sky",
|
|
2719
|
+
chainCategory: "evm",
|
|
2720
|
+
description: "Build Lockstake draw (borrow USDS).",
|
|
2721
|
+
prerequisites: ["keyGen", "executorAddress", "open urn"],
|
|
2722
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2723
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeDrawBatch" },
|
|
2724
|
+
inputZod: mcpSkyLockstakeDrawInputSchema
|
|
2725
|
+
}),
|
|
2726
|
+
defineProtocolMcpTool({
|
|
2727
|
+
name: "ctm_sky_build_lockstake_wipe_multisign",
|
|
2728
|
+
actionId: "sky.lockstake-wipe",
|
|
2729
|
+
protocolId: "sky",
|
|
2730
|
+
chainCategory: "evm",
|
|
2731
|
+
description: "Build Lockstake repay/wipe batch.",
|
|
2732
|
+
prerequisites: ["keyGen", "executorAddress", "urn index"],
|
|
2733
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2734
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeWipeBatch" },
|
|
2735
|
+
inputZod: mcpSkyLockstakeWipeInputSchema
|
|
2736
|
+
}),
|
|
2737
|
+
defineProtocolMcpTool({
|
|
2738
|
+
name: "ctm_sky_build_lockstake_close_multisign",
|
|
2739
|
+
actionId: "sky.lockstake-close",
|
|
2740
|
+
protocolId: "sky",
|
|
2741
|
+
chainCategory: "evm",
|
|
2742
|
+
description: "Build Lockstake close position batch.",
|
|
2743
|
+
prerequisites: ["keyGen", "executorAddress", "urn index"],
|
|
2744
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2745
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeCloseBatch" },
|
|
2746
|
+
inputZod: mcpSkyLockstakeCloseInputSchema
|
|
2747
|
+
}),
|
|
2748
|
+
defineProtocolMcpTool({
|
|
2749
|
+
name: "ctm_sky_build_lockstake_get_reward_multisign",
|
|
2750
|
+
actionId: "sky.lockstake-get-reward",
|
|
2751
|
+
protocolId: "sky",
|
|
2752
|
+
chainCategory: "evm",
|
|
2753
|
+
description: "Build Lockstake getReward batch.",
|
|
2754
|
+
prerequisites: ["keyGen", "executorAddress", "urn index"],
|
|
2755
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2756
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkyLockstakeGetRewardBatch" },
|
|
2757
|
+
inputZod: mcpSkyLockstakeGetRewardInputSchema
|
|
2758
|
+
}),
|
|
2759
|
+
defineProtocolMcpTool({
|
|
2760
|
+
name: "ctm_sky_build_susds_deposit_multisign",
|
|
2761
|
+
actionId: "sky.susds-deposit",
|
|
2762
|
+
protocolId: "sky",
|
|
2763
|
+
chainCategory: "evm",
|
|
2764
|
+
description: "Build USDS \u2192 sUSDS ERC-4626 deposit batch.",
|
|
2765
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2766
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2767
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsDepositFromUsdsBatch" },
|
|
2768
|
+
inputZod: mcpSkySusdsDepositInputSchema
|
|
2769
|
+
}),
|
|
2770
|
+
defineProtocolMcpTool({
|
|
2771
|
+
name: "ctm_sky_build_susds_redeem_multisign",
|
|
2772
|
+
actionId: "sky.susds-redeem",
|
|
2773
|
+
protocolId: "sky",
|
|
2774
|
+
chainCategory: "evm",
|
|
2775
|
+
description: "Build sUSDS redeem to USDS batch.",
|
|
2776
|
+
prerequisites: ["keyGen", "executorAddress", "RPC URL"],
|
|
2777
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2778
|
+
handler: { importPath: "protocols/evm/sky", exportName: "buildSkySusdsRedeemToUsdsBatch" },
|
|
2779
|
+
inputZod: mcpSkySusdsRedeemInputSchema
|
|
2780
|
+
}),
|
|
2781
|
+
defineProtocolMcpTool({
|
|
2782
|
+
name: "ctm_aave_v4_build_deposit_multisign",
|
|
2783
|
+
actionId: "aave-v4.deposit",
|
|
2784
|
+
protocolId: "aave-v4",
|
|
2785
|
+
chainCategory: "evm",
|
|
2786
|
+
description: "Build Aave v4 Spoke supply/deposit batch.",
|
|
2787
|
+
prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
|
|
2788
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2789
|
+
handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4DepositBatch" },
|
|
2790
|
+
inputZod: mcpAaveV4DepositInputSchema
|
|
2791
|
+
}),
|
|
2792
|
+
defineProtocolMcpTool({
|
|
2793
|
+
name: "ctm_aave_v4_build_withdraw_multisign",
|
|
2794
|
+
actionId: "aave-v4.withdraw",
|
|
2795
|
+
protocolId: "aave-v4",
|
|
2796
|
+
chainCategory: "evm",
|
|
2797
|
+
description: "Build Aave v4 Spoke withdraw batch.",
|
|
2798
|
+
prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
|
|
2799
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2800
|
+
handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeWithdraw" },
|
|
2801
|
+
inputZod: mcpAaveV4WithdrawInputSchema
|
|
2802
|
+
}),
|
|
2803
|
+
defineProtocolMcpTool({
|
|
2804
|
+
name: "ctm_aave_v4_build_borrow_multisign",
|
|
2805
|
+
actionId: "aave-v4.borrow",
|
|
2806
|
+
protocolId: "aave-v4",
|
|
2807
|
+
chainCategory: "evm",
|
|
2808
|
+
description: "Build Aave v4 Spoke borrow batch.",
|
|
2809
|
+
prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
|
|
2810
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2811
|
+
handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeBorrow" },
|
|
2812
|
+
inputZod: mcpAaveV4BorrowInputSchema
|
|
2813
|
+
}),
|
|
2814
|
+
defineProtocolMcpTool({
|
|
2815
|
+
name: "ctm_aave_v4_build_repay_multisign",
|
|
2816
|
+
actionId: "aave-v4.repay",
|
|
2817
|
+
protocolId: "aave-v4",
|
|
2818
|
+
chainCategory: "evm",
|
|
2819
|
+
description: "Build Aave v4 Spoke repay batch.",
|
|
2820
|
+
prerequisites: ["keyGen", "executorAddress", "spoke + underlying"],
|
|
2821
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2822
|
+
handler: { importPath: "protocols/evm/aave-v4", exportName: "buildEvmMultisignBodyAaveV4SpokeRepay" },
|
|
2823
|
+
inputZod: mcpAaveV4RepayInputSchema
|
|
2824
|
+
}),
|
|
2825
|
+
defineProtocolMcpTool({
|
|
2826
|
+
name: "ctm_euler_v2_build_isolated_lend_multisign",
|
|
2827
|
+
actionId: "euler-v2.isolated-lend",
|
|
2828
|
+
protocolId: "euler-v2",
|
|
2829
|
+
chainCategory: "evm",
|
|
2830
|
+
description: "Build Euler v2 vault deposit/lend batch.",
|
|
2831
|
+
prerequisites: ["keyGen", "executorAddress", "vault address"],
|
|
2832
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2833
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedLendDepositBatch" },
|
|
2834
|
+
inputZod: mcpEulerV2IsolatedLendInputSchema
|
|
2835
|
+
}),
|
|
2836
|
+
defineProtocolMcpTool({
|
|
2837
|
+
name: "ctm_euler_v2_build_isolated_borrow_multisign",
|
|
2838
|
+
actionId: "euler-v2.isolated-borrow",
|
|
2839
|
+
protocolId: "euler-v2",
|
|
2840
|
+
chainCategory: "evm",
|
|
2841
|
+
description: "Build Euler v2 isolated borrow loop batch.",
|
|
2842
|
+
prerequisites: ["keyGen", "executorAddress", "vault + collateral"],
|
|
2843
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2844
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2IsolatedBorrowBatch" },
|
|
2845
|
+
inputZod: mcpEulerV2IsolatedBorrowInputSchema
|
|
2846
|
+
}),
|
|
2847
|
+
defineProtocolMcpTool({
|
|
2848
|
+
name: "ctm_euler_v2_build_vault_withdraw_multisign",
|
|
2849
|
+
actionId: "euler-v2.vault-withdraw",
|
|
2850
|
+
protocolId: "euler-v2",
|
|
2851
|
+
chainCategory: "evm",
|
|
2852
|
+
description: "Build Euler v2 vault withdraw/redeem batch.",
|
|
2853
|
+
prerequisites: ["keyGen", "executorAddress", "vault address"],
|
|
2854
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2855
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2VaultWithdrawBatch" },
|
|
2856
|
+
inputZod: mcpEulerV2VaultWithdrawInputSchema
|
|
2857
|
+
}),
|
|
2858
|
+
defineProtocolMcpTool({
|
|
2859
|
+
name: "ctm_euler_v2_build_borrow_repay_multisign",
|
|
2860
|
+
actionId: "euler-v2.borrow-repay",
|
|
2861
|
+
protocolId: "euler-v2",
|
|
2862
|
+
chainCategory: "evm",
|
|
2863
|
+
description: "Build Euler v2 borrow repay batch.",
|
|
2864
|
+
prerequisites: ["keyGen", "executorAddress", "vault address"],
|
|
2865
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2866
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowRepayBatch" },
|
|
2867
|
+
inputZod: mcpEulerV2BorrowRepayInputSchema
|
|
2868
|
+
}),
|
|
2869
|
+
defineProtocolMcpTool({
|
|
2870
|
+
name: "ctm_euler_v2_build_collateral_deposit_multisign",
|
|
2871
|
+
actionId: "euler-v2.collateral-deposit",
|
|
2872
|
+
protocolId: "euler-v2",
|
|
2873
|
+
chainCategory: "evm",
|
|
2874
|
+
description: "Build Euler v2 borrow collateral deposit batch.",
|
|
2875
|
+
prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
|
|
2876
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2877
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralDepositBatch" },
|
|
2878
|
+
inputZod: mcpEulerV2CollateralDepositInputSchema
|
|
2879
|
+
}),
|
|
2880
|
+
defineProtocolMcpTool({
|
|
2881
|
+
name: "ctm_euler_v2_build_collateral_withdraw_multisign",
|
|
2882
|
+
actionId: "euler-v2.collateral-withdraw",
|
|
2883
|
+
protocolId: "euler-v2",
|
|
2884
|
+
chainCategory: "evm",
|
|
2885
|
+
description: "Build Euler v2 borrow collateral withdraw batch.",
|
|
2886
|
+
prerequisites: ["keyGen", "executorAddress", "vault + collateral asset"],
|
|
2887
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2888
|
+
handler: { importPath: "protocols/evm/euler-v2", exportName: "buildEvmMultisignBodyEulerV2BorrowCollateralWithdrawBatch" },
|
|
2889
|
+
inputZod: mcpEulerV2CollateralWithdrawInputSchema
|
|
2890
|
+
})
|
|
2891
|
+
];
|
|
2892
|
+
|
|
2893
|
+
// src/agent/mcpTools.ts
|
|
2894
|
+
function defineMcpTool(def) {
|
|
2895
|
+
return {
|
|
2896
|
+
...def,
|
|
2897
|
+
inputSchema: zodSchemaToMcpJsonSchema(def.inputZod),
|
|
2898
|
+
outputSchema: zodSchemaToMcpJsonSchema(def.outputZod),
|
|
2899
|
+
parseInput: (data) => def.inputZod.parse(data),
|
|
2900
|
+
parseOutput: (data) => def.outputZod.parse(data)
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
var CORE_MCP_TOOL_DEFINITIONS = [
|
|
2904
|
+
defineMcpTool({
|
|
2262
2905
|
name: "ctm_uniswap_v4_quote",
|
|
2263
2906
|
actionId: "uniswap-v4.quote",
|
|
2264
2907
|
protocolId: "uniswap-v4",
|
|
@@ -2267,33 +2910,10 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
2267
2910
|
prerequisites: ["Chain must be supported by Uniswap V4 (Universal Router map)."],
|
|
2268
2911
|
followUp: ["ctm_uniswap_v4_create_swap", "ctm_uniswap_v4_build_swap_multisign"],
|
|
2269
2912
|
handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapTradeQuote" },
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
amount: { type: "string", required: true, description: "Amount in token-in base units (wei string for ERC-20)" },
|
|
2275
|
-
tokenIn: { type: "address", required: true, description: "Input token; 0x0 for native ETH" },
|
|
2276
|
-
tokenOut: { type: "address", required: true, description: "Output token address" },
|
|
2277
|
-
chainId: { type: "number", required: true, description: "tokenInChainId / same-chain default" },
|
|
2278
|
-
uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API x-api-key" },
|
|
2279
|
-
swapper: { type: "address", required: false, description: "MPC executor; omit if keyGen + managementNodeUrl provided" },
|
|
2280
|
-
slippage: { type: "number", required: false, description: "Slippage percent; omit for API auto slippage" }
|
|
2281
|
-
}),
|
|
2282
|
-
required: requiredKeys({
|
|
2283
|
-
type: { type: "string", required: true, description: "" },
|
|
2284
|
-
amount: { type: "string", required: true, description: "" },
|
|
2285
|
-
tokenIn: { type: "address", required: true, description: "" },
|
|
2286
|
-
tokenOut: { type: "address", required: true, description: "" },
|
|
2287
|
-
chainId: { type: "number", required: true, description: "" },
|
|
2288
|
-
uniswapApiKey: { type: "string", required: true, description: "" }
|
|
2289
|
-
})
|
|
2290
|
-
},
|
|
2291
|
-
outputSchema: {
|
|
2292
|
-
type: "object",
|
|
2293
|
-
description: "Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts)."
|
|
2294
|
-
}
|
|
2295
|
-
},
|
|
2296
|
-
{
|
|
2913
|
+
inputZod: mcpUniswapV4QuoteInputSchema,
|
|
2914
|
+
outputZod: mcpUniswapV4QuoteOutputSchema
|
|
2915
|
+
}),
|
|
2916
|
+
defineMcpTool({
|
|
2297
2917
|
name: "ctm_uniswap_v4_create_swap",
|
|
2298
2918
|
actionId: "uniswap-v4.create-swap",
|
|
2299
2919
|
protocolId: "uniswap-v4",
|
|
@@ -2302,33 +2922,10 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
2302
2922
|
prerequisites: ["ctm_uniswap_v4_quote output (fullQuoteFromPermit)"],
|
|
2303
2923
|
followUp: ["ctm_uniswap_v4_build_swap_multisign"],
|
|
2304
2924
|
handler: { importPath: "protocols/evm/uniswap-v4", exportName: "uniswapCreateSwap" },
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
fullQuoteFromPermit: { type: "object", required: true, description: "Full quote JSON from ctm_uniswap_v4_quote" },
|
|
2310
|
-
swapTransactionDeadlineUnix: {
|
|
2311
|
-
type: "number",
|
|
2312
|
-
required: false,
|
|
2313
|
-
description: "On-chain deadline unix seconds; default ~30 min from now"
|
|
2314
|
-
},
|
|
2315
|
-
useServerProxy: {
|
|
2316
|
-
type: "boolean",
|
|
2317
|
-
required: false,
|
|
2318
|
-
description: "Set false in Node/agents; true only in browser via Next API route"
|
|
2319
|
-
}
|
|
2320
|
-
}),
|
|
2321
|
-
required: requiredKeys({
|
|
2322
|
-
uniswapApiKey: { type: "string", required: true, description: "" },
|
|
2323
|
-
fullQuoteFromPermit: { type: "object", required: true, description: "" }
|
|
2324
|
-
})
|
|
2325
|
-
},
|
|
2326
|
-
outputSchema: {
|
|
2327
|
-
type: "object",
|
|
2328
|
-
description: "{ swap: TransactionRequest, requestId?, gasFee? }"
|
|
2329
|
-
}
|
|
2330
|
-
},
|
|
2331
|
-
{
|
|
2925
|
+
inputZod: mcpUniswapV4CreateSwapInputSchema,
|
|
2926
|
+
outputZod: mcpUniswapV4CreateSwapOutputSchema
|
|
2927
|
+
}),
|
|
2928
|
+
defineMcpTool({
|
|
2332
2929
|
name: "ctm_uniswap_v4_build_swap_multisign",
|
|
2333
2930
|
actionId: "uniswap-v4.swap-exact-input",
|
|
2334
2931
|
protocolId: "uniswap-v4",
|
|
@@ -2340,73 +2937,47 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
2340
2937
|
"executorAddress matching MPC wallet",
|
|
2341
2938
|
"RPC URL and chainDetail from node chain config"
|
|
2342
2939
|
],
|
|
2343
|
-
followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig"],
|
|
2940
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
|
|
2344
2941
|
handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
tokenIn: { type: "address", required: true, description: "Token in; 0x0 for native ETH" },
|
|
2350
|
-
swap: { type: "object", required: true, description: "swap field from create_swap response" },
|
|
2351
|
-
createSwapResponse: { type: "object", required: true, description: "Full create_swap response" },
|
|
2352
|
-
fullQuoteSnapshot: { type: "object", required: true, description: "Quote JSON used for the swap" },
|
|
2353
|
-
swapDeadlineUnix: { type: "number", required: true, description: "Same deadline passed to create_swap" },
|
|
2354
|
-
slippagePercent: { type: "number", required: false, description: "Extra approve headroom for EXACT_OUTPUT" }
|
|
2355
|
-
},
|
|
2356
|
-
["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
|
|
2357
|
-
),
|
|
2358
|
-
required: requiredKeys(
|
|
2359
|
-
{
|
|
2360
|
-
tokenIn: { type: "address", required: true, description: "" },
|
|
2361
|
-
swap: { type: "object", required: true, description: "" },
|
|
2362
|
-
createSwapResponse: { type: "object", required: true, description: "" },
|
|
2363
|
-
fullQuoteSnapshot: { type: "object", required: true, description: "" },
|
|
2364
|
-
swapDeadlineUnix: { type: "number", required: true, description: "" }
|
|
2365
|
-
},
|
|
2366
|
-
["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
|
|
2367
|
-
)
|
|
2368
|
-
},
|
|
2369
|
-
outputSchema: multisignOutputSchema
|
|
2370
|
-
},
|
|
2371
|
-
{
|
|
2942
|
+
inputZod: mcpUniswapV4BuildSwapMultisignInputSchema,
|
|
2943
|
+
outputZod: multisignOutputSchema
|
|
2944
|
+
}),
|
|
2945
|
+
defineMcpTool({
|
|
2372
2946
|
name: "ctm_curve_dao_build_swap_multisign",
|
|
2373
2947
|
actionId: "curve-dao.swap",
|
|
2374
2948
|
protocolId: "curve-dao",
|
|
2375
2949
|
chainCategory: "evm",
|
|
2376
2950
|
description: "Build mpc-auth multiSignRequest for a Curve Router NG swap via @curvefi/api populateSwap. Optionally batches ERC-20 approve txs when allowance is insufficient, then exchange. Requires JSON-RPC and Curve-supported chain.",
|
|
2377
2951
|
prerequisites: ["keyGen", "executorAddress", "tokenIn/tokenOut/amountHuman/slippage", "RPC URL"],
|
|
2378
|
-
followUp: ["Sign messageToSign", "POST /multiSignRequest"],
|
|
2952
|
+
followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
|
|
2379
2953
|
handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
slippagePercent: { type: "number", required: true, description: "Slippage 0\u2013100 exclusive" }
|
|
2388
|
-
},
|
|
2389
|
-
["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail", "customGasChainDetails"]
|
|
2390
|
-
),
|
|
2391
|
-
required: requiredKeys(
|
|
2392
|
-
{
|
|
2393
|
-
tokenIn: { type: "address", required: true, description: "" },
|
|
2394
|
-
tokenOut: { type: "string", required: true, description: "" },
|
|
2395
|
-
amountHuman: { type: "string", required: true, description: "" },
|
|
2396
|
-
slippagePercent: { type: "number", required: true, description: "" }
|
|
2397
|
-
},
|
|
2398
|
-
["keyGen", "purposeText", "useCustomGas", "chainId", "rpcUrl", "executorAddress", "chainDetail"]
|
|
2399
|
-
)
|
|
2400
|
-
},
|
|
2401
|
-
outputSchema: multisignOutputSchema
|
|
2402
|
-
}
|
|
2954
|
+
inputZod: mcpCurveDaoBuildSwapMultisignInputSchema,
|
|
2955
|
+
outputZod: multisignOutputSchema
|
|
2956
|
+
})
|
|
2957
|
+
];
|
|
2958
|
+
var MCP_TOOL_DEFINITIONS = [
|
|
2959
|
+
...CORE_MCP_TOOL_DEFINITIONS,
|
|
2960
|
+
...MCP_PROTOCOL_TOOL_DEFINITIONS
|
|
2403
2961
|
];
|
|
2962
|
+
function buildToolSchemaMap(kind) {
|
|
2963
|
+
const out = {};
|
|
2964
|
+
for (const tool of MCP_TOOL_DEFINITIONS) {
|
|
2965
|
+
out[tool.name] = kind === "input" ? tool.inputZod : tool.outputZod;
|
|
2966
|
+
}
|
|
2967
|
+
return out;
|
|
2968
|
+
}
|
|
2969
|
+
var MCP_TOOL_INPUT_SCHEMAS = buildToolSchemaMap("input");
|
|
2970
|
+
var MCP_TOOL_OUTPUT_SCHEMAS = buildToolSchemaMap("output");
|
|
2404
2971
|
function getAgentCatalogForMcp() {
|
|
2405
2972
|
return {
|
|
2406
2973
|
tools: MCP_TOOL_DEFINITIONS,
|
|
2407
2974
|
protocols: getProtocolModules(),
|
|
2408
2975
|
commonParams: EVM_COMMON_PARAM_DOCS,
|
|
2409
2976
|
multisignOutput: MULTISIGN_OUTPUT_DOC,
|
|
2977
|
+
managementSig: MANAGEMENT_SIG_DOC,
|
|
2978
|
+
/** Zod schemas for MCP tool I/O — source of truth for continuum-mcp-server validation. */
|
|
2979
|
+
inputSchemas: MCP_TOOL_INPUT_SCHEMAS,
|
|
2980
|
+
outputSchemas: MCP_TOOL_OUTPUT_SCHEMAS,
|
|
2410
2981
|
workflow: {
|
|
2411
2982
|
evmSwapTypical: [
|
|
2412
2983
|
"1. Quote (protocol-specific API if needed)",
|
|
@@ -2414,14 +2985,222 @@ function getAgentCatalogForMcp() {
|
|
|
2414
2985
|
"3. build_*_multisign \u2192 { bodyForSign, messageToSign }",
|
|
2415
2986
|
"4. Sign messageToSign (MetaMask or Ed25519)",
|
|
2416
2987
|
"5. POST /multiSignRequest with clientSig and signedMessage"
|
|
2988
|
+
],
|
|
2989
|
+
managementPostTypical: [
|
|
2990
|
+
"1. GET /getNodeKey \u2192 nodeKey (128 hex)",
|
|
2991
|
+
"2. GET /getPublicMgtKeyNonce or /getNodeMgtKeyNonce \u2192 nonce",
|
|
2992
|
+
"3. buildManagementPostBody(nonce, nodeKey, { \u2026endpoint fields })",
|
|
2993
|
+
"4. messageToSignManagementBody(body) \u2192 sign \u2192 withManagementClientSig(body, sig)",
|
|
2994
|
+
"5. POST management route with signed body"
|
|
2417
2995
|
]
|
|
2418
2996
|
}
|
|
2419
2997
|
};
|
|
2420
2998
|
}
|
|
2999
|
+
getAddress(
|
|
3000
|
+
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
|
|
3001
|
+
);
|
|
3002
|
+
getAddress(
|
|
3003
|
+
"0x7f39C581F595B853cBbF37C12FfeeA971C5a5bEa"
|
|
3004
|
+
);
|
|
3005
|
+
getAddress("0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1");
|
|
3006
|
+
var LIDO_ETHEREUM_MAINNET_CHAIN_ID = 1;
|
|
3007
|
+
|
|
3008
|
+
// src/protocols/evm/lido/index.ts
|
|
3009
|
+
var LIDO_PROTOCOL_ID = "lido";
|
|
3010
|
+
var lidoProtocolModule = {
|
|
3011
|
+
id: LIDO_PROTOCOL_ID,
|
|
3012
|
+
chainCategory: "evm",
|
|
3013
|
+
isChainSupported(ctx) {
|
|
3014
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3015
|
+
return Number(ctx.chainId) === LIDO_ETHEREUM_MAINNET_CHAIN_ID;
|
|
3016
|
+
},
|
|
3017
|
+
isTokenSupported(token) {
|
|
3018
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
3019
|
+
},
|
|
3020
|
+
actions: [
|
|
3021
|
+
{ id: "lido.submit", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Stake ETH via Lido submit()", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { valueWei: { type: "string", required: true, description: "ETH to stake (wei string)" } } },
|
|
3022
|
+
{ id: "lido.request-withdrawals", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Queue stETH withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3023
|
+
{ id: "lido.claim-withdrawal", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Claim finalized withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3024
|
+
{ id: "lido.wrap-steth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Wrap stETH to wstETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3025
|
+
{ id: "lido.unwrap-wsteth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Unwrap wstETH to stETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3026
|
+
]
|
|
3027
|
+
};
|
|
3028
|
+
registerProtocolModule(lidoProtocolModule);
|
|
3029
|
+
var USDE_ETHEREUM_MAINNET = "0x4c9edd5852cd905f086c759e8383e09bff1e68b3";
|
|
3030
|
+
var USDE_MOST_L2S = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
|
|
3031
|
+
var USDE_ZKSYNC_ERA = "0x39Fe7a0DACcE31Bd90418e3e659fb0b5f0B3Db0d";
|
|
3032
|
+
var L2_SAME_ADDRESS_CHAIN_IDS = /* @__PURE__ */ new Set([
|
|
3033
|
+
42161,
|
|
3034
|
+
// Arbitrum One
|
|
3035
|
+
10,
|
|
3036
|
+
// Optimism
|
|
3037
|
+
8453,
|
|
3038
|
+
// Base
|
|
3039
|
+
56,
|
|
3040
|
+
// BNB Chain
|
|
3041
|
+
59144,
|
|
3042
|
+
// Linea
|
|
3043
|
+
5e3,
|
|
3044
|
+
// Mantle
|
|
3045
|
+
81457,
|
|
3046
|
+
// Blast
|
|
3047
|
+
169,
|
|
3048
|
+
// Manta Pacific
|
|
3049
|
+
534352,
|
|
3050
|
+
// Scroll
|
|
3051
|
+
252,
|
|
3052
|
+
// Fraxtal
|
|
3053
|
+
34443,
|
|
3054
|
+
// Mode
|
|
3055
|
+
196,
|
|
3056
|
+
// X Layer
|
|
3057
|
+
1088,
|
|
3058
|
+
// Metis
|
|
3059
|
+
80084,
|
|
3060
|
+
// Berachain
|
|
3061
|
+
2222,
|
|
3062
|
+
// Kava
|
|
3063
|
+
2818,
|
|
3064
|
+
// Morph
|
|
3065
|
+
1923,
|
|
3066
|
+
// Swell
|
|
3067
|
+
48900
|
|
3068
|
+
// Zircuit
|
|
3069
|
+
]);
|
|
3070
|
+
function usdeTokenAddressOnEvmChain(chainId) {
|
|
3071
|
+
if (chainId === 1) return USDE_ETHEREUM_MAINNET;
|
|
3072
|
+
if (chainId === 324) return USDE_ZKSYNC_ERA;
|
|
3073
|
+
if (L2_SAME_ADDRESS_CHAIN_IDS.has(chainId)) return USDE_MOST_L2S;
|
|
3074
|
+
return null;
|
|
3075
|
+
}
|
|
3076
|
+
function isEvmChainInEthenaUsdeList(chainId) {
|
|
3077
|
+
return usdeTokenAddressOnEvmChain(chainId) != null;
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
// src/protocols/evm/ethena/index.ts
|
|
3081
|
+
var ETHENA_PROTOCOL_ID = "ethena";
|
|
3082
|
+
var ethenaProtocolModule = {
|
|
3083
|
+
id: ETHENA_PROTOCOL_ID,
|
|
3084
|
+
chainCategory: "evm",
|
|
3085
|
+
isChainSupported(ctx) {
|
|
3086
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3087
|
+
const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
|
|
3088
|
+
return isEvmChainInEthenaUsdeList(n);
|
|
3089
|
+
},
|
|
3090
|
+
isTokenSupported(token) {
|
|
3091
|
+
return token.category === "evm" && token.kind === "erc20";
|
|
3092
|
+
},
|
|
3093
|
+
actions: [
|
|
3094
|
+
{ id: "ethena.stake-usde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Stake USDe \u2192 sUSDe", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { amountHuman: { type: "string", required: true, description: "USDe amount" } } },
|
|
3095
|
+
{ id: "ethena.redeem-susde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDe \u2192 USDe (no cooldown)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3096
|
+
{ id: "ethena.cooldown-shares", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Start sUSDe cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3097
|
+
{ id: "ethena.claim-unstake", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Claim after cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3098
|
+
]
|
|
3099
|
+
};
|
|
3100
|
+
registerProtocolModule(ethenaProtocolModule);
|
|
3101
|
+
|
|
3102
|
+
// src/protocols/evm/maple/constants.ts
|
|
3103
|
+
function isMapleSyrupSupportedChain(chainId) {
|
|
3104
|
+
return chainId === 1 || chainId === 11155111;
|
|
3105
|
+
}
|
|
3106
|
+
|
|
3107
|
+
// src/protocols/evm/maple/index.ts
|
|
3108
|
+
var MAPLE_PROTOCOL_ID = "maple-syrup";
|
|
3109
|
+
var mapleProtocolModule = {
|
|
3110
|
+
id: MAPLE_PROTOCOL_ID,
|
|
3111
|
+
chainCategory: "evm",
|
|
3112
|
+
isChainSupported(ctx) {
|
|
3113
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3114
|
+
const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
|
|
3115
|
+
return isMapleSyrupSupportedChain(n);
|
|
3116
|
+
},
|
|
3117
|
+
isTokenSupported(token) {
|
|
3118
|
+
return token.category === "evm" && token.kind === "erc20";
|
|
3119
|
+
},
|
|
3120
|
+
actions: [
|
|
3121
|
+
{ id: "maple-syrup.deposit", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Maple Syrup pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3122
|
+
{ id: "maple-syrup.request-redeem", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Request redeem from pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3123
|
+
]
|
|
3124
|
+
};
|
|
3125
|
+
registerProtocolModule(mapleProtocolModule);
|
|
3126
|
+
|
|
3127
|
+
// src/protocols/evm/sky/mainnet.ts
|
|
3128
|
+
var SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
|
|
3129
|
+
|
|
3130
|
+
// src/protocols/evm/sky/index.ts
|
|
3131
|
+
var SKY_PROTOCOL_ID = "sky";
|
|
3132
|
+
var skyProtocolModule = {
|
|
3133
|
+
id: SKY_PROTOCOL_ID,
|
|
3134
|
+
chainCategory: "evm",
|
|
3135
|
+
isChainSupported(ctx) {
|
|
3136
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3137
|
+
return Number(ctx.chainId) === SKY_ETHEREUM_MAINNET_CHAIN_ID;
|
|
3138
|
+
},
|
|
3139
|
+
isTokenSupported(token) {
|
|
3140
|
+
return token.category === "evm" && token.kind === "erc20";
|
|
3141
|
+
},
|
|
3142
|
+
actions: [
|
|
3143
|
+
{ id: "sky.lockstake-stake", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Open Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3144
|
+
{ id: "sky.lockstake-draw", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Borrow USDS from Lockstake", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3145
|
+
{ id: "sky.lockstake-wipe", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Repay Lockstake debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3146
|
+
{ id: "sky.lockstake-close", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Close Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3147
|
+
{ id: "sky.susds-deposit", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Deposit USDS into sUSDS vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3148
|
+
{ id: "sky.susds-redeem", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDS to USDS", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3149
|
+
]
|
|
3150
|
+
};
|
|
3151
|
+
registerProtocolModule(skyProtocolModule);
|
|
3152
|
+
|
|
3153
|
+
// src/protocols/evm/aave-v4/index.ts
|
|
3154
|
+
var AAVE_V4_PROTOCOL_ID = "aave-v4";
|
|
3155
|
+
var aaveV4ProtocolModule = {
|
|
3156
|
+
id: AAVE_V4_PROTOCOL_ID,
|
|
3157
|
+
chainCategory: "evm",
|
|
3158
|
+
isChainSupported(ctx) {
|
|
3159
|
+
return ctx.chainCategory === "evm";
|
|
3160
|
+
},
|
|
3161
|
+
isTokenSupported(token) {
|
|
3162
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
3163
|
+
},
|
|
3164
|
+
actions: [
|
|
3165
|
+
{ id: "aave-v4.deposit", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Supply to Aave v4 Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3166
|
+
{ id: "aave-v4.withdraw", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3167
|
+
{ id: "aave-v4.borrow", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3168
|
+
{ id: "aave-v4.repay", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Repay Spoke debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3169
|
+
]
|
|
3170
|
+
};
|
|
3171
|
+
registerProtocolModule(aaveV4ProtocolModule);
|
|
3172
|
+
|
|
3173
|
+
// src/protocols/evm/euler-v2/index.ts
|
|
3174
|
+
var EULER_V2_PROTOCOL_ID = "euler-v2";
|
|
3175
|
+
var eulerV2ProtocolModule = {
|
|
3176
|
+
id: EULER_V2_PROTOCOL_ID,
|
|
3177
|
+
chainCategory: "evm",
|
|
3178
|
+
isChainSupported(ctx) {
|
|
3179
|
+
return ctx.chainCategory === "evm";
|
|
3180
|
+
},
|
|
3181
|
+
isTokenSupported(token) {
|
|
3182
|
+
return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
|
|
3183
|
+
},
|
|
3184
|
+
actions: [
|
|
3185
|
+
{ id: "euler-v2.isolated-lend", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3186
|
+
{ id: "euler-v2.isolated-borrow", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3187
|
+
{ id: "euler-v2.vault-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3188
|
+
{ id: "euler-v2.borrow-repay", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Repay Euler borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3189
|
+
{ id: "euler-v2.collateral-deposit", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3190
|
+
{ id: "euler-v2.collateral-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3191
|
+
]
|
|
3192
|
+
};
|
|
3193
|
+
registerProtocolModule(eulerV2ProtocolModule);
|
|
2421
3194
|
|
|
2422
3195
|
// src/agent/catalog.ts
|
|
2423
3196
|
registerProtocolModule(uniswapV4ProtocolModule);
|
|
2424
3197
|
registerProtocolModule(curveDaoProtocolModule);
|
|
3198
|
+
registerProtocolModule(lidoProtocolModule);
|
|
3199
|
+
registerProtocolModule(ethenaProtocolModule);
|
|
3200
|
+
registerProtocolModule(mapleProtocolModule);
|
|
3201
|
+
registerProtocolModule(skyProtocolModule);
|
|
3202
|
+
registerProtocolModule(aaveV4ProtocolModule);
|
|
3203
|
+
registerProtocolModule(eulerV2ProtocolModule);
|
|
2425
3204
|
function getAgentCatalog() {
|
|
2426
3205
|
return {
|
|
2427
3206
|
protocols: getProtocolModules(),
|
|
@@ -2432,6 +3211,12 @@ function getAgentCatalog() {
|
|
|
2432
3211
|
},
|
|
2433
3212
|
uniswapV4: uniswapV4ProtocolModule,
|
|
2434
3213
|
curveDao: curveDaoProtocolModule,
|
|
3214
|
+
lido: lidoProtocolModule,
|
|
3215
|
+
ethena: ethenaProtocolModule,
|
|
3216
|
+
maple: mapleProtocolModule,
|
|
3217
|
+
sky: skyProtocolModule,
|
|
3218
|
+
aaveV4: aaveV4ProtocolModule,
|
|
3219
|
+
eulerV2: eulerV2ProtocolModule,
|
|
2435
3220
|
/** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
|
|
2436
3221
|
mcp: getAgentCatalogForMcp()
|
|
2437
3222
|
};
|
|
@@ -2441,6 +3226,6 @@ function getAgentCatalog() {
|
|
|
2441
3226
|
registerProtocolModule(uniswapV4ProtocolModule);
|
|
2442
3227
|
registerProtocolModule(curveDaoProtocolModule);
|
|
2443
3228
|
|
|
2444
|
-
export { NEAR_CHAIN_CATEGORY, SOLANA_CHAIN_CATEGORY, alignEip1559FeesWithLatestBase, buildEvmMultisignBatch, chainSnapshotForCustomGasExtraJSON, composeFeePayloadToTxParams, coreChainCategoryModule, curveDao, curveDaoProtocolModule, evmChainCategoryModule, fetchChainFeeParams, finalizeMultisign, firstClientIdFromKeyGen, gasLimitFromEstimateAndChainConfig, getActionsByChainCategory, getAgentCatalog, getProtocolModule, getProtocolModules, gweiToDecimalString, isEvmNativeToken, keyListFromKeyGen, matchEvmTokenKind, mergePurposeText, nearChainCategoryModule, nodeFetchWithReadAuth, parseEvmChainIdToNumber, proposalTxParamsToFeeSnapshot, registerProtocolModule, requirePubKeyHex, routerSwapGasLimitFromEstimate, solanaChainCategoryModule, triggerTxParamsFromComposeBody, uniswapV4, uniswapV4ProtocolModule };
|
|
3229
|
+
export { NEAR_CHAIN_CATEGORY, SOLANA_CHAIN_CATEGORY, alignEip1559FeesWithLatestBase, buildEvmMultisignBatch, buildManagementPostBody, chainSnapshotForCustomGasExtraJSON, composeFeePayloadToTxParams, coreChainCategoryModule, curveDao, curveDaoProtocolModule, evmChainCategoryModule, fetchChainFeeParams, fetchManagementNonce, fetchNodeKey, finalizeMultisign, firstClientIdFromKeyGen, gasLimitFromEstimateAndChainConfig, getActionsByChainCategory, getAgentCatalog, getProtocolModule, getProtocolModules, gweiToDecimalString, isEvmNativeToken, isValidRpcUrl, keyListFromKeyGen, managementSigFields, matchEvmTokenKind, mergePurposeText, messageToSignManagementBody, nearChainCategoryModule, nodeFetchWithReadAuth, normalizeManagementNodeKey, parseEvmChainIdToNumber, proposalTxParamsToFeeSnapshot, registerProtocolModule, requirePubKeyHex, routerSwapGasLimitFromEstimate, solanaChainCategoryModule, triggerTxParamsFromComposeBody, uniswapV4, uniswapV4ProtocolModule, withManagementClientSig };
|
|
2445
3230
|
//# sourceMappingURL=index.js.map
|
|
2446
3231
|
//# sourceMappingURL=index.js.map
|