dexe-mcp 0.2.0 → 0.3.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 (67) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +103 -80
  3. package/dist/config.d.ts +2 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +10 -0
  6. package/dist/config.js.map +1 -1
  7. package/dist/index.js +16 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/addresses.js +1 -1
  10. package/dist/lib/ipfs.d.ts.map +1 -1
  11. package/dist/lib/ipfs.js +2 -1
  12. package/dist/lib/ipfs.js.map +1 -1
  13. package/dist/lib/markdownToSlate.d.ts +39 -0
  14. package/dist/lib/markdownToSlate.d.ts.map +1 -0
  15. package/dist/lib/markdownToSlate.js +203 -0
  16. package/dist/lib/markdownToSlate.js.map +1 -0
  17. package/dist/lib/signer.d.ts +12 -0
  18. package/dist/lib/signer.d.ts.map +1 -0
  19. package/dist/lib/signer.js +31 -0
  20. package/dist/lib/signer.js.map +1 -0
  21. package/dist/lib/subgraph.d.ts +2 -2
  22. package/dist/lib/subgraph.d.ts.map +1 -1
  23. package/dist/lib/subgraph.js +14 -9
  24. package/dist/lib/subgraph.js.map +1 -1
  25. package/dist/tools/daoDeploy.d.ts.map +1 -1
  26. package/dist/tools/daoDeploy.js +313 -63
  27. package/dist/tools/daoDeploy.js.map +1 -1
  28. package/dist/tools/flow.d.ts +5 -0
  29. package/dist/tools/flow.d.ts.map +1 -0
  30. package/dist/tools/flow.js +451 -0
  31. package/dist/tools/flow.js.map +1 -0
  32. package/dist/tools/index.d.ts.map +1 -1
  33. package/dist/tools/index.js +8 -0
  34. package/dist/tools/index.js.map +1 -1
  35. package/dist/tools/ipfs.d.ts.map +1 -1
  36. package/dist/tools/ipfs.js +94 -28
  37. package/dist/tools/ipfs.js.map +1 -1
  38. package/dist/tools/proposal.js +28 -10
  39. package/dist/tools/proposal.js.map +1 -1
  40. package/dist/tools/proposalBuild.d.ts.map +1 -1
  41. package/dist/tools/proposalBuild.js +28 -13
  42. package/dist/tools/proposalBuild.js.map +1 -1
  43. package/dist/tools/proposalBuildComplex.d.ts.map +1 -1
  44. package/dist/tools/proposalBuildComplex.js +147 -81
  45. package/dist/tools/proposalBuildComplex.js.map +1 -1
  46. package/dist/tools/proposalBuildInternal.js +24 -11
  47. package/dist/tools/proposalBuildInternal.js.map +1 -1
  48. package/dist/tools/proposalBuildMore.js +42 -21
  49. package/dist/tools/proposalBuildMore.js.map +1 -1
  50. package/dist/tools/proposalBuildOffchain.d.ts.map +1 -1
  51. package/dist/tools/proposalBuildOffchain.js +8 -5
  52. package/dist/tools/proposalBuildOffchain.js.map +1 -1
  53. package/dist/tools/read.d.ts.map +1 -1
  54. package/dist/tools/read.js +227 -0
  55. package/dist/tools/read.js.map +1 -1
  56. package/dist/tools/subgraph.d.ts +4 -0
  57. package/dist/tools/subgraph.d.ts.map +1 -0
  58. package/dist/tools/subgraph.js +404 -0
  59. package/dist/tools/subgraph.js.map +1 -0
  60. package/dist/tools/txSend.d.ts +5 -0
  61. package/dist/tools/txSend.d.ts.map +1 -0
  62. package/dist/tools/txSend.js +87 -0
  63. package/dist/tools/txSend.js.map +1 -0
  64. package/dist/tools/voteBuild.d.ts.map +1 -1
  65. package/dist/tools/voteBuild.js +420 -0
  66. package/dist/tools/voteBuild.js.map +1 -1
  67. package/package.json +10 -2
