dexe-mcp 0.21.0 → 0.22.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +2 -1
  3. package/dexe-plugin/skills/dexe-create-dao/SKILL.md +8 -0
  4. package/dexe-plugin/skills/dexe-create-proposal/SKILL.md +26 -5
  5. package/dexe-plugin/skills/dexe-otc/SKILL.md +5 -0
  6. package/dexe-plugin/skills/dexe-vote-execute/SKILL.md +16 -3
  7. package/dist/config.d.ts +7 -0
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +49 -9
  10. package/dist/config.js.map +1 -1
  11. package/dist/env/schema.d.ts +27 -6
  12. package/dist/env/schema.d.ts.map +1 -1
  13. package/dist/env/schema.js +36 -6
  14. package/dist/env/schema.js.map +1 -1
  15. package/dist/index.js +33 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/lib/errors.d.ts +33 -0
  18. package/dist/lib/errors.d.ts.map +1 -0
  19. package/dist/lib/errors.js +65 -0
  20. package/dist/lib/errors.js.map +1 -0
  21. package/dist/lib/params.d.ts +8 -0
  22. package/dist/lib/params.d.ts.map +1 -0
  23. package/dist/lib/params.js +14 -0
  24. package/dist/lib/params.js.map +1 -0
  25. package/dist/lib/proposalBuilders.d.ts +30 -2
  26. package/dist/lib/proposalBuilders.d.ts.map +1 -1
  27. package/dist/lib/proposalBuilders.js +583 -17
  28. package/dist/lib/proposalBuilders.js.map +1 -1
  29. package/dist/lib/requireEnv.d.ts.map +1 -1
  30. package/dist/lib/requireEnv.js +7 -4
  31. package/dist/lib/requireEnv.js.map +1 -1
  32. package/dist/lib/signer.d.ts.map +1 -1
  33. package/dist/lib/signer.js +7 -2
  34. package/dist/lib/signer.js.map +1 -1
  35. package/dist/lib/txWait.d.ts +28 -0
  36. package/dist/lib/txWait.d.ts.map +1 -0
  37. package/dist/lib/txWait.js +63 -0
  38. package/dist/lib/txWait.js.map +1 -0
  39. package/dist/lib/units.d.ts +32 -0
  40. package/dist/lib/units.d.ts.map +1 -0
  41. package/dist/lib/units.js +64 -0
  42. package/dist/lib/units.js.map +1 -0
  43. package/dist/rpc.d.ts +29 -1
  44. package/dist/rpc.d.ts.map +1 -1
  45. package/dist/rpc.js +86 -22
  46. package/dist/rpc.js.map +1 -1
  47. package/dist/tools/dao.d.ts.map +1 -1
  48. package/dist/tools/dao.js +16 -12
  49. package/dist/tools/dao.js.map +1 -1
  50. package/dist/tools/daoCreate.d.ts.map +1 -1
  51. package/dist/tools/daoCreate.js +13 -2
  52. package/dist/tools/daoCreate.js.map +1 -1
  53. package/dist/tools/flow.d.ts +28 -1
  54. package/dist/tools/flow.d.ts.map +1 -1
  55. package/dist/tools/flow.js +368 -111
  56. package/dist/tools/flow.js.map +1 -1
  57. package/dist/tools/gate.js +2 -2
  58. package/dist/tools/gov.d.ts.map +1 -1
  59. package/dist/tools/gov.js +17 -4
  60. package/dist/tools/gov.js.map +1 -1
  61. package/dist/tools/inbox.d.ts.map +1 -1
  62. package/dist/tools/inbox.js +4 -2
  63. package/dist/tools/inbox.js.map +1 -1
  64. package/dist/tools/operationalContext.d.ts.map +1 -1
  65. package/dist/tools/operationalContext.js +39 -5
  66. package/dist/tools/operationalContext.js.map +1 -1
  67. package/dist/tools/otc.d.ts.map +1 -1
  68. package/dist/tools/otc.js +53 -13
  69. package/dist/tools/otc.js.map +1 -1
  70. package/dist/tools/predict.d.ts.map +1 -1
  71. package/dist/tools/predict.js +7 -4
  72. package/dist/tools/predict.js.map +1 -1
  73. package/dist/tools/proposal.d.ts.map +1 -1
  74. package/dist/tools/proposal.js +8 -4
  75. package/dist/tools/proposal.js.map +1 -1
  76. package/dist/tools/proposalBuild.d.ts +1 -0
  77. package/dist/tools/proposalBuild.d.ts.map +1 -1
  78. package/dist/tools/proposalBuild.js +2 -1
  79. package/dist/tools/proposalBuild.js.map +1 -1
  80. package/dist/tools/proposalBuildComplex.d.ts +7 -0
  81. package/dist/tools/proposalBuildComplex.d.ts.map +1 -1
  82. package/dist/tools/proposalBuildComplex.js +7 -7
  83. package/dist/tools/proposalBuildComplex.js.map +1 -1
  84. package/dist/tools/proposalBuildInternal.d.ts +21 -0
  85. package/dist/tools/proposalBuildInternal.d.ts.map +1 -1
  86. package/dist/tools/proposalBuildInternal.js +1 -1
  87. package/dist/tools/proposalBuildInternal.js.map +1 -1
  88. package/dist/tools/proposalBuildMore.d.ts +2 -0
  89. package/dist/tools/proposalBuildMore.d.ts.map +1 -1
  90. package/dist/tools/proposalBuildMore.js +2 -2
  91. package/dist/tools/proposalBuildMore.js.map +1 -1
  92. package/dist/tools/read.d.ts.map +1 -1
  93. package/dist/tools/read.js +25 -16
  94. package/dist/tools/read.js.map +1 -1
  95. package/dist/tools/subgraph.d.ts.map +1 -1
  96. package/dist/tools/subgraph.js +5 -3
  97. package/dist/tools/subgraph.js.map +1 -1
  98. package/dist/tools/txSend.d.ts.map +1 -1
  99. package/dist/tools/txSend.js +46 -6
  100. package/dist/tools/txSend.js.map +1 -1
  101. package/dist/tools/vote.d.ts.map +1 -1
  102. package/dist/tools/vote.js +7 -4
  103. package/dist/tools/vote.js.map +1 -1
  104. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync } from "node:fs";
