dexe-mcp 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +192 -136
- package/dist/lib/merkleTree.d.ts +38 -0
- package/dist/lib/merkleTree.d.ts.map +1 -0
- package/dist/lib/merkleTree.js +83 -0
- package/dist/lib/merkleTree.js.map +1 -0
- package/dist/tools/flow.d.ts +57 -0
- package/dist/tools/flow.d.ts.map +1 -1
- package/dist/tools/flow.js +204 -176
- package/dist/tools/flow.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/merkle.d.ts +4 -0
- package/dist/tools/merkle.d.ts.map +1 -0
- package/dist/tools/merkle.js +174 -0
- package/dist/tools/merkle.js.map +1 -0
- package/dist/tools/otc.d.ts +5 -0
- package/dist/tools/otc.d.ts.map +1 -0
- package/dist/tools/otc.js +481 -0
- package/dist/tools/otc.js.map +1 -0
- package/dist/tools/proposalBuildComplex.d.ts +222 -0
- package/dist/tools/proposalBuildComplex.d.ts.map +1 -1
- package/dist/tools/proposalBuildComplex.js +373 -66
- package/dist/tools/proposalBuildComplex.js.map +1 -1
- package/dist/tools/read.js +2 -2
- package/dist/tools/read.js.map +1 -1
- package/package.json +83 -83
package/CHANGELOG.md
CHANGED
|
@@ -1,136 +1,192 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 0.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- `
|
|
15
|
-
- `
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
**
|
|
20
|
-
- `
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
|
|
25
|
-
**
|
|
26
|
-
- `
|
|
27
|
-
- `
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
- `
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- `
|
|
79
|
-
- `
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
- `
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
###
|
|
105
|
-
|
|
106
|
-
- **
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
- `
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
OTC DAO support. Adds the calldata builders, merkle utilities, and four
|
|
6
|
+
composite tools needed to launch and operate an over-the-counter token sale
|
|
7
|
+
end-to-end through one MCP surface. **119 tools** total. Lifecycle proven
|
|
8
|
+
on BSC testnet (deploy → open_sale → vote → execute → buy → claim →
|
|
9
|
+
balance delta verified).
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
**Phase A — calldata builders (4 tools)**
|
|
14
|
+
- `dexe_proposal_build_token_sale_multi` — N-tier sale envelope. Sums and dedupes ERC20 approves per sale token, auto-derives merkle roots for `MerkleWhitelist` tiers when only `users[]` is supplied, auto-appends `addToWhitelist` for plain `Whitelist` tiers.
|
|
15
|
+
- `dexe_proposal_build_token_sale_whitelist` — standalone external proposal that calls `addToWhitelist([{tierId, users[], uri}, …])` on a live tier.
|
|
16
|
+
- `dexe_proposal_build_token_sale` — kept as back-compat shim forwarding `[tier]` to `_multi`. Gains optional `participation` field.
|
|
17
|
+
- `dexe_merkle_build` / `dexe_merkle_proof` — OZ `StandardMerkleTree`-compatible: sorted-pair commutative keccak, double-hash leaf `keccak256(keccak256(abi.encode(...)))`. Default leaf shape `["address"]`; advanced shapes via `entries` + `leafEncoding`.
|
|
18
|
+
|
|
19
|
+
**Phase B — composite tools (4 tools)**
|
|
20
|
+
- `dexe_otc_dao_open_sale` — orchestrates `_multi` + `runProposalCreate` (balance/threshold check, approve, deposit, IPFS metadata, `createProposalAndVote`). `buildOnly: true` short-circuits the proposal flow and just returns the envelope. `dryRun: true` returns ordered TxPayloads even when `DEXE_PRIVATE_KEY` is set.
|
|
21
|
+
- `dexe_otc_buyer_status` — read-only aggregator. Multicalls `getTierViews` + `getUserViews(user, tierIds, proofs)`, surfaces participation requirements + pre-computed `claimable` (`canClaim && !isClaimed ? claimTotalAmount : 0`) and `vestingWithdrawable` (`amountToWithdraw`). Optional per-tier `whitelists[]` triggers merkle-tree build + proof + verify check for the user.
|
|
22
|
+
- `dexe_otc_buyer_buy` — preflights ERC20 balance + allowance (skipped on native sentinel `ZeroAddress`), prepends `approve(spender=TokenSaleProposal, MAX_UINT256)` when needed, builds `buy(tierId, paymentToken, amount, proof)`. Auto-derives the merkle proof when `whitelistUsers[]` is supplied without a precomputed `proof`. Native path sets `value=amount`.
|
|
23
|
+
- `dexe_otc_buyer_claim_all` — picks tiers with `canClaim && !isClaimed` → `claim`, tiers with `amountToWithdraw > 0` → `vestingWithdraw`. Skips silently when nothing pending (`mode='noop'`).
|
|
24
|
+
|
|
25
|
+
**Refactors**
|
|
26
|
+
- `proposalBuildComplex.ts` — extracted `buildTokenSaleMultiActions(input)` pure helper; `tierSchema`, `TierSpec`, `buildTierTuple`, `buildSaleApprovals`, `TOKEN_SALE_PROPOSAL_ABI` now exported. The `dexe_proposal_build_token_sale_multi` registrar is a thin shim around the helper.
|
|
27
|
+
- `flow.ts` — extracted `runProposalCreate(input, deps)` + `sendOrCollect` exported. `dexe_proposal_create` gains a `dryRun` flag. `sendOrCollect` distinguishes `mode='dryRun'` (caller-requested) from `mode='payloads'` (no signer); the swarm orchestrator's `mcpFallbackDispatcher` only auto-broadcasts on `'payloads'`.
|
|
28
|
+
|
|
29
|
+
**Docs + scripts**
|
|
30
|
+
- `docs/OTC.md` — project-owner + buyer flows with paste-ready examples. Documents every gotcha that bit during integration: PRECISION 1e25 (not 1e18) on `exchangeRates`; `canClaim` requires `block.timestamp >= saleEndTime + claimLockDuration` so buyers must wait for the sale window to close even with `claimLockDuration: 0`; `maxAllocationPerUser == 0` means unlimited (not zero); newly-passed proposals briefly land in `Locked` (idx 6) before `SucceededFor` (idx 4); treasury must be seeded with sale token (mint via `tokenParams.users[]` + predicted `govPool` address).
|
|
31
|
+
- `scripts/lifecycle-otc.mjs` — runnable end-to-end proof on BSC testnet (chain 97). Single command. Deploys a fresh DAO, opens a 1-tier sale, votes+executes, buys, claims, verifies balance delta.
|
|
32
|
+
|
|
33
|
+
**Swarm scenarios**
|
|
34
|
+
- `S41-otc-multi-merkle-build` — 2 tiers Open + MerkleWhitelist, auto-derived root.
|
|
35
|
+
- `S42-otc-multi-whitelist-build` — 2 tiers Open + plain Whitelist, auto-appended `addToWhitelist`.
|
|
36
|
+
- `S43-otc-whitelist-extend-build` — standalone `_whitelist` proposal extending an existing tier.
|
|
37
|
+
- `S44-otc-open-sale-build` — `buildOnly` envelope sanity.
|
|
38
|
+
- `S45-otc-buyer-buy-native-build` — `dryRun` + native sentinel.
|
|
39
|
+
- `S46-otc-buyer-buy-merkle-build` — `dryRun` + auto-merkle proof.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- **Bug #25** — `TOKEN_SALE_PROPOSAL_ABI` had two field-order transpositions vs the contract: `TierInitParams` swapped `saleTokenAddress` <-> `claimLockDuration`, and `VestingSettings` was declared `(cliff, step, duration, percentage)` instead of canonical `(percentage, duration, cliff, step)`. Selector matched (`0x6a6effda`) but calldata was silently misdecoded — every prior single-tier sale proposal built via dexe-mcp landed with vesting + claim-lock fields scrambled.
|
|
44
|
+
- **Bug #26** — `getUserViews` ABI in `read.ts` (and copied into `otc.ts`) declared `UserView` as a flat 7-field struct (`canParticipate, isWhitelisted, purchasedAmount, owedAmount, lockedAmount, claimableAmount, vestingWithdrawAmount`). Actual contract returns `tuple(bool canParticipate, PurchaseView purchaseView, VestingUserView vestingUserView)` with nested structs. Both files now match the contract; affected callers (`dexe_read_token_sale_user`, `dexe_otc_buyer_status`, `dexe_otc_buyer_claim_all`) updated to read fields via the correct paths.
|
|
45
|
+
- **Bug #27** — `getUserViews` is a 3-arg function (`address user, uint256[] tierIds, bytes32[][] proofs`); ABI was missing the third parameter, causing every call to revert with `require(false)` at the abicoder layer. Fixed in both `read.ts` and `otc.ts`; non-merkle tiers pass `tierIds.map(() => [])`.
|
|
46
|
+
- **`flow.ts` `vote_and_execute` Locked state.** When `open_sale`'s `createProposalAndVote` clears quorum + earlyCompletion, the proposal lands directly in state 6 (`Locked`) before transitioning to `SucceededFor`. The skip-vote-and-execute branch only matched 4/5; now also matches 6.
|
|
47
|
+
- **`otc.ts` multicall double-unwrap.** Single-return-value functions are already unwrapped by `src/lib/multicall.ts`; the OTC composites were treating the result as one extra layer deep and indexing `[0]`. Fixed.
|
|
48
|
+
|
|
49
|
+
### Lifecycle proof
|
|
50
|
+
|
|
51
|
+
Live run on BSC testnet (chain 97) on 2026-05-01:
|
|
52
|
+
- govPool: `0x028C447c72A6Fd1955f0937bb3C5926E8EAC297c`
|
|
53
|
+
- deploy tx: `0x3e17ff4e46a6840bf4945e15a9c3af620be276b7de0e1efe807e08ec8a097dbe`
|
|
54
|
+
- execute proposal 1: `0x17b677e3fb0b078ca670d3a16c3a776cc36dac97e4497446b19d6490633873df`
|
|
55
|
+
- buyer balance: `400000.0` → `399999.0` (buy) → `400000.0` (claim) — delta verified
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 0.3.0
|
|
60
|
+
|
|
61
|
+
End-to-end testnet validation. Every proposal-builder tool is now exercised by an automated swarm scenario on BSC testnet, and the harness itself ships in-repo so external integrators can run it. **111 tools** total, **41 swarm scenarios**, full sweep green.
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
|
|
65
|
+
**Swarm test harness (`tests/swarm/` + `scripts/swarm/`)**
|
|
66
|
+
- `scripts/swarm/orchestrator.ts` — scenario loader + dispatcher. Inline ethers dispatchers for the no-IPFS toolset (vote_user_power, read_delegation_map, build_undelegate, build_withdraw, build_withdraw_all, build_erc20_approve, build_deposit, build_delegate, build_vote). Generic MCP-stdio fallback (`mcpFallbackDispatcher`) routes anything else through the dexe-mcp child server, so adding a scenario for a new tool is JSON-only — no code changes.
|
|
67
|
+
- Loop expansion (`spec.loop.over` × `appliesToSteps`), template engine (`{{dao}}`, `{{firstAllowlistedToken}}`, `{{firstAllowlistedDao}}`, `{{secondAllowlistedDao}}`, `{{dao.<helper>}}`, `{{agent:X:address}}`, `{{capture.path}}`, `{{capture.0.field}}`), `skipIf` evaluator with limited expressions, deferred-cascade for chained captures, wallet semaphore for parallel-safe broadcasts, per-scenario `prefund` hook that tops up agents from `AGENT_FUNDER_PK` before each scenario runs.
|
|
68
|
+
- `scripts/swarm/preflight.ts` + `scripts/swarm/fund-pool.ts` — wallet-readiness check + token allowlist–enforced top-up. Hard-refuses to send to any non-pool address or any token not on the allowlist.
|
|
69
|
+
- `scripts/swarm/nightly.sh` — Phase 5 cron runner. Pulls main, runs preflight + full sweep, tails the run report, posts the one-line summary to `SWARM_SUMMARY_WEBHOOK` and/or `SWARM_SUMMARY_ISSUE` (gh CLI), runs a triage stub on failure (with `SWARM_FIXER=1` opt-in for auto-fix), and rotates run-report dirs older than 30 days while keeping the latest 50.
|
|
70
|
+
- `scripts/swarm/orchestrator.ts` emits a single greppable summary line after `writeReport`: `SWARM <runId> <pass>/<total> <mode> <chainTag> <reportPath>` — consumed by nightly.sh and any external poster.
|
|
71
|
+
- `scripts/swarm/one-shot-execute.mjs` — closes a proposal lifecycle once it reaches `SucceededFor`. Polls + caps `wait()` at 90 s to avoid sandbox hangs.
|
|
72
|
+
- 41 scenario JSONs covering: reset, delegation chain, validator pass / veto / full lifecycle, expert / participation / staking / validator / catalog / cross-DAO / multi-proposal-state read snapshots, cancel-vote, decode-and-introspect, build-only sanity for every external + internal proposal type from `dexe_proposal_catalog`.
|
|
73
|
+
- Role prompts: `proposer`, `voter`, `delegator`, `reporter`, `triage`, `validator`, `expert`, `fixer`, plus `_shared.md` and the dao-personas fixture. Fixer prompt encodes the CLAUDE.md auto-fix loop verbatim — branch `swarm-fix/<YYYY-MM-DD>`, never push to main, diff scope hard-bounded to `src/tools/`, `src/lib/`, `tests/swarm/`.
|
|
74
|
+
|
|
75
|
+
**Composite + signing tools**
|
|
76
|
+
- `dexe_proposal_create` — full prerequisite handling: balance check, ERC20 approve, deposit, IPFS metadata upload, `createProposalAndVote`. When `DEXE_PRIVATE_KEY` is set the tool signs and broadcasts; otherwise returns the ordered `TxPayload` list. Supports `proposalType: 'modify_dao_profile' | 'custom'`.
|
|
77
|
+
- `dexe_proposal_vote_and_execute` — vote-then-execute composite with `autoExecute` + `depositFirst` flags.
|
|
78
|
+
- `dexe_tx_send` + `dexe_tx_status` — opt-in signer surface that uses the configured `DEXE_PRIVATE_KEY` when present. Calls remain calldata-by-default; users opt in by setting the env var.
|
|
79
|
+
- `dexe_dao_build_deploy` predicted-address auto-wiring: `govToken` flowed into `userKeeperParams.tokenAddress` and `distributionProposal` + `govTokenSale` into `additionalProposalExecutors` automatically. LINEAR / POLYNOMIAL `votePower` initData auto-encoded.
|
|
80
|
+
|
|
81
|
+
**Reads + introspection**
|
|
82
|
+
- `dexe_read_dao_list`, `_dao_members`, `_dao_experts`, `_user_activity`, `_distribution_status`, `_token_sale_tiers`, `_token_sale_user`, `_staking_info`, `_validator_list`, `_privacy_policy_status`, `_delegation_map` — fill out the DAO read surface.
|
|
83
|
+
- `dexe_get_methods` returns structured per-function metadata (4-byte selectors, mutability, full structured inputs/outputs with `internalType` preserved for tuples).
|
|
84
|
+
- `dexe_proposal_voters` switched to the `pools` subgraph and the proposalInteractions composite ID format (poolAddr + uint32LE(proposalId), no separator).
|
|
85
|
+
- `dexe_decode_proposal` understands every external + internal proposal action shape.
|
|
86
|
+
|
|
87
|
+
### Fixed
|
|
88
|
+
|
|
89
|
+
- **Proposal metadata format**: builders now emit `proposalName` / `proposalDescription` (not `name` / `description`), wrap diffs inside `changes: { proposedChanges, currentChanges }`, set `isMeta: false`, and round-trip identical to the frontend reference. 17 builders touched.
|
|
90
|
+
- **Approve target for deposits** is `UserKeeper`, not `GovPool`. Both flow tools (`proposal_create`, `vote_and_execute`) now approve the right address.
|
|
91
|
+
- **Personal voting power** = `tokenBalance.balance − ownedBalance` (deposited only). Without this, `withdraw` on freshly-funded agents reverts `GovUK: can't withdraw this`.
|
|
92
|
+
- **VotePower initData** uses `__LinearPower_init()` selector `0x892aea1f` (not empty `0x`) so newly-deployed DAOs initialize their LINEAR vote-power proxy correctly.
|
|
93
|
+
- **`STATE_NAMES` enum order** corrected (Defeated / Locked positions were swapped).
|
|
94
|
+
- **Custom-proposal IPFS metadata** now includes `category`, `isMeta`, `proposedChanges`, `currentChanges`.
|
|
95
|
+
- **Subgraph migration**: Studio URLs deprecated; switched to The Graph decentralized network with API key. Per-chain endpoints documented.
|
|
96
|
+
- **IPFS gateway path normalization**: dedicated gateways configured with a trailing `/ipfs` (e.g. `https://<sub>.mypinata.cloud/ipfs`) no longer produce `/ipfs/ipfs/<cid>` 404s.
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
|
|
100
|
+
- README updated: tool count `83 → 111`, new "Swarm test harness" section.
|
|
101
|
+
- `process.loadEnvFile()` is invoked from `index.ts` so the MCP server loads `.env` itself; users no longer have to plumb env-var changes through their MCP client config (which often doesn't reload).
|
|
102
|
+
- Repo now ships `.claude/skills/swarm-test/SKILL.md` for users running Claude Code; lets them invoke the swarm with `/swarm-test`.
|
|
103
|
+
|
|
104
|
+
### Notes
|
|
105
|
+
|
|
106
|
+
- **Validated network**: BSC testnet (chain 97). Two fixture DAOs deployed for the harness — Glacier (50% quorum, no validators) and Sentinel (5% quorum, 2 validators with 1k SVT each).
|
|
107
|
+
- **Mainnet status**: a separate run pass is staged (Stage B per `tests/swarm/README.md`) but blocked on a previously-observed `PoolFactory.deployGovPool` revert. Re-validate when the protocol team confirms a fix.
|
|
108
|
+
- **Off-chain backend tools** require `DEXE_BACKEND_API_URL` and only run on chains where DeXe operates a backend. The corresponding swarm scenarios declare `requiresChain: [56]` so they auto-skip on testnet.
|
|
109
|
+
|
|
110
|
+
## 0.2.0
|
|
111
|
+
|
|
112
|
+
The big one — dexe-mcp expands from 15 dev-tooling tools to **83 tools** covering the full DeXe DAO lifecycle. AI agents can now create DAOs, build any of the 33 proposal types the DeXe frontend exposes, upload metadata to IPFS, stake/delegate/vote/execute/claim — all end-to-end.
|
|
113
|
+
|
|
114
|
+
### Added
|
|
115
|
+
|
|
116
|
+
**Foundations + reads (13 tools)** — `dexe_dao_info`, `dexe_dao_predict_addresses`, `dexe_dao_registry_lookup`, `dexe_proposal_state`, `dexe_proposal_list`, `dexe_proposal_voters`, `dexe_vote_user_power`, `dexe_vote_get_votes`, `dexe_read_multicall`, `dexe_read_treasury`, `dexe_read_validators`, `dexe_read_settings`, `dexe_read_expert_status`. Backed by an `AddressBook` that resolves contracts via `ContractsRegistry`, a Multicall3 batch helper, a canonical `TxPayload` shape, enum mirrors for `ProposalState` / `VoteType`, and a minimal subgraph GraphQL client.
|
|
117
|
+
|
|
118
|
+
**IPFS (6 tools)** — `dexe_ipfs_upload_proposal_metadata`, `_upload_dao_metadata`, `_upload_file`, `_fetch`, `_cid_info`, `_cid_for_json`. Backed by a Pinata client and local CID computation via `multiformats`. Public gateways (dweb.link, ipfs.io, cf-ipfs, 4everland) are unreliable and NOT defaulted. Users must set `DEXE_IPFS_GATEWAY` to a dedicated gateway (the one Pinata provides alongside the JWT is recommended). Public gateways are opt-in via `DEXE_IPFS_GATEWAYS_FALLBACK` (comma-separated, tried sequentially — no parallel races).
|
|
119
|
+
|
|
120
|
+
**Proposals — all 33 types (35 tools)**
|
|
121
|
+
- `dexe_proposal_catalog` — enumerate every proposal type the DeXe UI exposes (24 external, 4 internal, 5 off-chain), with metadata shape, gating, and linked MCP builder.
|
|
122
|
+
- Primitives: `dexe_proposal_build_external` (+ `createProposalAndVote`), `dexe_proposal_build_internal`, `dexe_proposal_build_custom_abi`, `dexe_proposal_build_offchain`.
|
|
123
|
+
- External wrappers (each returns `{ metadata, actions: Action[] }`): `token_transfer`, `token_distribution`, `token_sale`, `token_sale_recover`, `change_voting_settings`, `manage_validators`, `add_expert`, `remove_expert`, `withdraw_treasury`, `delegate_to_expert`, `revoke_from_expert`, `create_staking_tier`, `change_math_model`, `modify_dao_profile`, `blacklist`, `reward_multiplier`, `apply_to_dao`, `new_proposal_type` (also covers *Enable Staking*).
|
|
124
|
+
- Internal validator wrappers (each returns `{ metadata, proposalType, data }`): `change_validator_balances` (type 0), `change_validator_settings` (type 1), `monthly_withdraw` (type 2), `offchain_internal_proposal` (type 3).
|
|
125
|
+
- Off-chain backend proposals: `offchain_single_option`, `offchain_multi_option`, `offchain_for_against`, `offchain_settings`. Plus `dexe_auth_request_nonce` + `dexe_auth_login_request` for the 2-step Bearer flow, and `dexe_offchain_build_vote` / `dexe_offchain_build_cancel_vote`.
|
|
126
|
+
- **Write model is calldata-only.** No signer, no private keys. Every write tool emits a signable payload the agent's wallet submits.
|
|
127
|
+
|
|
128
|
+
**Vote / stake / execute / claim writes (14 tools)** — `erc20_approve`, `deposit` (payable for native-staking DAOs), `withdraw`, `delegate`, `undelegate`, `vote`, `cancel_vote`, `validator_vote`, `validator_cancel_vote`, `move_to_validators`, `execute`, `claim_rewards`, `claim_micropool_rewards`, plus `multicall` to batch any of the above into one atomic tx. Arg-order gotchas captured in code comments (e.g. `GovPool.vote(pid, isFor, amount, nftIds)` vs `GovValidators.voteInternalProposal(pid, amount, isFor)`).
|
|
129
|
+
|
|
130
|
+
**DAO deploy (1 tool)** — `dexe_dao_build_deploy` encodes `PoolFactory.deployGovPool(GovPoolDeployParams)` with the full nested struct (settings / validators / userKeeper / token / votePower / verifier / BABT flag / descriptionURL / name). Auto-resolves PoolFactory via `ContractsRegistry` if omitted. When `deployer` + RPC are available, also returns the predicted GovPool address so agents can wire follow-up txs before the DAO exists. Encodes against the compiled `PoolFactory.json` artifact when present (strict parity); falls back to a hand-rolled tuple signature derived from `IPoolFactory.sol` otherwise.
|
|
131
|
+
|
|
132
|
+
### Changed
|
|
133
|
+
|
|
134
|
+
- `src/config.ts` adds `DEXE_CHAIN_ID` (default 56), `DEXE_CONTRACTS_REGISTRY` override, `DEXE_PINATA_JWT`, three subgraph URL overrides, `DEXE_BACKEND_API_URL`.
|
|
135
|
+
- `package.json` description rewritten to reflect full DAO-ops scope. New dep: `multiformats` (Protocol Labs, for local CID computation).
|
|
136
|
+
- `README.md` reorganized around the eight tool groups; added the full env-var matrix.
|
|
137
|
+
|
|
138
|
+
### Notes
|
|
139
|
+
|
|
140
|
+
- **No breaking changes.** All v0.1.x tools remain. The write contract is new-world: `TxPayload` for single-tx builders, `Action[]` for proposal wrappers — never a singular `action` field.
|
|
141
|
+
- **Deferred to future work** (`FUTURE.md`): Hardhat-fork simulation (`dexe_simulate_vote`), signer-aware send mode, additional IPFS pinning providers (Storacha, Lighthouse), and alternate subgraphs.
|
|
142
|
+
|
|
143
|
+
## 0.1.5
|
|
144
|
+
|
|
145
|
+
### Fixed
|
|
146
|
+
- **`'npx' is not recognized`** from inside `npm run compile` (and other npm scripts that internally call `npx hardhat …`) on stripped-Node Windows installs. v0.1.4 got `npm` itself spawning cleanly, but DeXe-Protocol's `compile` script is literally `npx hardhat compile --force`, and when npm spawned that child, `cmd.exe` couldn't find `npx.cmd` on PATH — the stripped `C:\Program Files\nodejs\` has `node.exe` only. Root cause: we weren't propagating the resolved Node's shim directory into the child's `PATH`.
|
|
147
|
+
- New `deriveNodeBinDir()` + `envWithNodeBinDir()` helpers in `src/runtime.ts` derive the directory containing `npm.cmd`/`npx.cmd` (Windows) or `bin/npm`/`bin/npx` (Unix) from the resolved `npm-cli.js` path, and prepend it to `PATH` on every child spawn (`bootstrap` npm install, `runNpmScript`, `runHardhat`). Child shells launched by npm scripts can now resolve `npx` / `npm` / any locally-installed binary as expected.
|
|
148
|
+
- `npmCommand()` now returns a `binDir` field alongside `command` / `prefixArgs` / `needsShell`. Bootstrap logs the prepended directory on first run so it's visible which Node install is contributing the shims.
|
|
149
|
+
|
|
150
|
+
## 0.1.4
|
|
151
|
+
|
|
152
|
+
### Fixed
|
|
153
|
+
- **`spawn EINVAL` during first-run `npm install`** on Windows hosts where `process.execPath` points at a Node install that does not bundle npm (e.g. a bare `node.exe` dropped under `C:\Program Files\nodejs\` without the rest of the toolchain). Two root causes addressed:
|
|
154
|
+
1. `resolveNpmCli()` now searches a broader set of locations for a usable `npm-cli.js` — including `%APPDATA%\nvm\v*\node_modules\npm\bin\npm-cli.js` (nvm-windows), `%APPDATA%\npm\node_modules\npm\bin\npm-cli.js` (per-user npm prefix), `C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js` (stock Windows installer), `~/.nvm/versions/node/v*/lib/node_modules/npm/bin/npm-cli.js` (nvm Unix), and Homebrew paths. Because `npm-cli.js` is plain JavaScript, *any* modern `node` can execute any of these, so the MCP process's own Node is free to "borrow" npm from a completely different Node install.
|
|
155
|
+
2. When no `npm-cli.js` is found anywhere and we fall back to spawning `npm.cmd` directly, `execFile` / `execa` now pass `{ shell: true }` — without it, Node refuses to spawn `.cmd` / `.bat` files (CVE-2024-27980 mitigation) and throws `spawn EINVAL`.
|
|
156
|
+
- Progress logging on first bootstrap now prints the resolved `npm-cli.js` path (or "shell-resolved" fallback), so "which npm is about to run" is visible in stderr.
|
|
157
|
+
|
|
158
|
+
## 0.1.3
|
|
159
|
+
|
|
160
|
+
### Docs
|
|
161
|
+
- **Windows install section rewritten** to lead with the absolute-path recipe (`node <abs path to dist/index.js>`) instead of `cmd /c dexe-mcp`. End-to-end testing against Claude Code on Windows showed the `cmd /c` wrapper, while standalone functional, did not reliably complete the MCP handshake when spawned by Claude Code — the absolute-path recipe has zero shim resolution and is known-working.
|
|
162
|
+
- **New prereq step**: verify `npm --version` actually runs in your shell *before* attempting `npm install -g dexe-mcp`. Users with a stripped `node.exe`-only install (common on Windows) will hit a silent `npm i -g` no-op otherwise, with no visible error.
|
|
163
|
+
- Added a "Verify the install" section showing how to smoke-test `dexe-mcp` over stdio without involving Claude Code, so users can distinguish "MCP server broken" from "client registration broken".
|
|
164
|
+
|
|
165
|
+
No code changes — 0.1.3 is a docs-only patch on top of 0.1.2's behavior.
|
|
166
|
+
|
|
167
|
+
## 0.1.2
|
|
168
|
+
|
|
169
|
+
### Fixed
|
|
170
|
+
- **Server no longer hangs / fails on first launch.** The heavy `git clone` + `npm install` bootstrap is now lazy — it runs only when a build tool (`dexe_compile`, `dexe_test`, `dexe_coverage`, `dexe_lint`) is first invoked, not inside MCP `initialize()`. Previously the MCP handshake would block for minutes or time out, and crash outright on hosts where `npm` / `git` were not on the spawned process's PATH.
|
|
171
|
+
- **PATH-independent spawning of `npm` and `hardhat`.** The runner now invokes `node <npm-cli.js>` and `node <protocol>/node_modules/hardhat/internal/cli/cli.js` directly via `process.execPath`, so it works on Windows installs where `npm.cmd` / `npx.cmd` aren't on the MCP client's spawn PATH (common with nvm-windows and with stripped `node.exe`-only installs).
|
|
172
|
+
- **Actionable error messages** when `git` is not installed, when `DEXE_PROTOCOL_PATH` points at a non-Hardhat directory, or when the user-managed checkout is missing `node_modules`.
|
|
173
|
+
- Concurrent build-tool calls now coalesce into a single bootstrap instead of racing `git clone` / `npm install`.
|
|
174
|
+
|
|
175
|
+
### Changed
|
|
176
|
+
- `loadConfig()` no longer hard-fails when the DeXe-Protocol checkout is missing or incomplete at startup — it logs a soft warning to stderr and defers preparation to the first build-tool invocation.
|
|
177
|
+
- `src/bootstrap.ts` split into `resolveProtocolPath()` (cheap, startup-safe) and `ensureBuildReady()` (lazy, idempotent).
|
|
178
|
+
- New `src/runtime.ts` with portable `npmCommand()` / `hardhatCommand()` / `hasGit()` helpers.
|
|
179
|
+
|
|
180
|
+
### Docs
|
|
181
|
+
- README now has an OS-specific install matrix (Mac/Linux vs. Windows) and a "dev / local checkout" recipe. Troubleshooting section updated for the new lazy-bootstrap behavior and the `process.execPath` npm resolution.
|
|
182
|
+
|
|
183
|
+
## 0.1.1
|
|
184
|
+
|
|
185
|
+
### Added
|
|
186
|
+
- `dexe_get_methods` introspection tool — returns per-contract methods partitioned into `read` (view/pure) and `write` (nonpayable/payable). Each entry includes `name`, canonical `signature`, 4-byte `selector`, `stateMutability`, and structured `inputs`/`outputs` with `internalType` preserved (so tuple-typed args like `IGovPool.ProposalView[]` survive intact). Designed for generating TypeScript interfaces or ethers wrappers without re-parsing raw ABIs. Supports `kind` filter (`read`/`write`/`all`) and optional `includeEvents`/`includeErrors`.
|
|
187
|
+
|
|
188
|
+
Tool count: 14 → 15.
|
|
189
|
+
|
|
190
|
+
## 0.1.0
|
|
191
|
+
|
|
192
|
+
Initial public release (Phase A): build/test, contract introspection, read-only governance tools. 14 tools.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal OpenZeppelin-StandardMerkleTree-compatible builder.
|
|
3
|
+
*
|
|
4
|
+
* Matches the frontend's `@openzeppelin/merkle-tree` (used in
|
|
5
|
+
* `C:/dev/investing-dashboard/src/utils/MerkleTreeEntity.ts`) and the
|
|
6
|
+
* on-chain verifier in `TokenSaleProposalBuy.sol::_checkMerkleProofs`:
|
|
7
|
+
*
|
|
8
|
+
* leaf = keccak256(bytes.concat(keccak256(abi.encode(...values))))
|
|
9
|
+
* node = keccak256(sorted(left, right)) // commutative
|
|
10
|
+
*
|
|
11
|
+
* Leaves are sorted by leafHash (ascending) to give a deterministic root.
|
|
12
|
+
*/
|
|
13
|
+
export type LeafValues = readonly unknown[];
|
|
14
|
+
export interface MerkleTreeResult {
|
|
15
|
+
root: string;
|
|
16
|
+
/** Proof per original-input index (i.e. proofs[i] is for entries[i]). */
|
|
17
|
+
proofs: string[][];
|
|
18
|
+
/** Sorted leaf hashes (debug/inspection). */
|
|
19
|
+
leafHashes: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a merkle tree over `entries`, where each entry is a tuple of values
|
|
23
|
+
* matching `leafEncoding` (e.g. `["address"]` or `["address", "uint256"]`).
|
|
24
|
+
*
|
|
25
|
+
* Returns root + per-entry proof + leaf hashes. Compatible with
|
|
26
|
+
* `MerkleProof.verifyCalldata` in OpenZeppelin Solidity.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildMerkleTree(entries: readonly LeafValues[], leafEncoding: readonly string[]): MerkleTreeResult;
|
|
29
|
+
/** Convenience: build a single-address-leaf tree (the OTC default). */
|
|
30
|
+
export declare function buildAddressMerkleTree(addresses: readonly string[]): MerkleTreeResult;
|
|
31
|
+
/** Verify a proof against the root. Mirrors `MerkleProof.verifyCalldata`. */
|
|
32
|
+
export declare function verifyProof(proof: readonly string[], root: string, leaf: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Compute leaf hash for a given entry — exposed for callers that want to
|
|
35
|
+
* pass the leaf to `verifyProof` without re-running the whole tree.
|
|
36
|
+
*/
|
|
37
|
+
export declare function computeLeafHash(values: LeafValues, leafEncoding: readonly string[]): string;
|
|
38
|
+
//# sourceMappingURL=merkleTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merkleTree.d.ts","sourceRoot":"","sources":["../../src/lib/merkleTree.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,UAAU,GAAG,SAAS,OAAO,EAAE,CAAC;AAoB5C,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,YAAY,EAAE,SAAS,MAAM,EAAE,GAC9B,gBAAgB,CA4ClB;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAGrF;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,OAAO,CAIT;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE3F"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AbiCoder, getBytes, keccak256, concat, hexlify } from "ethers";
|
|
2
|
+
const coder = AbiCoder.defaultAbiCoder();
|
|
3
|
+
function leafHash(types, values) {
|
|
4
|
+
const inner = keccak256(coder.encode(types, values));
|
|
5
|
+
return keccak256(concat([inner]));
|
|
6
|
+
}
|
|
7
|
+
function commutative(a, b) {
|
|
8
|
+
const ab = getBytes(a);
|
|
9
|
+
const bb = getBytes(b);
|
|
10
|
+
// lexicographic compare of bytes
|
|
11
|
+
let cmp = 0;
|
|
12
|
+
for (let i = 0; i < ab.length && cmp === 0; i++) {
|
|
13
|
+
cmp = (ab[i] ?? 0) - (bb[i] ?? 0);
|
|
14
|
+
}
|
|
15
|
+
return cmp <= 0 ? keccak256(concat([a, b])) : keccak256(concat([b, a]));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build a merkle tree over `entries`, where each entry is a tuple of values
|
|
19
|
+
* matching `leafEncoding` (e.g. `["address"]` or `["address", "uint256"]`).
|
|
20
|
+
*
|
|
21
|
+
* Returns root + per-entry proof + leaf hashes. Compatible with
|
|
22
|
+
* `MerkleProof.verifyCalldata` in OpenZeppelin Solidity.
|
|
23
|
+
*/
|
|
24
|
+
export function buildMerkleTree(entries, leafEncoding) {
|
|
25
|
+
if (entries.length === 0) {
|
|
26
|
+
throw new Error("buildMerkleTree: entries must not be empty");
|
|
27
|
+
}
|
|
28
|
+
const original = entries.map((vals) => leafHash(leafEncoding, vals));
|
|
29
|
+
const indexed = original
|
|
30
|
+
.map((h, i) => ({ h, i }))
|
|
31
|
+
.sort((a, b) => (a.h < b.h ? -1 : a.h > b.h ? 1 : 0));
|
|
32
|
+
const n = indexed.length;
|
|
33
|
+
const treeSize = n === 1 ? 1 : 2 * n - 1;
|
|
34
|
+
const tree = new Array(treeSize).fill("0x");
|
|
35
|
+
for (let i = 0; i < n; i++)
|
|
36
|
+
tree[n - 1 + i] = indexed[i].h;
|
|
37
|
+
for (let i = n - 2; i >= 0; i--) {
|
|
38
|
+
tree[i] = commutative(tree[2 * i + 1], tree[2 * i + 2]);
|
|
39
|
+
}
|
|
40
|
+
const sortedToOriginal = indexed.map(({ i }) => i);
|
|
41
|
+
const originalToSorted = new Array(n).fill(0);
|
|
42
|
+
for (let s = 0; s < n; s++)
|
|
43
|
+
originalToSorted[sortedToOriginal[s]] = s;
|
|
44
|
+
function siblingPath(leafSortedIdx) {
|
|
45
|
+
const proof = [];
|
|
46
|
+
let node = n - 1 + leafSortedIdx;
|
|
47
|
+
while (node > 0) {
|
|
48
|
+
const sibling = node % 2 === 0 ? node - 1 : node + 1;
|
|
49
|
+
proof.push(tree[sibling]);
|
|
50
|
+
node = Math.floor((node - 1) / 2);
|
|
51
|
+
}
|
|
52
|
+
return proof;
|
|
53
|
+
}
|
|
54
|
+
const proofs = new Array(n);
|
|
55
|
+
for (let original_i = 0; original_i < n; original_i++) {
|
|
56
|
+
proofs[original_i] = siblingPath(originalToSorted[original_i]);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
root: hexlify(tree[0]),
|
|
60
|
+
proofs,
|
|
61
|
+
leafHashes: indexed.map(({ h }) => h),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Convenience: build a single-address-leaf tree (the OTC default). */
|
|
65
|
+
export function buildAddressMerkleTree(addresses) {
|
|
66
|
+
const entries = addresses.map((a) => [a]);
|
|
67
|
+
return buildMerkleTree(entries, ["address"]);
|
|
68
|
+
}
|
|
69
|
+
/** Verify a proof against the root. Mirrors `MerkleProof.verifyCalldata`. */
|
|
70
|
+
export function verifyProof(proof, root, leaf) {
|
|
71
|
+
let computed = leaf;
|
|
72
|
+
for (const sibling of proof)
|
|
73
|
+
computed = commutative(computed, sibling);
|
|
74
|
+
return computed.toLowerCase() === root.toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Compute leaf hash for a given entry — exposed for callers that want to
|
|
78
|
+
* pass the leaf to `verifyProof` without re-running the whole tree.
|
|
79
|
+
*/
|
|
80
|
+
export function computeLeafHash(values, leafEncoding) {
|
|
81
|
+
return leafHash(leafEncoding, values);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=merkleTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merkleTree.js","sourceRoot":"","sources":["../../src/lib/merkleTree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAiBxE,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;AAEzC,SAAS,QAAQ,CAAC,KAAwB,EAAE,MAAkB;IAC5D,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,KAAiB,EAAE,MAAmB,CAAC,CAAC,CAAC;IAC9E,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,WAAW,CAAC,CAAS,EAAE,CAAS;IACvC,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,iCAAiC;IACjC,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAChD,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CA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,CAAC"}
|
package/dist/tools/flow.d.ts
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { ToolContext } from "./context.js";
|
|
3
|
+
import type { TxPayload } from "../lib/calldata.js";
|
|
4
|
+
import { RpcProvider } from "../rpc.js";
|
|
3
5
|
import { SignerManager } from "../lib/signer.js";
|
|
6
|
+
interface FlowStep {
|
|
7
|
+
label: string;
|
|
8
|
+
skipped: boolean;
|
|
9
|
+
reason?: string;
|
|
10
|
+
txHash?: string;
|
|
11
|
+
payload?: TxPayload;
|
|
12
|
+
}
|
|
13
|
+
export declare function sendOrCollect(signer: SignerManager, payloads: TxPayload[], opts?: {
|
|
14
|
+
dryRun?: boolean;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
mode: "executed" | "payloads" | "dryRun";
|
|
17
|
+
steps: FlowStep[];
|
|
18
|
+
}>;
|
|
19
|
+
export interface ProposalCreateInput {
|
|
20
|
+
govPool: string;
|
|
21
|
+
proposalType?: "modify_dao_profile" | "custom";
|
|
22
|
+
title: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
newDaoName?: string;
|
|
25
|
+
newDaoDescription?: string;
|
|
26
|
+
newWebsiteUrl?: string;
|
|
27
|
+
newAvatarCID?: string;
|
|
28
|
+
newAvatarFileName?: string;
|
|
29
|
+
newSocialLinks?: [string, string][];
|
|
30
|
+
actionsOnFor?: {
|
|
31
|
+
executor: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
data: string;
|
|
34
|
+
}[];
|
|
35
|
+
category?: string;
|
|
36
|
+
proposalMetadataExtra?: Record<string, unknown>;
|
|
37
|
+
voteAmount?: string;
|
|
38
|
+
voteNftIds?: string[];
|
|
39
|
+
user?: string;
|
|
40
|
+
/** When true, return ordered TxPayloads even if a signer is configured. */
|
|
41
|
+
dryRun?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface ProposalCreateDeps {
|
|
44
|
+
ctx: ToolContext;
|
|
45
|
+
signer: SignerManager;
|
|
46
|
+
rpc: RpcProvider;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pure runner behind `dexe_proposal_create`. Exposed for composite tools
|
|
50
|
+
* (e.g. `dexe_otc_dao_open_sale`) that build their own `actionsOnFor` and
|
|
51
|
+
* want the same prereq + IPFS + multicall flow without going through the
|
|
52
|
+
* MCP tool layer.
|
|
53
|
+
*/
|
|
54
|
+
export declare function runProposalCreate(inputRaw: ProposalCreateInput, deps: ProposalCreateDeps): Promise<{
|
|
55
|
+
content: {
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
}[];
|
|
59
|
+
}>;
|
|
4
60
|
export declare function registerFlowTools(server: McpServer, ctx: ToolContext, signer: SignerManager): void;
|
|
61
|
+
export {};
|
|
5
62
|
//# sourceMappingURL=flow.d.ts.map
|
package/dist/tools/flow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/tools/flow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../src/tools/flow.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAkCjD,UAAU,QAAQ;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,C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