@@ -0,0 +1,203 @@
1
+ /**
2
+ * Converts a Markdown string to the Slate node format used by the DeXe
3
+ * investing-dashboard frontend.
4
+ *
5
+ * Uses `unified` + `remark-parse` + `remark-slate-transformer` with overrides
6
+ * that map remark's default node types to the frontend's ELEMENT_TYPES enum:
7
+ *
8
+ * Remark default → Frontend Slate type
9
+ * ─────────────────────────────────────────────
10
+ * heading depth=1 → "heading-one"
11
+ * heading depth=2 → "heading-two"
12
+ * heading depth=3 → "heading-three"
13
+ * paragraph → "paragraph" (same)
14
+ * list ordered=false → "bulleted-list"
15
+ * list ordered=true → "numbered-list"
16
+ * listItem → "list-item"
17
+ * code → "code-block"
18
+ * link → "link"
19
+ * image → "image"
20
+ * delete → "strikethrough" (~~text~~)
21
+ *
22
+ * Text marks:
23
+ * strong → { bold: true }
24
+ * emphasis → { italic: true }
25
+ * inlineCode → wrapped in code-inline element
26
+ * delete → { strikethrough: true }
27
+ */
28
+ import { unified } from "unified";
29
+ import remarkParse from "remark-parse";
30
+ import remarkGfm from "remark-gfm";
31
+ import { remarkToSlate } from "remark-slate-transformer";
32
+ /**
33
+ * Override builders that remap remark-slate-transformer's default output
34
+ * into the exact element/mark types the frontend expects.
35
+ */
36
+ const overrides = {
37
+ // ── Block elements ──────────────────────────────────────────────
38
+ heading(node, next) {
39
+ const depthMap = {
40
+ 1: "heading-one",
41
+ 2: "heading-two",
42
+ 3: "heading-three",
43
+ };
44
+ return {
45
+ type: depthMap[node.depth] ?? "heading-three",
46
+ children: next(node.children),
47
+ };
48
+ },
49
+ // paragraph — default type name matches, but we define it explicitly
50
+ // to ensure children get processed through `next` consistently
51
+ paragraph(node, next) {
52
+ return {
53
+ type: "paragraph",
54
+ children: next(node.children),
55
+ };
56
+ },
57
+ list(node, next) {
58
+ const type = node.ordered ? "numbered-list" : "bulleted-list";
59
+ return {
60
+ type,
61
+ children: next(node.children),
62
+ };
63
+ },
64
+ listItem(node, next) {
65
+ // remark wraps list item content in a paragraph — we need to flatten
66
+ // so the frontend gets { type: "list-item", children: [{ text }] }
67
+ const processed = next(node.children);
68
+ // If the only child is a paragraph, unwrap its children
69
+ const children = processed.length === 1 &&
70
+ processed[0] &&
71
+ processed[0].type === "paragraph"
72
+ ? processed[0].children
73
+ : processed;
74
+ return {
75
+ type: "list-item",
76
+ children,
77
+ };
78
+ },
79
+ code(node) {
80
+ // Fenced code blocks → code-block element
81
+ return {
82
+ type: "code-block",
83
+ language: node.lang ?? "",
84
+ children: [{ text: node.value }],
85
+ };
86
+ },
87
+ blockquote(node, next) {
88
+ // Frontend doesn't have a blockquote type — flatten to paragraphs
89
+ // Each child (usually paragraphs) gets returned as-is
90
+ const children = next(node.children);
91
+ return children.length > 0 ? children : undefined;
92
+ },
93
+ thematicBreak() {
94
+ // --- / *** → no frontend equivalent, skip
95
+ return { type: "paragraph", children: [{ text: "---" }] };
96
+ },
97
+ // ── Inline elements ─────────────────────────────────────────────
98
+ link(node, next) {
99
+ return {
100
+ type: "link",
101
+ url: node.url,
102
+ children: next(node.children),
103
+ };
104
+ },
105
+ image(node) {
106
+ return {
107
+ type: "image",
108
+ url: node.url,
109
+ children: [{ text: node.alt ?? "" }],
110
+ };
111
+ },
112
+ // ── Text marks ──────────────────────────────────────────────────
113
+ // remark-slate-transformer applies these as flags on text nodes.
114
+ // We need to remap the flag names to match the frontend's CustomText.
115
+ strong(node, next) {
116
+ // Apply bold: true to all text children
117
+ const children = next(node.children);
118
+ return children.map((child) => ({ ...child, bold: true }));
119
+ },
120
+ emphasis(node, next) {
121
+ const children = next(node.children);
122
+ return children.map((child) => ({ ...child, italic: true }));
123
+ },
124
+ delete(node, next) {
125
+ const children = next(node.children);
126
+ return children.map((child) => ({ ...child, strikethrough: "true" }));
127
+ },
128
+ inlineCode(node) {
129
+ // Frontend has code-inline as an element type wrapping text
130
+ return {
131
+ type: "code-inline",
132
+ children: [{ text: node.value }],
133
+ };
134
+ },
135
+ };
136
+ /** The default empty Slate document the frontend uses. */
137
+ const SLATE_DEFAULT = [{ type: "paragraph", children: [{ text: "" }] }];
138
+ /**
139
+ * Unified processor configured with our overrides.
140
+ */
141
+ const processor = unified()
142
+ .use(remarkParse)
143
+ .use(remarkGfm) // GFM: ~~strikethrough~~, tables, autolinks, task lists
144
+ .use(remarkToSlate, { overrides });
145
+ /**
146
+ * Convert a Markdown string to a Slate `SlateDescendant[]` array compatible
147
+ * with the DeXe investing-dashboard frontend.
148
+ *
149
+ * - Empty / whitespace-only input → default empty paragraph node
150
+ * - Plain text (no markdown syntax) → paragraph nodes split by newline
151
+ * - Rich markdown → full Slate tree with headings, lists, bold, etc.
152
+ *
153
+ * This function is synchronous (`processSync`).
154
+ */
155
+ export function markdownToSlate(markdown) {
156
+ if (!markdown || markdown.trim().length === 0) {
157
+ return SLATE_DEFAULT;
158
+ }
159
+ try {
160
+ const result = processor.processSync(markdown);
161
+ const nodes = result.result;
162
+ if (!Array.isArray(nodes) || nodes.length === 0) {
163
+ return SLATE_DEFAULT;
164
+ }
165
+ // Flatten any arrays returned by mark overrides (strong/emphasis/delete
166
+ // return arrays of text nodes instead of a single element)
167
+ return flattenSlateNodes(nodes);
168
+ }
169
+ catch {
170
+ // Fallback: split by newlines into paragraphs (same as old behavior)
171
+ const lines = markdown.split("\n").filter((l) => l.length > 0);
172
+ return lines.length > 0
173
+ ? lines.map((line) => ({ type: "paragraph", children: [{ text: line }] }))
174
+ : SLATE_DEFAULT;
175
+ }
176
+ }
177
+ /**
178
+ * Recursively flatten any nested arrays that our mark overrides produce.
179
+ * Mark handlers (strong, emphasis, delete) return arrays of text nodes
180
+ * instead of elements, which can end up as nested arrays in children.
181
+ */
182
+ function flattenSlateNodes(nodes) {
183
+ const result = [];
184
+ for (const node of nodes) {
185
+ if (Array.isArray(node)) {
186
+ result.push(...flattenSlateNodes(node));
187
+ }
188
+ else if (node && typeof node === "object") {
189
+ const n = node;
190
+ if (Array.isArray(n.children)) {
191
+ result.push({ ...n, children: flattenSlateNodes(n.children) });
192
+ }
193
+ else {
194
+ result.push(n);
195
+ }
196
+ }
197
+ else {
198
+ result.push(node);
199
+ }
200
+ }
201
+ return result;
202
+ }
203
+ //# sourceMappingURL=markdownToSlate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdownToSlate.js","sourceRoot":"","sources":["../../src/lib/markdownToSlate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO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;QAC1C,CAAC;aAAM,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,CAAC,GAAG,IAA+B,CAAC;YAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,QAAqB,CAAC,EAAE,CAAC,CAAC;YAC9E,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Wallet } from "ethers";
2
+ import type { DexeConfig } from "../config.js";
3
+ export declare class SignerManager {
4
+ private wallet;
5
+ private readonly key;
6
+ private readonly rpcUrl;
7
+ constructor(config: DexeConfig);
8
+ hasSigner(): boolean;
9
+ getAddress(): string;
10
+ requireSigner(): Wallet;
11
+ }
12
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/lib/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAqB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;gBAEhC,MAAM,EAAE,UAAU;IAK9B,SAAS,IAAI,OAAO;IAIpB,UAAU,IAAI,MAAM;IAIpB,aAAa,IAAI,MAAM;CAgBxB"}
@@ -0,0 +1,31 @@
1
+ import { JsonRpcProvider, Wallet } from "ethers";
2
+ export class SignerManager {
3
+ wallet = null;
4
+ key;
5
+ rpcUrl;
6
+ constructor(config) {
7
+ this.key = config.privateKey;
8
+ this.rpcUrl = config.rpcUrl;
9
+ }
10
+ hasSigner() {
11
+ return !!this.key;
12
+ }
13
+ getAddress() {
14
+ return this.requireSigner().address;
15
+ }
16
+ requireSigner() {
17
+ if (!this.key) {
18
+ const dexeEnvKeys = Object.keys(process.env).filter(k => k.startsWith("DEXE_")).join(", ");
19
+ throw new Error(`DEXE_PRIVATE_KEY not set. Available DEXE_* env vars: [${dexeEnvKeys}]. Configure it in MCP server env to enable transaction signing.`);
20
+ }
21
+ if (!this.wallet) {
22
+ if (!this.rpcUrl) {
23
+ throw new Error("DEXE_RPC_URL required when DEXE_PRIVATE_KEY is set.");
24
+ }
25
+ const provider = new JsonRpcProvider(this.rpcUrl);
26
+ this.wallet = new Wallet(this.key, provider);
27
+ }
28
+ return this.wallet;
29
+ }
30
+ }
31
+ //# sourceMappingURL=signer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/lib/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGjD,MAAM,OAAO,aAAa;IAChB,MAAM,GAAkB,IAAI,CAAC;IACpB,GAAG,CAAqB;IACxB,MAAM,CAAqB;IAE5C,YAAY,MAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED,SAAS;QACP,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC;IACtC,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3F,MAAM,IAAI,KAAK,CACb,yDAAyD,WAAW,kEAAkE,CACvI,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;YACzE,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
@@ -10,6 +10,6 @@ export interface GqlResponse<T> {
10
10
  }>;
