@continuumdao/ctm-mpc-defi 0.2.8 → 0.2.10

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 (36) hide show
  1. package/dist/agent/catalog.cjs +1133 -2
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1268 -9
  4. package/dist/agent/catalog.js +1091 -3
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/hyperliquid/SKILL.md +205 -0
  7. package/dist/agent/skills/morpho/SKILL.md +48 -0
  8. package/dist/core/index.cjs +9 -0
  9. package/dist/core/index.cjs.map +1 -1
  10. package/dist/core/index.d.ts +3 -1
  11. package/dist/core/index.js +8 -1
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/index.cjs +9 -0
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +8 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  19. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  20. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  21. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  22. package/dist/protocols/evm/hyperliquid/index.cjs +1550 -0
  23. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -0
  24. package/dist/protocols/evm/hyperliquid/index.d.ts +668 -0
  25. package/dist/protocols/evm/hyperliquid/index.js +1464 -0
  26. package/dist/protocols/evm/hyperliquid/index.js.map +1 -0
  27. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  28. package/dist/protocols/evm/maple/index.js.map +1 -1
  29. package/dist/protocols/evm/morpho/index.cjs +1971 -0
  30. package/dist/protocols/evm/morpho/index.cjs.map +1 -0
  31. package/dist/protocols/evm/morpho/index.d.ts +522 -0
  32. package/dist/protocols/evm/morpho/index.js +1918 -0
  33. package/dist/protocols/evm/morpho/index.js.map +1 -0
  34. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  35. package/dist/protocols/evm/sky/index.js.map +1 -1
  36. package/package.json +11 -1
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: hyperliquid
3
+ description: Hyperliquid perps, vaults, and HYPE staking via HyperEVM CoreWriter — Continuum MPC multi-sign.
4
+ ---
5
+
6
+ # Hyperliquid (MCP)
7
+
8
+ Hyperliquid is a perpetuals and spot exchange with on-chain actions routed through **HyperEVM CoreWriter** (`0x3333…3333`). Continuum MPC sends **single-tx CoreWriter batches** from the KeyGen executor on HyperEVM.
9
+
10
+ Supported chains (must be in node chain registry with `rpcGateway`):
11
+
12
+ | chainId | Network |
13
+ |--------:|---------|
14
+ | **999** | HyperEVM mainnet |
15
+ | **998** | Hyperliquid testnet |
16
+
17
+ The MPC **executor address** (`keyGen.ethereumaddress`) is the Hyperliquid **user account** for balances, positions, and orders.
18
+
19
+ ## What Hyperliquid does (explain to users)
20
+
21
+ - **Perps:** USD-margined perpetuals (BTC, ETH, …) plus optional **HIP-3** builder dexes.
22
+ - **Spot ↔ Perp:** USDC is one asset split between **spot** and **perp margin** ledgers (not separate ERC20s). Move with `usdClassTransfer`.
23
+ - **Vaults:** Deposit/withdraw USD into protocol vaults (withdraw includes accrued PnL).
24
+ - **Staking:** Stake/unstake **HYPE** and delegate to validators.
25
+
26
+ Trading reads use Hyperliquid **REST `/info`**. Writes use **CoreWriter** on HyperEVM (not the signed `/exchange` API).
27
+
28
+ ## Getting started (funding)
29
+
30
+ Before first trade, the user typically needs:
31
+
32
+ 1. **USDC on Hyperliquid** — deposit via the official Hyperliquid bridge (commonly from **Arbitrum** USDC). Funds appear in the spot/perp account tied to the MPC address.
33
+ 2. **Perp margin** — for perp orders, USDC must be in the **perp** bucket. Use `ctm_hyperliquid_fetch_usd_class_balances` then `ctm_hyperliquid_build_usd_transfer_multisign` with `toPerp: true` if spot USDC is high but perp withdrawable is low.
34
+ 3. **HYPE on HyperEVM for gas** — CoreWriter txs on chain **999** / **998** require **native HYPE** on the executor for gas. Ensure the KeyGen wallet holds enough HYPE on HyperEVM (bridge/deposit separately from USDC trading balance).
35
+ 4. **Leverage** — Hyperliquid stores a per-market leverage setting. Check `ctm_hyperliquid_fetch_open_context` (`leverageLabel`, `availableToBuy` / `availableToSell`). Changing leverage on-exchange is **not** exposed in v1 MCP (user adjusts on Hyperliquid UI if needed).
36
+
37
+ Positions and orders from MCP reflect **live HyperCore state** after prior txs are **broadcast** — pending multi-sign requests are not visible until executed.
38
+
39
+ ## Typical agent flow (open perp)
40
+
41
+ 1. `load_defi_protocol({ protocolId: "hyperliquid" })`
42
+ 2. `get_defi_protocol_skill` — this file (+ shared gas/submit section appended)
43
+ 3. Confirm chain **999** or **998** in `get_chain_registry` with RPC
44
+ 4. `ctm_hyperliquid_search_markets({ chainId: 999, query: "AAPL" })` or `query: "Apple"` — resolves canonical `coin` (e.g. `xyz:AAPL`); use when user gives a ticker or company name
45
+ 5. `ctm_hyperliquid_fetch_market_snapshot({ chainId, coin: "AAPL" })` — **`livePrice.midUsd`** is the current price; `latestCandle` is the most recent bar; `candles` is capped (default 48). Throws if live price cannot be fetched.
46
+ 6. `ctm_hyperliquid_fetch_open_context({ chainId, executorAddress, coin: "Apple" })` — same resolution
47
+ 7. `ctm_hyperliquid_fetch_usd_class_balances({ chainId, executorAddress })` — spot vs perp USD if needed
48
+ 8. `get_multi_sign_gas_options({ chainId })` — confirm `useCustomGas` with user
49
+ 9. `ctm_hyperliquid_build_limit_order_multisign` → **`{ requestId }`**
50
+ 10. Base MPC lifecycle (shared gas/submit section below)
51
+
52
+ ## Tool selection
53
+
54
+ ### Read-only
55
+
56
+ | User intent | MCP tool |
57
+ |-------------|----------|
58
+ | List all perp markets + HIP-3 dexes | `ctm_hyperliquid_fetch_markets` |
59
+ | **Find market by ticker or name** (AAPL, Apple, BTC) | `ctm_hyperliquid_search_markets` |
60
+ | **Live price** (mark/mid) + short recent bars | `ctm_hyperliquid_fetch_market_snapshot` — use **`snapshot.livePrice.midUsd`** |
61
+ | **OHLCV history** (e.g. 15m for last 7 days) | `ctm_hyperliquid_fetch_ohlcv` — `lookbackDays: 7`, `interval: "15m"` |
62
+ | Account + capacity for one coin | `ctm_hyperliquid_fetch_open_context` |
63
+ | Open positions | `ctm_hyperliquid_fetch_positions` |
64
+ | Open orders | `ctm_hyperliquid_fetch_open_orders` |
65
+ | Spot vs perp USDC | `ctm_hyperliquid_fetch_usd_class_balances` |
66
+ | Vault catalog (+ APR) | `ctm_hyperliquid_fetch_vaults` |
67
+ | User vault equity | `ctm_hyperliquid_fetch_user_vault_equities` |
68
+ | HYPE stake summary | `ctm_hyperliquid_fetch_staking_summary` |
69
+ | Validator delegations | `ctm_hyperliquid_fetch_delegations` |
70
+
71
+ ### Multi-sign (writes)
72
+
73
+ | User intent | MCP tool |
74
+ |-------------|----------|
75
+ | Open / add limit or IoC order | `ctm_hyperliquid_build_limit_order_multisign` |
76
+ | Close / reduce position | `ctm_hyperliquid_build_close_multisign` |
77
+ | Cancel open order | `ctm_hyperliquid_build_cancel_multisign` |
78
+ | Move USDC spot ↔ perp | `ctm_hyperliquid_build_usd_transfer_multisign` |
79
+ | Vault deposit | `ctm_hyperliquid_build_vault_deposit_multisign` |
80
+ | Vault withdraw | `ctm_hyperliquid_build_vault_withdraw_multisign` |
81
+ | Stake HYPE | `ctm_hyperliquid_build_stake_multisign` |
82
+ | Unstake HYPE | `ctm_hyperliquid_build_unstake_multisign` |
83
+ | Delegate to validator | `ctm_hyperliquid_build_delegate_multisign` |
84
+ | Undelegate | `ctm_hyperliquid_build_undelegate_multisign` |
85
+
86
+ ## Common multisign inputs (all `build_*` tools)
87
+
88
+ | Field | Required | Notes |
89
+ |-------|----------|-------|
90
+ | `keyGen` | yes | `{ pubkeyhex, keylist?, ClientKeys? }` |
91
+ | `chainId` | yes | **999** or **998** |
92
+ | `rpcUrl` | yes | HyperEVM RPC from chain registry |
93
+ | `executorAddress` | yes | MPC `ethereumaddress` |
94
+ | `chainDetail` | yes | Gas config row from registry |
95
+ | `purposeText` | yes | Human-readable sign request purpose |
96
+ | `useCustomGas` | yes | See gas section below |
97
+ | `customGasChainDetails` | no | Snapshot when `useCustomGas: true` |
98
+
99
+ ## Limit order example
100
+
101
+ ```json
102
+ {
103
+ "keyGen": { "pubkeyhex": "…", "keylist": ["…"] },
104
+ "chainId": 999,
105
+ "rpcUrl": "https://…",
106
+ "executorAddress": "0x…",
107
+ "chainDetail": {},
108
+ "purposeText": "Hyperliquid: long BTC 0.01 @ 95000",
109
+ "useCustomGas": false,
110
+ "coin": "BTC",
111
+ "isBuy": true,
112
+ "limitPxHuman": "95000",
113
+ "szHuman": "0.01",
114
+ "tif": "gtc"
115
+ }
116
+ ```
117
+
118
+ - `tif`: `gtc` (default), `ioc`, or `alo`
119
+ - `marketKind`: optional `perp` (default) or `spot`
120
+ - `dex`: optional HIP-3 dex name; coin may be prefixed e.g. `xyz:SYMBOL`
121
+
122
+ Validate `szHuman` against `availableToBuy` / `availableToSell` from `fetch_open_context`.
123
+
124
+ ## Close position example
125
+
126
+ Use `isLong: true` for a **long** position (submits sell reduce-only IoC):
127
+
128
+ ```json
129
+ {
130
+ "coin": "BTC",
131
+ "isLong": true,
132
+ "limitPxHuman": "94000",
133
+ "szHuman": "0.01",
134
+ "tif": "ioc"
135
+ }
136
+ ```
137
+
138
+ ## Cancel example
139
+
140
+ ```json
141
+ {
142
+ "coin": "BTC",
143
+ "oid": 123456789
144
+ }
145
+ ```
146
+
147
+ `oid` from `ctm_hyperliquid_fetch_open_orders`.
148
+
149
+ ## Spot ↔ Perp USD transfer
150
+
151
+ ```json
152
+ {
153
+ "usdHuman": "100",
154
+ "toPerp": true
155
+ }
156
+ ```
157
+
158
+ Check balances first with `ctm_hyperliquid_fetch_usd_class_balances`.
159
+
160
+ ## Vault / stake
161
+
162
+ - **Vault deposit/withdraw:** `vaultAddress` from `fetch_vaults`; `usdHuman` amount. Mainnet vault catalog fetch can take ~10–15s (large stats feed). Testnet catalog is empty.
163
+ - **Stake/unstake:** `hypeHuman` amount in HYPE units.
164
+ - **Delegate/undelegate:** `validator` address + `hypeHuman`.
165
+
166
+ ## OHLCV history (e.g. “15m for the last week”)
167
+
168
+ Use **`ctm_hyperliquid_fetch_ohlcv`** — not `fetch_market_snapshot` (snapshot is for **live price** + ~48 recent bars only).
169
+
170
+ ```json
171
+ {
172
+ "chainId": 999,
173
+ "coin": "xyz:AAPL",
174
+ "interval": "15m",
175
+ "lookbackDays": 7
176
+ }
177
+ ```
178
+
179
+ - **`lookbackDays: 7`** + **`interval: "15m"`** → requests ~672 bars for exactly that window (not 7 days fetched then filtered).
180
+ - Alternatives: **`lookbackHours`**, or **`startTimeMs`** + **`endTimeMs`** for explicit ranges.
181
+ - Max **2000 bars** per call; if the range is too large, the tool errors — use a coarser interval (e.g. `1h` for multi-month).
182
+ - Check **`ohlcv.candleCount`** vs **`ohlcv.expectedBars`** to confirm the full range was returned.
183
+ - Default lookback if none specified: **1 day**.
184
+
185
+ ## HIP-3 dexes
186
+
187
+ HIP-3 builder perps (e.g. **XYZ** dex) are **not** in the default native meta alone. `fetch_markets` without `dex` returns **native + every listed HIP-3 dex** in one response.
188
+
189
+ - Coin names use `{dex}:{symbol}` — e.g. **`xyz:AAPL`**, not `xyzAAPL` or bare `AAPL` on the wire.
190
+ - **`search_markets`** is the right tool when the user says a ticker or company name (`AAPL`, `Apple`, `Tesla`). It searches **all dexes** using Hyperliquid annotations (display names + keywords).
191
+ - `fetch_market_snapshot`, `fetch_open_context`, and `build_*` limit/cancel/close also accept ticker/name and resolve automatically — but ambiguous matches (e.g. `AAPL` on both `xyz` and `km`) return an error listing options; pass `dex` or full `coin`.
192
+ - Pass `dex: "xyz"` on reads/build when filtering one dex, or rely on coin prefix inference for `xyz:…` coins.
193
+
194
+ ## Troubleshooting
195
+
196
+ | Symptom | Likely cause |
197
+ |---------|----------------|
198
+ | Agent quotes stale price (e.g. old hourly close) | Use **`snapshot.livePrice.midUsd`**, not a random candle from truncated history; republish defi with live-price fix |
199
+ | `fetch_market_snapshot` throws on HIP-3 | Missing dex — pass `coin: "xyz:AAPL"` or `dex: "xyz"` |
200
+ | `availableToBuy` / `availableToSell` is 0 | No perp margin, leverage too high, or USDC still in spot — transfer to perp |
201
+ | Order succeeds on-chain but no position | Limit not filled yet; IoC may partially/fully reject |
202
+ | Position missing after multi-sign | Request not yet broadcast; or wrong dex filter |
203
+ | Vault list empty on 998 | Expected — catalog is mainnet-only |
204
+ | CoreWriter tx fails on broadcast | Insufficient **HYPE** on HyperEVM for gas |
205
+ | Size rejected | Exceeds `availableToBuy`/`availableToSell` at current leverage |
@@ -0,0 +1,48 @@
1
+ # Morpho
2
+
3
+ Morpho integration: **listed earn vaults** (V1 + V2, unified), **Blue** variable-rate borrow, and **Merkl** rewards.
4
+
5
+ ## Data
6
+
7
+ - GraphQL: `https://api.morpho.org/graphql`
8
+ - Earn vault discovery: **`ctm_morpho_fetch_earn_vaults`** — Morpho-listed vaults only (`listed: true`). V1 and V2 are merged; do not ask the user about vault generation.
9
+ - Blue: `marketById(marketId, chainId)` for market params.
10
+ - Positions: `userByAddress` (vault + Blue positions).
11
+
12
+ ## Discover earn vaults
13
+
14
+ | Goal | Tool call |
15
+ |------|-----------|
16
+ | Vaults for a deposit asset | `ctm_morpho_fetch_earn_vaults({ chainId, underlying: "USDC" })` |
17
+ | Find vault by name | `ctm_morpho_fetch_earn_vaults({ chainId, query: "steakhouse prime" })` |
18
+ | Asset + name | `ctm_morpho_fetch_earn_vaults({ chainId, underlying: "USDC", query: "gauntlet" })` |
19
+ | Top listed vaults on chain | `ctm_morpho_fetch_earn_vaults({ chainId })` |
20
+
21
+ `underlying` accepts **symbol** (e.g. `USDC`, `WETH`) or **ERC-20 address**.
22
+ `query` is **case-insensitive** on vault name, symbol, address, and underlying symbol.
23
+
24
+ Use returned `vaultAddress` and `underlyingAddress` for deposit multisign. Each row includes `totalDepositsUsd`, `liquidityUsd`, `netApy` / `netApy7d` / `netApy30d` / `netApy90d`, `performanceFee`, and `exposure[]` (allocated markets/strategies with % of TVL).
25
+
26
+ ## MCP multisign tools
27
+
28
+ | Tool | Action |
29
+ |------|--------|
30
+ | `ctm_morpho_fetch_earn_vaults` | List/search Morpho-listed earn vaults |
31
+ | `ctm_morpho_build_vault_deposit_multisign` | Vault deposit (listed V1 or V2) |
32
+ | `ctm_morpho_build_vault_withdraw_multisign` | Vault withdraw |
33
+ | `ctm_morpho_build_blue_collateral_deposit_multisign` | Blue supplyCollateral |
34
+ | `ctm_morpho_build_blue_borrow_multisign` | Blue borrow |
35
+ | `ctm_morpho_build_blue_repay_multisign` | Blue repay |
36
+ | `ctm_morpho_build_blue_collateral_withdraw_multisign` | Blue withdrawCollateral |
37
+ | `ctm_morpho_build_merkl_claim_multisign` | Merkl claim |
38
+
39
+ Pass `marketId` from Morpho API for Blue tools (not recomputed on-chain).
40
+ **Deposits** require a **Morpho-listed** vault (`ctm_morpho_fetch_earn_vaults`). Unlisted/test vaults are rejected.
41
+
42
+ ## Workflow
43
+
44
+ 1. `get_chain_registry` + `keyGenId` enrichment (automatic in MCP handler).
45
+ 2. `ctm_morpho_fetch_earn_vaults` — pick `vaultAddress` by asset and/or name.
46
+ 3. Build multisign with deposit/withdraw; server resolves `marketParams` from `marketId` for Blue tools.
47
+
48
+ Midnight fixed-rate is not yet on mainnet.
@@ -91,6 +91,7 @@ function getActionsByChainCategory(category) {
91
91
  var aaveGraphqlProxyUrl;
92
92
  var eulerGraphqlProxyUrl;
93
93
  var mapleGraphqlProxyUrl;
94
+ var morphoGraphqlProxyUrl;
94
95
  var coingeckoProxyUrl;
95
96
  function setAaveGraphqlProxyUrl(url) {
96
97
  aaveGraphqlProxyUrl = url?.trim() || void 0;
@@ -110,6 +111,12 @@ function setMapleGraphqlProxyUrl(url) {
110
111
  function getMapleGraphqlProxyUrl() {
111
112
  return mapleGraphqlProxyUrl;
112
113
  }
114
+ function setMorphoGraphqlProxyUrl(url) {
115
+ morphoGraphqlProxyUrl = url?.trim() || void 0;
116
+ }
117
+ function getMorphoGraphqlProxyUrl() {
118
+ return morphoGraphqlProxyUrl;
119
+ }
113
120
  function setCoingeckoProxyUrl(url) {
114
121
  coingeckoProxyUrl = url?.trim() || void 0;
115
122
  }
@@ -153,6 +160,7 @@ exports.getActionsByChainCategory = getActionsByChainCategory;
153
160
  exports.getCoingeckoProxyUrl = getCoingeckoProxyUrl;
154
161
  exports.getEulerGraphqlProxyUrl = getEulerGraphqlProxyUrl;
155
162
  exports.getMapleGraphqlProxyUrl = getMapleGraphqlProxyUrl;
163
+ exports.getMorphoGraphqlProxyUrl = getMorphoGraphqlProxyUrl;
156
164
  exports.getProtocolModule = getProtocolModule;
157
165
  exports.getProtocolModules = getProtocolModules;
158
166
  exports.mergePurposeText = mergePurposeText;
@@ -162,5 +170,6 @@ exports.setAaveGraphqlProxyUrl = setAaveGraphqlProxyUrl;
162
170
  exports.setCoingeckoProxyUrl = setCoingeckoProxyUrl;
163
171
  exports.setEulerGraphqlProxyUrl = setEulerGraphqlProxyUrl;
164
172
  exports.setMapleGraphqlProxyUrl = setMapleGraphqlProxyUrl;
173
+ exports.setMorphoGraphqlProxyUrl = setMorphoGraphqlProxyUrl;
165
174
  //# sourceMappingURL=index.cjs.map
166
175
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts"],"names":["getClientIdFromKeyGenResult","r"],"mappings":";;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAqB,aAAA,EAAgC;AACpF,EAAA,MAAM,CAAA,GAAI,YAAY,IAAA,EAAK;AAC3B,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,CAAA,GAAI,GAAG,CAAC;;AAAA,EAAO,MAAM,CAAA,CAAA,GAAK,MAAA;A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AA;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,GAAI,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,EAAA,EAAK,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,EACjF;AACA,EAAA,OAAQ,MAAM,EAAE,IAAA,EAAK;AACvB","file":"index.cjs","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string, purposeSuffix?: string): string {\n const t = purposeText.trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload)\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json()) as T\n}\n"]}
1
+ {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts"],"names":["getClientIdFromKeyGenResult","r"],"mappings":";;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAqB,aAAA,EAAgC;AACpF,EAAA,MAAM,CAAA,GAAI,YAAY,IAAA,EAAK;AAC3B,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,CAAA,GAAI,GAAG,CAAC;;AAAA,EAAO,MAAM,CAAA,CAAA,GAAK,MAAA;AACnC;AC8BO,SAAS,kBAAkB,KAAA,EAAsD;AACtF,EAAA,MAAM,EAAE,MAAA,EAAQ,kBAAA,EAAoB,IAAA,EAAK,GAAI,KAAA;AAC7C,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAAA,EAC/D;AAEA,EAAA,MAAM,EAAA,GAAA,CAAM,MAAA,CAAO,SAAA,IAAa,EAAA,EAAI,IAAA,EAAK;AACzC,EAAA,IAAI,CAAC,EAAA,EAAI,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAEhE,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,OAAA,IAAW,EAAC;AACnC,EAAA,MAAM,QAAA,GAAWA,6CAA4B,MAAM,CAAA;AACnD,EAAA,MAAM,KAAA,GAAQ,KAAK,CAAC,CAAA;AAEpB,EAAA,MAAM,gBAAgB,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,KAAM,EAAE,OAAO,CAAA;AAC/C,EAAA,MAAM,kBAAkB,IAAA,CA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,MAAA,MAAM,IAAI,MAAMA,EAAAA,CAAE,MAAK,CAAE,KAAA,CAAM,MAAM,EAAE,CAAA;AACvC,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,GAAI,CAAA,WAAA,EAAcA,EAAAA,CAAE,MAAM,CAAA,EAAA,EAAK,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,WAAA,EAAcA,EAAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IAC7F;AACA,IAAA,OAAQ,MAAMA,GAAE,IAAA,EAAK;AAAA,EACvB;AACA,EAAA,MAAM,CAAA,GAAI,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW;AAAA,IACpC,MAAA,EAAQ,MAAA;AAAA,IACR,OAAA,EAAS,EAAC,cAAA,EAAgB,kBAAA,EAAkB;AAAA,IAC5C,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,IAAI;AAAA,GAC/B,CAAA;AACD,EAAA,IAAI,CAAC,EAAE,EAAA,EAAI;AACT,IAAA,MAAM,IAAI,MAAM,CAAA,CAAE,MAAK,CAAE,KAAA,CAAM,MAAM,EAAE,CAAA;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,GAAI,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,EAAA,EAAK,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,EACjF;AACA,EAAA,OAAQ,MAAM,EAAE,IAAA,EAAK;AACvB","file":"index.cjs","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string, purposeSuffix?: string): string {\n const t = purposeText.trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload)\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet morphoGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setMorphoGraphqlProxyUrl(url: string | undefined): void {\n morphoGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoGraphqlProxyUrl(): string | undefined {\n return morphoGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json()) as T\n}\n"]}
@@ -16,6 +16,8 @@ declare function setEulerGraphqlProxyUrl(url: string | undefined): void;
16
16
  declare function getEulerGraphqlProxyUrl(): string | undefined;
