@continuumdao/ctm-mpc-defi 0.2.48 → 0.2.49

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 (63) hide show
  1. package/dist/agent/catalog.cjs +1083 -4
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1191 -7
  4. package/dist/agent/catalog.js +1047 -5
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/derive/SKILL.md +112 -0
  7. package/dist/agent/skills/hyperliquid/SKILL.md +22 -2
  8. package/dist/chains/evm/index.d.ts +118 -6
  9. package/dist/chains/near/index.d.ts +7 -1
  10. package/dist/chains/solana/index.d.ts +7 -1
  11. package/dist/core/index.cjs +2 -1
  12. package/dist/core/index.cjs.map +1 -1
  13. package/dist/core/index.d.ts +138 -7
  14. package/dist/core/index.js +2 -1
  15. package/dist/core/index.js.map +1 -1
  16. package/dist/index.cjs +2 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +848 -16
  19. package/dist/index.js +2 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/protocols/evm/aave-v4/index.d.ts +600 -6
  22. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
  23. package/dist/protocols/evm/aerodrome/index.d.ts +125 -5
  24. package/dist/protocols/evm/aerodrome/index.js.map +1 -1
  25. package/dist/protocols/evm/arcus/index.d.ts +66 -2
  26. package/dist/protocols/evm/circle-cctp/index.d.ts +71 -2
  27. package/dist/protocols/evm/compound-v3/index.d.ts +52 -1
  28. package/dist/protocols/evm/continuum-dao/index.d.ts +56 -1
  29. package/dist/protocols/evm/curve-dao/index.d.ts +66 -2
  30. package/dist/protocols/evm/derive/index.cjs +2655 -0
  31. package/dist/protocols/evm/derive/index.cjs.map +1 -0
  32. package/dist/protocols/evm/derive/index.d.ts +859 -0
  33. package/dist/protocols/evm/derive/index.js +2536 -0
  34. package/dist/protocols/evm/derive/index.js.map +1 -0
  35. package/dist/protocols/evm/ethena/index.d.ts +52 -1
  36. package/dist/protocols/evm/euler-v2/index.d.ts +115 -16
  37. package/dist/protocols/evm/gmx/index.d.ts +66 -2
  38. package/dist/protocols/evm/hyperliquid/index.cjs +545 -267
  39. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  40. package/dist/protocols/evm/hyperliquid/index.d.ts +152 -7
  41. package/dist/protocols/evm/hyperliquid/index.js +535 -269
  42. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  43. package/dist/protocols/evm/lido/index.d.ts +52 -1
  44. package/dist/protocols/evm/maple/index.d.ts +52 -1
  45. package/dist/protocols/evm/morpho/index.d.ts +115 -4
  46. package/dist/protocols/evm/pendle/index.cjs +2 -1
  47. package/dist/protocols/evm/pendle/index.cjs.map +1 -1
  48. package/dist/protocols/evm/pendle/index.d.ts +125 -5
  49. package/dist/protocols/evm/pendle/index.js +2 -1
  50. package/dist/protocols/evm/pendle/index.js.map +1 -1
  51. package/dist/protocols/evm/permit2/index.d.ts +14 -1
  52. package/dist/protocols/evm/sky/index.d.ts +52 -1
  53. package/dist/protocols/evm/uniswap-v4/index.d.ts +78 -4
  54. package/dist/protocols/evm/venice/index.d.ts +52 -1
  55. package/package.json +7 -2
  56. package/dist/buildBatch-tsEUVn_a.d.ts +0 -45
  57. package/dist/eip712Multisign-6oNIlObj.d.ts +0 -39
  58. package/dist/envelope-Cm-llShH.d.ts +0 -37
  59. package/dist/merklDistributor-CdqtZC9N.d.ts +0 -65
  60. package/dist/multisign-Dr0j9fHm.d.ts +0 -489
  61. package/dist/registry-BvsXh0-r.d.ts +0 -8
  62. package/dist/types-RJpoU4Pc.d.ts +0 -34
  63. package/dist/types-lIfv59N1.d.ts +0 -63
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: derive
3
+ description: Derive decentralized options — fund from Ethereum / OP / Base / Arbitrum (Socket) or HyperEVM HYPE, then EIP-712 orderbook trades.
4
+ ---
5
+
6
+ # Derive (MCP)
7
+
8
+ Derive is an **options-only** venue in this SDK. Market data, portfolio, and orderbook place/cancel/replace. No perps, spot, RFQ, lending, or session keys. Fund from Ethereum L1, Socket FAST (ETH/OP/Base/Arb), or the HyperEVM HYPE vault.
9
+
10
+ Tool groups (activated in continuum-mcp-server):
11
+
12
+ | Group | Activate |
13
+ |-------|----------|
14
+ | `defi:derive:market-data` | `load_defi_protocol derive` |
15
+ | `defi:derive:options` | `activate_tool_group` after market-data |
16
+
17
+ ## Onboarding (read this first)
18
+
19
+ 1. **Same KeyGen on every chain.** The MPC executor EOA is the Derive owner on Ethereum, Base, Arbitrum, … — one address.
20
+ 2. **First subaccount = a deposit.** There is no empty account and no EIP-712 create. Pick a fundable row (see Deposit below), then poll `ctm_derive_fetch_pending_deposits`.
21
+ 3. **After credit, trade from any supported asset row.** Orders are Derive API + EIP-712 against Derive collateral. They do **not** spend the row’s Base/Arb/OP token unless that row is the funding source.
22
+ 4. If `ctm_derive_fetch_subaccounts` is empty → `{ funded: false }` — deposit from a fundable row, then poll pending deposits.
23
+ 5. Place/cancel/replace require `subaccountId` from `ctm_derive_fetch_subaccounts`. **Never use `0`.**
24
+
25
+ The first credit also creates a fallback subaccount (manager id `0`) — two ids is normal.
26
+
27
+ ## Typical agent flow
28
+
29
+ 1. `load_defi_protocol({ protocolId: "derive" })`
30
+ 2. `get_defi_protocol_skill` — this file
31
+ 3. `ctm_derive_fetch_subaccounts` — if `funded: false`, go to deposit on a fundable chain
32
+ 4. `ctm_derive_fetch_option_chain` — **expiry ladder only** (counts + min/max strike). Never dump or bash the full instrument list.
33
+ 5. `ctm_derive_fetch_tickers` `{currency, expiryDate}` — **ATM strike/premium ladder** (~9 strikes). `expiryDate` may be `20260925` or `2026-09-25` (string or number). Pass `ladder: "all"` only if they ask for every strike.
34
+ 6. `ctm_derive_fetch_market_snapshot` for one `instrumentName` if you need greeks. Then `ctm_derive_order_quote` (v3 needs `subaccountId` from step 3).
35
+ 7. `ctm_derive_build_place_order_multisign` — **EIP-712**, no `useCustomGas` / no txParams
36
+ 8. Base MPC lifecycle (shared gas/submit section below) — after Get Sig, originator Execute posts to Derive `private/order`
37
+
38
+ **Do not** call `ctm_derive_fetch_ohlcv` or `continuum__prepare_chart_from_rows` unless the user asked for a chart, candles, or technical analysis. Index OHLCV binds the node's Technical Analysis SSE and is **not** a substitute for a live option quote.
39
+
40
+ ## Deposit (first subaccount)
41
+
42
+ Fundable rows (logo only here): **ETH / USDC / WETH / WBTC** on Ethereum (1); **USDC / WETH / WBTC** on Optimism (10) and Arbitrum (42161); **USDC / WETH** on Base (8453); **HYPE / WHYPE** on HyperEVM (999); **USDC** on Sepolia (11155111). Not Polygon / Linea / BSC. Not Derive L2 957.
43
+
44
+ 1. `ctm_derive_fetch_risk_universes` — pick a manager that lists ETH options + USDC (or the row’s currency).
45
+ 2. Choose the deposit builder for the row:
46
+ - **Ethereum L1 ACTION_MANAGER** (when `DERIVE_ACTION_MANAGER` / testnet is set): `ctm_derive_build_deposit_new_subaccount_multisign`
47
+ - **Ethereum L1 standard address** (always works): `ctm_derive_register_deposit_address` then `ctm_derive_build_deposit_address_transfer_multisign`
48
+ - **ETH / OP / Base / Arb Socket FAST**: `ctm_derive_build_socket_deposit_multisign` (native ETH wraps to WETH; pays a small native bridge fee)
49
+ - **HyperEVM HYPE vault**: `ctm_derive_build_hype_vault_deposit_multisign`
50
+ 3. `get_multi_sign_gas_options` + `useCustomGas` — these are EVM batches on the **source** chain.
51
+ 4. Poll `ctm_derive_fetch_pending_deposits` until `credited: true`, then `ctm_derive_fetch_subaccounts`.
52
+
53
+ Extra subaccounts after the first funded one: `ctm_derive_build_transfer_spot_multisign` with `toSubaccountId: 0` and `newSubaccountManager`.
54
+
55
+ ## Tool selection
56
+
57
+ ### Read-only (`defi:derive:market-data`)
58
+
59
+ | User intent | MCP tool |
60
+ |-------------|----------|
61
+ | List currencies | `ctm_derive_fetch_currencies` |
62
+ | Expiry ladder (counts, strike range) | `ctm_derive_fetch_option_chain` |
63
+ | ATM strike/premium ladder for one expiry | `ctm_derive_fetch_tickers` `{expiryDate}` (default ATM; `ladder: "all"` for every strike) |
64
+ | Find a strike / expiry name | `ctm_derive_search_instruments` |
65
+ | Live mark, index, bid/ask, greeks for one name | `ctm_derive_fetch_market_snapshot` |
66
+ | **OHLCV history** (instrument or index) | `ctm_derive_fetch_ohlcv` — then **`continuum__prepare_chart_from_rows`** |
67
+ | Dry-run fill / margin | `ctm_derive_order_quote` |
68
+
69
+ ### Account + writes (`defi:derive:options`)
70
+
71
+ | User intent | MCP tool |
72
+ |-------------|----------|
73
+ | Risk universes / manager + collateral | `ctm_derive_fetch_risk_universes` |
74
+ | Pending deposits | `ctm_derive_fetch_pending_deposits` |
75
+ | Subaccount ids (empty → fund from a fundable row) | `ctm_derive_fetch_subaccounts` |
76
+ | Portfolio / positions / open orders | `ctm_derive_fetch_portfolio` / `_positions` / `_open_orders` |
77
+ | Register L1 deposit address | `ctm_derive_register_deposit_address` |
78
+ | **L1 standard transfer** | `ctm_derive_build_deposit_address_transfer_multisign` |
79
+ | **L1 ACTION_MANAGER** (when address is set) | `ctm_derive_build_deposit_new_subaccount_multisign` |
80
+ | **Socket FAST** (1 / 10 / 8453 / 42161) | `ctm_derive_build_socket_deposit_multisign` |
81
+ | **HyperEVM HYPE vault** | `ctm_derive_build_hype_vault_deposit_multisign` |
82
+ | Place options order (EIP-712) | `ctm_derive_build_place_order_multisign` |
83
+ | Replace order | `ctm_derive_build_replace_order_multisign` |
84
+ | Cancel order | `ctm_derive_build_cancel_multisign` |
85
+ | Extra subaccount / internal transfer | `ctm_derive_build_transfer_spot_multisign` |
86
+
87
+ ## Charting OHLCV
88
+
89
+ `ctm_derive_fetch_ohlcv` returns `{ ohlcv: { candles, interval, … }, dataSource: "derive" }` — the same envelope as Hyperliquid/Arcus.
90
+
91
+ - **Option candles:** pass `instrumentName` (traded price).
92
+ - **Index candles:** pass `currency` + `marketKind: "index"` (underlying spot, useful before a strike is picked).
93
+ - Intervals: `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1d`, `1w`. Default window is **~96 bars** for the interval. Only pass `lookbackDays` when the operator asks for a longer history.
94
+ - After fetch, call **`continuum__prepare_chart_from_rows`** with the tool result if the user wants a chart.
95
+ - Skip this entire section when the user asked how to buy / quote / explore a ladder — use `fetch_option_chain` + `fetch_tickers` (then snapshot / `order_quote`).
96
+
97
+ ## Signing
98
+
99
+ - **Place / replace / transfer_spot:** EIP-712 `Action` on Matching (`name: "Matching"`, settlement `chainId` 1 / 11155111). `destinationChainID` on the sign request is the **asset-row chain**. Delivery kind `derive_exchange`. **No `useCustomGas`.**
100
+ - **Cancel:** v3 `private/cancel` is session-auth; the builder signs EIP-191 login for those headers.
101
+ - **Deposit:** EVM batch on the source chain (`useCustomGas`) — L1 ACTION_MANAGER / L1 transfer / Socket / HYPE vault.
102
+ - Private reads need a cached EIP-191 `personal_sign` of a millisecond timestamp (`X-DeriveWallet` / `X-DeriveTimestamp` / `X-DeriveSignature`). The node caches one login session.
103
+
104
+ ## Do not
105
+
106
+ - Do not invent `subaccount_id: 0` for orders.
107
+ - Do not fetch OHLCV (or prepare a chart) as a fallback when currencies / option-chain / quotes fail.
108
+ - Do not `agent_bash` an offloaded option-chain dump to build a strike ladder. Use `ctm_derive_fetch_tickers`.
109
+ - Do not pass `ladder: "all"` unless the operator asked for every strike. Do not fetch OHLCV to explore a ladder.
110
+ - Do not try to fund Derive from Polygon / Linea / BSC (no Socket route). Do not treat chain 957 as a Continuum Assets chain.
111
+ - Do not send an on-chain tx on the asset-row chain for a trade — trades are API + EIP-712.
112
+ - Do not offer perps, spot, RFQ, or vaults.
@@ -46,7 +46,7 @@ Positions and orders from MCP reflect **live HyperCore state** after prior txs a
46
46
  5. `ctm_hyperliquid_fetch_market_snapshot({ chainId, coin: "AAPL" })` — **`livePrice.midUsd`** is the current price; **`funding`** is official hourly HyperCore funding; `latestCandle` is the most recent bar; `candles` is capped (default 48). Throws if live price cannot be fetched.