2
+ import { existsSync, readFileSync } from "node:fs";
3
3
  import { resolve, dirname } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -60,19 +60,46 @@ if (subcommand === "skills") {
60
60
  await mod.run(process.argv.slice(3));
61
61
  process.exit(0);
62
62
  }
63
+ /** Real package version — the MCP handshake previously hardcoded "0.1.5". */
64
+ function packageVersion() {
65
+ try {
66
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "..", "package.json"), "utf8"));
67
+ return pkg.version ?? "0.0.0";
68
+ }
69
+ catch {
70
+ return "0.0.0";
71
+ }
72
+ }
63
73
  async function main() {
64
74
  const config = await loadConfig();
65
- const server = new McpServer({ name: "dexe-mcp", version: "0.1.5" }, {
75
+ const server = new McpServer({ name: "dexe-mcp", version: packageVersion() }, {
66
76
  instructions: "Tools for DeXe Protocol governance DAOs (plus a generic dexe_gov_* surface for external OpenZeppelin/Compound Governor DAOs). " +
67
77
  "Call dexe_context first WHEN you need orientation (signer, active chain, env readiness, DAOs/proposals from prior sessions) — skip it when the user already gave you the target DAO and chain. " +
68
- "Prefer the composite flow tools over hand-sequencing calldata: dexe_dao_create (deploy a DAO), dexe_proposal_create (any proposal — pass proposalType + params), dexe_proposal_vote_and_execute. " +
78
+ "Prefer the composite flow tools over hand-sequencing calldata: dexe_dao_create (deploy a DAO), dexe_proposal_create (ANY of the 33 catalog proposal types — pass proposalType + params), dexe_proposal_vote_and_execute (auto-deposits when power is short). " +
79
+ "Amounts accept raw wei (digits-only) or human units with a decimal point ('12.5'); durations are seconds. " +
69
80
  "For images (DAO avatars): pass a LOCAL FILE PATH (avatarPath / newAvatarPath / filePath) and the server reads, validates, and pins it — never read image files or pass base64 through the conversation. " +
70
- "They handle the approve→deposit→create sequence, correct IPFS metadata, and the known deploy/proposal reverts. When depositing, ERC20.approve the UserKeeper, never GovPool. Validate DAO deploys on BSC testnet (chain 97). " +
71
- "Before any dexe_get_* / dexe_list_contracts / dexe_find_selector, run dexe_compile once per session. dexe_decode_proposal and dexe_read_gov_state need an RPC. " +
72
- "The tool surface is gated by DEXE_TOOLSETS (default 'core,proposals'). Set DEXE_TOOLSETS=full for every tool, or add sets: read, vote, governor, dev. " +
81
+ "The composites handle approve→deposit→create sequencing, correct IPFS metadata, and the known deploy/proposal reverts; on partial failure they return the landed-steps ledger fix the cause and re-run the same call (completed steps are skipped). " +
82
+ "When depositing, ERC20.approve the UserKeeper, never GovPool. Validate DAO deploys on BSC testnet (chain 97). " +
83
+ "Before any dexe_get_* / dexe_list_contracts / dexe_find_selector, run dexe_compile once per session. " +
84
+ "The tool surface is gated by DEXE_TOOLSETS (default 'core,proposals'); dexe_context reports which sets are off and what they unlock. " +
85
+ "Full intent→call recipes + error→remedy table: docs/PLAYBOOK.md (shipped in the package). " +
73
86
  "Recipe skills ship with the package (dexe-create-dao, dexe-create-proposal, dexe-vote-execute, dexe-otc). Installed automatically with the Claude Code plugin (`/plugin install dexe@dexe-mcp`), or copy them standalone with `npx dexe-mcp skills`.",
74
87
  });
75
88
  registerAll(server, config);
89
+ // The AI-efficiency guide, on demand (docs/PLAYBOOK.md ships in the package).
90
+ // Kept out of `instructions` so it doesn't cost tokens every session.
91
+ const playbookPath = resolve(__dirname, "..", "docs", "PLAYBOOK.md");
92
+ if (existsSync(playbookPath)) {
93
+ server.resource("playbook", "dexe://playbook", async () => ({
94
+ contents: [
95
+ {
96
+ uri: "dexe://playbook",
97
+ mimeType: "text/markdown",
98
+ text: readFileSync(playbookPath, "utf8"),
99
+ },
100
+ ],
101
+ }));
102
+ }
76
103
  const transport = new StdioServerTransport();
77
104
  await server.connect(transport);
78
105
  // Log-only, not protocol. stdout is the MCP channel.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAA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E,MAAM,CAAC,CAAC;IAE5B,8EAA8E;IAC9E,sEAAsE;IACtE,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;IACrE,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC1D,QAAQ,EAAE;gBACR;oBACE,GAAG,EAAE,iBAAiB;oBACtB,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC;iBACzC;aACF;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,qDAAqD;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qDAAqD,MAAM,CAAC,YAAY,GACtE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EACrC,IAAI,CACL,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Actionable-error layer (v0.22). Every catch-all in the composite flows routes
3
+ * through `toActionableError` so the model/user gets "what happened + what to do
4
+ * next" instead of a raw ethers dump. The remedy table is exported so
5
+ * `npm run gen:playbook` can render it into docs/PLAYBOOK.md — one source.
6
+ */
7
+ export interface KnownFailure {
8
+ /** Matched against the raw error message (case-insensitive). */
9
+ match: RegExp;
10
+ /** Stable slug used in PLAYBOOK's error→remedy table. */
11
+ slug: string;
12
+ /** One-sentence statement of what went wrong, in user terms. */
13
+ what: string;
14
+ /** Concrete next step ("do X"), tool names included. */
15
+ remedy: string;
16
+ }
17
+ /**
18
+ * Known failure signatures across the DeXe flows. Order matters — first match
19
+ * wins. Keep `what`/`remedy` self-contained: they are shown without the
20
+ * surrounding code context.
21
+ */
22
+ export declare const KNOWN_FAILURES: readonly KnownFailure[];
23
+ /** Result of classifying an unknown error against the KNOWN_FAILURES table. */
24
+ export interface ActionableError {
25
+ message: string;
26
+ slug?: string;
27
+ }
28
+ /**
29
+ * Wrap a caught error with step context and, when the signature is recognized,
30
+ * a concrete remedy. Falls back to the redacted raw message so nothing is lost.
31
+ */
32
+ export declare function toActionableError(err: unknown, step?: string): ActionableError;
33
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EA+CxC,CAAC;AAEX,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAS9E"}
@@ -0,0 +1,65 @@
1
+ import { safeErrorMessage } from "./redact.js";
2
+ /**
3
+ * Known failure signatures across the DeXe flows. Order matters — first match
4
+ * wins. Keep `what`/`remedy` self-contained: they are shown without the
5
+ * surrounding code context.
6
+ */
7
+ export const KNOWN_FAILURES = [
8
+ {
9
+ match: /insufficient funds for (gas|intrinsic)/i,
10
+ slug: "no-gas",
11
+ what: "The signer wallet has no BNB to pay gas.",
12
+ remedy: "Fund the signer address with BNB on the target chain (testnet 97: use a faucet, e.g. https://www.bnbchain.org/en/testnet-faucet), then re-run.",
13
+ },
14
+ {
15
+ match: /nonce (too low|has already been used)|already known|replacement transaction underpriced/i,
16
+ slug: "nonce-conflict",
17
+ what: "A transaction with this nonce is already pending or mined.",
18
+ remedy: "A previous broadcast is still settling. Wait ~15s, check it with dexe_tx_status, then re-run — the flow re-checks completed steps and skips them.",
19
+ },
20
+ {
21
+ match: /user rejected|user denied|rejected by user/i,
22
+ slug: "wallet-rejected",
23
+ what: "The transaction was rejected in the wallet.",
24
+ remedy: "Re-run the call and approve the request on the phone/wallet when it appears.",
25
+ },
26
+ {
27
+ match: /DEXE_PINATA_JWT/i,
28
+ slug: "pinata-missing",
29
+ what: "IPFS uploads need a Pinata JWT and none is configured.",
30
+ remedy: "1) Create a free API key at https://app.pinata.cloud/developers/api-keys with pinJSONToIPFS + pinFileToIPFS permissions. " +
31
+ "2) Add DEXE_PINATA_JWT=<jwt> to the .env at the dexe-mcp root (never .claude.json). " +
32
+ "3) Restart Claude Code (the .env is read once at startup). Or run /dexe-setup for a guided walkthrough.",
33
+ },
34
+ {
35
+ match: /rate.?limit|\b429\b|SERVER_ERROR|could not detect network|failed to fetch|fetch failed|ETIMEDOUT|ECONNRESET/i,
36
+ slug: "rpc-flaky",
37
+ what: "The RPC endpoint failed or rate-limited mid-call (retries were already attempted).",
38
+ remedy: "Re-run the call — completed steps are skipped. For reliability set a private endpoint in .env " +
39
+ "(DEXE_RPC_URL_MAINNET / DEXE_RPC_URL_TESTNET, e.g. Alchemy/QuickNode/Ankr) and restart.",
40
+ },
41
+ {
42
+ match: /execution reverted|CALL_EXCEPTION|transaction failed|status.*0\b/i,
43
+ slug: "onchain-revert",
44
+ what: "The transaction reverted on-chain (state was NOT changed by this step).",
45
+ remedy: "Read the revert reason above if present. Common causes: proposal not in the required state " +
46
+ "(check dexe_proposal_state), tokens locked in an active proposal (withdraw between proposals), " +
47
+ "or a blacklisted recipient. Fix the cause and re-run — earlier landed steps are skipped.",
48
+ },
49
+ ];
50
+ /**
51
+ * Wrap a caught error with step context and, when the signature is recognized,
52
+ * a concrete remedy. Falls back to the redacted raw message so nothing is lost.
53
+ */
54
+ export function toActionableError(err, step) {
55
+ const raw = safeErrorMessage(err);
56
+ const hit = KNOWN_FAILURES.find((k) => k.match.test(raw));
57
+ const prefix = step ? `${step} failed: ` : "";
58
+ if (!hit)
59
+ return { message: `${prefix}${raw}` };
60
+ return {
61
+ slug: hit.slug,
62
+ message: `${prefix}${raw}\n\n${hit.what}\nNext step: ${hit.remedy}`,
63
+ };
64
+ }
65
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAoB/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD;QACE,KAAK,EAAE,yCAAyC;QAChD,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,0CAA0C;QAChD,MAAM,EACJ,gJAAgJ;KACnJ;IACD;QACE,KAAK,EAAE,0FAA0F;QACjG,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,4DAA4D;QAClE,MAAM,EACJ,mJAAmJ;KACtJ;IACD;QACE,KAAK,EAAE,6CAA6C;QACpD,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,6CAA6C;QACnD,MAAM,EAAE,8EAA8E;KACvF;IACD;QACE,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,wDAAwD;QAC9D,MAAM,EACJ,2HAA2H;YAC3H,sFAAsF;YACtF,yGAAyG;KAC5G;IACD;QACE,KAAK,EAAE,8GAA8G;QACrH,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EACJ,gGAAgG;YAChG,yFAAyF;KAC5F;IACD;QACE,KAAK,EAAE,mEAAmE;QAC1E,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,yEAAyE;QAC/E,MAAM,EACJ,6FAA6F;YAC7F,iGAAiG;YACjG,0FAA0F;KAC7F;CACO,CAAC;AAQX;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY,EAAE,IAAa;IAC3D,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,GAAG,GAAG,EAAE,EAAE,CAAC;IAChD,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,IAAI,gBAAgB,GAAG,CAAC,MAAM,EAAE;KACpE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Shared `chainId` input param for every read tool. Optional — when omitted the
4
+ * MCP's default chain is used, so adding this to a tool is non-breaking.
5
+ * Write tools already carry their own copy with broadcast-specific wording.
6
+ */
7
+ export declare const chainIdParam: z.ZodOptional<z.ZodNumber>;
8
+ //# sourceMappingURL=params.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/lib/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,YAAY,4BAQtB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Shared `chainId` input param for every read tool. Optional — when omitted the
4
+ * MCP's default chain is used, so adding this to a tool is non-breaking.
5
+ * Write tools already carry their own copy with broadcast-specific wording.
6
+ */
7
+ export const chainIdParam = z
8
+ .number()
9
+ .int()
10
+ .positive()
11
+ .optional()
12
+ .describe("Chain id to read from (56 = BSC mainnet, 97 = BSC testnet). Defaults to the MCP's default chain. " +
13
+ "Rejects if no RPC is configured for the requested chain.");
14
+ //# sourceMappingURL=params.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.js","sourceRoot":"","sources":["../../src/lib/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,GAAG,EAAE;KACL,QAAQ,EAAE;KACV,QAAQ,EAAE;KACV,QAAQ,CACP,mGAAmG;IACjG,0DAA0D,CAC7D,CAAC"}
@@ -42,9 +42,37 @@ export interface CatalogBuilder {
42
42
  }
43
43
  /**
44
44
  * Registry keyed by the short `proposalType` accepted by `dexe_proposal_create`.
45
- * Extend this to wire another catalog type into the composite.
45
+ * Extend this to wire another catalog type into the composite. Aliases point at
46
+ * the same builder object (validators_allocation ≡ manage_validators;
47
+ * enable_staking ≡ new_proposal_type with StakingProposal among executors —
48
+ * matching the frontend, which reuses useGovPoolCreateProposalType).
46
49
  */
47
50
  export declare const PROPOSAL_BUILDERS: Record<string, CatalogBuilder>;
51
+ export interface BuiltInternalProposal {
52
+ /** GovValidators internal type: 0 ChangeBalances, 1 ChangeSettings, 2 MonthlyWithdraw, 3 OffchainProposal. */
53
+ internalType: 0 | 1 | 2 | 3;
54
+ /** Selector + abi-encoded args for the internal executor method ("0x" for type 3). */
55
+ data: string;
56
+ category: string;
57
+ metadataExtra: Record<string, unknown>;
58
+ summary: string;
59
+ }
60
+ export interface InternalCatalogBuilder {
61
+ schema: z.ZodTypeAny;
62
+ build: (params: unknown) => BuiltInternalProposal;
63
+ }
64
+ /**
65
+ * Internal proposals do NOT go through GovPool.createProposalAndVote — they are
66
+ * created on GovValidators (validators-only voting, no deposit). The flow layer
67
+ * routes these to a single createInternalProposal payload.
68
+ */
69
+ export declare const INTERNAL_PROPOSAL_BUILDERS: Record<string, InternalCatalogBuilder>;
70
+ /**
71
+ * Off-chain proposal types live on the DeXe backend (api.dexe.io), not on any
72
+ * contract — `dexe_proposal_create` rejects them with the exact alternative
73
+ * flow instead of a dead-end.
74
+ */
75
+ export declare const OFFCHAIN_FLOW_TYPES: readonly ["offchain_single_option", "offchain_multi_option", "offchain_for_against"];
48
76
  /** proposalType values `dexe_proposal_create` accepts directly. */
49
- export declare const FLOW_PROPOSAL_TYPES: readonly ["modify_dao_profile", "custom", ...string[]];
77
+ export declare const FLOW_PROPOSAL_TYPES: readonly ["modify_dao_profile", "custom", ...string[], "offchain_single_option", "offchain_multi_option", "offchain_for_against"];
50
78
  //# sourceMappingURL=proposalBuilders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"proposalBuilders.d.ts","sourceRoot":"","sources":["../../src/lib/proposalBuilders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAmCvD,MAAM,WAAW,oBAAoB;IACnC,mEA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