17
17
  declare function setMapleGraphqlProxyUrl(url: string | undefined): void;
18
18
  declare function getMapleGraphqlProxyUrl(): string | undefined;
19
+ declare function setMorphoGraphqlProxyUrl(url: string | undefined): void;
20
+ declare function getMorphoGraphqlProxyUrl(): string | undefined;
19
21
  declare function setCoingeckoProxyUrl(url: string | undefined): void;
20
22
  declare function getCoingeckoProxyUrl(): string | undefined;
21
23
  declare function postJsonViaOptionalProxy<T>(args: {
@@ -25,4 +27,4 @@ declare function postJsonViaOptionalProxy<T>(args: {
25
27
  proxyEnvelope?: unknown;
26
28
  }): Promise<T>;
27
29
 
28
- export { getAaveGraphqlProxyUrl, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, mergePurposeText, postJsonViaOptionalProxy, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl };
30
+ export { getAaveGraphqlProxyUrl, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, getMorphoGraphqlProxyUrl, mergePurposeText, postJsonViaOptionalProxy, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl, setMorphoGraphqlProxyUrl };
@@ -90,6 +90,7 @@ function getActionsByChainCategory(category) {
90
90
  var aaveGraphqlProxyUrl;
91
91
  var eulerGraphqlProxyUrl;
92
92
  var mapleGraphqlProxyUrl;
93
+ var morphoGraphqlProxyUrl;
93
94
  var coingeckoProxyUrl;
94
95
  function setAaveGraphqlProxyUrl(url) {
95
96
  aaveGraphqlProxyUrl = url?.trim() || void 0;
@@ -109,6 +110,12 @@ function setMapleGraphqlProxyUrl(url) {
109
110
  function getMapleGraphqlProxyUrl() {
110
111
  return mapleGraphqlProxyUrl;
111
112
  }
113
+ function setMorphoGraphqlProxyUrl(url) {
114
+ morphoGraphqlProxyUrl = url?.trim() || void 0;
115
+ }
116
+ function getMorphoGraphqlProxyUrl() {
117
+ return morphoGraphqlProxyUrl;
118
+ }
112
119
  function setCoingeckoProxyUrl(url) {
113
120
  coingeckoProxyUrl = url?.trim() || void 0;
114
121
  }
@@ -141,6 +148,6 @@ async function postJsonViaOptionalProxy(args) {
141
148
  return await r.json();
142
149
  }
143
150
 
144
- export { coreChainCategoryModule, finalizeMultisign, getAaveGraphqlProxyUrl, getActionsByChainCategory, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, getProtocolModule, getProtocolModules, mergePurposeText, postJsonViaOptionalProxy, registerProtocolModule, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl };
151
+ export { coreChainCategoryModule, finalizeMultisign, getAaveGraphqlProxyUrl, getActionsByChainCategory, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, getMorphoGraphqlProxyUrl, getProtocolModule, getProtocolModules, mergePurposeText, postJsonViaOptionalProxy, registerProtocolModule, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl, setMorphoGraphqlProxyUrl };
145
152
  //# sourceMappingURL=index.js.map
146
153
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts"],"names":["r"],"mappings":";;;;;;AACO,SAAS,gBAAA,CAAiB,aAAqB,aAAA,EAAgC;AACpF,EAAA,MAAM,CAAA,GAAI,YAAY,IAAA,EAAK;AAC3B,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,CAAA,GAAI,GAAG,CAAC;;AAAA,EAAO,MAAM,CAAA,CAAA,GAAK,MAAA;AACnC;AC8BO,SAAS,kBAAkB,KAAA,EAAsD;AACtF,EAAA,MAAM,EAAE,MAAA,EAAQ,kBAAA,EAAoB,IAAA,EAAK,GAAI,KAAA;AAC7C,EAAA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M,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,EACjF;AACA,EAAA,OAAQ,MAAM,EAAE,IAAA,EAAK;AACvB","file":"index.js","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string, purposeSuffix?: string): string {\n const t = purposeText.trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload)\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json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AAA,CAAE,MAAM,CAAA,EAAA,EAAK,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,WAAA,EAAcA,EAAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,IAC7F;AACA,IAAA,OAAQ,MAAMA,GAAE,IAAA,EAAK;AAAA,EACvB;AACA,EAAA,MAAM,CAAA,GAAI,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW;AAAA,IACpC,MAAA,EAAQ,MAAA;AAAA,IACR,OAAA,EAAS,EAAC,cAAA,EAAgB,kBAAA,EAAkB;AAAA,IAC5C,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,IAAA,CAAK,IAAI;AAAA,GAC/B,CAAA;AACD,EAAA,IAAI,CAAC,EAAE,EAAA,EAAI;AACT,IAAA,MAAM,IAAI,MAAM,CAAA,CAAE,MAAK,CAAE,KAAA,CAAM,MAAM,EAAE,CAAA;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,GAAI,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,EAAA,EAAK,CAAA,CAAE,KAAA,CAAM,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA,GAAK,CAAA,KAAA,EAAQ,CAAA,CAAE,MAAM,CAAA,CAAE,CAAA;AAAA,EACjF;AACA,EAAA,OAAQ,MAAM,EAAE,IAAA,EAAK;AACvB","file":"index.js","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string, purposeSuffix?: string): string {\n const t = purposeText.trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload)\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet morphoGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setMorphoGraphqlProxyUrl(url: string | undefined): void {\n morphoGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoGraphqlProxyUrl(): string | undefined {\n return morphoGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json()) as T\n}\n"]}
package/dist/index.cjs CHANGED
@@ -92,6 +92,7 @@ function getActionsByChainCategory(category) {
92
92
  var aaveGraphqlProxyUrl;
93
93
  var eulerGraphqlProxyUrl;
94
94
  var mapleGraphqlProxyUrl;
95
+ var morphoGraphqlProxyUrl;
95
96
  var coingeckoProxyUrl;
96
97
  function setAaveGraphqlProxyUrl(url) {
97
98
  aaveGraphqlProxyUrl = url?.trim() || void 0;
@@ -111,6 +112,12 @@ function setMapleGraphqlProxyUrl(url) {
111
112
  function getMapleGraphqlProxyUrl() {
112
113
  return mapleGraphqlProxyUrl;
113
114
  }
115
+ function setMorphoGraphqlProxyUrl(url) {
116
+ morphoGraphqlProxyUrl = url?.trim() || void 0;
117
+ }
118
+ function getMorphoGraphqlProxyUrl() {
119
+ return morphoGraphqlProxyUrl;
120
+ }
114
121
  function setCoingeckoProxyUrl(url) {
115
122
  coingeckoProxyUrl = url?.trim() || void 0;
116
123
  }
@@ -2525,6 +2532,7 @@ exports.getActionsByChainCategory = getActionsByChainCategory;
2525
2532
  exports.getCoingeckoProxyUrl = getCoingeckoProxyUrl;
2526
2533
  exports.getEulerGraphqlProxyUrl = getEulerGraphqlProxyUrl;
2527
2534
  exports.getMapleGraphqlProxyUrl = getMapleGraphqlProxyUrl;
2535
+ exports.getMorphoGraphqlProxyUrl = getMorphoGraphqlProxyUrl;
2528
2536
  exports.getProtocolModule = getProtocolModule;
2529
2537
  exports.getProtocolModules = getProtocolModules;
2530
2538
  exports.isEvmNativeToken = isEvmNativeToken;
@@ -2541,6 +2549,7 @@ exports.setAaveGraphqlProxyUrl = setAaveGraphqlProxyUrl;
2541
2549
  exports.setCoingeckoProxyUrl = setCoingeckoProxyUrl;
2542
2550
  exports.setEulerGraphqlProxyUrl = setEulerGraphqlProxyUrl;
2543
2551
  exports.setMapleGraphqlProxyUrl = setMapleGraphqlProxyUrl;
2552
+ exports.setMorphoGraphqlProxyUrl = setMorphoGraphqlProxyUrl;
2544
2553
  exports.solanaChainCategoryModule = solanaChainCategoryModule;
2545
2554
  exports.uniswapV4 = uniswapV4;
2546
2555
  exports.uniswapV4ProtocolModule = uniswapV4ProtocolModule;