@continuumdao/ctm-mpc-defi 0.2.0 → 0.2.1

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.
Files changed (100) hide show
  1. package/README.md +20 -78
  2. package/dist/agent/catalog.cjs +511 -4
  3. package/dist/agent/catalog.cjs.map +1 -1
  4. package/dist/agent/catalog.d.ts +140 -20
  5. package/dist/agent/catalog.js +501 -6
  6. package/dist/agent/catalog.js.map +1 -1
  7. package/dist/agent/skills/aave-v4/SKILL.md +43 -0
  8. package/dist/agent/skills/curve-dao/SKILL.md +12 -0
  9. package/dist/agent/skills/ethena/SKILL.md +10 -0
  10. package/dist/agent/skills/euler-v2/SKILL.md +10 -0
  11. package/dist/agent/skills/lido/SKILL.md +22 -0
  12. package/dist/agent/skills/maple-syrup/SKILL.md +10 -0
  13. package/dist/agent/skills/sky/SKILL.md +10 -0
  14. package/dist/agent/skills/uniswap-v4/SKILL.md +22 -0
  15. package/dist/chains/evm/index.cjs +27 -226
  16. package/dist/chains/evm/index.cjs.map +1 -1
  17. package/dist/chains/evm/index.d.ts +14 -26
  18. package/dist/chains/evm/index.js +21 -211
  19. package/dist/chains/evm/index.js.map +1 -1
  20. package/dist/chains/near/index.d.ts +1 -1
  21. package/dist/chains/solana/index.d.ts +1 -1
  22. package/dist/core/index.cjs +8 -110
  23. package/dist/core/index.cjs.map +1 -1
  24. package/dist/core/index.d.ts +5 -39
  25. package/dist/core/index.js +6 -100
  26. package/dist/core/index.js.map +1 -1
  27. package/dist/{envelope-CcE5Cz_q.d.ts → envelope-CpBUh9eP.d.ts} +1 -1
  28. package/dist/index.cjs +238 -1868
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.d.ts +7 -11
  31. package/dist/index.js +227 -1839
  32. package/dist/index.js.map +1 -1
  33. package/dist/protocols/evm/aave-v4/index.cjs +385 -662
  34. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  35. package/dist/protocols/evm/aave-v4/index.d.ts +1 -2
  36. package/dist/protocols/evm/aave-v4/index.js +385 -662
  37. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  38. package/dist/protocols/evm/curve-dao/index.cjs +24 -124
  39. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  40. package/dist/protocols/evm/curve-dao/index.d.ts +3 -4
  41. package/dist/protocols/evm/curve-dao/index.js +15 -115
  42. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  43. package/dist/protocols/evm/ethena/index.cjs +290 -402
  44. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  45. package/dist/protocols/evm/ethena/index.d.ts +1 -2
  46. package/dist/protocols/evm/ethena/index.js +291 -403
  47. package/dist/protocols/evm/ethena/index.js.map +1 -1
  48. package/dist/protocols/evm/euler-v2/index.cjs +485 -1163
  49. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  50. package/dist/protocols/evm/euler-v2/index.d.ts +1 -2
  51. package/dist/protocols/evm/euler-v2/index.js +486 -1164
  52. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  53. package/dist/protocols/evm/lido/index.cjs +241 -236
  54. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  55. package/dist/protocols/evm/lido/index.d.ts +1 -2
  56. package/dist/protocols/evm/lido/index.js +242 -237
  57. package/dist/protocols/evm/lido/index.js.map +1 -1
  58. package/dist/protocols/evm/maple/index.cjs +310 -398
  59. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  60. package/dist/protocols/evm/maple/index.d.ts +1 -2
  61. package/dist/protocols/evm/maple/index.js +311 -399
  62. package/dist/protocols/evm/maple/index.js.map +1 -1
  63. package/dist/protocols/evm/sky/index.cjs +238 -233
  64. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  65. package/dist/protocols/evm/sky/index.d.ts +1 -2
  66. package/dist/protocols/evm/sky/index.js +236 -231
  67. package/dist/protocols/evm/sky/index.js.map +1 -1
  68. package/dist/protocols/evm/uniswap-v4/index.cjs +423 -658
  69. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  70. package/dist/protocols/evm/uniswap-v4/index.d.ts +3 -4
  71. package/dist/protocols/evm/uniswap-v4/index.js +422 -657
  72. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  73. package/dist/{registry-oMKlO_5z.d.ts → registry-Bv5o37_w.d.ts} +1 -1
  74. package/dist/{types-Ce2qNHai.d.cts → types-BfjWdw1j.d.ts} +3 -1
  75. package/dist/{types-5u863Fd9.d.ts → types-DUeNJLr9.d.ts} +1 -1
  76. package/package.json +7 -6
  77. package/dist/agent/catalog.d.cts +0 -939
  78. package/dist/chains/evm/index.d.cts +0 -64
  79. package/dist/chains/near/index.d.cts +0 -37
  80. package/dist/chains/solana/index.d.cts +0 -40
  81. package/dist/core/index.d.cts +0 -43
  82. package/dist/envelope-DYDPnrHZ.d.cts +0 -35
  83. package/dist/index.d.cts +0 -16
  84. package/dist/keygen-CfNp8yKJ.d.cts +0 -9
  85. package/dist/keygen-DsINazx8.d.ts +0 -9
  86. package/dist/nodeRead-BnmSaMGO.d.cts +0 -8
  87. package/dist/nodeRead-BnmSaMGO.d.ts +0 -8
  88. package/dist/protocols/evm/aave-v4/index.d.cts +0 -500
  89. package/dist/protocols/evm/curve-dao/index.d.cts +0 -147
  90. package/dist/protocols/evm/ethena/index.d.cts +0 -161
  91. package/dist/protocols/evm/euler-v2/index.d.cts +0 -317
  92. package/dist/protocols/evm/lido/index.d.cts +0 -120
  93. package/dist/protocols/evm/maple/index.d.cts +0 -109
  94. package/dist/protocols/evm/sky/index.d.cts +0 -218
  95. package/dist/protocols/evm/uniswap-v4/index.d.cts +0 -324
  96. package/dist/registry-BwZoE668.d.cts +0 -8
  97. package/dist/txParams-BC7ogvdR.d.cts +0 -19
  98. package/dist/txParams-BC7ogvdR.d.ts +0 -19
  99. package/dist/types-B8idm_gu.d.cts +0 -34
  100. package/dist/types-Ce2qNHai.d.ts +0 -57
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @continuumdao/ctm-mpc-defi
2
2
 