11
11
  }
12
12
  export declare function gqlRequest<T>(endpoint: string, query: string, variables?: Record<string, unknown>): Promise<T>;
13
- /** Ported from frontend `/src/gql/interactions.ts`. */
14
- export declare const VOTES_BY_PROPOSAL_QUERY = "\n query VotesByProposal($pool: Bytes!, $proposalId: BigInt!, $first: Int!, $skip: Int!) {\n votes(\n where: { pool: $pool, proposalId: $proposalId }\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n id\n voter\n isVoteFor\n totalRawVoted\n timestamp\n transactionHash\n }\n }\n";
13
+ /** Ported from frontend gov-pools subgraph `proposalInteractions` query. */
14
+ export declare const PROPOSAL_INTERACTIONS_QUERY = "\n query ProposalInteractions($proposalId: String!, $first: Int!, $skip: Int!) {\n proposalInteractions(\n where: { proposal: $proposalId }\n first: $first\n skip: $skip\n orderBy: timestamp\n orderDirection: desc\n ) {\n id\n hash\n timestamp\n interactionType\n totalVote\n voter {\n id\n voter {\n id\n }\n }\n }\n }\n";
15
15
  //# sourceMappingURL=subgraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../src/lib/subgraph.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC;AAED,wBAAsB,UAAU,CAAC,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,uDAAuD;AACvD,eAAO,MAAM,uBAAuB,6XAiBnC,CAAC"}