47
47
  6. `ctm_hyperliquid_fetch_open_context({ chainId, executorAddress, coin: "Apple" })` — same resolution
48
48
  7. `ctm_hyperliquid_fetch_usd_class_balances({ chainId, executorAddress })` — spot vs perp USD if needed
49
- 8. **Gas** — `get_multi_sign_gas_options({ chainId })` + `useCustomGas` for **CoreWriter** tools only (plain limit, close, cancel, transfers, vault, stake). **Skip gas** for `build_update_leverage_multisign`, `build_bridge_withdraw_multisign`, `build_lend_multisign`, and limit orders **with TP/SL triggers** (EIP-712 `/exchange`).
49
+ 8. **Gas** — `get_multi_sign_gas_options({ chainId })` + `useCustomGas` for **CoreWriter** tools only (plain limit, close, cancel, transfers, vault, stake). **Skip gas** for `build_update_leverage_multisign`, `build_bridge_withdraw_multisign`, `build_lend_multisign`, `build_trailing_stop_multisign`, and limit orders **with TP/SL or trailingOffsetHuman** (EIP-712 `/exchange`).
50
50
  9. `ctm_hyperliquid_build_limit_order_multisign` → **`{ requestId }`**
51
51
  10. Base MPC lifecycle (shared gas/submit section below)