3
- Continuum MPC DeFi protocol library — builds **multiSignRequest** payloads for EVM (and future chain categories). Usable from the Next.js app and from AI agents / Node scripts.
3
+ Continuum MPC DeFi protocol library — builds **multiSignRequest** payloads for EVM (and future chain categories). Bundled into the **continuum-mcp-server** Docker image; linked locally via `file:../ctm-mpc-defi`.
4
4
 
5
5
  **License:** [Business Source License 1.1](LICENSE) (ContinuumDAO). Converts to GPL-3.0-or-later on 2030-01-01.
6
6
 
@@ -8,92 +8,55 @@ 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, **management POST sig**, registry |
12
- | Chain categories | `src/chains/<category>/` | EVM batch builder, fees; Solana/NEAR stubs |
11
+ | Core | `src/core/` | Purpose text, mpc-auth envelope, protocol registry |
12
+ | Chain categories | `src/chains/<category>/` | EVM batch builder; Solana/NEAR stubs |
13
13
  | Protocols | `src/protocols/<category>/<name>/` | DeFi actions (Uniswap V4, Curve DAO, …) |
14
+ | Agent | `src/agent/` | MCP tool catalog, SKILL.md, support advisors |
14
15
 
15
- ## Install
16
+ Management reads, fee helpers, and client-sign utilities live in **`@continuumdao/continuum-node-sdk`** — import those from the SDK, not from this package.
16
17
 
17
- ```bash
18
- npm install @continuumdao/ctm-mpc-defi viem
19
- ```
18
+ ## Install
20
19
 
21
- Local link with the app:
20
+ This package is published to npm for production deploys (e.g. Railway). For local development against unreleased changes, use a `file:` link:
22
21
 
23
22
  ```json
24
23
  "@continuumdao/ctm-mpc-defi": "file:../ctm-mpc-defi"
25
24
  ```
26
25
 
27
- Run `npm run build` in this repo after changes so `dist/` is up to date.
26
+ Run `npm run build` in this repo after changes so `dist/` is up to date before linking.
28
27
 
29
28
  ## Package exports
30
29
 