1
+ {"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../src/lib/subgraph.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC;AAED,wBAAsB,UAAU,CAAC,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,4EAA4E;AAC5E,eAAO,MAAM,2BAA2B,2aAsBvC,CAAC"}
@@ -15,22 +15,27 @@ export async function gqlRequest(endpoint, query, variables) {
15
15
  throw new Error("Subgraph returned empty data");
16
16
  return body.data;
17
17
  }
18
- /** Ported from frontend `/src/gql/interactions.ts`. */
19
- export const VOTES_BY_PROPOSAL_QUERY = /* GraphQL */ `
20
- query VotesByProposal($pool: Bytes!, $proposalId: BigInt!, $first: Int!, $skip: Int!) {
21
- votes(
22
- where: { pool: $pool, proposalId: $proposalId }
18
+ /** Ported from frontend gov-pools subgraph `proposalInteractions` query. */
19
+ export const PROPOSAL_INTERACTIONS_QUERY = /* GraphQL */ `
20
+ query ProposalInteractions($proposalId: String!, $first: Int!, $skip: Int!) {
21
+ proposalInteractions(
22
+ where: { proposal: $proposalId }
23
23
  first: $first
24
24
  skip: $skip
25
25
  orderBy: timestamp
26
26
  orderDirection: desc
27
27
  ) {
28
28
  id
29
- voter
30
- isVoteFor
31
- totalRawVoted
29
+ hash
32
30
  timestamp
33
- transactionHash
31
+ interactionType
32
+ totalVote
33
+ voter {
34
+ id
35
+ voter {
36
+ id
37
+ }
38
+ }
34
39
  }
35
40
  }
36
41
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"subgraph.js","sourceRoot":"","sources":["../../src/lib/subgraph.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,QAAgB,EAChB,KAAa,EACb,SAAmC;IAEnC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE;QAChC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;KAC3C,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAmB,CAAC;IAClD,IAAI,IAAI,CAAC,MAAM,EAAE,MA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,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,2BAA2B,GAAG,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;CAsBxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"daoDeploy.d.ts","sourceRoot":"","sources":["../../src/tools/daoDeploy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4FhD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAGhF"}
1
+ {"version":3,"file":"daoDeploy.d.ts","sourceRoot":"","sources":["../../src/tools/daoDeploy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAyJhD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAGhF"}