52
52
 
@@ -78,6 +78,7 @@ Positions and orders from MCP reflect **live HyperCore state** after prior txs a
78
78
  | User intent | MCP tool |
79
79
  |-------------|----------|
80
80
  | Open / add limit or IoC order | `ctm_hyperliquid_build_limit_order_multisign` |
81
+ | Attach / place a trailing stop | `ctm_hyperliquid_build_trailing_stop_multisign` (or `trailingOffsetHuman` on the limit tool) |
81
82
  | Close / reduce position | `ctm_hyperliquid_build_close_multisign` |
82
83
  | Cancel open order | `ctm_hyperliquid_build_cancel_multisign` |
83
84
  | Move USDC spot ↔ perp | `ctm_hyperliquid_build_usd_transfer_multisign` |
@@ -100,7 +101,8 @@ Positions and orders from MCP reflect **live HyperCore state** after prior txs a
100
101
  | `build_update_leverage_multisign` | EIP-712 → `/exchange` | **No** — trigger without txParams |
101
102
  | `build_bridge_withdraw_multisign` | EIP-712 → `/exchange` | **No** |
102
103
  | `build_lend_multisign` | EIP-712 → `/exchange` | **No** — trigger without txParams |
103
- | Limit with `takeProfitTriggerPxHuman` and/or `stopLossTriggerPxHuman` | EIP-712 normalTpsl → `/exchange` | **No** — re-build if entry/TP/SL change |
104
+ | `build_trailing_stop_multisign` | EIP-712 `trailingStop` → `/exchange` | **No** — trigger without txParams |
105
+ | Limit with `takeProfitTriggerPxHuman`, `stopLossTriggerPxHuman`, and/or `trailingOffsetHuman` | EIP-712 → `/exchange` (`normalTpsl` for TP/SL; trailing is a second signed action) | **No** — re-build if params change |
104
106
 
105
107
  ## Common multisign inputs (all `build_*` tools)
106
108
 
@@ -149,6 +151,24 @@ When **`takeProfitTriggerPxHuman`** and/or **`stopLossTriggerPxHuman`** are set
149
151
  - **`tpslExecMode`:** `limit_at_trigger` (default — limit px = trigger px) or `market` (10% slippage tolerance on HL). Configure default in trade-desk / node trade defaults under `hyperliquid.tpslExecMode`.
150
152
  - **`targetOffsetPct` / `targetOffsetMode`:** desk defaults under `hyperliquid` — pull TP inside analysis target (`price` = % of target; `atr` = % of one ATR bar from analysis OHLCV).
151
153
  - **OCO semantics:** TP/SL children activate when the entry order **fully fills**. If the parent is canceled before fill, children are canceled. Untriggered children do **not** appear in `fetch_open_orders` until entry fills.
154
+ - **Trailing stop:** set `trailingOffsetHuman` + optional `trailingOffsetType` (`percentage` default, or `price`) and `trailingActivationPxHuman`. Cannot combine with `stopLossTriggerPxHuman`. Perp only. The venue action is `type: "trailingStop"` (not a trigger child). On a limit entry the trailing leg is reduce-only on the closing side.
155
+
156
+ ## Trailing stop on an open position
157
+
158
+ Use `ctm_hyperliquid_build_trailing_stop_multisign` (EIP-712, no gas). `isBuy: false` closes a long; `isBuy: true` closes a short. `reduceOnly` defaults to true.
159
+
160
+ ```json
161
+ {
162
+ "keyGenId": "…",
163
+ "chainId": 999,
164
+ "purposeText": "HL trailing stop ETH 2%",
165
+ "coin": "ETH",
166
+ "isBuy": false,
167
+ "szHuman": "0.5",
168
+ "trailingOffsetHuman": "2",
169
+ "trailingOffsetType": "percentage"
170
+ }
171
+ ```
152
172
 
