@continuumdao/ctm-mpc-defi 0.1.3 → 0.1.4

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 CHANGED
@@ -8,7 +8,7 @@ Continuum MPC DeFi protocol library — builds **multiSignRequest** payloads for
8
8
 
9
9
  | Layer | Path | Role |
10
10
  |-------|------|------|
11
- | Core | `src/core/` | KeyGen, purpose, mpc-auth envelope, registry |
11
+ | Core | `src/core/` | KeyGen, purpose, mpc-auth envelope, **management POST sig**, registry |
12
12
  | Chain categories | `src/chains/<category>/` | EVM batch builder, fees; Solana/NEAR stubs |
13
13
  | Protocols | `src/protocols/<category>/<name>/` | DeFi actions (Uniswap V4, Curve DAO, …) |
14
14
 
@@ -52,6 +52,21 @@ const quote = await uniswapV4.quote({
52
52
 
53
53
  const { bodyForSign, messageToSign } = await uniswapV4.buildSwapMultisignBody({ /* … */ })
54
54
  // Sign messageToSign, POST { ...bodyForSign, clientSig, signedMessage }
55
+
56
+ // Management POST routes (Get Sig, shelve, keyGen, …) use NodeMgtKeySig:
57
+ import {
58
+ buildManagementPostBody,
59
+ fetchManagementNonce,
60
+ fetchNodeKey,
61
+ messageToSignManagementBody,
62
+ withManagementClientSig,
63
+ } from '@continuumdao/ctm-mpc-defi/core'
64
+
65
+ const { nodeKey } = await fetchNodeKey(managementNodeUrl)
66
+ const { nonce } = await fetchManagementNonce(managementNodeUrl, true, ed25519PublicKey)
67
+ const body = buildManagementPostBody(nonce, nodeKey, { requestId: '…' })
68
+ const messageToSign = messageToSignManagementBody(body)
69
+ // sign messageToSign → POST with withManagementClientSig(body, sig)
55
70
  ```
56
71
 
57
72
  ## Agent catalog
@@ -247,6 +247,31 @@ var MULTISIGN_OUTPUT_DOC = {
247
247
  }
248
248
  }
249
249
  };
250
+ var MANAGEMENT_SIG_DOC = {
251
+ 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.",
252
+ fields: {
253
+ nonce: {
254
+ type: "number",
255
+ description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey)."
256
+ },
257
+ clientSig: {
258
+ type: "string",
259
+ description: "Management signature; empty string in the message to sign."
260
+ },
261
+ nodeKey: {
262
+ type: "string",
263
+ description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix)."
264
+ }
265
+ },
266
+ helpers: {
267
+ managementSigFields: "Base envelope with clientSig cleared.",
268
+ buildManagementPostBody: "Spread managementSigFields then endpoint fields.",
269
+ messageToSignManagementBody: "Canonical JSON string to sign.",
270
+ withManagementClientSig: "Attach signature to POST body.",
271
+ fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.",
272
+ fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key."
273
+ }
274
+ };
250
275
 
251
276
  // src/agent/mcpTools.ts
252
277
  function paramProperties(params, includeCommon = []) {
@@ -368,7 +393,7 @@ var MCP_TOOL_DEFINITIONS = [
368
393
  "executorAddress matching MPC wallet",
369
394
  "RPC URL and chainDetail from node chain config"
370
395
  ],
371
- followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig"],
396
+ followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
372
397
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
373
398
  inputSchema: {
374
399
  type: "object",
@@ -403,7 +428,7 @@ var MCP_TOOL_DEFINITIONS = [
403
428
  chainCategory: "evm",
404
429
  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.",
405
430
  prerequisites: ["keyGen", "executorAddress", "tokenIn/tokenOut/amountHuman/slippage", "RPC URL"],
406
- followUp: ["Sign messageToSign", "POST /multiSignRequest"],
431
+ followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
407
432
  handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
408
433
  inputSchema: {
409
434
  type: "object",
@@ -441,6 +466,7 @@ function getAgentCatalogForMcp() {
441
466
  protocols: getProtocolModules(),
442
467
  commonParams: EVM_COMMON_PARAM_DOCS,
443
468
  multisignOutput: MULTISIGN_OUTPUT_DOC,
469
+ managementSig: MANAGEMENT_SIG_DOC,
444
470
  workflow: {
445
471
  evmSwapTypical: [
446
472
  "1. Quote (protocol-specific API if needed)",
@@ -448,6 +474,13 @@ function getAgentCatalogForMcp() {
448
474
  "3. build_*_multisign \u2192 { bodyForSign, messageToSign }",
449
475
  "4. Sign messageToSign (MetaMask or Ed25519)",
450
476
  "5. POST /multiSignRequest with clientSig and signedMessage"
477
+ ],
478
+ managementPostTypical: [
479
+ "1. GET /getNodeKey \u2192 nodeKey (128 hex)",
480
+ "2. GET /getPublicMgtKeyNonce or /getNodeMgtKeyNonce \u2192 nonce",
481
+ "3. buildManagementPostBody(nonce, nodeKey, { \u2026endpoint fields })",
482
+ "4. messageToSignManagementBody(body) \u2192 sign \u2192 withManagementClientSig(body, sig)",
483
+ "5. POST management route with signed body"
451
484
  ]
452
485
  }
453
486
  };
@@ -472,6 +505,7 @@ function getAgentCatalog() {
472
505
  }
473
506
 
474
507
  exports.EVM_COMMON_PARAM_DOCS = EVM_COMMON_PARAM_DOCS;
508
+ exports.MANAGEMENT_SIG_DOC = MANAGEMENT_SIG_DOC;
475
509
  exports.MCP_TOOL_DEFINITIONS = MCP_TOOL_DEFINITIONS;
476
510
  exports.MULTISIGN_OUTPUT_DOC = MULTISIGN_OUTPUT_DOC;
477
511
  exports.getActionsByChainCategory = getActionsByChainCategory;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/registry.ts","../../src/chains/evm/chainIdParse.ts","../../src/protocols/evm/uniswap-v4/constants.ts","../../src/protocols/evm/uniswap-v4/index.ts","../../src/protocols/evm/curve-dao/support.ts","../../src/protocols/evm/curve-dao/index.ts","../../src/agent/commonParamDocs.ts","../../src/agent/mcpTools.ts","../../src/agent/catalog.ts"],"names":[],"mappings":";;;;;AAEA,IAAM,UAA4B,EAAC;AAE5B,SAAS,uBAAuB,GAAA,EAA2B;AAChE,EAAA,MAAM,QAAA,GAAW,QAAQ,SAAA,CAAU,CAAC,MAAM,CAAA,CAAE,EAAA,KAAO,IAAI,EAAE,CAAA;AACzD,EAAA,IAAI,YAAY,CAAA,EAAG;AACjB,IAAA,OAAA,CAAQ,QAAQ,CAAA,GAAI,GAAA;AAAA,EACtB,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,EAClB;AACF;AAEO,SAAS,kBAAA,GAAgD;AAC9D,EAAA,OAAO,OAAA;AACT;AAMO,SAAS,0BAA0B,QAAA,EAA6C;AACrF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,aAAA,KAAkB,QAAQ,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,CAAA;AACrF;;;ACtBO,SAAS,wBAAwB,OAAA,EAA8D;AACpG,EAAA,IAAI,OAAA,IAAW,IAAA,EAAM,OAAO,MAAA,CAAO,GAAA;AACnC,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,MAAM,CAAA,GAAI,OAAO,OAAO,CAAA;AACxB,IAAA,OAAO,OAAO,aAAA,CAAc,CAAC,KAAK,CAAA,IAAK,CAAA,GAAI,IAAI,MAAA,CAAO,GAAA;AAAA,EACxD;AACA,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,OAAO,OAAO,SAAA,CAAU,OAAO,KAAK,OAAA,IAAW,CAAA,GAAI,UAAU,MAAA,CAAO,GAAA;AAAA,EACtE;AACA,EAAA,MAAM,CAAA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,oBAAA;AAAA,IACjB,QAAA,EAAU;AAAA,MACR,cAAA,EAAgB;AAAA,QACd,4CAAA;AAAA,QACA,+CAAA;AAAA,QACA,4DAAA;AAAA,QACA,6CAAA;AAAA,QACA;AAAA;AACF;AACF,GACF;AACF;;;AC3PA,sBAAA,CAAuB,uBAAuB,CAAA;AAC9C,sBAAA,CAAuB,sBAAsB,CAAA;AAGtC,SAAS,eAAA,GAAkB;AAChC,EAAA,OAAO;AAAA,IACL,WAAW,kBAAA,EAAmB;AAAA,IAC9B,UAAA,EAAY;AAAA,MACV,GAAA,EAAK,0BAA0B,KAAK,CAAA;AAAA,MACpC,MAAA,EAAQ,0BAA0B,QAAQ,CAAA;AAAA,MAC1C,IAAA,EAAM,0BAA0B,MAAM;AAAA,KACxC;AAAA,IACA,SAAA,EAAW,uBAAA;AAAA,IACX,QAAA,EAAU,sBAAA;AAAA;AAAA,IAEV,KAAK,qBAAA;AAAsB,GAC7B;AACF","file":"catalog.cjs","sourcesContent":["import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/** Parse chain id for comparisons (decimal, 0x hex, CAIP-2 eip155:N, bigint). */\nexport function parseEvmChainIdToNumber(chainId: string | number | bigint | null | undefined): number {\n if (chainId == null) return Number.NaN\n if (typeof chainId === 'bigint') {\n const n = Number(chainId)\n return Number.isSafeInteger(n) && n >= 0 ? n : Number.NaN\n }\n if (typeof chainId === 'number') {\n return Number.isInteger(chainId) && chainId >= 0 ? chainId : Number.NaN\n }\n const t = String(chainId).trim()\n if (!t) return Number.NaN\n const low = t.toLowerCase()\n if (low.startsWith('eip155:')) {\n const rest = t.slice('eip155:'.length).trim()\n const n = Number.parseInt(rest, 10)\n return Number.isNaN(n) || n < 0 ? Number.NaN : n\n }\n if (low.startsWith('0x')) {\n return Number.parseInt(t, 16)\n }\n return Number.parseInt(t, 10)\n}\n","import { getAddress, type Address } from 'viem'\nimport { parseEvmChainIdToNumber } from '../../../chains/evm/chainIdParse.js'\n\n/** Canonical Uniswap token-allowance contract on most EVM chains. */\nexport const PERMIT2_ADDRESS: Address = '0x000000000022D473030F116dDEE9F6B43aC78BA3'\n\nconst UNIVERSAL_ROUTER_SPENDER: Partial<Record<number, string>> = {\n 1: '0x66a9893cc07d91d95644aedd05d03f95e1dba8af',\n 5: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 11155111: '0x3a9d48ab9751398bbfa63ad67599bb04e4bdf98b',\n 137: '0x1095692a6237d83c6a72f3f5efedb9a670c49223',\n 80001: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 10: '0x851116d9223fabed8e56c0e6b8ad0c31d98b3507',\n 420: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 42161: '0xa51afafe0263b40edaef0df8781ea9aa03e381a3',\n 421613: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 42220: '0xcb695bc5D3Aa22cAD1E6DF07801b061a05A0233A',\n 44787: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 56: '0x1906c1d672b88cd1b9ac7593301ca990f94eae07',\n 43114: '0x94b75331ae8d42c1b61065089b7d48fe14aa73b7',\n 84531: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',\n 8453: '0x6fF5693b99212da76ad316178a184ab56d299b43',\n 81457: '0xeabbcb3e8e415306207ef514f660a3f820025be3',\n 7777777: '0x3315ef7ca28db74abadc6c44570efdf06b04b020',\n 324: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',\n 480: '0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743',\n 1301: '0xf70536b3bcc1bd1a972dc186a2cf84cc6da6be5d',\n 130: '0xef740bf23acae26f6492b10de645d6b98dc8eaf3',\n 10143: '0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893',\n 84532: '0x492e6456d9528771018deb9e87ef7750ef184104',\n 1868: '0x0e2850543f69f678257266e0907ff9a58b3f13de',\n 143: '0x0d97dc33264bfc1c226207428a79b26757fb9dc3',\n 59144: '0x661e93cca42afacb172121ef892830ca3b70f08d',\n 4217: '0x1febb76be10aaf3a1402f04e8e835f2c382f7914',\n 196: '0x5507749f2c558bb3e162c6e90c314c092e7372ff',\n}\n\nexport function isUniswapV4ChainSupported(chainId: string | number | bigint | null | undefined): boolean {\n if (chainId == null) return false\n const n = parseEvmChainIdToNumber(chainId)\n if (Number.isNaN(n) || n < 0) return false\n const a = UNIVERSAL_ROUTER_SPENDER[n]\n return typeof a === 'string' && a.startsWith('0x')\n}\n\nexport function getUniswapUniversalRouterSpenderOrThrow(chainId: number): Address {\n const raw = UNIVERSAL_ROUTER_SPENDER[chainId]\n if (!raw || !raw.startsWith('0x')) {\n throw new Error(\n `No Uniswap Universal Router (spender) is configured for chainId ${chainId}. Add this chain to uniswap-v4/constants or use a chain supported by the Uniswap SDK.`,\n )\n }\n return getAddress(raw)\n}\n\nexport const MAX_UINT160 = (1n << 160n) - 1n\nexport const MAX_UINT48 = (1n << 48n) - 1n\n\nexport const UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS = 1_500_000n\nexport const UNISWAP_TRADE_BASE_DEFAULT = 'https://trade-api.gateway.uniswap.org/v1'\nexport const UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT = '2.0'\nexport const UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES = 30\nexport const UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET = UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES * 60\n","import type { ProtocolModule } from '../../../core/types.js'\nimport { registerProtocolModule } from '../../../core/registry.js'\nimport { isUniswapV4ChainSupported } from './constants.js'\n\nexport * from './constants.js'\nexport * from './quote.js'\nexport * from './swapMultisign.js'\nexport * from './purpose.js'\nexport * from './support.js'\nexport * from './swap.js'\n\nexport {\n isUniswapV4SwapEvmSignRequest,\n resolveRouterSwapGasUnitsFromSignRequest,\n} from './swapMultisign.js'\n\nexport const UNISWAP_V4_PROTOCOL_ID = 'uniswap-v4'\n\nexport const uniswapV4ProtocolModule: ProtocolModule = {\n id: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n isChainSupported(ctx) {\n if (ctx.chainCategory !== 'evm') return false\n return isUniswapV4ChainSupported(ctx.chainId)\n },\n isTokenSupported(token) {\n if (token.category !== 'evm') return false\n return token.kind === 'native' || token.kind === 'erc20'\n },\n actions: [\n {\n id: 'uniswap-v4.swap-exact-input',\n protocolId: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Swap ERC-20 or native token via Uniswap V4 Universal Router (classic allowance path)',\n commonParams: ['keyGen', 'purposeText', 'useCustomGas'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'Input token (0x0 for native)' },\n tokenOut: { type: 'address', required: true, description: 'Output token address' },\n amount: { type: 'string', required: true, description: 'Human or wei amount per trade type' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage tolerance percent' },\n swapTransactionDeadlineUnix: {\n type: 'number',\n required: false,\n description: 'On-chain swap deadline (unix seconds)',\n },\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API key' },\n },\n },\n {\n id: 'uniswap-v4.quote',\n protocolId: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Fetch Uniswap Trade API quote',\n commonParams: ['keyGen'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'Input token' },\n tokenOut: { type: 'address', required: true, description: 'Output token' },\n amount: { type: 'string', required: true, description: 'Amount for quote' },\n type: { type: 'EXACT_INPUT | EXACT_OUTPUT', required: true, description: 'Trade type' },\n },\n },\n ],\n}\n\nregisterProtocolModule(uniswapV4ProtocolModule)\n\nimport { uniswapTradeQuote } from './quote.js'\nimport { buildEvmMultisignBodyUniswapV4SkipPermit2Batch } from './swapMultisign.js'\nimport { swapExactInput as swapExactInputFn, quoteSwap, createSwap, swapFromQuote } from './swap.js'\n\nexport const uniswapV4 = {\n quoteSwap,\n createSwap,\n swapExactInput: swapExactInputFn,\n swapFromQuote,\n buildSwapMultisignBody: buildEvmMultisignBodyUniswapV4SkipPermit2Batch,\n quote: uniswapTradeQuote,\n isChainSupported: isUniswapV4ChainSupported,\n}\n","import { parseEvmChainIdToNumber } from '../../../chains/evm/chainIdParse.js'\n\nconst CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS: ReadonlySet<number> = new Set([\n 1, 10, 56, 100, 137, 146, 196, 250, 252, 324, 999, 1284, 2222, 5000, 8453, 42161, 42220, 43114, 1313161554,\n])\n\nexport function isCurveApiChainSupported(chainId: string | number | bigint | null | undefined): boolean {\n const n = parseEvmChainIdToNumber(chainId)\n if (Number.isNaN(n) || n < 0) return false\n return CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS.has(n)\n}\n\nexport { isCurveApiChainSupported as isCurveDaoChainSupported }\n","import type { ProtocolModule } from '../../../core/types.js'\nimport { registerProtocolModule } from '../../../core/registry.js'\nimport { isCurveApiChainSupported } from './support.js'\n\nexport * from './support.js'\nexport * from './swapDestinations.js'\nexport * from './apiSession.js'\nexport * from './purpose.js'\nexport * from './executeHelpers.js'\nexport * from './multisign.js'\n\nexport const CURVE_DAO_PROTOCOL_ID = 'curve-dao'\n\nexport const curveDaoProtocolModule: ProtocolModule = {\n id: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n isChainSupported(ctx) {\n if (ctx.chainCategory !== 'evm') return false\n return isCurveApiChainSupported(ctx.chainId)\n },\n isTokenSupported(token) {\n if (token.category !== 'evm') return false\n return token.kind === 'native' || token.kind === 'erc20'\n },\n actions: [\n {\n id: 'curve-dao.swap',\n protocolId: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Swap via Curve Router NG (optional ERC-20 approve batch)',\n commonParams: ['keyGen', 'purposeText', 'useCustomGas'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'ERC-20 token in (native uses WETH path in UI)' },\n tokenOut: { type: 'address', required: true, description: 'Output token or 0xeeee… native placeholder' },\n amountHuman: { type: 'string', required: true, description: 'Human-readable input amount' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage percent (0–100 exclusive)' },\n },\n },\n ],\n}\n\nregisterProtocolModule(curveDaoProtocolModule)\n\nimport { buildEvmMultisignBodyCurveDaoBatch } from './multisign.js'\nimport { loadFullCurveSessionForRpc } from './apiSession.js'\n\nexport const curveDao = {\n buildSwapMultisignBody: buildEvmMultisignBodyCurveDaoBatch,\n isChainSupported: isCurveApiChainSupported,\n loadSession: loadFullCurveSessionForRpc,\n}\n","import type { ParamDoc } from '../core/types.js'\n\n/** Shared inputs documented once for all EVM multisign builders. */\nexport const EVM_COMMON_PARAM_DOCS: Record<string, ParamDoc> = {\n keyGen: {\n type: 'object',\n required: true,\n description:\n 'MPC key slice: { pubkeyhex: string (required), keylist: string[], ClientKeys?: Record<string,string> }. Used for pubKey/keyList on POST /multiSignRequest.',\n },\n purposeText: {\n type: 'string',\n required: true,\n description:\n 'Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix).',\n },\n useCustomGas: {\n type: 'boolean',\n required: true,\n description:\n 'When true, apply chain gas settings from chainDetail / customGasChainDetails instead of raw RPC estimates only.',\n },\n chainId: {\n type: 'number',\n required: true,\n description: 'EVM chain id (decimal). Becomes destinationChainID on the sign request.',\n },\n rpcUrl: {\n type: 'string',\n required: true,\n description: 'HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads.',\n },\n executorAddress: {\n type: 'address',\n required: true,\n description: 'MPC wallet address (from keyGen ethereumaddress) — tx sender for estimates and approvals.',\n },\n chainDetail: {\n type: 'object',\n required: true,\n description:\n 'Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }.',\n },\n customGasChainDetails: {\n type: 'object',\n required: false,\n description: 'Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.',\n },\n}\n\nexport const MULTISIGN_OUTPUT_DOC = {\n description:\n 'Unsigned mpc-auth multiSignRequest payload. The caller must sign messageToSign (MetaMask personal_sign or Ed25519) and POST { ...bodyForSign, clientSig, signedMessage: messageToSign } to /multiSignRequest.',\n fields: {\n bodyForSign: {\n type: 'object',\n description:\n 'POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs.',\n },\n messageToSign: {\n type: 'string',\n description: 'JSON.stringify(bodyForSign) — exact string to sign before adding clientSig.',\n },\n },\n} as const\n","import type { ChainCategory, ParamDoc } from '../core/types.js'\nimport { EVM_COMMON_PARAM_DOCS, MULTISIGN_OUTPUT_DOC } from './commonParamDocs.js'\nimport { getProtocolModules } from '../core/registry.js'\n\n/** JSON-schema-like object for MCP tool `inputSchema` / `outputSchema`. */\nexport type McpSchemaProperty = {\n type: string\n description?: string\n}\n\nexport type McpJsonSchema = {\n type: string\n description?: string\n properties?: Record<string, McpSchemaProperty>\n required?: string[]\n items?: McpJsonSchema\n enum?: string[]\n}\n\nexport type McpToolHandler = {\n /** Import path subpath, e.g. protocols/evm/uniswap-v4 */\n importPath: string\n /** Named export to invoke */\n exportName: string\n}\n\nexport type McpToolDefinition = {\n /** Stable MCP tool name (snake_case). */\n name: string\n /** Registry action id, e.g. uniswap-v4.quote */\n actionId: string\n protocolId: string\n chainCategory: ChainCategory\n /** Long description for the LLM — what it does, when to use it, what it does NOT do. */\n description: string\n /** Prerequisites (other tools or data that must exist first). */\n prerequisites: string[]\n /** Typical next tools after this one succeeds. */\n followUp: string[]\n inputSchema: McpJsonSchema\n outputSchema: McpJsonSchema\n handler: McpToolHandler\n}\n\nfunction paramProperties(\n params: Record<string, ParamDoc>,\n includeCommon: Array<keyof typeof EVM_COMMON_PARAM_DOCS> = [],\n): Record<string, McpSchemaProperty> {\n const out: Record<string, McpSchemaProperty> = {}\n for (const k of includeCommon) {\n const d = EVM_COMMON_PARAM_DOCS[k]\n if (d) out[k] = { type: d.type, description: d.description }\n }\n for (const [k, d] of Object.entries(params)) {\n out[k] = { type: d.type, description: d.description }\n }\n return out\n}\n\nfunction requiredKeys(\n params: Record<string, ParamDoc>,\n includeCommon: Array<keyof typeof EVM_COMMON_PARAM_DOCS> = [],\n): string[] {\n const req: string[] = []\n for (const k of includeCommon) {\n if (EVM_COMMON_PARAM_DOCS[k]?.required) req.push(k)\n }\n for (const [k, d] of Object.entries(params)) {\n if (d.required) req.push(k)\n }\n return req\n}\n\nconst multisignOutputSchema: McpJsonSchema = {\n type: 'object',\n description: MULTISIGN_OUTPUT_DOC.description,\n properties: {\n bodyForSign: {\n type: 'object',\n description: MULTISIGN_OUTPUT_DOC.fields.bodyForSign.description,\n },\n messageToSign: {\n type: 'string',\n description: MULTISIGN_OUTPUT_DOC.fields.messageToSign.description,\n },\n },\n required: ['bodyForSign', 'messageToSign'],\n}\n\n/** Curated MCP tools with rich descriptions — use this to register MCP server tools. */\nexport const MCP_TOOL_DEFINITIONS: McpToolDefinition[] = [\n {\n name: 'ctm_uniswap_v4_quote',\n actionId: 'uniswap-v4.quote',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Fetch a Uniswap V4 Trade API quote (POST /v1/quote). Returns classic quote JSON including quote.input/output amounts and routing. Does NOT create a sign request — use ctm_uniswap_v4_create_swap and ctm_uniswap_v4_build_swap_multisign after quoting. Requires uniswapApiKey and swapper (MPC executor address) or keyGen + managementNodeUrl to resolve swapper.',\n prerequisites: ['Chain must be supported by Uniswap V4 (Universal Router map).'],\n followUp: ['ctm_uniswap_v4_create_swap', 'ctm_uniswap_v4_build_swap_multisign'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'uniswapTradeQuote' },\n inputSchema: {\n type: 'object',\n properties: paramProperties({\n type: { type: 'string', required: true, description: 'EXACT_INPUT or EXACT_OUTPUT' },\n amount: { type: 'string', required: true, description: 'Amount in token-in base units (wei string for ERC-20)' },\n tokenIn: { type: 'address', required: true, description: 'Input token; 0x0 for native ETH' },\n tokenOut: { type: 'address', required: true, description: 'Output token address' },\n chainId: { type: 'number', required: true, description: 'tokenInChainId / same-chain default' },\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API x-api-key' },\n swapper: { type: 'address', required: false, description: 'MPC executor; omit if keyGen + managementNodeUrl provided' },\n slippage: { type: 'number', required: false, description: 'Slippage percent; omit for API auto slippage' },\n }),\n required: requiredKeys({\n type: { type: 'string', required: true, description: '' },\n amount: { type: 'string', required: true, description: '' },\n tokenIn: { type: 'address', required: true, description: '' },\n tokenOut: { type: 'address', required: true, description: '' },\n chainId: { type: 'number', required: true, description: '' },\n uniswapApiKey: { type: 'string', required: true, description: '' },\n }),\n },\n outputSchema: {\n type: 'object',\n description: 'Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts).',\n },\n },\n {\n name: 'ctm_uniswap_v4_create_swap',\n actionId: 'uniswap-v4.create-swap',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Call Uniswap Trade API POST /v1/swap to build Universal Router calldata from a prior quote. Returns { swap: { to, data, value, gasLimit? }, requestId? }. Does NOT produce a multiSignRequest — call ctm_uniswap_v4_build_swap_multisign next.',\n prerequisites: ['ctm_uniswap_v4_quote output (fullQuoteFromPermit)'],\n followUp: ['ctm_uniswap_v4_build_swap_multisign'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'uniswapCreateSwap' },\n inputSchema: {\n type: 'object',\n properties: paramProperties({\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API key' },\n fullQuoteFromPermit: { type: 'object', required: true, description: 'Full quote JSON from ctm_uniswap_v4_quote' },\n swapTransactionDeadlineUnix: {\n type: 'number',\n required: false,\n description: 'On-chain deadline unix seconds; default ~30 min from now',\n },\n useServerProxy: {\n type: 'boolean',\n required: false,\n description: 'Set false in Node/agents; true only in browser via Next API route',\n },\n }),\n required: requiredKeys({\n uniswapApiKey: { type: 'string', required: true, description: '' },\n fullQuoteFromPermit: { type: 'object', required: true, description: '' },\n }),\n },\n outputSchema: {\n type: 'object',\n description: '{ swap: TransactionRequest, requestId?, gasFee? }',\n },\n },\n {\n name: 'ctm_uniswap_v4_build_swap_multisign',\n actionId: 'uniswap-v4.swap-exact-input',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Build mpc-auth multiSignRequest body for a Uniswap V4 swap. May batch 1–3 EVM txs: ERC-20 approve(s) to Permit2/router path + Universal Router swap (or 1 tx for native-in). Estimates gas, serializes unsigned txs, sets proposalTxParams. Output must be signed and POSTed to /multiSignRequest by the caller.',\n prerequisites: [\n 'ctm_uniswap_v4_create_swap output',\n 'keyGen with pubkeyhex',\n 'executorAddress matching MPC wallet',\n 'RPC URL and chainDetail from node chain config',\n ],\n followUp: ['Sign messageToSign', 'POST /multiSignRequest with clientSig'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'buildEvmMultisignBodyUniswapV4SkipPermit2Batch' },\n inputSchema: {\n type: 'object',\n properties: paramProperties(\n {\n tokenIn: { type: 'address', required: true, description: 'Token in; 0x0 for native ETH' },\n swap: { type: 'object', required: true, description: 'swap field from create_swap response' },\n createSwapResponse: { type: 'object', required: true, description: 'Full create_swap response' },\n fullQuoteSnapshot: { type: 'object', required: true, description: 'Quote JSON used for the swap' },\n swapDeadlineUnix: { type: 'number', required: true, description: 'Same deadline passed to create_swap' },\n slippagePercent: { type: 'number', required: false, description: 'Extra approve headroom for EXACT_OUTPUT' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail', 'customGasChainDetails'],\n ),\n required: requiredKeys(\n {\n tokenIn: { type: 'address', required: true, description: '' },\n swap: { type: 'object', required: true, description: '' },\n createSwapResponse: { type: 'object', required: true, description: '' },\n fullQuoteSnapshot: { type: 'object', required: true, description: '' },\n swapDeadlineUnix: { type: 'number', required: true, description: '' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail'],\n ),\n },\n outputSchema: multisignOutputSchema,\n },\n {\n name: 'ctm_curve_dao_build_swap_multisign',\n actionId: 'curve-dao.swap',\n protocolId: 'curve-dao',\n chainCategory: 'evm',\n description:\n '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.',\n prerequisites: ['keyGen', 'executorAddress', 'tokenIn/tokenOut/amountHuman/slippage', 'RPC URL'],\n followUp: ['Sign messageToSign', 'POST /multiSignRequest'],\n handler: { importPath: 'protocols/evm/curve-dao', exportName: 'buildEvmMultisignBodyCurveDaoBatch' },\n inputSchema: {\n type: 'object',\n properties: paramProperties(\n {\n tokenIn: { type: 'address', required: true, description: 'ERC-20 sold (native in uses WETH path in UI)' },\n tokenOut: { type: 'string', required: true, description: 'Output token or 0xeeee… native placeholder' },\n amountHuman: { type: 'string', required: true, description: 'Human-readable amount of tokenIn' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage 0–100 exclusive' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail', 'customGasChainDetails'],\n ),\n required: requiredKeys(\n {\n tokenIn: { type: 'address', required: true, description: '' },\n tokenOut: { type: 'string', required: true, description: '' },\n amountHuman: { type: 'string', required: true, description: '' },\n slippagePercent: { type: 'number', required: true, description: '' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail'],\n ),\n },\n outputSchema: multisignOutputSchema,\n },\n]\n\nexport function getMcpToolDefinitions(): readonly McpToolDefinition[] {\n return MCP_TOOL_DEFINITIONS\n}\n\nexport function getMcpToolByName(name: string): McpToolDefinition | undefined {\n return MCP_TOOL_DEFINITIONS.find((t) => t.name === name)\n}\n\n/** Summary from protocol registry (shorter) plus full MCP tool list. */\nexport function getAgentCatalogForMcp() {\n return {\n tools: MCP_TOOL_DEFINITIONS,\n protocols: getProtocolModules(),\n commonParams: EVM_COMMON_PARAM_DOCS,\n multisignOutput: MULTISIGN_OUTPUT_DOC,\n workflow: {\n evmSwapTypical: [\n '1. Quote (protocol-specific API if needed)',\n '2. Build protocol calldata (e.g. create_swap)',\n '3. build_*_multisign → { bodyForSign, messageToSign }',\n '4. Sign messageToSign (MetaMask or Ed25519)',\n '5. POST /multiSignRequest with clientSig and signedMessage',\n ],\n },\n }\n}\n","import { getProtocolModules, getActionsByChainCategory, registerProtocolModule } from '../core/registry.js'\nimport { uniswapV4ProtocolModule } from '../protocols/evm/uniswap-v4/index.js'\nimport { curveDaoProtocolModule } from '../protocols/evm/curve-dao/index.js'\nimport { getAgentCatalogForMcp } from './mcpTools.js'\n\nexport {\n getMcpToolDefinitions,\n getMcpToolByName,\n getAgentCatalogForMcp,\n MCP_TOOL_DEFINITIONS,\n} from './mcpTools.js'\nexport { EVM_COMMON_PARAM_DOCS, MULTISIGN_OUTPUT_DOC } from './commonParamDocs.js'\n\nregisterProtocolModule(uniswapV4ProtocolModule)\nregisterProtocolModule(curveDaoProtocolModule)\n\n/** Machine-readable catalog of protocol actions grouped by chain category. */\nexport function getAgentCatalog() {\n return {\n protocols: getProtocolModules(),\n byCategory: {\n evm: getActionsByChainCategory('evm'),\n solana: getActionsByChainCategory('solana'),\n near: getActionsByChainCategory('near'),\n },\n uniswapV4: uniswapV4ProtocolModule,\n curveDao: curveDaoProtocolModule,\n /** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */\n mcp: getAgentCatalogForMcp(),\n }\n}\n\nexport { getProtocolModules, getActionsByChainCategory }\n"]}
1
+ {"version":3,"sources":["../../src/core/registry.ts","../../src/chains/evm/chainIdParse.ts","../../src/protocols/evm/uniswap-v4/constants.ts","../../src/protocols/evm/uniswap-v4/index.ts","../../src/protocols/evm/curve-dao/support.ts","../../src/protocols/evm/curve-dao/index.ts","../../src/agent/commonParamDocs.ts","../../src/agent/mcpTools.ts","../../src/agent/catalog.ts"],"names":[],"mappings":";;;;;AAEA,IAAM,UAA4B,EAAC;AAE5B,SAAS,uBAAuB,GAAA,EAA2B;AAChE,EAAA,MAAM,QAAA,GAAW,QAAQ,SAAA,CAAU,CAAC,MAAM,CAAA,CAAE,EAAA,KAAO,IAAI,EAAE,CAAA;AACzD,EAAA,IAAI,YAAY,CAAA,EAAG;AACjB,IAAA,OAAA,CAAQ,QAAQ,CAAA,GAAI,GAAA;AAAA,EACtB,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,EAClB;AACF;AAEO,SAAS,kBAAA,GAAgD;AAC9D,EAAA,OAAO,OAAA;AACT;AAMO,SAAS,0BAA0B,QAAA,EAA6C;AACrF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,aAAA,KAAkB,QAAQ,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAA,KAAM,CAAA,CAAE,OAAO,CAAA;AACrF;;;ACtBO,SAAS,wBAAwB,OAAA,EAA8D;AACpG,EAAA,IAAI,OAAA,IAAW,IAAA,EAAM,OAAO,MAAA,CAAO,GAAA;AACnC,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,MAAM,CAAA,GAAI,OAAO,OAAO,CAAA;AACxB,IAAA,OAAO,OAAO,aAAA,CAAc,CAAC,KAAK,CAAA,IAAK,CAAA,GAAI,IAAI,MAAA,CAAO,GAAA;AAAA,EACxD;AACA,EAAA,IAAI,OAAO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K,0BAA0B,KAAK,CAAA;AAAA,MACpC,MAAA,EAAQ,0BAA0B,QAAQ,CAAA;AAAA,MAC1C,IAAA,EAAM,0BAA0B,MAAM;AAAA,KACxC;AAAA,IACA,SAAA,EAAW,uBAAA;AAAA,IACX,QAAA,EAAU,sBAAA;AAAA;AAAA,IAEV,KAAK,qBAAA;AAAsB,GAC7B;AACF","file":"catalog.cjs","sourcesContent":["import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/** Parse chain id for comparisons (decimal, 0x hex, CAIP-2 eip155:N, bigint). */\nexport function parseEvmChainIdToNumber(chainId: string | number | bigint | null | undefined): number {\n if (chainId == null) return Number.NaN\n if (typeof chainId === 'bigint') {\n const n = Number(chainId)\n return Number.isSafeInteger(n) && n >= 0 ? n : Number.NaN\n }\n if (typeof chainId === 'number') {\n return Number.isInteger(chainId) && chainId >= 0 ? chainId : Number.NaN\n }\n const t = String(chainId).trim()\n if (!t) return Number.NaN\n const low = t.toLowerCase()\n if (low.startsWith('eip155:')) {\n const rest = t.slice('eip155:'.length).trim()\n const n = Number.parseInt(rest, 10)\n return Number.isNaN(n) || n < 0 ? Number.NaN : n\n }\n if (low.startsWith('0x')) {\n return Number.parseInt(t, 16)\n }\n return Number.parseInt(t, 10)\n}\n","import { getAddress, type Address } from 'viem'\nimport { parseEvmChainIdToNumber } from '../../../chains/evm/chainIdParse.js'\n\n/** Canonical Uniswap token-allowance contract on most EVM chains. */\nexport const PERMIT2_ADDRESS: Address = '0x000000000022D473030F116dDEE9F6B43aC78BA3'\n\nconst UNIVERSAL_ROUTER_SPENDER: Partial<Record<number, string>> = {\n 1: '0x66a9893cc07d91d95644aedd05d03f95e1dba8af',\n 5: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 11155111: '0x3a9d48ab9751398bbfa63ad67599bb04e4bdf98b',\n 137: '0x1095692a6237d83c6a72f3f5efedb9a670c49223',\n 80001: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 10: '0x851116d9223fabed8e56c0e6b8ad0c31d98b3507',\n 420: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 42161: '0xa51afafe0263b40edaef0df8781ea9aa03e381a3',\n 421613: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 42220: '0xcb695bc5D3Aa22cAD1E6DF07801b061a05A0233A',\n 44787: '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD',\n 56: '0x1906c1d672b88cd1b9ac7593301ca990f94eae07',\n 43114: '0x94b75331ae8d42c1b61065089b7d48fe14aa73b7',\n 84531: '0xd0872d928672ae2ff74bdb2f5130ac12229cafaf',\n 8453: '0x6fF5693b99212da76ad316178a184ab56d299b43',\n 81457: '0xeabbcb3e8e415306207ef514f660a3f820025be3',\n 7777777: '0x3315ef7ca28db74abadc6c44570efdf06b04b020',\n 324: '0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06',\n 480: '0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743',\n 1301: '0xf70536b3bcc1bd1a972dc186a2cf84cc6da6be5d',\n 130: '0xef740bf23acae26f6492b10de645d6b98dc8eaf3',\n 10143: '0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893',\n 84532: '0x492e6456d9528771018deb9e87ef7750ef184104',\n 1868: '0x0e2850543f69f678257266e0907ff9a58b3f13de',\n 143: '0x0d97dc33264bfc1c226207428a79b26757fb9dc3',\n 59144: '0x661e93cca42afacb172121ef892830ca3b70f08d',\n 4217: '0x1febb76be10aaf3a1402f04e8e835f2c382f7914',\n 196: '0x5507749f2c558bb3e162c6e90c314c092e7372ff',\n}\n\nexport function isUniswapV4ChainSupported(chainId: string | number | bigint | null | undefined): boolean {\n if (chainId == null) return false\n const n = parseEvmChainIdToNumber(chainId)\n if (Number.isNaN(n) || n < 0) return false\n const a = UNIVERSAL_ROUTER_SPENDER[n]\n return typeof a === 'string' && a.startsWith('0x')\n}\n\nexport function getUniswapUniversalRouterSpenderOrThrow(chainId: number): Address {\n const raw = UNIVERSAL_ROUTER_SPENDER[chainId]\n if (!raw || !raw.startsWith('0x')) {\n throw new Error(\n `No Uniswap Universal Router (spender) is configured for chainId ${chainId}. Add this chain to uniswap-v4/constants or use a chain supported by the Uniswap SDK.`,\n )\n }\n return getAddress(raw)\n}\n\nexport const MAX_UINT160 = (1n << 160n) - 1n\nexport const MAX_UINT48 = (1n << 48n) - 1n\n\nexport const UNISWAP_UNIVERSAL_ROUTER_DEFAULT_GAS_UNITS = 1_500_000n\nexport const UNISWAP_TRADE_BASE_DEFAULT = 'https://trade-api.gateway.uniswap.org/v1'\nexport const UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT = '2.0'\nexport const UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES = 30\nexport const UNISWAP_SWAP_DEFAULT_DEADLINE_SEC_OFFSET = UNISWAP_SWAP_DEFAULT_EXPIRY_MINUTES * 60\n","import type { ProtocolModule } from '../../../core/types.js'\nimport { registerProtocolModule } from '../../../core/registry.js'\nimport { isUniswapV4ChainSupported } from './constants.js'\n\nexport * from './constants.js'\nexport * from './quote.js'\nexport * from './swapMultisign.js'\nexport * from './purpose.js'\nexport * from './support.js'\nexport * from './swap.js'\n\nexport {\n isUniswapV4SwapEvmSignRequest,\n resolveRouterSwapGasUnitsFromSignRequest,\n} from './swapMultisign.js'\n\nexport const UNISWAP_V4_PROTOCOL_ID = 'uniswap-v4'\n\nexport const uniswapV4ProtocolModule: ProtocolModule = {\n id: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n isChainSupported(ctx) {\n if (ctx.chainCategory !== 'evm') return false\n return isUniswapV4ChainSupported(ctx.chainId)\n },\n isTokenSupported(token) {\n if (token.category !== 'evm') return false\n return token.kind === 'native' || token.kind === 'erc20'\n },\n actions: [\n {\n id: 'uniswap-v4.swap-exact-input',\n protocolId: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Swap ERC-20 or native token via Uniswap V4 Universal Router (classic allowance path)',\n commonParams: ['keyGen', 'purposeText', 'useCustomGas'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'Input token (0x0 for native)' },\n tokenOut: { type: 'address', required: true, description: 'Output token address' },\n amount: { type: 'string', required: true, description: 'Human or wei amount per trade type' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage tolerance percent' },\n swapTransactionDeadlineUnix: {\n type: 'number',\n required: false,\n description: 'On-chain swap deadline (unix seconds)',\n },\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API key' },\n },\n },\n {\n id: 'uniswap-v4.quote',\n protocolId: UNISWAP_V4_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Fetch Uniswap Trade API quote',\n commonParams: ['keyGen'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'Input token' },\n tokenOut: { type: 'address', required: true, description: 'Output token' },\n amount: { type: 'string', required: true, description: 'Amount for quote' },\n type: { type: 'EXACT_INPUT | EXACT_OUTPUT', required: true, description: 'Trade type' },\n },\n },\n ],\n}\n\nregisterProtocolModule(uniswapV4ProtocolModule)\n\nimport { uniswapTradeQuote } from './quote.js'\nimport { buildEvmMultisignBodyUniswapV4SkipPermit2Batch } from './swapMultisign.js'\nimport { swapExactInput as swapExactInputFn, quoteSwap, createSwap, swapFromQuote } from './swap.js'\n\nexport const uniswapV4 = {\n quoteSwap,\n createSwap,\n swapExactInput: swapExactInputFn,\n swapFromQuote,\n buildSwapMultisignBody: buildEvmMultisignBodyUniswapV4SkipPermit2Batch,\n quote: uniswapTradeQuote,\n isChainSupported: isUniswapV4ChainSupported,\n}\n","import { parseEvmChainIdToNumber } from '../../../chains/evm/chainIdParse.js'\n\nconst CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS: ReadonlySet<number> = new Set([\n 1, 10, 56, 100, 137, 146, 196, 250, 252, 324, 999, 1284, 2222, 5000, 8453, 42161, 42220, 43114, 1313161554,\n])\n\nexport function isCurveApiChainSupported(chainId: string | number | bigint | null | undefined): boolean {\n const n = parseEvmChainIdToNumber(chainId)\n if (Number.isNaN(n) || n < 0) return false\n return CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS.has(n)\n}\n\nexport { isCurveApiChainSupported as isCurveDaoChainSupported }\n","import type { ProtocolModule } from '../../../core/types.js'\nimport { registerProtocolModule } from '../../../core/registry.js'\nimport { isCurveApiChainSupported } from './support.js'\n\nexport * from './support.js'\nexport * from './swapDestinations.js'\nexport * from './apiSession.js'\nexport * from './purpose.js'\nexport * from './executeHelpers.js'\nexport * from './multisign.js'\n\nexport const CURVE_DAO_PROTOCOL_ID = 'curve-dao'\n\nexport const curveDaoProtocolModule: ProtocolModule = {\n id: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n isChainSupported(ctx) {\n if (ctx.chainCategory !== 'evm') return false\n return isCurveApiChainSupported(ctx.chainId)\n },\n isTokenSupported(token) {\n if (token.category !== 'evm') return false\n return token.kind === 'native' || token.kind === 'erc20'\n },\n actions: [\n {\n id: 'curve-dao.swap',\n protocolId: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Swap via Curve Router NG (optional ERC-20 approve batch)',\n commonParams: ['keyGen', 'purposeText', 'useCustomGas'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'ERC-20 token in (native uses WETH path in UI)' },\n tokenOut: { type: 'address', required: true, description: 'Output token or 0xeeee… native placeholder' },\n amountHuman: { type: 'string', required: true, description: 'Human-readable input amount' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage percent (0–100 exclusive)' },\n },\n },\n ],\n}\n\nregisterProtocolModule(curveDaoProtocolModule)\n\nimport { buildEvmMultisignBodyCurveDaoBatch } from './multisign.js'\nimport { loadFullCurveSessionForRpc } from './apiSession.js'\n\nexport const curveDao = {\n buildSwapMultisignBody: buildEvmMultisignBodyCurveDaoBatch,\n isChainSupported: isCurveApiChainSupported,\n loadSession: loadFullCurveSessionForRpc,\n}\n","import type { ParamDoc } from '../core/types.js'\n\n/** Shared inputs documented once for all EVM multisign builders. */\nexport const EVM_COMMON_PARAM_DOCS: Record<string, ParamDoc> = {\n keyGen: {\n type: 'object',\n required: true,\n description:\n 'MPC key slice: { pubkeyhex: string (required), keylist: string[], ClientKeys?: Record<string,string> }. Used for pubKey/keyList on POST /multiSignRequest.',\n },\n purposeText: {\n type: 'string',\n required: true,\n description:\n 'Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix).',\n },\n useCustomGas: {\n type: 'boolean',\n required: true,\n description:\n 'When true, apply chain gas settings from chainDetail / customGasChainDetails instead of raw RPC estimates only.',\n },\n chainId: {\n type: 'number',\n required: true,\n description: 'EVM chain id (decimal). Becomes destinationChainID on the sign request.',\n },\n rpcUrl: {\n type: 'string',\n required: true,\n description: 'HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads.',\n },\n executorAddress: {\n type: 'address',\n required: true,\n description: 'MPC wallet address (from keyGen ethereumaddress) — tx sender for estimates and approvals.',\n },\n chainDetail: {\n type: 'object',\n required: true,\n description:\n 'Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }.',\n },\n customGasChainDetails: {\n type: 'object',\n required: false,\n description: 'Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true.',\n },\n}\n\nexport const MULTISIGN_OUTPUT_DOC = {\n description:\n 'Unsigned mpc-auth multiSignRequest payload. The caller must sign messageToSign (MetaMask personal_sign or Ed25519) and POST { ...bodyForSign, clientSig, signedMessage: messageToSign } to /multiSignRequest.',\n fields: {\n bodyForSign: {\n type: 'object',\n description:\n 'POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs.',\n },\n messageToSign: {\n type: 'string',\n description: 'JSON.stringify(bodyForSign) — exact string to sign before adding clientSig.',\n },\n },\n} as const\n\n/** mpc-auth NodeMgtKeySig envelope for management POST routes (Get Sig, shelve, keyGen, groups, …). */\nexport const MANAGEMENT_SIG_DOC = {\n description:\n '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.',\n fields: {\n nonce: {\n type: 'number',\n description: 'From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).',\n },\n clientSig: {\n type: 'string',\n description: 'Management signature; empty string in the message to sign.',\n },\n nodeKey: {\n type: 'string',\n description: 'Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).',\n },\n },\n helpers: {\n managementSigFields: 'Base envelope with clientSig cleared.',\n buildManagementPostBody: 'Spread managementSigFields then endpoint fields.',\n messageToSignManagementBody: 'Canonical JSON string to sign.',\n withManagementClientSig: 'Attach signature to POST body.',\n fetchNodeKey: 'GET /getNodeKey via nodeFetchWithReadAuth.',\n fetchManagementNonce: 'GET nonce for Ed25519 or Ethereum management key.',\n },\n} as const\n","import type { ChainCategory, ParamDoc } from '../core/types.js'\nimport { EVM_COMMON_PARAM_DOCS, MULTISIGN_OUTPUT_DOC, MANAGEMENT_SIG_DOC } from './commonParamDocs.js'\nimport { getProtocolModules } from '../core/registry.js'\n\n/** JSON-schema-like object for MCP tool `inputSchema` / `outputSchema`. */\nexport type McpSchemaProperty = {\n type: string\n description?: string\n}\n\nexport type McpJsonSchema = {\n type: string\n description?: string\n properties?: Record<string, McpSchemaProperty>\n required?: string[]\n items?: McpJsonSchema\n enum?: string[]\n}\n\nexport type McpToolHandler = {\n /** Import path subpath, e.g. protocols/evm/uniswap-v4 */\n importPath: string\n /** Named export to invoke */\n exportName: string\n}\n\nexport type McpToolDefinition = {\n /** Stable MCP tool name (snake_case). */\n name: string\n /** Registry action id, e.g. uniswap-v4.quote */\n actionId: string\n protocolId: string\n chainCategory: ChainCategory\n /** Long description for the LLM — what it does, when to use it, what it does NOT do. */\n description: string\n /** Prerequisites (other tools or data that must exist first). */\n prerequisites: string[]\n /** Typical next tools after this one succeeds. */\n followUp: string[]\n inputSchema: McpJsonSchema\n outputSchema: McpJsonSchema\n handler: McpToolHandler\n}\n\nfunction paramProperties(\n params: Record<string, ParamDoc>,\n includeCommon: Array<keyof typeof EVM_COMMON_PARAM_DOCS> = [],\n): Record<string, McpSchemaProperty> {\n const out: Record<string, McpSchemaProperty> = {}\n for (const k of includeCommon) {\n const d = EVM_COMMON_PARAM_DOCS[k]\n if (d) out[k] = { type: d.type, description: d.description }\n }\n for (const [k, d] of Object.entries(params)) {\n out[k] = { type: d.type, description: d.description }\n }\n return out\n}\n\nfunction requiredKeys(\n params: Record<string, ParamDoc>,\n includeCommon: Array<keyof typeof EVM_COMMON_PARAM_DOCS> = [],\n): string[] {\n const req: string[] = []\n for (const k of includeCommon) {\n if (EVM_COMMON_PARAM_DOCS[k]?.required) req.push(k)\n }\n for (const [k, d] of Object.entries(params)) {\n if (d.required) req.push(k)\n }\n return req\n}\n\nconst multisignOutputSchema: McpJsonSchema = {\n type: 'object',\n description: MULTISIGN_OUTPUT_DOC.description,\n properties: {\n bodyForSign: {\n type: 'object',\n description: MULTISIGN_OUTPUT_DOC.fields.bodyForSign.description,\n },\n messageToSign: {\n type: 'string',\n description: MULTISIGN_OUTPUT_DOC.fields.messageToSign.description,\n },\n },\n required: ['bodyForSign', 'messageToSign'],\n}\n\n/** Curated MCP tools with rich descriptions — use this to register MCP server tools. */\nexport const MCP_TOOL_DEFINITIONS: McpToolDefinition[] = [\n {\n name: 'ctm_uniswap_v4_quote',\n actionId: 'uniswap-v4.quote',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Fetch a Uniswap V4 Trade API quote (POST /v1/quote). Returns classic quote JSON including quote.input/output amounts and routing. Does NOT create a sign request — use ctm_uniswap_v4_create_swap and ctm_uniswap_v4_build_swap_multisign after quoting. Requires uniswapApiKey and swapper (MPC executor address) or keyGen + managementNodeUrl to resolve swapper.',\n prerequisites: ['Chain must be supported by Uniswap V4 (Universal Router map).'],\n followUp: ['ctm_uniswap_v4_create_swap', 'ctm_uniswap_v4_build_swap_multisign'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'uniswapTradeQuote' },\n inputSchema: {\n type: 'object',\n properties: paramProperties({\n type: { type: 'string', required: true, description: 'EXACT_INPUT or EXACT_OUTPUT' },\n amount: { type: 'string', required: true, description: 'Amount in token-in base units (wei string for ERC-20)' },\n tokenIn: { type: 'address', required: true, description: 'Input token; 0x0 for native ETH' },\n tokenOut: { type: 'address', required: true, description: 'Output token address' },\n chainId: { type: 'number', required: true, description: 'tokenInChainId / same-chain default' },\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API x-api-key' },\n swapper: { type: 'address', required: false, description: 'MPC executor; omit if keyGen + managementNodeUrl provided' },\n slippage: { type: 'number', required: false, description: 'Slippage percent; omit for API auto slippage' },\n }),\n required: requiredKeys({\n type: { type: 'string', required: true, description: '' },\n amount: { type: 'string', required: true, description: '' },\n tokenIn: { type: 'address', required: true, description: '' },\n tokenOut: { type: 'address', required: true, description: '' },\n chainId: { type: 'number', required: true, description: '' },\n uniswapApiKey: { type: 'string', required: true, description: '' },\n }),\n },\n outputSchema: {\n type: 'object',\n description: 'Full Uniswap POST /quote JSON (includes nested quote object with input/output amounts).',\n },\n },\n {\n name: 'ctm_uniswap_v4_create_swap',\n actionId: 'uniswap-v4.create-swap',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Call Uniswap Trade API POST /v1/swap to build Universal Router calldata from a prior quote. Returns { swap: { to, data, value, gasLimit? }, requestId? }. Does NOT produce a multiSignRequest — call ctm_uniswap_v4_build_swap_multisign next.',\n prerequisites: ['ctm_uniswap_v4_quote output (fullQuoteFromPermit)'],\n followUp: ['ctm_uniswap_v4_build_swap_multisign'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'uniswapCreateSwap' },\n inputSchema: {\n type: 'object',\n properties: paramProperties({\n uniswapApiKey: { type: 'string', required: true, description: 'Uniswap Trade API key' },\n fullQuoteFromPermit: { type: 'object', required: true, description: 'Full quote JSON from ctm_uniswap_v4_quote' },\n swapTransactionDeadlineUnix: {\n type: 'number',\n required: false,\n description: 'On-chain deadline unix seconds; default ~30 min from now',\n },\n useServerProxy: {\n type: 'boolean',\n required: false,\n description: 'Set false in Node/agents; true only in browser via Next API route',\n },\n }),\n required: requiredKeys({\n uniswapApiKey: { type: 'string', required: true, description: '' },\n fullQuoteFromPermit: { type: 'object', required: true, description: '' },\n }),\n },\n outputSchema: {\n type: 'object',\n description: '{ swap: TransactionRequest, requestId?, gasFee? }',\n },\n },\n {\n name: 'ctm_uniswap_v4_build_swap_multisign',\n actionId: 'uniswap-v4.swap-exact-input',\n protocolId: 'uniswap-v4',\n chainCategory: 'evm',\n description:\n 'Build mpc-auth multiSignRequest body for a Uniswap V4 swap. May batch 1–3 EVM txs: ERC-20 approve(s) to Permit2/router path + Universal Router swap (or 1 tx for native-in). Estimates gas, serializes unsigned txs, sets proposalTxParams. Output must be signed and POSTed to /multiSignRequest by the caller.',\n prerequisites: [\n 'ctm_uniswap_v4_create_swap output',\n 'keyGen with pubkeyhex',\n 'executorAddress matching MPC wallet',\n 'RPC URL and chainDetail from node chain config',\n ],\n followUp: ['Sign messageToSign', 'POST /multiSignRequest with clientSig and signedMessage'],\n handler: { importPath: 'protocols/evm/uniswap-v4', exportName: 'buildEvmMultisignBodyUniswapV4SkipPermit2Batch' },\n inputSchema: {\n type: 'object',\n properties: paramProperties(\n {\n tokenIn: { type: 'address', required: true, description: 'Token in; 0x0 for native ETH' },\n swap: { type: 'object', required: true, description: 'swap field from create_swap response' },\n createSwapResponse: { type: 'object', required: true, description: 'Full create_swap response' },\n fullQuoteSnapshot: { type: 'object', required: true, description: 'Quote JSON used for the swap' },\n swapDeadlineUnix: { type: 'number', required: true, description: 'Same deadline passed to create_swap' },\n slippagePercent: { type: 'number', required: false, description: 'Extra approve headroom for EXACT_OUTPUT' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail', 'customGasChainDetails'],\n ),\n required: requiredKeys(\n {\n tokenIn: { type: 'address', required: true, description: '' },\n swap: { type: 'object', required: true, description: '' },\n createSwapResponse: { type: 'object', required: true, description: '' },\n fullQuoteSnapshot: { type: 'object', required: true, description: '' },\n swapDeadlineUnix: { type: 'number', required: true, description: '' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail'],\n ),\n },\n outputSchema: multisignOutputSchema,\n },\n {\n name: 'ctm_curve_dao_build_swap_multisign',\n actionId: 'curve-dao.swap',\n protocolId: 'curve-dao',\n chainCategory: 'evm',\n description:\n '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.',\n prerequisites: ['keyGen', 'executorAddress', 'tokenIn/tokenOut/amountHuman/slippage', 'RPC URL'],\n followUp: ['Sign messageToSign', 'POST /multiSignRequest with clientSig and signedMessage'],\n handler: { importPath: 'protocols/evm/curve-dao', exportName: 'buildEvmMultisignBodyCurveDaoBatch' },\n inputSchema: {\n type: 'object',\n properties: paramProperties(\n {\n tokenIn: { type: 'address', required: true, description: 'ERC-20 sold (native in uses WETH path in UI)' },\n tokenOut: { type: 'string', required: true, description: 'Output token or 0xeeee… native placeholder' },\n amountHuman: { type: 'string', required: true, description: 'Human-readable amount of tokenIn' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage 0–100 exclusive' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail', 'customGasChainDetails'],\n ),\n required: requiredKeys(\n {\n tokenIn: { type: 'address', required: true, description: '' },\n tokenOut: { type: 'string', required: true, description: '' },\n amountHuman: { type: 'string', required: true, description: '' },\n slippagePercent: { type: 'number', required: true, description: '' },\n },\n ['keyGen', 'purposeText', 'useCustomGas', 'chainId', 'rpcUrl', 'executorAddress', 'chainDetail'],\n ),\n },\n outputSchema: multisignOutputSchema,\n },\n]\n\nexport function getMcpToolDefinitions(): readonly McpToolDefinition[] {\n return MCP_TOOL_DEFINITIONS\n}\n\nexport function getMcpToolByName(name: string): McpToolDefinition | undefined {\n return MCP_TOOL_DEFINITIONS.find((t) => t.name === name)\n}\n\n/** Summary from protocol registry (shorter) plus full MCP tool list. */\nexport function getAgentCatalogForMcp() {\n return {\n tools: MCP_TOOL_DEFINITIONS,\n protocols: getProtocolModules(),\n commonParams: EVM_COMMON_PARAM_DOCS,\n multisignOutput: MULTISIGN_OUTPUT_DOC,\n managementSig: MANAGEMENT_SIG_DOC,\n workflow: {\n evmSwapTypical: [\n '1. Quote (protocol-specific API if needed)',\n '2. Build protocol calldata (e.g. create_swap)',\n '3. build_*_multisign → { bodyForSign, messageToSign }',\n '4. Sign messageToSign (MetaMask or Ed25519)',\n '5. POST /multiSignRequest with clientSig and signedMessage',\n ],\n managementPostTypical: [\n '1. GET /getNodeKey → nodeKey (128 hex)',\n '2. GET /getPublicMgtKeyNonce or /getNodeMgtKeyNonce → nonce',\n '3. buildManagementPostBody(nonce, nodeKey, { …endpoint fields })',\n '4. messageToSignManagementBody(body) → sign → withManagementClientSig(body, sig)',\n '5. POST management route with signed body',\n ],\n },\n }\n}\n","import { getProtocolModules, getActionsByChainCategory, registerProtocolModule } from '../core/registry.js'\nimport { uniswapV4ProtocolModule } from '../protocols/evm/uniswap-v4/index.js'\nimport { curveDaoProtocolModule } from '../protocols/evm/curve-dao/index.js'\nimport { getAgentCatalogForMcp } from './mcpTools.js'\n\nexport {\n getMcpToolDefinitions,\n getMcpToolByName,\n getAgentCatalogForMcp,\n MCP_TOOL_DEFINITIONS,\n} from './mcpTools.js'\nexport { EVM_COMMON_PARAM_DOCS, MULTISIGN_OUTPUT_DOC, MANAGEMENT_SIG_DOC } from './commonParamDocs.js'\n\nregisterProtocolModule(uniswapV4ProtocolModule)\nregisterProtocolModule(curveDaoProtocolModule)\n\n/** Machine-readable catalog of protocol actions grouped by chain category. */\nexport function getAgentCatalog() {\n return {\n protocols: getProtocolModules(),\n byCategory: {\n evm: getActionsByChainCategory('evm'),\n solana: getActionsByChainCategory('solana'),\n near: getActionsByChainCategory('near'),\n },\n uniswapV4: uniswapV4ProtocolModule,\n curveDao: curveDaoProtocolModule,\n /** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */\n mcp: getAgentCatalogForMcp(),\n }\n}\n\nexport { getProtocolModules, getActionsByChainCategory }\n"]}
@@ -59,8 +59,34 @@ declare function getAgentCatalogForMcp(): {
59
59
  };
60
60
  };
61
61
  };
62
+ managementSig: {
63
+ readonly 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.";
64
+ readonly fields: {
65
+ readonly nonce: {
66
+ readonly type: "number";
67
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
68
+ };
69
+ readonly clientSig: {
70
+ readonly type: "string";
71
+ readonly description: "Management signature; empty string in the message to sign.";
72
+ };
73
+ readonly nodeKey: {
74
+ readonly type: "string";
75
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
76
+ };
77
+ };
78
+ readonly helpers: {
79
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
80
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
81
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
82
+ readonly withManagementClientSig: "Attach signature to POST body.";
83
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
84
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
85
+ };
86
+ };
62
87
  workflow: {
63
88
  evmSwapTypical: string[];
89
+ managementPostTypical: string[];
64
90
  };
65
91
  };
66
92
 
@@ -79,6 +105,32 @@ declare const MULTISIGN_OUTPUT_DOC: {
79
105
  };
80
106
  };
81
107
  };
108
+ /** mpc-auth NodeMgtKeySig envelope for management POST routes (Get Sig, shelve, keyGen, groups, …). */
109
+ declare const MANAGEMENT_SIG_DOC: {
110
+ readonly 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.";
111
+ readonly fields: {
112
+ readonly nonce: {
113
+ readonly type: "number";
114
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
115
+ };
116
+ readonly clientSig: {
117
+ readonly type: "string";
118
+ readonly description: "Management signature; empty string in the message to sign.";
119
+ };
120
+ readonly nodeKey: {
121
+ readonly type: "string";
122
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
123
+ };
124
+ };
125
+ readonly helpers: {
126
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
127
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
128
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
129
+ readonly withManagementClientSig: "Attach signature to POST body.";
130
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
131
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
132
+ };
133
+ };
82
134
 
83
135
  /** Machine-readable catalog of protocol actions grouped by chain category. */
84
136
  declare function getAgentCatalog(): {
@@ -108,10 +160,36 @@ declare function getAgentCatalog(): {
108
160
  };
109
161
  };
110
162
  };
163
+ managementSig: {
164
+ readonly 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.";
165
+ readonly fields: {
166
+ readonly nonce: {
167
+ readonly type: "number";
168
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
169
+ };
170
+ readonly clientSig: {
171
+ readonly type: "string";
172
+ readonly description: "Management signature; empty string in the message to sign.";
173
+ };
174
+ readonly nodeKey: {
175
+ readonly type: "string";
176
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
177
+ };
178
+ };
179
+ readonly helpers: {
180
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
181
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
182
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
183
+ readonly withManagementClientSig: "Attach signature to POST body.";
184
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
185
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
186
+ };
187
+ };
111
188
  workflow: {
112
189
  evmSwapTypical: string[];
190
+ managementPostTypical: string[];
113
191
  };
114
192
  };
115
193
  };
116
194
 
117
- export { EVM_COMMON_PARAM_DOCS, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions };
195
+ export { EVM_COMMON_PARAM_DOCS, MANAGEMENT_SIG_DOC, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions };
@@ -59,8 +59,34 @@ declare function getAgentCatalogForMcp(): {
59
59
  };
60
60
  };
61
61
  };
62
+ managementSig: {
63
+ readonly 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.";
64
+ readonly fields: {
65
+ readonly nonce: {
66
+ readonly type: "number";
67
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
68
+ };
69
+ readonly clientSig: {
70
+ readonly type: "string";
71
+ readonly description: "Management signature; empty string in the message to sign.";
72
+ };
73
+ readonly nodeKey: {
74
+ readonly type: "string";
75
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
76
+ };
77
+ };
78
+ readonly helpers: {
79
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
80
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
81
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
82
+ readonly withManagementClientSig: "Attach signature to POST body.";
83
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
84
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
85
+ };
86
+ };
62
87
  workflow: {
63
88
  evmSwapTypical: string[];
89
+ managementPostTypical: string[];
64
90
  };
65
91
  };
66
92
 
@@ -79,6 +105,32 @@ declare const MULTISIGN_OUTPUT_DOC: {
79
105
  };
80
106
  };
81
107
  };
108
+ /** mpc-auth NodeMgtKeySig envelope for management POST routes (Get Sig, shelve, keyGen, groups, …). */
109
+ declare const MANAGEMENT_SIG_DOC: {
110
+ readonly 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.";
111
+ readonly fields: {
112
+ readonly nonce: {
113
+ readonly type: "number";
114
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
115
+ };
116
+ readonly clientSig: {
117
+ readonly type: "string";
118
+ readonly description: "Management signature; empty string in the message to sign.";
119
+ };
120
+ readonly nodeKey: {
121
+ readonly type: "string";
122
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
123
+ };
124
+ };
125
+ readonly helpers: {
126
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
127
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
128
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
129
+ readonly withManagementClientSig: "Attach signature to POST body.";
130
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
131
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
132
+ };
133
+ };
82
134
 
83
135
  /** Machine-readable catalog of protocol actions grouped by chain category. */
84
136
  declare function getAgentCatalog(): {
@@ -108,10 +160,36 @@ declare function getAgentCatalog(): {
108
160
  };
109
161
  };
110
162
  };
163
+ managementSig: {
164
+ readonly 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.";
165
+ readonly fields: {
166
+ readonly nonce: {
167
+ readonly type: "number";
168
+ readonly description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey).";
169
+ };
170
+ readonly clientSig: {
171
+ readonly type: "string";
172
+ readonly description: "Management signature; empty string in the message to sign.";
173
+ };
174
+ readonly nodeKey: {
175
+ readonly type: "string";
176
+ readonly description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix).";
177
+ };
178
+ };
179
+ readonly helpers: {
180
+ readonly managementSigFields: "Base envelope with clientSig cleared.";
181
+ readonly buildManagementPostBody: "Spread managementSigFields then endpoint fields.";
182
+ readonly messageToSignManagementBody: "Canonical JSON string to sign.";
183
+ readonly withManagementClientSig: "Attach signature to POST body.";
184
+ readonly fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.";
185
+ readonly fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.";
186
+ };
187
+ };
111
188
  workflow: {
112
189
  evmSwapTypical: string[];
190
+ managementPostTypical: string[];
113
191
  };
114
192
  };
115
193
  };
116
194
 
117
- export { EVM_COMMON_PARAM_DOCS, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions };
195
+ export { EVM_COMMON_PARAM_DOCS, MANAGEMENT_SIG_DOC, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions };
@@ -245,6 +245,31 @@ var MULTISIGN_OUTPUT_DOC = {
245
245
  }
246
246
  }
247
247
  };
248
+ var MANAGEMENT_SIG_DOC = {
249
+ 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.",
250
+ fields: {
251
+ nonce: {
252
+ type: "number",
253
+ description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey)."
254
+ },
255
+ clientSig: {
256
+ type: "string",
257
+ description: "Management signature; empty string in the message to sign."
258
+ },
259
+ nodeKey: {
260
+ type: "string",
261
+ description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix)."
262
+ }
263
+ },
264
+ helpers: {
265
+ managementSigFields: "Base envelope with clientSig cleared.",
266
+ buildManagementPostBody: "Spread managementSigFields then endpoint fields.",
267
+ messageToSignManagementBody: "Canonical JSON string to sign.",
268
+ withManagementClientSig: "Attach signature to POST body.",
269
+ fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.",
270
+ fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key."
271
+ }
272
+ };
248
273
 
249
274
  // src/agent/mcpTools.ts
250
275
  function paramProperties(params, includeCommon = []) {
@@ -366,7 +391,7 @@ var MCP_TOOL_DEFINITIONS = [
366
391
  "executorAddress matching MPC wallet",
367
392
  "RPC URL and chainDetail from node chain config"
368
393
  ],
369
- followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig"],
394
+ followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
370
395
  handler: { importPath: "protocols/evm/uniswap-v4", exportName: "buildEvmMultisignBodyUniswapV4SkipPermit2Batch" },
371
396
  inputSchema: {
372
397
  type: "object",
@@ -401,7 +426,7 @@ var MCP_TOOL_DEFINITIONS = [
401
426
  chainCategory: "evm",
402
427
  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.",
403
428
  prerequisites: ["keyGen", "executorAddress", "tokenIn/tokenOut/amountHuman/slippage", "RPC URL"],
404
- followUp: ["Sign messageToSign", "POST /multiSignRequest"],
429
+ followUp: ["Sign messageToSign", "POST /multiSignRequest with clientSig and signedMessage"],
405
430
  handler: { importPath: "protocols/evm/curve-dao", exportName: "buildEvmMultisignBodyCurveDaoBatch" },
406
431
  inputSchema: {
407
432
  type: "object",
@@ -439,6 +464,7 @@ function getAgentCatalogForMcp() {
439
464
  protocols: getProtocolModules(),
440
465
  commonParams: EVM_COMMON_PARAM_DOCS,
441
466
  multisignOutput: MULTISIGN_OUTPUT_DOC,
467
+ managementSig: MANAGEMENT_SIG_DOC,
442
468
  workflow: {
443
469
  evmSwapTypical: [
444
470
  "1. Quote (protocol-specific API if needed)",
@@ -446,6 +472,13 @@ function getAgentCatalogForMcp() {
446
472
  "3. build_*_multisign \u2192 { bodyForSign, messageToSign }",
447
473
  "4. Sign messageToSign (MetaMask or Ed25519)",
448
474
  "5. POST /multiSignRequest with clientSig and signedMessage"
475
+ ],
476
+ managementPostTypical: [
477
+ "1. GET /getNodeKey \u2192 nodeKey (128 hex)",
478
+ "2. GET /getPublicMgtKeyNonce or /getNodeMgtKeyNonce \u2192 nonce",
479
+ "3. buildManagementPostBody(nonce, nodeKey, { \u2026endpoint fields })",
480
+ "4. messageToSignManagementBody(body) \u2192 sign \u2192 withManagementClientSig(body, sig)",
481
+ "5. POST management route with signed body"
449
482
  ]
450
483
  }
451
484
  };
@@ -469,6 +502,6 @@ function getAgentCatalog() {
469
502
  };
470
503
  }
471
504
 
472
- export { EVM_COMMON_PARAM_DOCS, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getActionsByChainCategory, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions, getProtocolModules };
505
+ export { EVM_COMMON_PARAM_DOCS, MANAGEMENT_SIG_DOC, MCP_TOOL_DEFINITIONS, MULTISIGN_OUTPUT_DOC, getActionsByChainCategory, getAgentCatalog, getAgentCatalogForMcp, getMcpToolByName, getMcpToolDefinitions, getProtocolModules };
473
506
  //# sourceMappingURL=catalog.js.map
474
507
  //# sourceMappingURL=catalog.js.map