31
- - `@continuumdao/ctm-mpc-defi` — core + registry
32
- - `@continuumdao/ctm-mpc-defi/core`
33
- - `@continuumdao/ctm-mpc-defi/chains/evm`
34
- - `@continuumdao/ctm-mpc-defi/protocols/evm/uniswap-v4`
35
- - `@continuumdao/ctm-mpc-defi/protocols/evm/curve-dao`
36
- - `@continuumdao/ctm-mpc-defi/agent` — action catalog for agents
30
+ - `@continuumdao/ctm-mpc-defi` — registry + protocol modules
31
+ - `@continuumdao/ctm-mpc-defi/core` — envelope, registry, `KeyGenSubset`, `firstClientIdFromKeyGen`
32
+ - `@continuumdao/ctm-mpc-defi/chains/evm` — `buildEvmMultisignBatch`, chain helpers
33
+ - `@continuumdao/ctm-mpc-defi/protocols/evm/<protocol>` — per-protocol builders
34
+ - `@continuumdao/ctm-mpc-defi/agent` — MCP tool catalog and SKILL.md paths
37
35
 
38
- ## Agent example (Uniswap V4)
36
+ ## Protocol example (Uniswap V4)
39
37
 
40
38
  ```typescript
41
39
  import { uniswapV4 } from '@continuumdao/ctm-mpc-defi/protocols/evm/uniswap-v4'
42
40
 
43
- const quote = await uniswapV4.quote({
44
- type: 'EXACT_INPUT',
45
- amount: '1000000',
46
- tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
47
- tokenOut: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
48
- chainId: 1,
49
- uniswapApiKey: process.env.UNISWAP_API_KEY!,
50
- swapper: '0xYourMpcExecutor',
51
- })
52
-
41
+ const quote = await uniswapV4.quote({ /* … */ })
53
42
  const { bodyForSign, messageToSign } = await uniswapV4.buildSwapMultisignBody({ /* … */ })
54
43
  // 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)
70
44
  ```
71
45
 
72
- ## Agent catalog
46
+ ## MCP servers
73
47
 
74
- Short registry (protocol actions):
75
-
76
- ```typescript
77
- import { getAgentCatalog } from '@continuumdao/ctm-mpc-defi/agent'
78
- console.log(getAgentCatalog().byCategory.evm)
79
- ```
80
-
81
- **MCP servers** should use the richer tool definitions (descriptions, input/output schema, handler mapping, prerequisites):
48
+ Use the agent export for tool registration and discovery:
82
49
 
83
50
  ```typescript
84
51
  import { getMcpToolDefinitions, getAgentCatalogForMcp } from '@continuumdao/ctm-mpc-defi/agent'
85
52
 
86
53
  for (const tool of getMcpToolDefinitions()) {
87
- // Register each tool with your MCP server using tool.name, tool.description,
88
- // tool.inputSchema, tool.outputSchema; invoke via tool.handler.importPath + exportName
54
+ // Register tool.name, tool.description, tool.inputSchema, tool.outputSchema
55
+ // Invoke via tool.handler.importPath + exportName
89
56
  }
90
57
  ```
91
58
 
92
- Each MCP tool includes:
93
- - Long `description` (what it does and does not do)
94
- - `inputSchema` / `outputSchema` (including `MultisignBuildResult` for sign builders)
95
- - `prerequisites` / `followUp` (typical quote → swap → multisign → sign → POST flow)
96
- - `handler`: `{ importPath, exportName }` pointing at the library export to call
59
+ Each MCP tool includes descriptions, Zod-derived JSON schemas, prerequisites/followUp hints, and a handler pointing at the library export. The continuum-node-sdk MCP server enriches slim inputs (`keyGenId`, `chainId`) before calling builders.
97
60
 
98
61
  ## Development
99
62
 
@@ -103,24 +66,3 @@ npm run build
103
66
  npm test
104
67
  npm run typecheck
105
68
  ```
106
-
107
- ## Publish (npm)
108
-
109
- Scoped package for the [ContinuumDAO npm org](https://www.npmjs.com/org/continuumdao):
110
-
111
- ```bash
112
- npm login
113
- npm publish
114
- ```
115
-
116
- Install in consumers:
117
-
118
- ```bash
119
- npm install @continuumdao/ctm-mpc-defi
120
- ```
121
-
122
- For local development against the sibling repo:
123
-
124
- ```json
125
- "@continuumdao/ctm-mpc-defi": "file:../ctm-mpc-defi"
126
- ```