153
173
  ```json
154
174
  {
@@ -1,9 +1,121 @@
1
- import { b as EvmTxStep } from '../../types-RJpoU4Pc.js';
2
- export { E as EvmChainDetail, a as EvmProtocolContext, i as isEvmNativeToken, m as matchEvmTokenKind } from '../../types-RJpoU4Pc.js';
3
- export { E as EvmBatchMetaBuilder, a as EvmBuildBatchArgs, b as buildEvmMultisignBatch, e as evmChainCategoryModule } from '../../buildBatch-tsEUVn_a.js';
4
1
  import { Address, PublicClient } from 'viem';
5
- import '../../types-lIfv59N1.js';
6
- import '../../envelope-Cm-llShH.js';
2
+
3
+ type MultisignBuildResult = {
4
+ bodyForSign: Record<string, unknown>;
5
+ messageToSign: string;
6
+ };
7
+ type EvmTokenKind = 'native' | 'erc20' | 'erc721' | 'ctmerc20' | 'ctmrwa1';
8
+ interface MultisignCommonArgs {
9
+ keyGen: KeyGenSubset;
10
+ purposeText: string;
11
+ /** Optional Unix seconds (UTC) for POST /multiSignRequest expiryDate. */
12
+ expiryDate?: number;
13
+ }
14
+ type KeyGenSubset = {
15
+ pubkeyhex?: string;
16
+ keylist?: string[];
17
+ ClientKeys?: Record<string, string>;
18
+ groupId?: string;
19
+ GroupId?: string;
20
+ };
21
+
22
+ type EvmChainDetail = {
23
+ legacy?: boolean;
24
+ gasLimit?: number;
25
+ gasMultiplier?: number;
26
+ gasPrice?: number;
27
+ baseFee?: number;
28
+ priorityFee?: number;
29
+ baseFeeMultiplier?: number;
30
+ };
31
+ interface EvmProtocolContext extends MultisignCommonArgs {
32
+ chainCategory: 'evm';
33
+ chainId: number;
34
+ rpcUrl: string;
35
+ executorAddress: Address;
36
+ chainDetail: EvmChainDetail;
37
+ useCustomGas: boolean;
38
+ customGasChainDetails?: Record<string, unknown> | null;
39
+ }
40
+ type EvmTxStep = {
41
+ to: Address;
42
+ data: `0x${string}`;
43
+ value: bigint;
44
+ /** Fallback when estimateGas reverts */
45
+ fallbackGas?: bigint;
46
+ /** When set, use routerSwapGasLimitFromEstimate instead of plain estimate */
47
+ routerSwap?: boolean;
48
+ };
49
+ declare function isEvmNativeToken(address: string): boolean;
50
+ declare function matchEvmTokenKind(kind: EvmTokenKind, address: string): boolean;
51
+
52
+ interface MultisignLeg {
53
+ msgHash: string;
54
+ msgRaw: string;
55
+ destinationAddress: string;
56
+ signatureText: string;
57
+ audit: Record<string, unknown>;
58
+ feeSnapshot: Record<string, unknown>;
59
+ proposalTxParams?: Record<string, unknown>;
60
+ /** Payable value wei string for first leg only when relevant */
61
+ valueWei?: bigint;
62
+ }
63
+ interface ChainCategoryBuildInput {
64
+ keyGen: KeyGenSubset;
65
+ purposeText: string;
66
+ purposeSuffix?: string;
67
+ destinationChainID: string;
68
+ legs: MultisignLeg[];
69
+ extraJSON?: Record<string, unknown>;
70
+ /** Top-level destination address (first leg destination if omitted) */
71
+ destinationAddress?: string;
72
+ /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */
73
+ expiryDate?: number;
74
+ }
75
+ /**
76
+ * Assemble mpc-auth `bodyForSign` from category-built legs.
77
+ * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).
78
+ */
79
+ declare function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult;
80
+
81
+ type EvmBatchMetaBuilder = (args: {
82
+ step: EvmTxStep;
83
+ index: number;
84
+ gasLimit: bigint;
85
+ }) => Record<string, unknown>;
86
+ type EvmBuildBatchArgs = {
87
+ context: EvmProtocolContext;
88
+ steps: EvmTxStep[];
89
+ purposeSuffix?: string;
90
+ buildBatchMeta: EvmBatchMetaBuilder;
91
+ /** First leg msgRaw without 0x prefix; defaults to first step calldata */
92
+ firstMsgRawNo0x?: string;
93
+ destinationAddress?: Address;
94
+ /** Top-level `value` on bodyForSign when the payable amount is not on the first leg */
95
+ payableValueWei?: bigint;
96
+ resolveGasLimit?: (args: {
97
+ step: EvmTxStep;
98
+ index: number;
99
+ estimatedGas: bigint;
100
+ publicClient: PublicClient;
101
+ }) => Promise<bigint> | bigint;
102
+ /** Override default `estimateGas` (e.g. trade-API gas, skip post-approve deposit estimate). */
103
+ estimateGasForStep?: (args: {
104
+ step: EvmTxStep;
105
+ index: number;
106
+ publicClient: PublicClient;
107
+ executor: Address;
108
+ }) => Promise<bigint> | bigint;
109
+ };
110
+ /**
111
+ * Build unsigned EVM txs, estimate gas, serialize, hash — then assemble mpc-auth body via core envelope.
112
+ */
113
+ declare function buildEvmMultisignBatch(args: EvmBuildBatchArgs): Promise<MultisignBuildResult>;
114
+ declare const evmChainCategoryModule: {
115
+ category: "evm";
116
+ finalizeMultisign: typeof finalizeMultisign;
117
+ buildEvmMultisignBatch: typeof buildEvmMultisignBatch;
118
+ };
7
119
 
8
120
  /** Parse chain id for comparisons (decimal, 0x hex, CAIP-2 eip155:N, bigint). */
9
121
  declare function parseEvmChainIdToNumber(chainId: string | number | bigint | null | undefined): number;
@@ -57,4 +169,4 @@ declare function coingeckoPlatformForChainId(chainId: string | number): string |
57
169
  /** Curve router swap gas: chain cap when set, else 12/10 estimate bump. */
58
170
  declare function routerSwapGasLimitFromEstimate(estimatedGas: bigint, chainGasLimit?: number | null): bigint;
59
171
 
60
- export { COINGECKO_PLATFORM_BY_CHAIN_ID, type ConditionalApproveStep, EvmTxStep, approveStepsToEvmTxSteps, buildConditionalErc20ApproveSteps, coingeckoPlatformForChainId, normalizeCurveRouterAmountString, normalizeHumanDecimalAmount, parseEvmChainIdToNumber, publicClientForRpc, resolveErc20Decimals, routerSwapGasLimitFromEstimate };
172
+ export { COINGECKO_PLATFORM_BY_CHAIN_ID, type ConditionalApproveStep, type EvmBatchMetaBuilder, type EvmBuildBatchArgs, type EvmChainDetail, type EvmProtocolContext, type EvmTxStep, approveStepsToEvmTxSteps, buildConditionalErc20ApproveSteps, buildEvmMultisignBatch, coingeckoPlatformForChainId, evmChainCategoryModule, isEvmNativeToken, matchEvmTokenKind, normalizeCurveRouterAmountString, normalizeHumanDecimalAmount, parseEvmChainIdToNumber, publicClientForRpc, resolveErc20Decimals, routerSwapGasLimitFromEstimate };
@@ -1,4 +1,10 @@
1
- import { K as KeyGenSubset } from '../../types-lIfv59N1.js';
1
+ type KeyGenSubset = {
2
+ pubkeyhex?: string;
3
+ keylist?: string[];
4
+ ClientKeys?: Record<string, string>;
5
+ groupId?: string;
6
+ GroupId?: string;
7
+ };
2
8
 
3
9
  type NearSigningDefaults = {
4
10
  gasPriceYocto?: string;
@@ -1,4 +1,10 @@
1
- import { K as KeyGenSubset } from '../../types-lIfv59N1.js';
1
+ type KeyGenSubset = {
2
+ pubkeyhex?: string;
3
+ keylist?: string[];
4
+ ClientKeys?: Record<string, string>;
5
+ groupId?: string;
6
+ GroupId?: string;
7
+ };
2
8
 
3
9
  /** Solana signing defaults — mirrors app NonEvmChainDetailRow.signingDefaults. */
4
10
  type SolanaSigningDefaults = {
@@ -318,7 +318,8 @@ var DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
318
318
  "arcus",
319
319
  "curve-dao",
320
320
  "aerodrome",
321
- "pendle"
321
+ "pendle",
322
+ "derive"
322
323
  ]);
323
324
  function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
324
325
  if (typeof explicitExpiryDate === "number" && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts","../../src/core/defiEvmClient.ts","../../src/core/eip712Multisign.ts","../../src/core/payloadSignEd25519Multisign.ts","../../src/core/expiry.ts"],"names":["getClientIdFromKeyGenResult","r","http","stringToHex","hashTypedData"],"mappings":";;;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAiC,aAAA,EAAgC;AAChG,EAAA,MAAM,CAAA,GAAA,CAAK,WAAA,IAAe,EAAA,EAAI,IAAA,EAAK;AACnC,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,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A,IAAiB,4BAAA;AAAA,QACrC,KAAA,EAAO;AAAA,UACL,IAAA,EAAM,sBAAA;AAAA,UACN,YAAA,EAAc,KAAK,QAAA,CAAS,IAAA;AAAA,UAC5B,eAAe,YAAA,CAAa,MAAA;AAAA,UAC5B,GAAI,IAAA,CAAK,KAAA,IAAS;AAAC,SACrB;AAAA,QACA,aAAa;AAAC;AAChB;AACF,GACD,CAAA;AACH;;;ACnFO,IAAM,wCAAwC,EAAA,GAAK;AAGnD,IAAM,gCAAA,uBAAuC,GAAA,CAAI;AAAA,EACtD,YAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,8BAAA,CACd,YACA,kBAAA,EACoB;AACpB,EAAA,IAAI,OAAO,uBAAuB,QAAA,IAAY,MAAA,CAAO,SAAS,kBAAkB,CAAA,IAAK,qBAAqB,CAAA,EAAG;AAC3G,IAAA,OAAO,IAAA,CAAK,MAAM,kBAAkB,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,UAAA,IAAc,gCAAA,CAAiC,GAAA,CAAI,UAAU,CAAA,EAAG;AAClE,IAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,GAAA,EAAI,GAAI,GAAI,CAAA,GAAI,qCAAA;AAAA,EACzC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.cjs","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string | undefined, 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 /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */\n expiryDate?: number\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, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\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 if (input.expiryDate != null && input.expiryDate > 0) {\n bodyForSign.expiryDate = Math.floor(input.expiryDate)\n }\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\n/** Browser → Next.js base path for Euler V3 REST (`/v3/evk/vaults`, …). */\nlet eulerV3ApiProxyBase: string | undefined\n\nexport function setEulerV3ApiProxyBase(url: string | undefined): void {\n eulerV3ApiProxyBase = url?.trim().replace(/\\/$/, '') || undefined\n}\n\nexport function getEulerV3ApiProxyBase(): string | undefined {\n return eulerV3ApiProxyBase\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\n/** Browser → Next.js base path for Morpho Midnight REST (replaces api.morpho.org/v0/midnight). */\nlet morphoMidnightRestProxyUrl: string | undefined\n\nexport function setMorphoMidnightRestProxyUrl(url: string | undefined): void {\n morphoMidnightRestProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoMidnightRestProxyUrl(): string | undefined {\n return morphoMidnightRestProxyUrl\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\nexport async function getJsonViaOptionalProxy<T>(args: {\n directUrl: string\n /** When set, GET this URL instead of directUrl (same path semantics as caller built). */\n proxyUrl?: string\n}): Promise<T> {\n const url = args.proxyUrl?.trim() || args.directUrl\n const r = await fetch(url, { method: 'GET', headers: { accept: 'application/json' } })\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","import { http, type Transport } from 'viem'\n\n/**\n * Optional browser transport for protocol `eth_*` reads (allowance, decimals, spoke views).\n * Node / MCP leave this unset and use viem `http(rpcUrl)`.\n */\nlet evmRpcTransportFactory: ((rpcUrl: string) => Transport) | undefined\n\nexport function setDefiEvmRpcTransportFactory(factory: ((rpcUrl: string) => Transport) | undefined): void {\n evmRpcTransportFactory = factory\n}\n\nexport function getDefiEvmRpcTransportFactory(): ((rpcUrl: string) => Transport) | undefined {\n return evmRpcTransportFactory\n}\n\n/** Same-origin proxy in the browser when the app has called {@link setDefiEvmRpcTransportFactory}. */\nexport function defiEvmTransport(rpcUrl: string, opts?: Parameters<typeof http>[1]): Transport {\n const url = rpcUrl.trim()\n return evmRpcTransportFactory?.(url) ?? http(url, opts)\n}\n","import { hashTypedData, stringToHex, type TypedDataDomain } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const EIP712_SIGN_REQUEST_KIND = 'eip712' as const\n\nexport type Eip712TypedDataField = { name: string; type: string }\n\nexport type Eip712TypedDataPayload = {\n domain: TypedDataDomain\n types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>\n primaryType: string\n message: Record<string, unknown>\n}\n\nexport type Eip712MultisignDelivery = Record<string, unknown> & { kind: string }\n\nexport type BuildEip712MultisignLeg = {\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n}\n\nexport type BuildEip712MultisignArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */\n destinationChainID: string\n destinationAddress: string\n legs: readonly BuildEip712MultisignLeg[]\n expiryDate?: number\n}\n\nfunction msgHashNo0x(digest: `0x${string}`): string {\n return digest.startsWith('0x') ? digest.slice(2) : digest\n}\n\nfunction eip712SignatureText(domain: TypedDataDomain, primaryType: string): string {\n return JSON.stringify({\n kind: 'EIP-712',\n ...(typeof domain.name === 'string' ? { name: domain.name } : {}),\n primaryType,\n })\n}\n\nfunction jsonStringifyForAudit(value: unknown): string {\n return JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n}\n\nfunction eip712LegEnvelope(\n typedData: Eip712TypedDataPayload,\n delivery: Eip712MultisignDelivery,\n digest: `0x${string}`,\n): Record<string, unknown> {\n return {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n delivery,\n }\n}\n\nfunction eip712MsgRawHex(envelope: Record<string, unknown>): string {\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).\n * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.\n */\nexport function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult {\n if (args.legs.length < 1) {\n throw new Error('buildEip712Multisign requires at least one leg')\n }\n\n const eip712: Record<string, unknown>[] = []\n const legs = args.legs.map((leg) => {\n const digest = hashTypedData({\n domain: leg.typedData.domain,\n types: leg.typedData.types,\n primaryType: leg.typedData.primaryType,\n message: leg.typedData.message,\n })\n const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest)\n eip712.push(envelope)\n return {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(envelope),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: leg.typedData.primaryType,\n deliveryKind: leg.delivery.kind,\n ...(leg.audit ?? {}),\n },\n feeSnapshot: {},\n }\n })\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON: {\n signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712,\n },\n expiryDate: args.expiryDate,\n legs,\n })\n}\n","import { stringToHex } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const PAYLOAD_SIGN_ED25519_REQUEST_KIND = 'payload_sign_ed25519' as const\n\nexport type PayloadSignEd25519Delivery = Record<string, unknown> & { kind: string }\n\nexport type BuildPayloadSignEd25519MultisignBodyArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n destinationAddress: string\n /** UTF-8 bytes to sign (Arcus canonical JSON). */\n messageUtf8: string\n /** secp256k1 pub key hex for billing when signing with paired ed25519 KeyGen. */\n billingKeyGenPubKey?: string\n delivery: PayloadSignEd25519Delivery\n audit?: Record<string, unknown>\n expiryDate?: number\n signatureText?: string\n}\n\nfunction msgHashNo0xFromBytes(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nfunction payloadMsgRawHex(messageUtf8: string, delivery: PayloadSignEd25519Delivery): string {\n const envelope = {\n version: 1,\n messageUtf8,\n delivery,\n }\n return stringToHex(JSON.stringify(envelope))\n}\n\n/**\n * Build mpc-auth multiSignRequest for Ed25519 FROST signing over variable-length UTF-8 (Arcus Scheme 1).\n * `msgHash` is hex of the raw message bytes (not SHA-256); mpc-auth givre worker signs these bytes directly.\n */\nexport function buildPayloadSignEd25519MultisignBody(\n args: BuildPayloadSignEd25519MultisignBodyArgs,\n): MultisignBuildResult {\n const messageBytes = Buffer.from(args.messageUtf8, 'utf8')\n const msgHash = msgHashNo0xFromBytes(messageBytes)\n\n const extraJSON: Record<string, unknown> = {\n signRequestKind: PAYLOAD_SIGN_ED25519_REQUEST_KIND,\n payloadSignEd25519: {\n version: 1,\n messageHex: msgHash,\n messageLength: messageBytes.length,\n },\n delivery: args.delivery,\n }\n if (args.billingKeyGenPubKey?.trim()) {\n extraJSON.billingKeyGenPubKey = args.billingKeyGenPubKey.trim()\n }\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON,\n expiryDate: args.expiryDate,\n legs: [\n {\n msgHash,\n msgRaw: payloadMsgRawHex(args.messageUtf8, args.delivery),\n destinationAddress: args.destinationAddress,\n signatureText: args.signatureText ?? 'Arcus Ed25519 payload sign',\n audit: {\n kind: 'PAYLOAD_SIGN_ED25519',\n deliveryKind: args.delivery.kind,\n messageLength: messageBytes.length,\n ...(args.audit ?? {}),\n },\n feeSnapshot: {},\n },\n ],\n })\n}\n","/** Default MPC sign-request agreement window for fast-moving DeFi protocols (30 minutes). */\nexport const DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60\n\n/** Protocol ids that default to 30-minute expiry when `expiryDate` is omitted on multisign MCP tools. */\nexport const DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = new Set([\n 'uniswap-v4',\n 'gmx',\n 'hyperliquid',\n 'arcus',\n 'curve-dao',\n 'aerodrome',\n 'pendle',\n])\n\nexport function defiMultisignExpiryUnixSeconds(\n protocolId: string | undefined,\n explicitExpiryDate?: number | null,\n): number | undefined {\n if (typeof explicitExpiryDate === 'number' && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {\n return Math.floor(explicitExpiryDate)\n }\n if (protocolId && DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {\n return Math.floor(Date.now() / 1000) + DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS\n }\n return undefined\n}\n"]}
1
+ {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts","../../src/core/defiEvmClient.ts","../../src/core/eip712Multisign.ts","../../src/core/payloadSignEd25519Multisign.ts","../../src/core/expiry.ts"],"names":["getClientIdFromKeyGenResult","r","http","stringToHex","hashTypedData"],"mappings":";;;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAiC,aAAA,EAAgC;AAChG,EAAA,MAAM,CAAA,GAAA,CAAK,WAAA,IAAe,EAAA,EAAI,IAAA,EAAK;AACnC,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;ACgCO,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,EAA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A,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,8BAAA,CACd,YACA,kBAAA,EACoB;AACpB,EAAA,IAAI,OAAO,uBAAuB,QAAA,IAAY,MAAA,CAAO,SAAS,kBAAkB,CAAA,IAAK,qBAAqB,CAAA,EAAG;AAC3G,IAAA,OAAO,IAAA,CAAK,MAAM,kBAAkB,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,UAAA,IAAc,gCAAA,CAAiC,GAAA,CAAI,UAAU,CAAA,EAAG;AAClE,IAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,GAAA,EAAI,GAAI,GAAI,CAAA,GAAI,qCAAA;AAAA,EACzC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.cjs","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string | undefined, 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 /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */\n expiryDate?: number\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, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\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 if (input.expiryDate != null && input.expiryDate > 0) {\n bodyForSign.expiryDate = Math.floor(input.expiryDate)\n }\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\n/** Browser → Next.js base path for Euler V3 REST (`/v3/evk/vaults`, …). */\nlet eulerV3ApiProxyBase: string | undefined\n\nexport function setEulerV3ApiProxyBase(url: string | undefined): void {\n eulerV3ApiProxyBase = url?.trim().replace(/\\/$/, '') || undefined\n}\n\nexport function getEulerV3ApiProxyBase(): string | undefined {\n return eulerV3ApiProxyBase\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\n/** Browser → Next.js base path for Morpho Midnight REST (replaces api.morpho.org/v0/midnight). */\nlet morphoMidnightRestProxyUrl: string | undefined\n\nexport function setMorphoMidnightRestProxyUrl(url: string | undefined): void {\n morphoMidnightRestProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoMidnightRestProxyUrl(): string | undefined {\n return morphoMidnightRestProxyUrl\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\nexport async function getJsonViaOptionalProxy<T>(args: {\n directUrl: string\n /** When set, GET this URL instead of directUrl (same path semantics as caller built). */\n proxyUrl?: string\n}): Promise<T> {\n const url = args.proxyUrl?.trim() || args.directUrl\n const r = await fetch(url, { method: 'GET', headers: { accept: 'application/json' } })\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","import { http, type Transport } from 'viem'\n\n/**\n * Optional browser transport for protocol `eth_*` reads (allowance, decimals, spoke views).\n * Node / MCP leave this unset and use viem `http(rpcUrl)`.\n */\nlet evmRpcTransportFactory: ((rpcUrl: string) => Transport) | undefined\n\nexport function setDefiEvmRpcTransportFactory(factory: ((rpcUrl: string) => Transport) | undefined): void {\n evmRpcTransportFactory = factory\n}\n\nexport function getDefiEvmRpcTransportFactory(): ((rpcUrl: string) => Transport) | undefined {\n return evmRpcTransportFactory\n}\n\n/** Same-origin proxy in the browser when the app has called {@link setDefiEvmRpcTransportFactory}. */\nexport function defiEvmTransport(rpcUrl: string, opts?: Parameters<typeof http>[1]): Transport {\n const url = rpcUrl.trim()\n return evmRpcTransportFactory?.(url) ?? http(url, opts)\n}\n","import { hashTypedData, stringToHex, type TypedDataDomain } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const EIP712_SIGN_REQUEST_KIND = 'eip712' as const\n\nexport type Eip712TypedDataField = { name: string; type: string }\n\nexport type Eip712TypedDataPayload = {\n domain: TypedDataDomain\n types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>\n primaryType: string\n message: Record<string, unknown>\n}\n\nexport type Eip712MultisignDelivery = Record<string, unknown> & { kind: string }\n\nexport type BuildEip712MultisignLeg = {\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n}\n\nexport type BuildEip712MultisignArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */\n destinationChainID: string\n destinationAddress: string\n legs: readonly BuildEip712MultisignLeg[]\n expiryDate?: number\n}\n\nfunction msgHashNo0x(digest: `0x${string}`): string {\n return digest.startsWith('0x') ? digest.slice(2) : digest\n}\n\nfunction eip712SignatureText(domain: TypedDataDomain, primaryType: string): string {\n return JSON.stringify({\n kind: 'EIP-712',\n ...(typeof domain.name === 'string' ? { name: domain.name } : {}),\n primaryType,\n })\n}\n\nfunction jsonStringifyForAudit(value: unknown): string {\n return JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n}\n\nfunction eip712LegEnvelope(\n typedData: Eip712TypedDataPayload,\n delivery: Eip712MultisignDelivery,\n digest: `0x${string}`,\n): Record<string, unknown> {\n return {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n delivery,\n }\n}\n\nfunction eip712MsgRawHex(envelope: Record<string, unknown>): string {\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).\n * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.\n */\nexport function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult {\n if (args.legs.length < 1) {\n throw new Error('buildEip712Multisign requires at least one leg')\n }\n\n const eip712: Record<string, unknown>[] = []\n const legs = args.legs.map((leg) => {\n const digest = hashTypedData({\n domain: leg.typedData.domain,\n types: leg.typedData.types,\n primaryType: leg.typedData.primaryType,\n message: leg.typedData.message,\n })\n const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest)\n eip712.push(envelope)\n return {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(envelope),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: leg.typedData.primaryType,\n deliveryKind: leg.delivery.kind,\n ...(leg.audit ?? {}),\n },\n feeSnapshot: {},\n }\n })\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON: {\n signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712,\n },\n expiryDate: args.expiryDate,\n legs,\n })\n}\n","import { stringToHex } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const PAYLOAD_SIGN_ED25519_REQUEST_KIND = 'payload_sign_ed25519' as const\n\nexport type PayloadSignEd25519Delivery = Record<string, unknown> & { kind: string }\n\nexport type BuildPayloadSignEd25519MultisignBodyArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n destinationAddress: string\n /** UTF-8 bytes to sign (Arcus canonical JSON). */\n messageUtf8: string\n /** secp256k1 pub key hex for billing when signing with paired ed25519 KeyGen. */\n billingKeyGenPubKey?: string\n delivery: PayloadSignEd25519Delivery\n audit?: Record<string, unknown>\n expiryDate?: number\n signatureText?: string\n}\n\nfunction msgHashNo0xFromBytes(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nfunction payloadMsgRawHex(messageUtf8: string, delivery: PayloadSignEd25519Delivery): string {\n const envelope = {\n version: 1,\n messageUtf8,\n delivery,\n }\n return stringToHex(JSON.stringify(envelope))\n}\n\n/**\n * Build mpc-auth multiSignRequest for Ed25519 FROST signing over variable-length UTF-8 (Arcus Scheme 1).\n * `msgHash` is hex of the raw message bytes (not SHA-256); mpc-auth givre worker signs these bytes directly.\n */\nexport function buildPayloadSignEd25519MultisignBody(\n args: BuildPayloadSignEd25519MultisignBodyArgs,\n): MultisignBuildResult {\n const messageBytes = Buffer.from(args.messageUtf8, 'utf8')\n const msgHash = msgHashNo0xFromBytes(messageBytes)\n\n const extraJSON: Record<string, unknown> = {\n signRequestKind: PAYLOAD_SIGN_ED25519_REQUEST_KIND,\n payloadSignEd25519: {\n version: 1,\n messageHex: msgHash,\n messageLength: messageBytes.length,\n },\n delivery: args.delivery,\n }\n if (args.billingKeyGenPubKey?.trim()) {\n extraJSON.billingKeyGenPubKey = args.billingKeyGenPubKey.trim()\n }\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON,\n expiryDate: args.expiryDate,\n legs: [\n {\n msgHash,\n msgRaw: payloadMsgRawHex(args.messageUtf8, args.delivery),\n destinationAddress: args.destinationAddress,\n signatureText: args.signatureText ?? 'Arcus Ed25519 payload sign',\n audit: {\n kind: 'PAYLOAD_SIGN_ED25519',\n deliveryKind: args.delivery.kind,\n messageLength: messageBytes.length,\n ...(args.audit ?? {}),\n },\n feeSnapshot: {},\n },\n ],\n })\n}\n","/** Default MPC sign-request agreement window for fast-moving DeFi protocols (30 minutes). */\nexport const DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60\n\n/** Protocol ids that default to 30-minute expiry when `expiryDate` is omitted on multisign MCP tools. */\nexport const DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = new Set([\n 'uniswap-v4',\n 'gmx',\n 'hyperliquid',\n 'arcus',\n 'curve-dao',\n 'aerodrome',\n 'pendle',\n 'derive',\n])\n\nexport function defiMultisignExpiryUnixSeconds(\n protocolId: string | undefined,\n explicitExpiryDate?: number | null,\n): number | undefined {\n if (typeof explicitExpiryDate === 'number' && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {\n return Math.floor(explicitExpiryDate)\n }\n if (protocolId && DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {\n return Math.floor(Date.now() / 1000) + DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS\n }\n return undefined\n}\n"]}
@@ -1,14 +1,110 @@
1
- import { K as KeyGenSubset, M as MultisignBuildResult } from '../types-lIfv59N1.js';
2
- export { C as ChainCategory, a as ChainSupportContext, E as EvmTokenKind, b as KeyGenSubsetForPermit, c as MultisignCommonArgs, N as NearTokenKind, P as ParamDoc, d as ProtocolActionDescriptor, e as ProtocolModule, S as SolanaTokenKind, T as TokenRef } from '../types-lIfv59N1.js';
3
1
  export { getClientIdFromKeyGenResult as firstClientIdFromKeyGen } from '@continuumdao/continuum-node-sdk';
4
- export { C as ChainCategoryBuildInput, a as ChainCategoryModule, M as MultisignLeg, c as coreChainCategoryModule, f as finalizeMultisign } from '../envelope-Cm-llShH.js';
5
- export { g as getActionsByChainCategory, a as getProtocolModule, b as getProtocolModules, r as registerProtocolModule } from '../registry-BvsXh0-r.js';
6
- import { http, Transport } from 'viem';
7
- export { B as BuildEip712MultisignArgs, a as BuildEip712MultisignLeg, E as EIP712_SIGN_REQUEST_KIND, b as Eip712MultisignDelivery, c as Eip712TypedDataField, d as Eip712TypedDataPayload, e as buildEip712Multisign } from '../eip712Multisign-6oNIlObj.js';
2
+ import { http, Transport, TypedDataDomain } from 'viem';
3
+
4
+ /** Aligns with app NonEvmChainType + 'evm'. Extend as mpc-auth adds chains. */
5
+ type ChainCategory = 'evm' | 'solana' | 'near' | 'sui' | 'ton' | 'stellar';
6
+ type MultisignBuildResult = {
7
+ bodyForSign: Record<string, unknown>;
8
+ messageToSign: string;
9
+ };
10
+ type EvmTokenKind = 'native' | 'erc20' | 'erc721' | 'ctmerc20' | 'ctmrwa1';
11
+ type SolanaTokenKind = 'native' | 'spl' | 'spl2022';
12
+ type NearTokenKind = 'native' | 'nep141';
13
+ type TokenRef = {
14
+ category: 'evm';
15
+ kind: EvmTokenKind;
16
+ address: `0x${string}`;
17
+ } | {
18
+ category: 'solana';
19
+ kind: SolanaTokenKind;
20
+ mint: string;
21
+ } | {
22
+ category: 'near';
23
+ kind: NearTokenKind;
24
+ contractId: string;
25
+ };
26
+ type ParamDoc = {
27
+ type: string;
28
+ required: boolean;
29
+ description: string;
30
+ };
31
+ type ProtocolActionDescriptor = {
32
+ id: string;
33
+ protocolId: string;
34
+ chainCategory: ChainCategory;
35
+ description: string;
36
+ commonParams: Array<'keyGen' | 'purposeText' | 'useCustomGas' | 'useCustomFees'>;
37
+ params: Record<string, ParamDoc>;
38
+ };
39
+ type ChainSupportContext = {
40
+ chainCategory: ChainCategory;
41
+ chainId: string | number;
42
+ };
43
+ interface ProtocolModule {
44
+ id: string;
45
+ chainCategory: ChainCategory;
46
+ isChainSupported(ctx: ChainSupportContext): boolean | Promise<boolean>;
47
+ isTokenSupported(token: TokenRef): boolean | Promise<boolean>;
48
+ actions: ProtocolActionDescriptor[];
49
+ }
50
+ interface MultisignCommonArgs {
51
+ keyGen: KeyGenSubset;
52
+ purposeText: string;
53
+ /** Optional Unix seconds (UTC) for POST /multiSignRequest expiryDate. */
54
+ expiryDate?: number;
55
+ }
56
+ type KeyGenSubset = {
57
+ pubkeyhex?: string;
58
+ keylist?: string[];
59
+ ClientKeys?: Record<string, string>;
60
+ groupId?: string;
61
+ GroupId?: string;
62
+ };
63
+ /** App-compatible alias used by multisign builders and Permit2 helpers. */
64
+ type KeyGenSubsetForPermit = KeyGenSubset;
8
65
 
9
66
  /** Merge user purpose text with an optional batch / protocol suffix. */
10
67
  declare function mergePurposeText(purposeText: string | undefined, purposeSuffix?: string): string;
11
68
 
69
+ interface MultisignLeg {
70
+ msgHash: string;
71
+ msgRaw: string;
72
+ destinationAddress: string;
73
+ signatureText: string;
74
+ audit: Record<string, unknown>;
75
+ feeSnapshot: Record<string, unknown>;
76
+ proposalTxParams?: Record<string, unknown>;
77
+ /** Payable value wei string for first leg only when relevant */
78
+ valueWei?: bigint;
79
+ }
80
+ interface ChainCategoryBuildInput {
81
+ keyGen: KeyGenSubset;
82
+ purposeText: string;
83
+ purposeSuffix?: string;
84
+ destinationChainID: string;
85
+ legs: MultisignLeg[];
86
+ extraJSON?: Record<string, unknown>;
87
+ /** Top-level destination address (first leg destination if omitted) */
88
+ destinationAddress?: string;
89
+ /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */
90
+ expiryDate?: number;
91
+ }
92
+ interface ChainCategoryModule {
93
+ category: ChainCategory;
94
+ finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult;
95
+ }
96
+ /**
97
+ * Assemble mpc-auth `bodyForSign` from category-built legs.
98
+ * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).
99
+ */
100
+ declare function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult;
101
+ declare const coreChainCategoryModule: ChainCategoryModule;
102
+
103
+ declare function registerProtocolModule(mod: ProtocolModule): void;
104
+ declare function getProtocolModules(): readonly ProtocolModule[];
105
+ declare function getProtocolModule(id: string): ProtocolModule | undefined;
106
+ declare function getActionsByChainCategory(category: string): ProtocolModule['actions'];
107
+
12
108
  /**
13
109
  * Optional browser → Next.js API proxy paths for DeFi upstream calls.
14
110
  * Set once from continuumdao-node-app client bootstrap.
@@ -44,6 +140,41 @@ declare function getDefiEvmRpcTransportFactory(): ((rpcUrl: string) => Transport
44
140
  /** Same-origin proxy in the browser when the app has called {@link setDefiEvmRpcTransportFactory}. */
45
141
  declare function defiEvmTransport(rpcUrl: string, opts?: Parameters<typeof http>[1]): Transport;
46
142
 
143
+ declare const EIP712_SIGN_REQUEST_KIND: "eip712";
144
+ type Eip712TypedDataField = {
145
+ name: string;
146
+ type: string;
147
+ };
148
+ type Eip712TypedDataPayload = {
149
+ domain: TypedDataDomain;
150
+ types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>;
151
+ primaryType: string;
152
+ message: Record<string, unknown>;
153
+ };
154
+ type Eip712MultisignDelivery = Record<string, unknown> & {
155
+ kind: string;
156
+ };
157
+ type BuildEip712MultisignLeg = {
158
+ typedData: Eip712TypedDataPayload;
159
+ delivery: Eip712MultisignDelivery;
160
+ audit?: Record<string, unknown>;
161
+ };
162
+ type BuildEip712MultisignArgs = {
163
+ keyGen: KeyGenSubset;
164
+ purposeText: string;
165
+ purposeSuffix?: string;
166
+ /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */
167
+ destinationChainID: string;
168
+ destinationAddress: string;
169
+ legs: readonly BuildEip712MultisignLeg[];
170
+ expiryDate?: number;
171
+ };
172
+ /**
173
+ * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).
174
+ * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.
175
+ */
176
+ declare function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult;
177
+
47
178
  declare const PAYLOAD_SIGN_ED25519_REQUEST_KIND: "payload_sign_ed25519";
48
179
  type PayloadSignEd25519Delivery = Record<string, unknown> & {
49
180
  kind: string;
@@ -75,4 +206,4 @@ declare const DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS: number;
75
206
  declare const DEFI_PROTOCOLS_WITH_30MIN_EXPIRY: Set<string>;
76
207
  declare function defiMultisignExpiryUnixSeconds(protocolId: string | undefined, explicitExpiryDate?: number | null): number | undefined;
77
208
 
78
- export { type BuildPayloadSignEd25519MultisignBodyArgs, DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS, DEFI_PROTOCOLS_WITH_30MIN_EXPIRY, KeyGenSubset, MultisignBuildResult, PAYLOAD_SIGN_ED25519_REQUEST_KIND, type PayloadSignEd25519Delivery, buildPayloadSignEd25519MultisignBody, defiEvmTransport, defiMultisignExpiryUnixSeconds, getAaveGraphqlProxyUrl, getCoingeckoProxyUrl, getDefiEvmRpcTransportFactory, getEulerGraphqlProxyUrl, getEulerV3ApiProxyBase, getJsonViaOptionalProxy, getMapleGraphqlProxyUrl, getMorphoGraphqlProxyUrl, getMorphoMidnightRestProxyUrl, mergePurposeText, postJsonViaOptionalProxy, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setDefiEvmRpcTransportFactory, setEulerGraphqlProxyUrl, setEulerV3ApiProxyBase, setMapleGraphqlProxyUrl, setMorphoGraphqlProxyUrl, setMorphoMidnightRestProxyUrl };
209
+ export { type BuildEip712MultisignArgs, type BuildEip712MultisignLeg, type BuildPayloadSignEd25519MultisignBodyArgs, type ChainCategory, type ChainCategoryBuildInput, type ChainCategoryModule, type ChainSupportContext, DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS, DEFI_PROTOCOLS_WITH_30MIN_EXPIRY, EIP712_SIGN_REQUEST_KIND, type Eip712MultisignDelivery, type Eip712TypedDataField, type Eip712TypedDataPayload, type EvmTokenKind, type KeyGenSubset, type KeyGenSubsetForPermit, type MultisignBuildResult, type MultisignCommonArgs, type MultisignLeg, type NearTokenKind, PAYLOAD_SIGN_ED25519_REQUEST_KIND, type ParamDoc, type PayloadSignEd25519Delivery, type ProtocolActionDescriptor, type ProtocolModule, type SolanaTokenKind, type TokenRef, buildEip712Multisign, buildPayloadSignEd25519MultisignBody, coreChainCategoryModule, defiEvmTransport, defiMultisignExpiryUnixSeconds, finalizeMultisign, getAaveGraphqlProxyUrl, getActionsByChainCategory, getCoingeckoProxyUrl, getDefiEvmRpcTransportFactory, getEulerGraphqlProxyUrl, getEulerV3ApiProxyBase, getJsonViaOptionalProxy, getMapleGraphqlProxyUrl, getMorphoGraphqlProxyUrl, getMorphoMidnightRestProxyUrl, getProtocolModule, getProtocolModules, mergePurposeText, postJsonViaOptionalProxy, registerProtocolModule, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setDefiEvmRpcTransportFactory, setEulerGraphqlProxyUrl, setEulerV3ApiProxyBase, setMapleGraphqlProxyUrl, setMorphoGraphqlProxyUrl, setMorphoMidnightRestProxyUrl };