@continuumdao/ctm-mpc-defi 0.2.65 → 0.2.66

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 (115) hide show
  1. package/dist/agent/catalog.cjs +1227 -2928
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1620 -1631
  4. package/dist/agent/catalog.js +1226 -2929
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/chains/evm/index.cjs +15 -11
  7. package/dist/chains/evm/index.cjs.map +1 -1
  8. package/dist/chains/evm/index.js +5 -1
  9. package/dist/chains/evm/index.js.map +1 -1
  10. package/dist/core/index.cjs +3 -3
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.ts +1 -1
  13. package/dist/core/index.js +2 -2
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/index.cjs +18 -13
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +7 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/protocols/evm/aave-v4/index.cjs +16 -12
  21. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  22. package/dist/protocols/evm/aave-v4/index.js +5 -1
  23. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  24. package/dist/protocols/evm/aerodrome/index.cjs +15 -11
  25. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
  26. package/dist/protocols/evm/aerodrome/index.js +5 -1
  27. package/dist/protocols/evm/aerodrome/index.js.map +1 -1
  28. package/dist/protocols/evm/arcus/index.cjs +15 -11
  29. package/dist/protocols/evm/arcus/index.cjs.map +1 -1
  30. package/dist/protocols/evm/arcus/index.js +5 -1
  31. package/dist/protocols/evm/arcus/index.js.map +1 -1
  32. package/dist/protocols/evm/circle-cctp/index.cjs +15 -11
  33. package/dist/protocols/evm/circle-cctp/index.cjs.map +1 -1
  34. package/dist/protocols/evm/circle-cctp/index.js +5 -1
  35. package/dist/protocols/evm/circle-cctp/index.js.map +1 -1
  36. package/dist/protocols/evm/compound-v3/index.cjs +15 -11
  37. package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
  38. package/dist/protocols/evm/compound-v3/index.js +5 -1
  39. package/dist/protocols/evm/compound-v3/index.js.map +1 -1
  40. package/dist/protocols/evm/continuum-dao/index.cjs +26 -14
  41. package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -1
  42. package/dist/protocols/evm/continuum-dao/index.d.ts +3 -1
  43. package/dist/protocols/evm/continuum-dao/index.js +16 -5
  44. package/dist/protocols/evm/continuum-dao/index.js.map +1 -1
  45. package/dist/protocols/evm/curve-dao/index.cjs +15 -11
  46. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  47. package/dist/protocols/evm/curve-dao/index.d.ts +1 -1
  48. package/dist/protocols/evm/curve-dao/index.js +5 -1
  49. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  50. package/dist/protocols/evm/derive/index.cjs +18 -14
  51. package/dist/protocols/evm/derive/index.cjs.map +1 -1
  52. package/dist/protocols/evm/derive/index.js +5 -1
  53. package/dist/protocols/evm/derive/index.js.map +1 -1
  54. package/dist/protocols/evm/ethena/index.cjs +16 -12
  55. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  56. package/dist/protocols/evm/ethena/index.js +5 -1
  57. package/dist/protocols/evm/ethena/index.js.map +1 -1
  58. package/dist/protocols/evm/euler-v2/index.cjs +15 -11
  59. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  60. package/dist/protocols/evm/euler-v2/index.js +5 -1
  61. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  62. package/dist/protocols/evm/gmx/index.cjs +15 -11
  63. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  64. package/dist/protocols/evm/gmx/index.js +5 -1
  65. package/dist/protocols/evm/gmx/index.js.map +1 -1
  66. package/dist/protocols/evm/hyperliquid/index.cjs +15 -11
  67. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  68. package/dist/protocols/evm/hyperliquid/index.js +5 -1
  69. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  70. package/dist/protocols/evm/hyperliquidOutcome/index.cjs +2 -2
  71. package/dist/protocols/evm/hyperliquidOutcome/index.cjs.map +1 -1
  72. package/dist/protocols/evm/hyperliquidOutcome/index.js +1 -1
  73. package/dist/protocols/evm/hyperliquidOutcome/index.js.map +1 -1
  74. package/dist/protocols/evm/lido/index.cjs +15 -11
  75. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  76. package/dist/protocols/evm/lido/index.js +5 -1
  77. package/dist/protocols/evm/lido/index.js.map +1 -1
  78. package/dist/protocols/evm/maple/index.cjs +15 -11
  79. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  80. package/dist/protocols/evm/maple/index.js +5 -1
  81. package/dist/protocols/evm/maple/index.js.map +1 -1
  82. package/dist/protocols/evm/morpho/index.cjs +15 -11
  83. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  84. package/dist/protocols/evm/morpho/index.js +5 -1
  85. package/dist/protocols/evm/morpho/index.js.map +1 -1
  86. package/dist/protocols/evm/pendle/index.cjs +15 -11
  87. package/dist/protocols/evm/pendle/index.cjs.map +1 -1
  88. package/dist/protocols/evm/pendle/index.js +5 -1
  89. package/dist/protocols/evm/pendle/index.js.map +1 -1
  90. package/dist/protocols/evm/permit2/index.cjs +2 -2
  91. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  92. package/dist/protocols/evm/permit2/index.js +1 -1
  93. package/dist/protocols/evm/permit2/index.js.map +1 -1
  94. package/dist/protocols/evm/railgun/index.cjs +15 -11
  95. package/dist/protocols/evm/railgun/index.cjs.map +1 -1
  96. package/dist/protocols/evm/railgun/index.js +5 -1
  97. package/dist/protocols/evm/railgun/index.js.map +1 -1
  98. package/dist/protocols/evm/sky/index.cjs +15 -11
  99. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  100. package/dist/protocols/evm/sky/index.js +5 -1
  101. package/dist/protocols/evm/sky/index.js.map +1 -1
  102. package/dist/protocols/evm/trueo/index.cjs +15 -11
  103. package/dist/protocols/evm/trueo/index.cjs.map +1 -1
  104. package/dist/protocols/evm/trueo/index.js +5 -1
  105. package/dist/protocols/evm/trueo/index.js.map +1 -1
  106. package/dist/protocols/evm/uniswap-v4/index.cjs +17 -12
  107. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  108. package/dist/protocols/evm/uniswap-v4/index.d.ts +1 -1
  109. package/dist/protocols/evm/uniswap-v4/index.js +6 -1
  110. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  111. package/dist/protocols/evm/venice/index.cjs +16 -12
  112. package/dist/protocols/evm/venice/index.cjs.map +1 -1
  113. package/dist/protocols/evm/venice/index.js +5 -1
  114. package/dist/protocols/evm/venice/index.js.map +1 -1
  115. package/package.json +2 -2
@@ -5,10 +5,10 @@ var api = require('@morpho-org/midnight-sdk/api');
5
5
  var zodToJsonSchema = require('zod-to-json-schema');
6
6
  var zod = require('zod');
7
7
  require('@msgpack/msgpack');
8
- var module$1 = require('module');
9
- var url = require('url');
10
8
  var fs = require('fs');
11
9
  var path = require('path');
10
+ var url = require('url');
11
+ var module$1 = require('module');
12
12
 
13
13
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
14
14
  var __defProp = Object.defineProperty;
@@ -21,147 +21,6 @@ var __export = (target, all) => {
21
21
  __defProp(target, name, { get: all[name], enumerable: true });
22
22
  };
23
23
 
24
- // src/chains/evm/chainIdParse.ts
25
- function parseEvmChainIdToNumber(chainId) {
26
- if (chainId == null) return Number.NaN;
27
- if (typeof chainId === "bigint") {
28
- const n = Number(chainId);
29
- return Number.isSafeInteger(n) && n >= 0 ? n : Number.NaN;
30
- }
31
- if (typeof chainId === "number") {
32
- return Number.isInteger(chainId) && chainId >= 0 ? chainId : Number.NaN;
33
- }
34
- const t = String(chainId).trim();
35
- if (!t) return Number.NaN;
36
- const low = t.toLowerCase();
37
- if (low.startsWith("eip155:")) {
38
- const rest = t.slice("eip155:".length).trim();
39
- const n = Number.parseInt(rest, 10);
40
- return Number.isNaN(n) || n < 0 ? Number.NaN : n;
41
- }
42
- if (low.startsWith("0x")) {
43
- return Number.parseInt(t, 16);
44
- }
45
- return Number.parseInt(t, 10);
46
- }
47
- var init_chainIdParse = __esm({
48
- "src/chains/evm/chainIdParse.ts"() {
49
- }
50
- });
51
- function isCoinbaseB20AssetToken(address) {
52
- try {
53
- return viem.getAddress(address).toLowerCase().startsWith(COINBASE_B20_ASSET_PREFIX);
54
- } catch {
55
- return false;
56
- }
57
- }
58
- function looksLikeCoinbaseStockSymbol(symbol) {
59
- return /^[A-Za-z][A-Za-z0-9]{0,8}(?:\.[A-Za-z][A-Za-z0-9]{0,4})?c$/.test((symbol ?? "").trim());
60
- }
61
- function indexCatalog(rows) {
62
- catalogRows = rows;
63
- catalogAt = Date.now();
64
- catalogBySymbol.clear();
65
- catalogByAddress.clear();
66
- for (const row of rows) {
67
- catalogBySymbol.set(row.symbol.toLowerCase(), row);
68
- catalogByAddress.set(row.address.toLowerCase(), row);
69
- }
70
- }
71
- function parseCoinbaseTokenizedStocksPayload(payload) {
72
- const tokens = Array.isArray(payload) ? payload : payload && typeof payload === "object" && Array.isArray(payload.tokens) ? payload.tokens : [];
73
- const out = [];
74
- const seen = /* @__PURE__ */ new Set();
75
- for (const row of tokens) {
76
- if (!row || typeof row !== "object") continue;
77
- const rec = row;
78
- const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
79
- const addressRaw = typeof rec.contract_address === "string" ? rec.contract_address.trim() : "";
80
- if (!looksLikeCoinbaseStockSymbol(symbol) || !isCoinbaseB20AssetToken(addressRaw)) continue;
81
- const address = viem.getAddress(addressRaw);
82
- const key = address.toLowerCase();
83
- if (seen.has(key)) continue;
84
- seen.add(key);
85
- const name = typeof rec.name === "string" && rec.name.trim() ? rec.name.trim() : symbol;
86
- const iconUrl = typeof rec.icon_url === "string" && rec.icon_url.trim() ? rec.icon_url.trim() : void 0;
87
- const decimals = typeof rec.decimals === "number" && Number.isInteger(rec.decimals) && rec.decimals >= 0 && rec.decimals <= 18 ? rec.decimals : COINBASE_B20_STOCK_DECIMALS;
88
- out.push({ address, symbol, name, decimals, iconUrl });
89
- if (out.length >= CATALOG_MAX) break;
90
- }
91
- return out;
92
- }
93
- async function fetchCoinbaseB20StockCatalog() {
94
- const merged = [];
95
- const seen = /* @__PURE__ */ new Set();
96
- let pageToken = "";
97
- for (let page = 0; page < 4; page++) {
98
- const url = new URL(COINBASE_TOKENIZED_STOCKS_API_URL);
99
- url.searchParams.set("page_size", "500");
100
- if (pageToken) url.searchParams.set("page_token", pageToken);
101
- const res = await fetch(url, { cache: "no-store", signal: AbortSignal.timeout(8e3) });
102
- if (!res.ok) break;
103
- const json = await res.json();
104
- for (const row of parseCoinbaseTokenizedStocksPayload(json)) {
105
- const key = row.address.toLowerCase();
106
- if (seen.has(key)) continue;
107
- seen.add(key);
108
- merged.push(row);
109
- if (merged.length >= CATALOG_MAX) break;
110
- }
111
- pageToken = typeof json.next_page_token === "string" ? json.next_page_token.trim() : "";
112
- if (!pageToken || merged.length >= CATALOG_MAX) break;
113
- }
114
- if (merged.length > 0) indexCatalog(merged);
115
- return catalogRows ?? [];
116
- }
117
- async function ensureCoinbaseB20StockCatalog() {
118
- if (catalogRows && catalogRows.length > 0 && Date.now() - catalogAt < CATALOG_TTL_MS) return catalogRows;
119
- if (!catalogInflight) {
120
- catalogInflight = fetchCoinbaseB20StockCatalog().finally(() => {
121
- catalogInflight = null;
122
- });
123
- }
124
- try {
125
- return await catalogInflight;
126
- } catch {
127
- return catalogRows ?? [];
128
- }
129
- }
130
- function lookupCoinbaseB20StockToken(token) {
131
- const key = (token ?? "").trim();
132
- if (!key) return null;
133
- const fromCatalog = catalogBySymbol.get(key.toLowerCase());
134
- if (fromCatalog) return fromCatalog;
135
- try {
136
- return catalogByAddress.get(viem.getAddress(key).toLowerCase()) ?? null;
137
- } catch {
138
- return null;
139
- }
140
- }
141
- var COINBASE_B20_STOCK_DECIMALS, COINBASE_B20_ASSET_PREFIX, COINBASE_TOKENIZED_STOCKS_API_URL, CATALOG_TTL_MS, CATALOG_MAX, catalogRows, catalogAt, catalogInflight, catalogBySymbol, catalogByAddress;
142
- var init_coinbaseB20 = __esm({
143
- "src/protocols/evm/shared/coinbaseB20.ts"() {
144
- COINBASE_B20_STOCK_DECIMALS = 8;
145
- COINBASE_B20_ASSET_PREFIX = "0xb200000000000000000000";
146
- COINBASE_TOKENIZED_STOCKS_API_URL = "https://api.coinbase.com/v1/tokenized-stocks";
147
- CATALOG_TTL_MS = 15 * 60 * 1e3;
148
- CATALOG_MAX = 500;
149
- catalogRows = null;
150
- catalogAt = 0;
151
- catalogInflight = null;
152
- catalogBySymbol = /* @__PURE__ */ new Map();
153
- catalogByAddress = /* @__PURE__ */ new Map();
154
- }
155
- });
156
- function defiEvmTransport(rpcUrl, opts) {
157
- const url = rpcUrl.trim();
158
- return viem.http(url, opts);
159
- }
160
- var init_defiEvmClient = __esm({
161
- "src/core/defiEvmClient.ts"() {
162
- }
163
- });
164
-
165
24
  // src/core/defiProxy.ts
166
25
  function getAaveGraphqlProxyUrl() {
167
26
  return aaveGraphqlProxyUrl;
@@ -208,135 +67,6 @@ var init_defiProxy = __esm({
208
67
  "src/core/defiProxy.ts"() {
209
68
  }
210
69
  });
211
- function isConfiguredAddress(addr2) {
212
- if (!addr2?.trim()) return false;
213
- try {
214
- return viem.getAddress(addr2) !== viem.zeroAddress;
215
- } catch {
216
- return false;
217
- }
218
- }
219
- function continuumDaoDeployment(chainId) {
220
- return CONTINUUM_DAO_DEPLOYMENTS[chainId] ?? null;
221
- }
222
- function isContinuumDaoLockChain(chainId) {
223
- return chainId === CONTINUUM_DAO_LINEA_CHAIN_ID || chainId === CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID;
224
- }
225
- function isContinuumDaoSupportedChainId(chainId) {
226
- return continuumDaoDeployment(chainId) != null;
227
- }
228
- function ctmTokenAddressOnEvmChain(chainId) {
229
- const ctm = continuumDaoDeployment(chainId)?.ctm;
230
- return ctm && isConfiguredAddress(ctm) ? viem.getAddress(ctm) : null;
231
- }
232
- function votingEscrowAddressOnEvmChain(chainId) {
233
- const ve = continuumDaoDeployment(chainId)?.votingEscrow;
234
- return ve && isConfiguredAddress(ve) ? viem.getAddress(ve) : null;
235
- }
236
- function votingEscrowMarketplaceAddressOnEvmChain(chainId) {
237
- if (chainId !== CONTINUUM_DAO_LINEA_CHAIN_ID) return null;
238
- return VOTING_ESCROW_MARKETPLACE_LINEA_ADDRESS;
239
- }
240
- function listContinuumDaoDefaultAssets() {
241
- const out = [];
242
- for (const chainId of [
243
- CONTINUUM_DAO_LINEA_CHAIN_ID,
244
- CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID,
245
- CONTINUUM_DAO_ETHEREUM_CHAIN_ID
246
- ]) {
247
- const dep = continuumDaoDeployment(chainId);
248
- if (!dep) continue;
249
- if (isConfiguredAddress(dep.ctm)) {
250
- out.push({
251
- chainId,
252
- tokenType: "CTMERC20",
253
- contractAddress: viem.getAddress(dep.ctm),
254
- name: CTM_TOKEN_NAME,
255
- symbol: CTM_TOKEN_SYMBOL,
256
- decimals: CTM_TOKEN_DECIMALS
257
- });
258
- }
259
- if (isContinuumDaoLockChain(chainId) && isConfiguredAddress(dep.votingEscrow)) {
260
- out.push({
261
- chainId,
262
- tokenType: "ERC721",
263
- contractAddress: viem.getAddress(dep.votingEscrow),
264
- name: VECTM_TOKEN_NAME,
265
- symbol: VECTM_TOKEN_SYMBOL
266
- });
267
- }
268
- }
269
- return out;
270
- }
271
- var CONTINUUM_DAO_PROTOCOL_ID, CONTINUUM_DAO_ETHEREUM_CHAIN_ID, CONTINUUM_DAO_LINEA_CHAIN_ID, CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID, CTM_TOKEN_NAME, CTM_TOKEN_SYMBOL, VECTM_TOKEN_NAME, VECTM_TOKEN_SYMBOL, CTM_TOKEN_DECIMALS, WEEK_SECONDS, UNSET, CTM_TOKEN_ADDRESS, VOTING_ESCROW_LINEA_ADDRESS, VOTING_ESCROW_MARKETPLACE_LINEA_ADDRESS, MARKETPLACE_WETH_LINEA_ADDRESS, MARKETPLACE_USDC_LINEA_ADDRESS, CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS, CONTINUUM_DAO_DEPLOYMENTS;
272
- var init_constants = __esm({
273
- "src/protocols/evm/continuum-dao/constants.ts"() {
274
- CONTINUUM_DAO_PROTOCOL_ID = "continuum-dao";
275
- CONTINUUM_DAO_ETHEREUM_CHAIN_ID = 1;
276
- CONTINUUM_DAO_LINEA_CHAIN_ID = 59144;
277
- CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID = 59141;
278
- CTM_TOKEN_NAME = "Continuum";
279
- CTM_TOKEN_SYMBOL = "CTM";
280
- VECTM_TOKEN_NAME = "Voting Escrow Continuum";
281
- VECTM_TOKEN_SYMBOL = "veCTM";
282
- CTM_TOKEN_DECIMALS = 18;
283
- WEEK_SECONDS = 7 * 86400;
284
- UNSET = {
285
- ctm: viem.zeroAddress,
286
- votingEscrow: viem.zeroAddress,
287
- nodeProperties: viem.zeroAddress,
288
- rewards: viem.zeroAddress,
289
- governor: viem.zeroAddress
290
- };
291
- CTM_TOKEN_ADDRESS = viem.getAddress("0x7581696b0ED142f6534E5797baaABBb9a1b27086");
292
- VOTING_ESCROW_LINEA_ADDRESS = viem.getAddress("0x221EC90B3B083A8501A37bdeb7035CeaedF3C31f");
293
- viem.getAddress("0x4ebd7cCBe32a51d1638cFE90E8eD1c4BdF42f729");
294
- VOTING_ESCROW_MARKETPLACE_LINEA_ADDRESS = viem.getAddress("0x92557d38beAe4658d3c03A02F349FFB60c3bfFA5");
295
- MARKETPLACE_WETH_LINEA_ADDRESS = viem.getAddress("0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f");
296
- MARKETPLACE_USDC_LINEA_ADDRESS = viem.getAddress("0x176211869cA2b568f2A7D4EE941E073a821EE1ff");
297
- CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID = "continuum-dao-marketplace";
298
- CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS = viem.getAddress("0x76FF2CB03175900F1D83328C82D27EA9aeaF2355");
299
- viem.getAddress("0x4800F9f1dC1b6daCA841B71E0531F547D374168E");
300
- CONTINUUM_DAO_DEPLOYMENTS = {
301
- [CONTINUUM_DAO_LINEA_CHAIN_ID]: {
302
- ...UNSET,
303
- ctm: CTM_TOKEN_ADDRESS,
304
- votingEscrow: VOTING_ESCROW_LINEA_ADDRESS,
305
- governor: CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS
306
- },
307
- [CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID]: { ...UNSET },
308
- [CONTINUUM_DAO_ETHEREUM_CHAIN_ID]: {
309
- ...UNSET,
310
- ctm: CTM_TOKEN_ADDRESS
311
- }
312
- };
313
- }
314
- });
315
-
316
- // src/protocols/evm/arcus/support.ts
317
- function isArcusChainSupported(chainId) {
318
- return ARCUS_SUPPORTED_CHAIN_IDS.includes(chainId);
319
- }
320
- var ARCUS_SUPPORTED_CHAIN_IDS;
321
- var init_support = __esm({
322
- "src/protocols/evm/arcus/support.ts"() {
323
- ARCUS_SUPPORTED_CHAIN_IDS = [4663];
324
- }
325
- });
326
-
327
- // src/protocols/evm/arcus/constants.ts
328
- var ARCUS_PROTOCOL_ID;
329
- var init_constants2 = __esm({
330
- "src/protocols/evm/arcus/constants.ts"() {
331
- ARCUS_PROTOCOL_ID = "arcus";
332
- }
333
- });
334
-
335
- // src/protocols/evm/arcus/api.ts
336
- var init_api = __esm({
337
- "src/protocols/evm/arcus/api.ts"() {
338
- }
339
- });
340
70
 
341
71
  // src/protocols/evm/morpho/midnightConstants.ts
342
72
  var midnightConstants_exports = {};
@@ -625,726 +355,136 @@ var init_midnightApi = __esm({
625
355
  init_midnightConstants();
626
356
  }
627
357
  });
628
- function isAerodromeChainSupported(chainId) {
629
- const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
630
- return AERO_CHAIN_IDS.includes(n);
631
- }
632
- function aerodromeUnsupportedChainMessage(chainId) {
633
- const listed = AERO_CHAIN_IDS.map((id) => `${AERO_CHAIN_LABEL[id]} ${id}`).join(", ");
634
- return `Aero is not deployed on chain ${chainId}. Launch chains: ${listed}.`;
635
- }
636
- var AERODROME_PROTOCOL_ID, AERODROME_CHAIN_ID, AERO_CHAIN_IDS, AERO_CHAIN_LABEL, AERODROME_WETH_BASE, AERODROME_USDC_BASE;
637
- var init_support2 = __esm({
638
- "src/protocols/evm/aerodrome/support.ts"() {
639
- AERODROME_PROTOCOL_ID = "aerodrome";
640
- AERODROME_CHAIN_ID = 8453;
641
- AERO_CHAIN_IDS = [8453, 1, 10, 42161, 4663, 5042, 57073];
642
- AERO_CHAIN_LABEL = {
643
- 1: "Ethereum",
644
- 10: "OP Mainnet",
645
- 42161: "Arbitrum",
646
- 4663: "Robinhood Chain",
647
- 5042: "Arc",
648
- 8453: "Base",
649
- 57073: "Ink"
650
- };
651
- AERODROME_WETH_BASE = "0x4200000000000000000000000000000000000006";
652
- AERODROME_USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
358
+
359
+ // src/core/registry.ts
360
+ var modules = [];
361
+ function registerProtocolModule(mod) {
362
+ const existing = modules.findIndex((m) => m.id === mod.id);
363
+ if (existing >= 0) {
364
+ modules[existing] = mod;
365
+ } else {
366
+ modules.push(mod);
653
367
  }
654
- });
655
- function addr(raw) {
656
- return viem.getAddress(raw);
657
368
  }
658
- function aeroUsdcAddress(chainId) {
659
- const raw = AERO_USDC_BY_CHAIN[chainId];
660
- return raw ? addr(raw) : null;
369
+ function getProtocolModules() {
370
+ return modules;
661
371
  }
662
- function aeroWrappedNativeAddress(chainId) {
663
- const raw = AERO_WETH_BY_CHAIN[chainId];
664
- return raw ? addr(raw) : null;
665
- }
666
- function aeroAddressesForChain(chainId) {
667
- const fb = AERODROME_BASE_ADDRESSES_FALLBACK;
668
- const cl = addr(AERO_CL_FACTORY_BY_CHAIN[chainId] ?? AERO_CL_FACTORY_BY_CHAIN[AERODROME_CHAIN_ID]);
669
- const receipt = addr(AERO_RECEIPT_BY_CHAIN[chainId] ?? AERO_RECEIPT_BY_CHAIN[AERODROME_CHAIN_ID]);
670
- const weth = aeroWrappedNativeAddress(chainId) ?? addr("0x0000000000000000000000000000000000000000");
671
- const token = chainId === AERODROME_CHAIN_ID ? addr(AERO_TOKEN_BASE) : receipt;
672
- return {
673
- chainId,
674
- aero: token,
675
- router: chainId === AERODROME_CHAIN_ID ? addr(fb.router) : addr(AERO_METAROUTER),
676
- poolFactory: addr(AERO_VOLATILE_POOL_FACTORY),
677
- factoryRegistry: addr(AERO_FACTORY_REGISTRY_BY_CHAIN[chainId] ?? AERO_FACTORY_REGISTRY_BY_CHAIN[AERODROME_CHAIN_ID]),
678
- voter: addr(AERO_LEAF_VOTER),
679
- votingEscrow: addr("0xBF7977E1521e9a3032bf7243Ee4712f311f13915"),
680
- rewardsDistributor: addr(fb.rewardsDistributor),
681
- mixedQuoter: addr(AERO_METAQUOTER),
682
- mixedQuoterV3: addr(AERO_METAQUOTER),
683
- nfpm: addr(AERO_NFPM),
684
- clFactory: cl,
685
- clFactory2: cl,
686
- clFactory3: cl,
687
- universalRouter: addr(fb.universalRouter),
688
- swapRouter: addr(AERO_SWAP_ROUTER),
689
- swapRouter2: addr(AERO_SWAP_ROUTER),
690
- swapRouter3: addr(AERO_SWAP_ROUTER),
691
- pricesOracle: addr(fb.pricesOracle),
692
- slipstreamHelper: addr(fb.slipstreamHelper),
693
- lpSugar: chainId === AERODROME_CHAIN_ID ? addr(fb.lpSugar) : addr("0x0000000000000000000000000000000000000000"),
694
- sugarSlipstreamHelper: addr(fb.sugarSlipstreamHelper),
695
- swapper: addr(fb.swapper),
696
- weth,
697
- stablePoolFactory: addr(AERO_STABLE_POOL_FACTORY),
698
- volatilePoolFactory: addr(AERO_VOLATILE_POOL_FACTORY),
699
- metarouter: addr(AERO_METAROUTER),
700
- metaquoter: addr(AERO_METAQUOTER),
701
- receiptToken: receipt
702
- };
703
- }
704
- var AERODROME_BASE_ADDRESSES_FALLBACK, AERO_TOKEN_BASE, AERO_METAROUTER, AERO_METAQUOTER, AERO_STABLE_POOL_FACTORY, AERO_VOLATILE_POOL_FACTORY, AERO_NFPM, AERO_SWAP_ROUTER, AERO_LEAF_VOTER, AERO_RECEIPT_BY_CHAIN, AERO_FACTORY_REGISTRY_BY_CHAIN, AERO_CL_FACTORY_BY_CHAIN, OP_STACK_WETH, AERO_WETH_BY_CHAIN, AERO_USDC_BY_CHAIN;
705
- var init_addresses = __esm({
706
- "src/protocols/evm/aerodrome/addresses.ts"() {
707
- init_support2();
708
- AERODROME_BASE_ADDRESSES_FALLBACK = {
709
- chainId: AERODROME_CHAIN_ID,
710
- aero: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
711
- router: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
712
- poolFactory: "0x420DD381b31aEf6683db6B902084cB0FFECe40Da",
713
- factoryRegistry: "0x5C3F18F06CC09CA1910767A34a20F771039E37C0",
714
- voter: "0x16613524e02ad97eDfeF371bC883F2F5d6C480A5",
715
- votingEscrow: "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4",
716
- rewardsDistributor: "0x227f65131A261548b057215bB1D5Ab2997964C7d",
717
- mixedQuoter: "0x0A5aA5D3a4d28014f967Bf0f29EAA3FF9807D5c6",
718
- /** MixedRouteQuoterV3 — v2 + all three CL factories (bitmask path encoding). */
719
- mixedQuoterV3: "0xCd2A7D98e82D6107eac1828ce8DeAA6acB65b555",
720
- nfpm: "0x827922686190790b37229fd06084350E74485b72",
721
- /** Oldest Slipstream CL factory (Gauges V1). Path bit 1<<20. */
722
- clFactory: "0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A",
723
- /** Slipstream CL factory 2 (gauge caps). Raw tickSpacing in MixedQuoterV3. */
724
- clFactory2: "0xaDe65c38CD4849aDBA595a4323a8C7DdfE89716a",
725
- /** Newest Slipstream CL factory (Gauges V3) — Coinbase B20 stock pools. Path bit 1<<19. */
726
- clFactory3: "0xf8f2eB4940CFE7d13603DDDD87f123820Fc061Ef",
727
- universalRouter: "0x6Cb442acF35158D5eDa88fe602221b67B400Be3E",
728
- swapRouter: "0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5",
729
- swapRouter2: "0xcbBb8035cAc7D4B3Ca7aBb74cF7BdF900215Ce0D",
730
- swapRouter3: "0x698Cb2b6dd822994581fEa6eA4Fc755d1363A92F",
731
- pricesOracle: "0xee717411f6E44F9feE011835C8E6FAaC5dEfF166",
732
- slipstreamHelper: "0x0AD09A66af0154a84e86F761313d02d0abB6edd5",
733
- lpSugar: "0x69dD9db6d8f8E7d83887A704f447b1a584b599A1",
734
- sugarSlipstreamHelper: "0x9c62ab10577fB3C20A22E231b7703Ed6D456CC7a",
735
- swapper: "0x91616a7B9CF6D23f8C17845581051EBdC4BcB916",
736
- weth: AERODROME_WETH_BASE
737
- };
738
- AERO_TOKEN_BASE = "0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee";
739
- AERO_METAROUTER = "0x0fEf9e88A7b76BCDBF451780C6774FE32965Ee98";
740
- AERO_METAQUOTER = "0x1dDfeC5058180C207F55BB77D95AcDd0d8227868";
741
- AERO_STABLE_POOL_FACTORY = "0x78589E876edcEbdce72ee3436ab3c9AD3a7cEF2D";
742
- AERO_VOLATILE_POOL_FACTORY = "0x8E6a9FCd1d638CC760Ffba397605Fe3355dE76D2";
743
- AERO_NFPM = "0x4857DB576eE0e45F10525eC59527BfD10beeC60b";
744
- AERO_SWAP_ROUTER = "0x9Ee35Bf1bd69a03c6F0393582030fCe8Bb93D418";
745
- AERO_LEAF_VOTER = "0x382409fad8503FbCdbB27A4211551fa03e884078";
746
- AERO_RECEIPT_BY_CHAIN = {
747
- 8453: "0x6CdDa0E730744DC6fF67654B35350Adad05EceE7",
748
- 10: "0xbdEaeA5205d16f34Cb40038052d91235D87B4C54",
749
- 42161: "0x436a085B2751cB87db270FFa66f8d698F87bEC82",
750
- 1: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
751
- 57073: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
752
- 4663: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
753
- 5042: "0x20077cC0d5E385A0Fe9C91bbC7DC744f51559307"
754
- };
755
- AERO_FACTORY_REGISTRY_BY_CHAIN = {
756
- 8453: "0x7b2A2c12dC5Ea2a31455952a05031C3E4BB28F3E",
757
- 10: "0xb6F9705A631CC1C0E8570FFde48882C95E2Df408",
758
- 42161: "0x9E635b2c689fC52201DF7eF1C9FA607c2F58f666",
759
- 1: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
760
- 57073: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
761
- 4663: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
762
- 5042: "0xCe44907DC45D3BFa3f5f6035B0e6E8B22D780A42"
763
- };
764
- AERO_CL_FACTORY_BY_CHAIN = {
765
- 8453: "0x9CB220581b91b0C83223012FE69688b92aD07a76",
766
- 10: "0xfeaB42D90055db3a0616249f76B6002D72266778",
767
- 42161: "0x88a60ee77392577c355C0acb2A8d476D5a4EC03a",
768
- 1: "0xF4Fd2E6c5B60c5b365cd1B96DD6245E6D60414c2",
769
- 57073: "0x7660BF2aDefC687C22906112ca323d60A00358cF",
770
- 4663: "0xc63d7338c178e805c544B8f897066bD3BBcBE136",
771
- 5042: "0x7F83235643181E440433400a027618Cd50879751"
772
- };
773
- OP_STACK_WETH = "0x4200000000000000000000000000000000000006";
774
- AERO_WETH_BY_CHAIN = {
775
- 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
776
- 10: OP_STACK_WETH,
777
- 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
778
- 8453: OP_STACK_WETH,
779
- 57073: OP_STACK_WETH,
780
- 4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
781
- };
782
- AERO_USDC_BY_CHAIN = {
783
- 1: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
784
- 10: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
785
- 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
786
- 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
787
- };
788
- }
789
- });
790
- var init_stockTokens = __esm({
791
- "src/protocols/evm/aerodrome/stockTokens.ts"() {
792
- init_coinbaseB20();
793
- }
794
- });
795
- var init_discover = __esm({
796
- "src/protocols/evm/aerodrome/discover.ts"() {
797
- }
798
- });
799
- var init_yields = __esm({
800
- "src/protocols/evm/aerodrome/yields.ts"() {
801
- init_addresses();
802
- init_support2();
803
- new Set(
804
- [
805
- AERODROME_WETH_BASE,
806
- AERODROME_USDC_BASE,
807
- AERODROME_BASE_ADDRESSES_FALLBACK.aero,
808
- "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
809
- "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
810
- "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
811
- "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
812
- "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452"
813
- ].map((a) => a.toLowerCase())
814
- );
815
- }
816
- });
817
- var init_committeeList = __esm({
818
- "src/protocols/evm/continuum-dao/committeeList.ts"() {
819
- }
820
- });
821
- var init_proposalCatalog = __esm({
822
- "src/protocols/evm/continuum-dao/proposalCatalog.ts"() {
823
- ({
824
- name: "linea",
825
- label: "Linea",
826
- chainId: "59144",
827
- c3governor: viem.getAddress("0x58B610a359c870E0fc941139821a51F5aa23f14E")
828
- });
829
- }
830
- });
831
- var init_forum = __esm({
832
- "src/protocols/evm/continuum-dao/forum.ts"() {
833
- }
834
- });
835
- var init_governance = __esm({
836
- "src/protocols/evm/continuum-dao/governance.ts"() {
837
- viem.parseAbi([
838
- "function propose(address[] targets, uint256[] values, bytes[] calldatas, string description) returns (uint256)",
839
- "function castVote(uint256 proposalId, uint8 support) returns (uint256)",
840
- "function castVoteWithReasonAndParams(uint256 proposalId, uint8 support, string reason, bytes params) returns (uint256)",
841
- "function execute(uint256 proposalId) payable",
842
- "function cancel(uint256 proposalId)"
843
- ]);
844
- viem.parseAbi([
845
- "function hashProposal(address[] targets, uint256[] values, bytes[] calldatas, bytes32 descriptionHash) view returns (uint256)",
846
- "function state(uint256 proposalId) view returns (uint8)",
847
- "function getVotes(address account, uint256 timepoint) view returns (uint256)",
848
- "function proposalThreshold() view returns (uint256)",
849
- "function proposalCount() view returns (uint256)",
850
- "function clock() view returns (uint48)",
851
- "function proposalVotes(uint256 proposalId) view returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes)",
852
- "function hasVoted(uint256 proposalId, address account) view returns (bool)",
853
- "function proposalSnapshot(uint256 proposalId) view returns (uint256)"
854
- ]);
855
- }
856
- });
857
-
858
- // src/protocols/evm/continuum-dao/explainProposal.ts
859
- var init_explainProposal = __esm({
860
- "src/protocols/evm/continuum-dao/explainProposal.ts"() {
861
- }
862
- });
863
- var init_foundryProposalScript = __esm({
864
- "src/protocols/evm/continuum-dao/foundryProposalScript.ts"() {
865
- }
866
- });
867
- var init_simulateProposal = __esm({
868
- "src/protocols/evm/continuum-dao/simulateProposal.ts"() {
869
- }
870
- });
871
-
872
- // src/core/registry.ts
873
- var modules = [];
874
- function registerProtocolModule(mod) {
875
- const existing = modules.findIndex((m) => m.id === mod.id);
876
- if (existing >= 0) {
877
- modules[existing] = mod;
878
- } else {
879
- modules.push(mod);
880
- }
881
- }
882
- function getProtocolModules() {
883
- return modules;
372
+ function getProtocolModule(id) {
373
+ return modules.find((m) => m.id === id);
884
374
  }
885
375
  function getActionsByChainCategory(category) {
886
376
  return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions);
887
377
  }
888
378
 
889
- // src/protocols/evm/uniswap-v4/constants.ts
890
- init_chainIdParse();
891
- var UNIVERSAL_ROUTER_SPENDER = {
892
- 1: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
893
- 5: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
894
- 11155111: "0x3a9d48ab9751398bbfa63ad67599bb04e4bdf98b",
895
- 137: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
896
- 80001: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
897
- 10: "0x851116d9223fabed8e56c0e6b8ad0c31d98b3507",
898
- 420: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
899
- 42161: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
900
- 421613: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
901
- 42220: "0xcb695bc5D3Aa22cAD1E6DF07801b061a05A0233A",
902
- 44787: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
903
- 56: "0x1906c1d672b88cd1b9ac7593301ca990f94eae07",
904
- 43114: "0x94b75331ae8d42c1b61065089b7d48fe14aa73b7",
905
- 84531: "0xd0872d928672ae2ff74bdb2f5130ac12229cafaf",
906
- 8453: "0x6fF5693b99212da76ad316178a184ab56d299b43",
907
- 81457: "0xeabbcb3e8e415306207ef514f660a3f820025be3",
908
- 7777777: "0x3315ef7ca28db74abadc6c44570efdf06b04b020",
909
- 324: "0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06",
910
- 480: "0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743",
911
- 1301: "0xf70536b3bcc1bd1a972dc186a2cf84cc6da6be5d",
912
- 130: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3",
913
- 10143: "0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893",
914
- 84532: "0x492e6456d9528771018deb9e87ef7750ef184104",
915
- 1868: "0x0e2850543f69f678257266e0907ff9a58b3f13de",
916
- 143: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
917
- 59144: "0x661e93cca42afacb172121ef892830ca3b70f08d",
918
- 4217: "0x1febb76be10aaf3a1402f04e8e835f2c382f7914",
919
- 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff",
920
- /** Robinhood Chain mainnet — Universal Router v2.1.1 (Trade API / interface) */
921
- 4663: "0x8876789976decbfcbbbe364623c63652db8c0904",
922
- /** Circle Arc mainnet — official Uniswap v4 deployments */
923
- 5042: "0x4fcA4a51Ab4F23A7447b3284fBd7D73289A89Fb1"
924
- };
925
- function isUniswapV4ChainSupported(chainId) {
926
- if (chainId == null) return false;
927
- const n = parseEvmChainIdToNumber(chainId);
928
- if (Number.isNaN(n) || n < 0) return false;
929
- const a = UNIVERSAL_ROUTER_SPENDER[n];
930
- return typeof a === "string" && a.startsWith("0x");
931
- }
932
-
933
- // src/protocols/evm/uniswap-v4/index.ts
934
- var UNISWAP_V4_PROTOCOL_ID = "uniswap-v4";
935
- var uniswapV4ProtocolModule = {
936
- id: UNISWAP_V4_PROTOCOL_ID,
937
- chainCategory: "evm",
938
- isChainSupported(ctx) {
939
- if (ctx.chainCategory !== "evm") return false;
940
- return isUniswapV4ChainSupported(ctx.chainId);
379
+ // src/agent/commonParamDocs.ts
380
+ var EVM_COMMON_PARAM_DOCS = {
381
+ keyGen: {
382
+ type: "object",
383
+ required: true,
384
+ description: "MPC key slice: { pubkeyhex: string (required), keylist: string[], ClientKeys?: Record<string,string> }. Used for pubKey/keyList on POST /multiSignRequest."
941
385
  },
942
- isTokenSupported(token) {
943
- if (token.category !== "evm") return false;
944
- return token.kind === "native" || token.kind === "erc20";
386
+ purposeText: {
387
+ type: "string",
388
+ required: true,
389
+ description: "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
945
390
  },
946
- actions: [
947
- {
948
- id: "uniswap-v4.swap-exact-input",
949
- protocolId: UNISWAP_V4_PROTOCOL_ID,
950
- chainCategory: "evm",
951
- description: "Swap ERC-20 or native token via Uniswap V4 Universal Router (classic allowance path)",
952
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
953
- params: {
954
- tokenIn: { type: "address", required: true, description: "Input token (0x0 for native)" },
955
- tokenOut: { type: "address", required: true, description: "Output token address" },
956
- amount: { type: "string", required: true, description: "Human or wei amount per trade type" },
957
- slippagePercent: { type: "number", required: true, description: "Slippage tolerance percent" },
958
- swapTransactionDeadlineUnix: {
959
- type: "number",
960
- required: false,
961
- description: "On-chain swap deadline (unix seconds)"
962
- },
963
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" }
964
- }
965
- },
966
- {
967
- id: "uniswap-v4.quote",
968
- protocolId: UNISWAP_V4_PROTOCOL_ID,
969
- chainCategory: "evm",
970
- description: "Fetch Uniswap Trade API quote",
971
- commonParams: ["keyGen"],
972
- params: {
973
- tokenIn: { type: "address", required: true, description: "Input token" },
974
- tokenOut: { type: "address", required: true, description: "Output token" },
975
- amount: { type: "string", required: true, description: "Amount for quote" },
976
- type: { type: "EXACT_INPUT | EXACT_OUTPUT", required: true, description: "Trade type" }
977
- }
391
+ useCustomGas: {
392
+ type: "boolean",
393
+ required: true,
394
+ description: "When true, apply Custom Gas Config from chainDetail / customGasChainDetails. Omitted baseFee/priorityFee is valid \u2014 live RPC fees are used at proposal; configured values are optional floors/multipliers. When false, use live RPC estimates only."
395
+ },
396
+ chainId: {
397
+ type: "number",
398
+ required: true,
399
+ description: "EVM chain id (decimal). Becomes destinationChainID on the sign request."
400
+ },
401
+ rpcUrl: {
402
+ type: "string",
403
+ required: true,
404
+ description: "HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."
405
+ },
406
+ executorAddress: {
407
+ type: "address",
408
+ required: true,
409
+ description: "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
410
+ },
411
+ chainDetail: {
412
+ type: "object",
413
+ required: true,
414
+ description: "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
415
+ },
416
+ customGasChainDetails: {
417
+ type: "object",
418
+ required: false,
419
+ description: "Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true."
420
+ }
421
+ };
422
+ var MULTISIGN_SUBMIT_OUTPUT_DOC = {
423
+ description: "Submitted mpc-auth multiSignRequest id. continuum-mcp-server builds, signs the management envelope, and POSTs /multiSignRequest. Continue with sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result. Do not poll wait_for_sign_request_ready after submit (Join may take days). Do not call the same build tool again if requestId was returned.",
424
+ fields: {
425
+ requestId: {
426
+ type: "string",
427
+ description: "Sign request id from POST /multiSignRequest."
978
428
  },
979
- {
980
- id: "uniswap-v4.limit-order",
981
- protocolId: UNISWAP_V4_PROTOCOL_ID,
982
- chainCategory: "evm",
983
- description: "Place UniswapX limit order via EIP-712 sign + POST /order (Ethereum mainnet only)",
984
- commonParams: ["keyGen", "purposeText"],
985
- params: {
986
- fullLimitQuote: { type: "object", required: true, description: "Full limit order quote from Trade API" },
987
- uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" }
988
- }
429
+ status: {
430
+ type: "string",
431
+ description: "submitted when POST succeeded \u2014 do not call the same build tool again."
989
432
  },
990
- {
991
- id: "uniswap-v4.mint-liquidity",
992
- protocolId: UNISWAP_V4_PROTOCOL_ID,
993
- chainCategory: "evm",
994
- description: "Mint a new Uniswap V4 concentrated liquidity position (Position Manager NFT)",
995
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
996
- params: {
997
- lpResponse: { type: "object", required: true, description: "Full LP API create response" },
998
- nativeWrapped: { type: "address", required: false, description: "WETH when pool uses native ETH" },
999
- poolReference: { type: "string", required: false, description: "V4 pool id" },
1000
- uniswapApiKey: { type: "string", required: true, description: "Uniswap API key" }
1001
- }
433
+ followUp: {
434
+ type: "string",
435
+ description: "Lifecycle next steps (sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result). No polling after submit."
436
+ }
437
+ }
438
+ };
439
+ var MULTISIGN_OUTPUT_DOC = {
440
+ description: "Unsigned mpc-auth multiSignRequest payload from protocol builders. MCP agents receive { requestId } instead; node-app callers sign messageToSign and POST { ...bodyForSign, clientSig, signedMessage }.",
441
+ fields: {
442
+ bodyForSign: {
443
+ type: "object",
444
+ description: "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
1002
445
  },
1003
- {
1004
- id: "uniswap-v4.increase-liquidity",
1005
- protocolId: UNISWAP_V4_PROTOCOL_ID,
1006
- chainCategory: "evm",
1007
- description: "Increase liquidity on an existing Uniswap V4 position NFT",
1008
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1009
- params: {
1010
- nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
1011
- lpResponse: { type: "object", required: true, description: "Full LP API increase response" }
1012
- }
446
+ messageToSign: {
447
+ type: "string",
448
+ description: "JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig."
449
+ }
450
+ }
451
+ };
452
+ var MANAGEMENT_SIG_DOC = {
453
+ description: "Management POST bodies embed NodeMgtKeySig: { nonce, clientSig, nodeKey }. Sign JSON with clientSig cleared via messageToSignManagementBody; POST with withManagementClientSig(body, sig). Do not put signedMessage in the JSON body for standard management routes. Legacy Nonce/Sig/sig field names are not accepted.",
454
+ exceptions: {
455
+ configUpdateImplement: "POST /configUpdateImplement: include nodeKey + plannedYaml + signedMessage (opaque configUpdateImplement|<sha256> line). Sign the opaque line bytes, not the JSON body.",
456
+ postMSQTTKey: "POST /postMSQTTKey: include nodeKey + caCertPem + clientSig. Sign caCertPem PEM bytes directly (use buildPostMqttKeyBody).",
457
+ addManagementKey: "POST /addManagementKey / removeManagementKey (EIP-191): may still use signedMessage equal to the canonical JSON string for dual-mode Ethereum signing.",
458
+ agentLlmConfig: "POST /agentLlmConfig / agentLlmApiKey: sign canonical JSON with action + clientSig cleared; POST body has nonce, clientSig, nodeKey, endpoint fields \u2014 no signedMessage field.",
459
+ multiSignRequest: "POST /multiSignRequest (client key, not management): POST { ...bodyForSign, clientSig, signedMessage: messageToSign }."
460
+ },
461
+ fields: {
462
+ nonce: {
463
+ type: "number",
464
+ description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey)."
1013
465
  },
1014
- {
1015
- id: "uniswap-v4.decrease-liquidity",
1016
- protocolId: UNISWAP_V4_PROTOCOL_ID,
1017
- chainCategory: "evm",
1018
- description: "Decrease liquidity on an existing Uniswap V4 position NFT",
1019
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1020
- params: {
1021
- nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
1022
- lpResponse: { type: "object", required: true, description: "Full LP API decrease response" }
1023
- }
466
+ clientSig: {
467
+ type: "string",
468
+ description: "Management signature; empty string in the message to sign."
1024
469
  },
1025
- {
1026
- id: "uniswap-v4.collect-fees",
1027
- protocolId: UNISWAP_V4_PROTOCOL_ID,
1028
- chainCategory: "evm",
1029
- description: "Collect accrued fees from a Uniswap V4 position NFT",
1030
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1031
- params: {
1032
- nftTokenId: { type: "string", required: true, description: "Position NFT token id" },
1033
- lpResponse: { type: "object", required: true, description: "Full LP API claim response" }
1034
- }
470
+ nodeKey: {
471
+ type: "string",
472
+ description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix)."
1035
473
  }
1036
- ]
1037
- };
1038
- registerProtocolModule(uniswapV4ProtocolModule);
1039
-
1040
- // src/protocols/evm/curve-dao/support.ts
1041
- init_chainIdParse();
1042
- var CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS = /* @__PURE__ */ new Set([
1043
- 1,
1044
- 10,
1045
- 56,
1046
- 100,
1047
- 137,
1048
- 146,
1049
- 196,
1050
- 250,
1051
- 252,
1052
- 324,
1053
- 999,
1054
- 1284,
1055
- 2222,
1056
- 5e3,
1057
- 8453,
1058
- 42161,
1059
- 42220,
1060
- 43114,
1061
- 1313161554
1062
- ]);
1063
- function isCurveApiChainSupported(chainId) {
1064
- const n = parseEvmChainIdToNumber(chainId);
1065
- if (Number.isNaN(n) || n < 0) return false;
1066
- return CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS.has(n);
1067
- }
1068
- var CURVE_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
1069
- var ETH_PLACEHOLDER = CURVE_NATIVE_PLACEHOLDER;
1070
- function normalizeAddr(a) {
1071
- return a.toLowerCase();
1072
- }
1073
- function addEdge(adj, a, b) {
1074
- if (a === b) return;
1075
- if (!adj.has(a)) adj.set(a, /* @__PURE__ */ new Set());
1076
- if (!adj.has(b)) adj.set(b, /* @__PURE__ */ new Set());
1077
- adj.get(a).add(b);
1078
- adj.get(b).add(a);
1079
- }
1080
- function buildCurveLiquidityGraphFromApi(curve) {
1081
- const adj = /* @__PURE__ */ new Map();
1082
- for (const id of curve.getPoolList()) {
1083
- try {
1084
- const pool = curve.getPool(id);
1085
- const w = (pool.wrappedCoinAddresses ?? []).map(normalizeAddr);
1086
- const u = (pool.underlyingCoinAddresses ?? []).map(normalizeAddr);
1087
- const all = [.../* @__PURE__ */ new Set([...w, ...u])];
1088
- for (let i = 0; i < all.length; i++) {
1089
- for (let j = i + 1; j < all.length; j++) {
1090
- addEdge(adj, all[i], all[j]);
1091
- }
1092
- }
1093
- } catch {
1094
- }
1095
- }
1096
- return adj;
1097
- }
1098
- function addNativeWethBridge(adj, wrappedNative) {
1099
- if (!wrappedNative) return;
1100
- const w = wrappedNative.toLowerCase();
1101
- const a = ETH_PLACEHOLDER;
1102
- const b = w;
1103
- if (a === b) return;
1104
- if (!adj.has(a)) adj.set(a, /* @__PURE__ */ new Set());
1105
- if (!adj.has(b)) adj.set(b, /* @__PURE__ */ new Set());
1106
- adj.get(a).add(b);
1107
- adj.get(b).add(a);
1108
- }
1109
- function swappableCurveGraphNodeKeys(adj) {
1110
- const out = /* @__PURE__ */ new Set();
1111
- for (const [k, neigh] of adj) {
1112
- if (neigh.size > 0) out.add(k);
1113
- }
1114
- return out;
1115
- }
1116
-
1117
- // src/protocols/evm/curve-dao/apiSession.ts
1118
- var CURVE_SESSION_CACHE_TTL_MS = 5 * 60 * 1e3;
1119
- var curveSessionCache = /* @__PURE__ */ new Map();
1120
- async function fetchAllCurvePools(curve) {
1121
- const run = (p) => p.catch(() => void 0);
1122
- const tasks = [];
1123
- for (const key of [
1124
- "factory",
1125
- "crvUSDFactory",
1126
- "EYWAFactory",
1127
- "cryptoFactory",
1128
- "twocryptoFactory",
1129
- "tricryptoFactory",
1130
- "stableNgFactory"
1131
- ]) {
1132
- const f = curve[key];
1133
- if (f?.fetchPools) {
1134
- tasks.push(run(f.fetchPools()));
1135
- }
1136
- }
1137
- await Promise.all(tasks);
1138
- }
1139
- async function loadFullCurveSessionForRpc(rpcUrl) {
1140
- const url = (rpcUrl ?? "").trim();
1141
- if (!url) {
1142
- throw new Error("rpcUrl is required.");
1143
- }
1144
- const cached3 = curveSessionCache.get(url);
1145
- if (cached3 && cached3.expiresAt > Date.now()) {
1146
- return cached3.session;
1147
- }
1148
- try {
1149
- const { default: curve } = await import('@curvefi/api');
1150
- await curve.init("JsonRpc", { url }, {});
1151
- const wrapped = curve.getNetworkConstants().NATIVE_COIN?.wrappedAddress;
1152
- if (!curve.hasRouter || !curve.hasRouter()) {
1153
- const session2 = {
1154
- curve,
1155
- adj: /* @__PURE__ */ new Map(),
1156
- swappableNodeKeys: /* @__PURE__ */ new Set(),
1157
- wrappedNative: wrapped
1158
- };
1159
- curveSessionCache.set(url, { session: session2, expiresAt: Date.now() + CURVE_SESSION_CACHE_TTL_MS });
1160
- return session2;
1161
- }
1162
- await fetchAllCurvePools(curve);
1163
- const adj = buildCurveLiquidityGraphFromApi(curve);
1164
- addNativeWethBridge(adj, wrapped);
1165
- const session = {
1166
- curve,
1167
- adj,
1168
- swappableNodeKeys: swappableCurveGraphNodeKeys(adj),
1169
- wrappedNative: wrapped
1170
- };
1171
- curveSessionCache.set(url, { session, expiresAt: Date.now() + CURVE_SESSION_CACHE_TTL_MS });
1172
- return session;
1173
- } catch (e) {
1174
- const msg = e instanceof Error ? e.message : String(e);
1175
- throw new Error(`Curve session init failed for RPC: ${msg}`);
1176
- }
1177
- }
1178
-
1179
- // src/protocols/evm/curve-dao/index.ts
1180
- var CURVE_DAO_PROTOCOL_ID = "curve-dao";
1181
- var curveDaoProtocolModule = {
1182
- id: CURVE_DAO_PROTOCOL_ID,
1183
- chainCategory: "evm",
1184
- isChainSupported(ctx) {
1185
- if (ctx.chainCategory !== "evm") return false;
1186
- return isCurveApiChainSupported(ctx.chainId);
1187
- },
1188
- isTokenSupported(token) {
1189
- if (token.category !== "evm") return false;
1190
- return token.kind === "native" || token.kind === "erc20";
1191
- },
1192
- actions: [
1193
- {
1194
- id: "curve-dao.quote",
1195
- protocolId: CURVE_DAO_PROTOCOL_ID,
1196
- chainCategory: "evm",
1197
- description: "Quote swap via Curve Router NG (getBestRouteAndOutput)",
1198
- commonParams: [],
1199
- params: {
1200
- chainId: { type: "number", required: true, description: "EVM chain id" },
1201
- tokenIn: { type: "address", required: true, description: "Token in or native placeholder" },
1202
- tokenOut: { type: "address", required: true, description: "Token out or native placeholder" },
1203
- amountHuman: { type: "string", required: true, description: "Human-readable input amount" }
1204
- }
1205
- },
1206
- {
1207
- id: "curve-dao.swap",
1208
- protocolId: CURVE_DAO_PROTOCOL_ID,
1209
- chainCategory: "evm",
1210
- description: "Swap via Curve Router NG (optional ERC-20 approve batch)",
1211
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1212
- params: {
1213
- tokenIn: { type: "address", required: true, description: "ERC-20 token in (native uses WETH path in UI)" },
1214
- tokenOut: { type: "address", required: true, description: "Output token or 0xeeee\u2026 native placeholder" },
1215
- amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
1216
- slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
1217
- }
1218
- },
1219
- {
1220
- id: "curve-dao.add-liquidity",
1221
- protocolId: CURVE_DAO_PROTOCOL_ID,
1222
- chainCategory: "evm",
1223
- description: "Add liquidity to an important Curve pool (optional gauge stake)",
1224
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1225
- params: {}
1226
- },
1227
- {
1228
- id: "curve-dao.remove-liquidity",
1229
- protocolId: CURVE_DAO_PROTOCOL_ID,
1230
- chainCategory: "evm",
1231
- description: "Remove liquidity from an important Curve pool",
1232
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
1233
- params: {}
1234
- }
1235
- ]
1236
- };
1237
- registerProtocolModule(curveDaoProtocolModule);
1238
-
1239
- // src/agent/commonParamDocs.ts
1240
- var EVM_COMMON_PARAM_DOCS = {
1241
- keyGen: {
1242
- type: "object",
1243
- required: true,
1244
- description: "MPC key slice: { pubkeyhex: string (required), keylist: string[], ClientKeys?: Record<string,string> }. Used for pubKey/keyList on POST /multiSignRequest."
1245
- },
1246
- purposeText: {
1247
- type: "string",
1248
- required: true,
1249
- description: "Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
1250
- },
1251
- useCustomGas: {
1252
- type: "boolean",
1253
- required: true,
1254
- description: "When true, apply Custom Gas Config from chainDetail / customGasChainDetails. Omitted baseFee/priorityFee is valid \u2014 live RPC fees are used at proposal; configured values are optional floors/multipliers. When false, use live RPC estimates only."
1255
- },
1256
- chainId: {
1257
- type: "number",
1258
- required: true,
1259
- description: "EVM chain id (decimal). Becomes destinationChainID on the sign request."
1260
- },
1261
- rpcUrl: {
1262
- type: "string",
1263
- required: true,
1264
- description: "HTTPS JSON-RPC URL for gas estimation, nonce, and allowance reads."
1265
- },
1266
- executorAddress: {
1267
- type: "address",
1268
- required: true,
1269
- description: "MPC wallet address (from keyGen ethereumaddress) \u2014 tx sender for estimates and approvals."
1270
- },
1271
- chainDetail: {
1272
- type: "object",
1273
- required: true,
1274
- description: "Optional gas config: { legacy?, gasLimit?, gasMultiplier?, gasPrice?, baseFee?, priorityFee?, baseFeeMultiplier? }."
1275
- },
1276
- customGasChainDetails: {
1277
- type: "object",
1278
- required: false,
1279
- description: "Snapshot written to extraJSON.customGasChainDetails when useCustomGas is true."
1280
- }
1281
- };
1282
- var MULTISIGN_SUBMIT_OUTPUT_DOC = {
1283
- description: "Submitted mpc-auth multiSignRequest id. continuum-mcp-server builds, signs the management envelope, and POSTs /multiSignRequest. Continue with sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result. Do not poll wait_for_sign_request_ready after submit (Join may take days). Do not call the same build tool again if requestId was returned.",
1284
- fields: {
1285
- requestId: {
1286
- type: "string",
1287
- description: "Sign request id from POST /multiSignRequest."
1288
- },
1289
- status: {
1290
- type: "string",
1291
- description: "submitted when POST succeeded \u2014 do not call the same build tool again."
1292
- },
1293
- followUp: {
1294
- type: "string",
1295
- description: "Lifecycle next steps (sign_request_agree \u2192 trigger_sign_result \u2192 broadcast_sign_result). No polling after submit."
1296
- }
1297
- }
1298
- };
1299
- var MULTISIGN_OUTPUT_DOC = {
1300
- description: "Unsigned mpc-auth multiSignRequest payload from protocol builders. MCP agents receive { requestId } instead; node-app callers sign messageToSign and POST { ...bodyForSign, clientSig, signedMessage }.",
1301
- fields: {
1302
- bodyForSign: {
1303
- type: "object",
1304
- description: "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
1305
- },
1306
- messageToSign: {
1307
- type: "string",
1308
- description: "JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig."
1309
- }
1310
- }
1311
- };
1312
- var MANAGEMENT_SIG_DOC = {
1313
- description: "Management POST bodies embed NodeMgtKeySig: { nonce, clientSig, nodeKey }. Sign JSON with clientSig cleared via messageToSignManagementBody; POST with withManagementClientSig(body, sig). Do not put signedMessage in the JSON body for standard management routes. Legacy Nonce/Sig/sig field names are not accepted.",
1314
- exceptions: {
1315
- configUpdateImplement: "POST /configUpdateImplement: include nodeKey + plannedYaml + signedMessage (opaque configUpdateImplement|<sha256> line). Sign the opaque line bytes, not the JSON body.",
1316
- postMSQTTKey: "POST /postMSQTTKey: include nodeKey + caCertPem + clientSig. Sign caCertPem PEM bytes directly (use buildPostMqttKeyBody).",
1317
- addManagementKey: "POST /addManagementKey / removeManagementKey (EIP-191): may still use signedMessage equal to the canonical JSON string for dual-mode Ethereum signing.",
1318
- agentLlmConfig: "POST /agentLlmConfig / agentLlmApiKey: sign canonical JSON with action + clientSig cleared; POST body has nonce, clientSig, nodeKey, endpoint fields \u2014 no signedMessage field.",
1319
- multiSignRequest: "POST /multiSignRequest (client key, not management): POST { ...bodyForSign, clientSig, signedMessage: messageToSign }."
1320
- },
1321
- fields: {
1322
- nonce: {
1323
- type: "number",
1324
- description: "From GET /getPublicMgtKeyNonce (Ed25519) or GET /getNodeMgtKeyNonce (Ethereum NodeMgtKey)."
1325
- },
1326
- clientSig: {
1327
- type: "string",
1328
- description: "Management signature; empty string in the message to sign."
1329
- },
1330
- nodeKey: {
1331
- type: "string",
1332
- description: "Required. 128-hex MPC node id from GET /getNodeKey (no 0x prefix)."
1333
- }
1334
- },
1335
- helpers: {
1336
- managementSigFields: "Base envelope with clientSig cleared.",
1337
- buildManagementPostBody: "Spread managementSigFields then endpoint fields.",
1338
- buildPostMqttKeyBody: "POST /postMSQTTKey unsigned body (sign PEM directly).",
1339
- buildPostPreferredKeyGenBody: "POST /postPreferredKeyGen unsigned body.",
1340
- buildConfigUpdateImplementPostBody: "POST /configUpdateImplement with opaque signedMessage line.",
1341
- buildSignRequestAgreeUnsignedBody: "POST /signRequestAgree unsigned body with nodeKey.",
1342
- messageToSignManagementBody: "Canonical JSON string to sign.",
1343
- withManagementClientSig: "Attach signature to POST body.",
1344
- fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.",
1345
- fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.",
1346
- fetchPreferredKeyGen: "GET /getPreferredKeyGen for agent default KeyGen."
1347
- }
474
+ },
475
+ helpers: {
476
+ managementSigFields: "Base envelope with clientSig cleared.",
477
+ buildManagementPostBody: "Spread managementSigFields then endpoint fields.",
478
+ buildPostMqttKeyBody: "POST /postMSQTTKey unsigned body (sign PEM directly).",
479
+ buildPostPreferredKeyGenBody: "POST /postPreferredKeyGen unsigned body.",
480
+ buildConfigUpdateImplementPostBody: "POST /configUpdateImplement with opaque signedMessage line.",
481
+ buildSignRequestAgreeUnsignedBody: "POST /signRequestAgree unsigned body with nodeKey.",
482
+ messageToSignManagementBody: "Canonical JSON string to sign.",
483
+ withManagementClientSig: "Attach signature to POST body.",
484
+ fetchNodeKey: "GET /getNodeKey via nodeFetchWithReadAuth.",
485
+ fetchManagementNonce: "GET nonce for Ed25519 or Ethereum management key.",
486
+ fetchPreferredKeyGen: "GET /getPreferredKeyGen for agent default KeyGen."
487
+ }
1348
488
  };
1349
489
 
1350
490
  // src/agent/mcpMultisignSubmitMeta.ts
@@ -1487,28 +627,129 @@ function withMultisignKeySourceRefine(schema) {
1487
627
  message: "keyGenId is required for MCP agents (or pass keyGen + executorAddress + rpcUrl for manual calls).",
1488
628
  path: ["keyGenId"]
1489
629
  }
1490
- );
630
+ );
631
+ }
632
+ var multisignOutputSchema = zod.z.object({
633
+ bodyForSign: zod.z.record(zod.z.unknown()).describe(
634
+ "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
635
+ ),
636
+ messageToSign: zod.z.string().describe("JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig."),
637
+ proposalCatalog: zod.z.object({
638
+ payload: zod.z.record(zod.z.unknown()),
639
+ canonical: zod.z.string()
640
+ }).optional().describe("Unsigned POST /proposals/create body and the canonical string to sign before the multisign is submitted.")
641
+ }).describe(
642
+ "Unsigned mpc-auth multiSignRequest payload from protocol builders (used internally before management submit)."
643
+ );
644
+ var jsonObjectSchema = zod.z.record(zod.z.unknown());
645
+ function parseMultisignBuilderOutput(data) {
646
+ return multisignOutputSchema.parse(data);
647
+ }
648
+
649
+ // src/protocols/evm/aave-v4/api.ts
650
+ init_defiProxy();
651
+ var COINBASE_B20_STOCK_DECIMALS = 8;
652
+ var COINBASE_B20_ASSET_PREFIX = "0xb200000000000000000000";
653
+ function isCoinbaseB20AssetToken(address) {
654
+ try {
655
+ return viem.getAddress(address).toLowerCase().startsWith(COINBASE_B20_ASSET_PREFIX);
656
+ } catch {
657
+ return false;
658
+ }
659
+ }
660
+ function looksLikeCoinbaseStockSymbol(symbol) {
661
+ return /^[A-Za-z][A-Za-z0-9]{0,8}(?:\.[A-Za-z][A-Za-z0-9]{0,4})?c$/.test((symbol ?? "").trim());
662
+ }
663
+ var COINBASE_TOKENIZED_STOCKS_API_URL = "https://api.coinbase.com/v1/tokenized-stocks";
664
+ var CATALOG_TTL_MS = 15 * 60 * 1e3;
665
+ var CATALOG_MAX = 500;
666
+ var catalogRows = null;
667
+ var catalogAt = 0;
668
+ var catalogInflight = null;
669
+ var catalogBySymbol = /* @__PURE__ */ new Map();
670
+ var catalogByAddress = /* @__PURE__ */ new Map();
671
+ function indexCatalog(rows) {
672
+ catalogRows = rows;
673
+ catalogAt = Date.now();
674
+ catalogBySymbol.clear();
675
+ catalogByAddress.clear();
676
+ for (const row of rows) {
677
+ catalogBySymbol.set(row.symbol.toLowerCase(), row);
678
+ catalogByAddress.set(row.address.toLowerCase(), row);
679
+ }
680
+ }
681
+ function parseCoinbaseTokenizedStocksPayload(payload) {
682
+ const tokens = Array.isArray(payload) ? payload : payload && typeof payload === "object" && Array.isArray(payload.tokens) ? payload.tokens : [];
683
+ const out = [];
684
+ const seen = /* @__PURE__ */ new Set();
685
+ for (const row of tokens) {
686
+ if (!row || typeof row !== "object") continue;
687
+ const rec = row;
688
+ const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
689
+ const addressRaw = typeof rec.contract_address === "string" ? rec.contract_address.trim() : "";
690
+ if (!looksLikeCoinbaseStockSymbol(symbol) || !isCoinbaseB20AssetToken(addressRaw)) continue;
691
+ const address = viem.getAddress(addressRaw);
692
+ const key = address.toLowerCase();
693
+ if (seen.has(key)) continue;
694
+ seen.add(key);
695
+ const name = typeof rec.name === "string" && rec.name.trim() ? rec.name.trim() : symbol;
696
+ const iconUrl = typeof rec.icon_url === "string" && rec.icon_url.trim() ? rec.icon_url.trim() : void 0;
697
+ const decimals = typeof rec.decimals === "number" && Number.isInteger(rec.decimals) && rec.decimals >= 0 && rec.decimals <= 18 ? rec.decimals : COINBASE_B20_STOCK_DECIMALS;
698
+ out.push({ address, symbol, name, decimals, iconUrl });
699
+ if (out.length >= CATALOG_MAX) break;
700
+ }
701
+ return out;
702
+ }
703
+ async function fetchCoinbaseB20StockCatalog() {
704
+ const merged = [];
705
+ const seen = /* @__PURE__ */ new Set();
706
+ let pageToken = "";
707
+ for (let page = 0; page < 4; page++) {
708
+ const url = new URL(COINBASE_TOKENIZED_STOCKS_API_URL);
709
+ url.searchParams.set("page_size", "500");
710
+ if (pageToken) url.searchParams.set("page_token", pageToken);
711
+ const res = await fetch(url, { cache: "no-store", signal: AbortSignal.timeout(8e3) });
712
+ if (!res.ok) break;
713
+ const json = await res.json();
714
+ for (const row of parseCoinbaseTokenizedStocksPayload(json)) {
715
+ const key = row.address.toLowerCase();
716
+ if (seen.has(key)) continue;
717
+ seen.add(key);
718
+ merged.push(row);
719
+ if (merged.length >= CATALOG_MAX) break;
720
+ }
721
+ pageToken = typeof json.next_page_token === "string" ? json.next_page_token.trim() : "";
722
+ if (!pageToken || merged.length >= CATALOG_MAX) break;
723
+ }
724
+ if (merged.length > 0) indexCatalog(merged);
725
+ return catalogRows ?? [];
1491
726
  }
1492
- var multisignOutputSchema = zod.z.object({
1493
- bodyForSign: zod.z.record(zod.z.unknown()).describe(
1494
- "POST body fields without clientSig: keyList, pubKey, msgHash, msgRaw, destinationChainID, purpose, extraJSON, proposalTxParams (batch), messageHashes/messageRawBatch when N>1 txs."
1495
- ),
1496
- messageToSign: zod.z.string().describe("JSON.stringify(bodyForSign) \u2014 exact string to sign before adding clientSig."),
1497
- proposalCatalog: zod.z.object({
1498
- payload: zod.z.record(zod.z.unknown()),
1499
- canonical: zod.z.string()
1500
- }).optional().describe("Unsigned POST /proposals/create body and the canonical string to sign before the multisign is submitted.")
1501
- }).describe(
1502
- "Unsigned mpc-auth multiSignRequest payload from protocol builders (used internally before management submit)."
1503
- );
1504
- var jsonObjectSchema = zod.z.record(zod.z.unknown());
1505
- function parseMultisignBuilderOutput(data) {
1506
- return multisignOutputSchema.parse(data);
727
+ async function ensureCoinbaseB20StockCatalog() {
728
+ if (catalogRows && catalogRows.length > 0 && Date.now() - catalogAt < CATALOG_TTL_MS) return catalogRows;
729
+ if (!catalogInflight) {
730
+ catalogInflight = fetchCoinbaseB20StockCatalog().finally(() => {
731
+ catalogInflight = null;
732
+ });
733
+ }
734
+ try {
735
+ return await catalogInflight;
736
+ } catch {
737
+ return catalogRows ?? [];
738
+ }
739
+ }
740
+ function lookupCoinbaseB20StockToken(token) {
741
+ const key = (token ?? "").trim();
742
+ if (!key) return null;
743
+ const fromCatalog = catalogBySymbol.get(key.toLowerCase());
744
+ if (fromCatalog) return fromCatalog;
745
+ try {
746
+ return catalogByAddress.get(viem.getAddress(key).toLowerCase()) ?? null;
747
+ } catch {
748
+ return null;
749
+ }
1507
750
  }
1508
751
 
1509
752
  // src/protocols/evm/aave-v4/api.ts
1510
- init_defiProxy();
1511
- init_coinbaseB20();
1512
753
  var AAVE_V4_GRAPHQL_URL = "https://api.v4.aave.com/graphql";
1513
754
  async function aaveV4Gql(query, variables) {
1514
755
  const body = { query, variables: variables ?? {} };
@@ -3059,8 +2300,132 @@ function preprocessMerklClaimInput(kind) {
3059
2300
  };
3060
2301
  }
3061
2302
 
2303
+ // src/chains/evm/chainIdParse.ts
2304
+ function parseEvmChainIdToNumber(chainId) {
2305
+ if (chainId == null) return Number.NaN;
2306
+ if (typeof chainId === "bigint") {
2307
+ const n = Number(chainId);
2308
+ return Number.isSafeInteger(n) && n >= 0 ? n : Number.NaN;
2309
+ }
2310
+ if (typeof chainId === "number") {
2311
+ return Number.isInteger(chainId) && chainId >= 0 ? chainId : Number.NaN;
2312
+ }
2313
+ const t = String(chainId).trim();
2314
+ if (!t) return Number.NaN;
2315
+ const low = t.toLowerCase();
2316
+ if (low.startsWith("eip155:")) {
2317
+ const rest = t.slice("eip155:".length).trim();
2318
+ const n = Number.parseInt(rest, 10);
2319
+ return Number.isNaN(n) || n < 0 ? Number.NaN : n;
2320
+ }
2321
+ if (low.startsWith("0x")) {
2322
+ return Number.parseInt(t, 16);
2323
+ }
2324
+ return Number.parseInt(t, 10);
2325
+ }
2326
+
2327
+ // src/protocols/evm/continuum-dao/constants.ts
2328
+ var CONTINUUM_DAO_PROTOCOL_ID = "continuum-dao";
2329
+ var CONTINUUM_DAO_ETHEREUM_CHAIN_ID = 1;
2330
+ var CONTINUUM_DAO_LINEA_CHAIN_ID = 59144;
2331
+ var CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID = 59141;
2332
+ var CTM_TOKEN_NAME = "Continuum";
2333
+ var CTM_TOKEN_SYMBOL = "CTM";
2334
+ var VECTM_TOKEN_NAME = "Voting Escrow Continuum";
2335
+ var VECTM_TOKEN_SYMBOL = "veCTM";
2336
+ var CTM_TOKEN_DECIMALS = 18;
2337
+ var WEEK_SECONDS = 7 * 86400;
2338
+ var UNSET = {
2339
+ ctm: viem.zeroAddress,
2340
+ votingEscrow: viem.zeroAddress,
2341
+ nodeProperties: viem.zeroAddress,
2342
+ rewards: viem.zeroAddress,
2343
+ governor: viem.zeroAddress
2344
+ };
2345
+ var CTM_TOKEN_ADDRESS = viem.getAddress("0x7581696b0ED142f6534E5797baaABBb9a1b27086");
2346
+ var VOTING_ESCROW_LINEA_ADDRESS = viem.getAddress("0x221EC90B3B083A8501A37bdeb7035CeaedF3C31f");
2347
+ viem.getAddress("0x4ebd7cCBe32a51d1638cFE90E8eD1c4BdF42f729");
2348
+ var VOTING_ESCROW_MARKETPLACE_LINEA_ADDRESS = viem.getAddress("0x92557d38beAe4658d3c03A02F349FFB60c3bfFA5");
2349
+ var MARKETPLACE_WETH_LINEA_ADDRESS = viem.getAddress("0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f");
2350
+ var MARKETPLACE_USDC_LINEA_ADDRESS = viem.getAddress("0x176211869cA2b568f2A7D4EE941E073a821EE1ff");
2351
+ var CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID = "continuum-dao-marketplace";
2352
+ var CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS = viem.getAddress("0x76FF2CB03175900F1D83328C82D27EA9aeaF2355");
2353
+ viem.getAddress("0x4800F9f1dC1b6daCA841B71E0531F547D374168E");
2354
+ var CONTINUUM_DAO_DEPLOYMENTS = {
2355
+ [CONTINUUM_DAO_LINEA_CHAIN_ID]: {
2356
+ ...UNSET,
2357
+ ctm: CTM_TOKEN_ADDRESS,
2358
+ votingEscrow: VOTING_ESCROW_LINEA_ADDRESS,
2359
+ governor: CONTINUUM_DAO_LINEA_GOVERNOR_ADDRESS
2360
+ },
2361
+ [CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID]: { ...UNSET },
2362
+ [CONTINUUM_DAO_ETHEREUM_CHAIN_ID]: {
2363
+ ...UNSET,
2364
+ ctm: CTM_TOKEN_ADDRESS
2365
+ }
2366
+ };
2367
+ function isConfiguredAddress(addr2) {
2368
+ if (!addr2?.trim()) return false;
2369
+ try {
2370
+ return viem.getAddress(addr2) !== viem.zeroAddress;
2371
+ } catch {
2372
+ return false;
2373
+ }
2374
+ }
2375
+ function continuumDaoDeployment(chainId) {
2376
+ return CONTINUUM_DAO_DEPLOYMENTS[chainId] ?? null;
2377
+ }
2378
+ function isContinuumDaoLockChain(chainId) {
2379
+ return chainId === CONTINUUM_DAO_LINEA_CHAIN_ID || chainId === CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID;
2380
+ }
2381
+ function isContinuumDaoSupportedChainId(chainId) {
2382
+ return continuumDaoDeployment(chainId) != null;
2383
+ }
2384
+ function ctmTokenAddressOnEvmChain(chainId) {
2385
+ const ctm = continuumDaoDeployment(chainId)?.ctm;
2386
+ return ctm && isConfiguredAddress(ctm) ? viem.getAddress(ctm) : null;
2387
+ }
2388
+ function votingEscrowAddressOnEvmChain(chainId) {
2389
+ const ve = continuumDaoDeployment(chainId)?.votingEscrow;
2390
+ return ve && isConfiguredAddress(ve) ? viem.getAddress(ve) : null;
2391
+ }
2392
+ function votingEscrowMarketplaceAddressOnEvmChain(chainId) {
2393
+ if (chainId !== CONTINUUM_DAO_LINEA_CHAIN_ID) return null;
2394
+ return VOTING_ESCROW_MARKETPLACE_LINEA_ADDRESS;
2395
+ }
2396
+ function listContinuumDaoDefaultAssets() {
2397
+ const out = [];
2398
+ for (const chainId of [
2399
+ CONTINUUM_DAO_LINEA_CHAIN_ID,
2400
+ CONTINUUM_DAO_LINEA_SEPOLIA_CHAIN_ID,
2401
+ CONTINUUM_DAO_ETHEREUM_CHAIN_ID
2402
+ ]) {
2403
+ const dep = continuumDaoDeployment(chainId);
2404
+ if (!dep) continue;
2405
+ if (isConfiguredAddress(dep.ctm)) {
2406
+ out.push({
2407
+ chainId,
2408
+ tokenType: "CTMERC20",
2409
+ contractAddress: viem.getAddress(dep.ctm),
2410
+ name: CTM_TOKEN_NAME,
2411
+ symbol: CTM_TOKEN_SYMBOL,
2412
+ decimals: CTM_TOKEN_DECIMALS
2413
+ });
2414
+ }
2415
+ if (isContinuumDaoLockChain(chainId) && isConfiguredAddress(dep.votingEscrow)) {
2416
+ out.push({
2417
+ chainId,
2418
+ tokenType: "ERC721",
2419
+ contractAddress: viem.getAddress(dep.votingEscrow),
2420
+ name: VECTM_TOKEN_NAME,
2421
+ symbol: VECTM_TOKEN_SYMBOL
2422
+ });
2423
+ }
2424
+ }
2425
+ return out;
2426
+ }
2427
+
3062
2428
  // src/protocols/evm/continuum-dao/purpose.ts
3063
- init_constants();
3064
2429
  function chainParts(chainId) {
3065
2430
  const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId ?? "").trim(), 10);
3066
2431
  const id = Number.isFinite(n) ? n : 0;
@@ -7816,7 +7181,7 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
7816
7181
  actionId: "continuum-dao.propose-bravo",
7817
7182
  protocolId: "continuum-dao",
7818
7183
  chainCategory: "evm",
7819
- description: "Build ContinuumDAO.propose for a Bravo (For/Against/Abstain) proposal and POST /proposals/create (pendingOnChain) before the multi-sign request is submitted. Requires description and type (0\u20134) matching the forum section. Each action input requires a name. Refuses if getVotes(KeyGen) < live proposalThreshold(), the forum section does not match type, or propose() reverts. forumKey must be a Governance thread from ctm_continuum_dao_forum_create_topic. Ideas threads and the homepage are refused. Empty actions insert a no-op to the KeyGen address. Linea only. No billing legs. register_proposal retries the catalog write and, on 409, updates the existing row instead of creating a second proposal.",
7184
+ description: "Build ContinuumDAO.propose for a Bravo (For/Against/Abstain) proposal and POST /proposals/create (pendingOnChain) before the multi-sign request is submitted. Requires description and type (0\u20134) matching the forum section. Each action input requires a name. Refuses if getVotes(KeyGen) < live proposalThreshold(), the forum section does not match type, or propose() reverts. forumKey must be a Governance thread from ctm_continuum_dao_forum_create_topic. Ideas threads and the homepage are refused. The catalog POST stores forumKey as the path from / with no leading slash (topic/52/slug). Empty actions insert a no-op to the KeyGen address. Linea only. No billing legs. register_proposal retries the catalog write and, on 409, updates the existing row instead of creating a second proposal.",
7820
7185
  prerequisites: [
7821
7186
  "keyGen",
7822
7187
  "Linea RPC",
@@ -7834,7 +7199,7 @@ var MCP_PROTOCOL_TOOL_DEFINITIONS = [
7834
7199
  actionId: "continuum-dao.propose-delta",
7835
7200
  protocolId: "continuum-dao",
7836
7201
  chainCategory: "evm",
7837
- description: "Build ContinuumDAO.propose for a Delta multi-option proposal and POST /proposals/create (pendingOnChain) before the multi-sign request is submitted. Requires description and type (0\u20134) matching the forum section. Each action input requires a name. Refuses if getVotes(KeyGen) < live proposalThreshold(), the forum section does not match type, or propose() reverts. forumKey must be a Governance thread from ctm_continuum_dao_forum_create_topic. Empty options get a no-op so indices increment. Linea only. No billing legs. register_proposal retries the catalog write and, on 409, updates the existing row instead of creating a second proposal.",
7202
+ description: "Build ContinuumDAO.propose for a Delta multi-option proposal and POST /proposals/create (pendingOnChain) before the multi-sign request is submitted. Requires description and type (0\u20134) matching the forum section. Each action input requires a name. Refuses if getVotes(KeyGen) < live proposalThreshold(), the forum section does not match type, or propose() reverts. forumKey must be a Governance thread from ctm_continuum_dao_forum_create_topic. The catalog POST stores forumKey as the path from / with no leading slash (topic/52/slug). Empty options get a no-op so indices increment. Linea only. No billing legs. register_proposal retries the catalog write and, on 409, updates the existing row instead of creating a second proposal.",
7838
7203
  prerequisites: [
7839
7204
  "keyGen",
7840
7205
  "at least 2 options",
@@ -10142,7 +9507,7 @@ var CORE_MCP_TOOL_DEFINITIONS = [
10142
9507
  actionId: "continuum-dao.register-proposal",
10143
9508
  protocolId: "continuum-dao",
10144
9509
  chainCategory: "evm",
10145
- description: "Retry the catalog write when propose did not leave a row. POST /proposals/create, and on 409 POST /proposals/repair to update title, description, forumKey, type, and actions or option labels and actions on the existing onchainId. Each action input requires a name. A Delta repair must use the on-chain nOptions and nWinners. Does not create a second proposal and does not revert a chain tx. The node signs with Ed25519.",
9510
+ description: "Retry the catalog write when propose did not leave a row. POST /proposals/create, and on 409 POST /proposals/repair to update title, description, forumKey, type, and actions or option labels and actions on the existing onchainId. Pass the full topic URL as forumKey; the POST stores the path from / with no leading slash (topic/52/slug). Each action input requires a name. A Delta repair must use the on-chain nOptions and nWinners. Does not create a second proposal and does not revert a chain tx. The node signs with Ed25519.",
10146
9511
  prerequisites: ["onchainId from hashProposal or ProposalCreated", "title", "proposer", "forumKey", "type", "configuration"],
10147
9512
  followUp: [],
10148
9513
  handler: { importPath: "protocols/evm/continuum-dao", exportName: "continuumDaoRegisterProposal" },
@@ -11432,269 +10797,247 @@ function getAgentCatalogForMcp() {
11432
10797
  }
11433
10798
  };
11434
10799
  }
11435
- var LIDO_STETH_CONTRACT_MAINNET = viem.getAddress(
11436
- "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
11437
- );
11438
- var LIDO_WSTETH_CONTRACT_MAINNET = viem.getAddress(
11439
- "0x7f39C581F595B853cBbF37C12FfeeA971C5a5bEa"
11440
- );
11441
- viem.getAddress("0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1");
11442
- var LIDO_ETHEREUM_MAINNET_CHAIN_ID = 1;
11443
- var LIDO_ROBINHOOD_CHAIN_ID = 4663;
11444
- var LIDO_WSTETH_ROBINHOOD = viem.getAddress("0x2dC99af320BC317c567f24eE95811dcbd5983DfD");
11445
- function listLidoSupportedChainIds() {
11446
- return [LIDO_ETHEREUM_MAINNET_CHAIN_ID, LIDO_ROBINHOOD_CHAIN_ID];
10800
+
10801
+ // src/agent/protocol-manifest.ts
10802
+ var PROTOCOL_MANIFEST = [
10803
+ { id: "uniswap-v4", chainCategory: "evm", importPath: "protocols/evm/uniswap-v4", catalogKey: "uniswapV4" },
10804
+ { id: "curve-dao", chainCategory: "evm", importPath: "protocols/evm/curve-dao", catalogKey: "curveDao" },
10805
+ { id: "lido", chainCategory: "evm", importPath: "protocols/evm/lido", catalogKey: "lido" },
10806
+ { id: "railgun", chainCategory: "evm", importPath: "protocols/evm/railgun", catalogKey: "railgun" },
10807
+ { id: "ethena", chainCategory: "evm", importPath: "protocols/evm/ethena", catalogKey: "ethena" },
10808
+ { id: "maple-syrup", chainCategory: "evm", importPath: "protocols/evm/maple", catalogKey: "maple" },
10809
+ { id: "sky", chainCategory: "evm", importPath: "protocols/evm/sky", catalogKey: "sky" },
10810
+ { id: "aave-v4", chainCategory: "evm", importPath: "protocols/evm/aave-v4", catalogKey: "aaveV4" },
10811
+ { id: "euler-v2", chainCategory: "evm", importPath: "protocols/evm/euler-v2", catalogKey: "eulerV2" },
10812
+ { id: "gmx", chainCategory: "evm", importPath: "protocols/evm/gmx", catalogKey: "gmx" },
10813
+ { id: "hyperliquid", chainCategory: "evm", importPath: "protocols/evm/hyperliquid", catalogKey: "hyperliquid" },
10814
+ { id: "arcus", chainCategory: "evm", importPath: "protocols/evm/arcus", catalogKey: "arcus" },
10815
+ { id: "morpho", chainCategory: "evm", importPath: "protocols/evm/morpho", catalogKey: "morpho" },
10816
+ { id: "circle-cctp", chainCategory: "evm", importPath: "protocols/evm/circle-cctp", catalogKey: "circleCctp" },
10817
+ { id: "venice", chainCategory: "evm", importPath: "protocols/evm/venice", catalogKey: "venice" },
10818
+ { id: "aerodrome", chainCategory: "evm", importPath: "protocols/evm/aerodrome", catalogKey: "aerodrome" },
10819
+ { id: "continuum-dao", chainCategory: "evm", importPath: "protocols/evm/continuum-dao", catalogKey: "continuumDao" },
10820
+ { id: "continuum-dao-marketplace", chainCategory: "evm", importPath: "protocols/evm/continuum-dao", catalogKey: "continuumDaoMarketplace" },
10821
+ { id: "compound-v3", chainCategory: "evm", importPath: "protocols/evm/compound-v3", catalogKey: "compoundV3" },
10822
+ { id: "pendle", chainCategory: "evm", importPath: "protocols/evm/pendle", catalogKey: "pendle" },
10823
+ { id: "derive", chainCategory: "evm", importPath: "protocols/evm/derive", catalogKey: "derive" },
10824
+ { id: "trueo", chainCategory: "evm", importPath: "protocols/evm/trueo", catalogKey: "trueo" },
10825
+ { id: "hyperliquidOutcome", chainCategory: "evm", importPath: "protocols/evm/hyperliquidOutcome", catalogKey: "hyperliquidOutcome" }
10826
+ ];
10827
+ var byId = new Map(PROTOCOL_MANIFEST.map((entry) => [entry.id, entry]));
10828
+ function protocolManifestEntry(id) {
10829
+ return byId.get(id);
10830
+ }
10831
+ var skillsDir = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href)))), "skills");
10832
+ var SKILL_PROTOCOL_IDS = [
10833
+ "aave-v4",
10834
+ "lido",
10835
+ "railgun",
10836
+ "uniswap-v4",
10837
+ "curve-dao",
10838
+ "ethena",
10839
+ "euler-v2",
10840
+ "maple-syrup",
10841
+ "sky",
10842
+ "gmx",
10843
+ "hyperliquid",
10844
+ "arcus",
10845
+ "morpho",
10846
+ "circle-cctp",
10847
+ "aerodrome",
10848
+ "pendle",
10849
+ "continuum-dao",
10850
+ "continuum-dao-marketplace",
10851
+ "compound-v3",
10852
+ "derive",
10853
+ "trueo",
10854
+ "hyperliquidOutcome",
10855
+ "yield-compare"
10856
+ ];
10857
+ function getToolsForProtocol(protocolId) {
10858
+ return MCP_TOOL_DEFINITIONS.filter((t) => t.protocolId === protocolId);
11447
10859
  }
11448
- function isLidoSupportedChainId(chainId) {
11449
- return chainId === LIDO_ETHEREUM_MAINNET_CHAIN_ID || chainId === LIDO_ROBINHOOD_CHAIN_ID;
10860
+ function readSharedMultisignMcpGasSection() {
10861
+ try {
10862
+ return fs.readFileSync(path.join(skillsDir, "_shared", "multisign-mcp-gas.md"), "utf8").trim();
10863
+ } catch {
10864
+ return "";
10865
+ }
11450
10866
  }
11451
-
11452
- // src/protocols/evm/lido/index.ts
11453
- var LIDO_PROTOCOL_ID = "lido";
11454
- var lidoProtocolModule = {
11455
- id: LIDO_PROTOCOL_ID,
11456
- chainCategory: "evm",
11457
- isChainSupported(ctx) {
11458
- if (ctx.chainCategory !== "evm") return false;
11459
- return isLidoSupportedChainId(Number(ctx.chainId));
11460
- },
11461
- isTokenSupported(token) {
11462
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
11463
- },
11464
- actions: [
11465
- { id: "lido.submit", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Stake ETH via Lido submit()", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { valueWei: { type: "string", required: true, description: "ETH to stake (wei string)" } } },
11466
- { id: "lido.request-withdrawals", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Queue stETH withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11467
- { id: "lido.claim-withdrawal", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Claim finalized withdrawal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11468
- { id: "lido.wrap-steth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Wrap stETH to wstETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11469
- { id: "lido.unwrap-wsteth", protocolId: LIDO_PROTOCOL_ID, chainCategory: "evm", description: "Unwrap wstETH to stETH", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11470
- ]
11471
- };
11472
- registerProtocolModule(lidoProtocolModule);
11473
-
11474
- // src/protocols/evm/railgun/networks.ts
11475
- function selectRailgunNetworks(config) {
11476
- const rows = [];
11477
- for (const entry of Object.values(config)) {
11478
- if (!entry || entry.deprecated || entry.isDevOnlyNetwork) continue;
11479
- const chainId = Number(entry.chain?.id);
11480
- const proxyContract = String(entry.proxyContract ?? "").trim();
11481
- const wrappedAddress = String(entry.baseToken?.wrappedAddress ?? "").trim();
11482
- if (!Number.isFinite(chainId) || chainId <= 0 || !proxyContract || !wrappedAddress) continue;
11483
- rows.push({
11484
- chainId,
11485
- networkName: String(entry.name ?? ""),
11486
- publicName: String(entry.publicName ?? entry.name ?? ""),
11487
- proxyContract,
11488
- deploymentBlock: Number(entry.deploymentBlock ?? 0),
11489
- wrappedAddress,
11490
- wrappedSymbol: String(entry.baseToken?.wrappedSymbol ?? entry.baseToken?.symbol ?? ""),
11491
- wrappedDecimals: Number(entry.baseToken?.decimals ?? 18),
11492
- isTestnet: Boolean(entry.isTestnet)
11493
- });
10867
+ function getProtocolSkill(protocolId) {
10868
+ if (!SKILL_PROTOCOL_IDS.includes(protocolId)) {
10869
+ return void 0;
10870
+ }
10871
+ try {
10872
+ const skill = fs.readFileSync(path.join(skillsDir, protocolId, "SKILL.md"), "utf8").trim();
10873
+ const shared = readSharedMultisignMcpGasSection();
10874
+ if (!shared) return skill;
10875
+ if (skill.includes("## Gas and MCP submit")) return skill;
10876
+ return `${skill}
10877
+
10878
+ ${shared}
10879
+ `;
10880
+ } catch {
10881
+ return void 0;
11494
10882
  }
11495
- rows.sort((a, b) => a.chainId - b.chainId);
11496
- return rows;
11497
- }
11498
- var cached = null;
11499
- async function loadRailgunNetworks() {
11500
- if (cached) return cached;
11501
- const mod = await import('@railgun-community/shared-models');
11502
- cached = selectRailgunNetworks(mod.NETWORK_CONFIG);
11503
- return cached;
11504
10883
  }
11505
- async function loadRailgunSupportedChainIds() {
11506
- const rows = await loadRailgunNetworks();
11507
- return new Set(rows.map((row) => row.chainId));
10884
+ function listProtocolsWithSkills() {
10885
+ return [...SKILL_PROTOCOL_IDS];
11508
10886
  }
11509
- async function railgunNetworkByChainId(chainId) {
11510
- const rows = await loadRailgunNetworks();
11511
- return rows.find((row) => row.chainId === chainId);
10887
+ function getProtocolDiscoverySummary(protocolId) {
10888
+ const mod = getProtocolModules().find((p) => p.id === protocolId);
10889
+ if (!mod) return void 0;
10890
+ return {
10891
+ protocolId: mod.id,
10892
+ chainCategory: mod.chainCategory,
10893
+ actions: mod.actions.map((a) => ({ id: a.id, description: a.description })),
10894
+ tools: getToolsForProtocol(protocolId).map((t) => ({
10895
+ name: t.name,
10896
+ actionId: t.actionId,
10897
+ description: t.description,
10898
+ prerequisites: t.prerequisites,
10899
+ followUp: t.followUp
10900
+ }))
10901
+ };
11512
10902
  }
11513
10903
 
11514
- // src/protocols/evm/railgun/popular-assets.ts
11515
- init_constants();
11516
- var RAILGUN_POPULAR_ASSET_LIMIT = 5;
11517
- var POPULAR_ASSET_CACHE_MS = 10 * 60 * 1e3;
11518
- var RECENT_SHIELD_LIMIT = 200;
11519
- var SHIELD_INDEX_BY_NETWORK_NAME = {
11520
- Ethereum: "https://rail-squid.squids.live/squid-railgun-ethereum-v2/graphql",
11521
- BNB_Chain: "https://rail-squid.squids.live/squid-railgun-bsc-v2/graphql",
11522
- Polygon: "https://rail-squid.squids.live/squid-railgun-polygon-v2/graphql",
11523
- Arbitrum: "https://rail-squid.squids.live/squid-railgun-arbitrum-v2/graphql"
11524
- };
11525
- var RECENT_SHIELDS_QUERY = `query RecentShields($limit: Int!) {
11526
- shieldCommitments(orderBy: [blockNumber_DESC], limit: $limit) {
11527
- preimage { token { tokenType tokenAddress } }
11528
- }
11529
- }`;
11530
- var cache = /* @__PURE__ */ new Map();
11531
- function rankPopularShieldTokens(rows, limit = RAILGUN_POPULAR_ASSET_LIMIT) {
11532
- const counts = /* @__PURE__ */ new Map();
11533
- for (const row of rows) {
11534
- if (Number(row.tokenType) !== 0) continue;
11535
- let address;
10904
+ // src/protocols/evm/curve-dao/support.ts
10905
+ var CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS = /* @__PURE__ */ new Set([
10906
+ 1,
10907
+ 10,
10908
+ 56,
10909
+ 100,
10910
+ 137,
10911
+ 146,
10912
+ 196,
10913
+ 250,
10914
+ 252,
10915
+ 324,
10916
+ 999,
10917
+ 1284,
10918
+ 2222,
10919
+ 5e3,
10920
+ 8453,
10921
+ 42161,
10922
+ 42220,
10923
+ 43114,
10924
+ 1313161554
10925
+ ]);
10926
+ function isCurveApiChainSupported(chainId) {
10927
+ const n = parseEvmChainIdToNumber(chainId);
10928
+ if (Number.isNaN(n) || n < 0) return false;
10929
+ return CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS.has(n);
10930
+ }
10931
+ var CURVE_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
10932
+ var ETH_PLACEHOLDER = CURVE_NATIVE_PLACEHOLDER;
10933
+ function normalizeAddr(a) {
10934
+ return a.toLowerCase();
10935
+ }
10936
+ function addEdge(adj, a, b) {
10937
+ if (a === b) return;
10938
+ if (!adj.has(a)) adj.set(a, /* @__PURE__ */ new Set());
10939
+ if (!adj.has(b)) adj.set(b, /* @__PURE__ */ new Set());
10940
+ adj.get(a).add(b);
10941
+ adj.get(b).add(a);
10942
+ }
10943
+ function buildCurveLiquidityGraphFromApi(curve) {
10944
+ const adj = /* @__PURE__ */ new Map();
10945
+ for (const id of curve.getPoolList()) {
11536
10946
  try {
11537
- address = viem.getAddress(row.tokenAddress);
10947
+ const pool = curve.getPool(id);
10948
+ const w = (pool.wrappedCoinAddresses ?? []).map(normalizeAddr);
10949
+ const u = (pool.underlyingCoinAddresses ?? []).map(normalizeAddr);
10950
+ const all = [.../* @__PURE__ */ new Set([...w, ...u])];
10951
+ for (let i = 0; i < all.length; i++) {
10952
+ for (let j = i + 1; j < all.length; j++) {
10953
+ addEdge(adj, all[i], all[j]);
10954
+ }
10955
+ }
11538
10956
  } catch {
11539
- continue;
11540
10957
  }
11541
- if (address === viem.zeroAddress) continue;
11542
- const key = address.toLowerCase();
11543
- counts.set(key, (counts.get(key) ?? 0) + 1);
11544
10958
  }
11545
- return [...counts.entries()].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)).slice(0, limit).map(([address]) => viem.getAddress(address));
11546
- }
11547
- function shieldIndexEndpoint(networkName) {
11548
- return SHIELD_INDEX_BY_NETWORK_NAME[networkName] ?? null;
11549
- }
11550
- function commitmentsFromShieldIndex(payload) {
11551
- const rows = payload?.data?.shieldCommitments;
11552
- if (!Array.isArray(rows)) return [];
11553
- return rows.map((row) => {
11554
- const token = row?.preimage?.token;
11555
- const tokenType = token?.tokenType === "ERC20" || token?.tokenType === 0 ? 0 : Number(token?.tokenType ?? -1);
11556
- return {
11557
- tokenAddress: String(token?.tokenAddress ?? ""),
11558
- tokenType: Number.isFinite(tokenType) ? tokenType : -1
11559
- };
11560
- });
10959
+ return adj;
11561
10960
  }
11562
- var shieldLogReaderOverride = null;
11563
- async function readShieldCommitments(args) {
11564
- const endpoint = shieldIndexEndpoint(args.networkName);
11565
- if (!endpoint) return [];
11566
- const response = await fetch(endpoint, {
11567
- method: "POST",
11568
- headers: { "content-type": "application/json" },
11569
- body: JSON.stringify({
11570
- query: RECENT_SHIELDS_QUERY,
11571
- variables: { limit: RECENT_SHIELD_LIMIT }
11572
- })
11573
- });
11574
- if (!response.ok) throw new Error(`Railgun shield index returned ${response.status}`);
11575
- return commitmentsFromShieldIndex(await response.json());
10961
+ function addNativeWethBridge(adj, wrappedNative) {
10962
+ if (!wrappedNative) return;
10963
+ const w = wrappedNative.toLowerCase();
10964
+ const a = ETH_PLACEHOLDER;
10965
+ const b = w;
10966
+ if (a === b) return;
10967
+ if (!adj.has(a)) adj.set(a, /* @__PURE__ */ new Set());
10968
+ if (!adj.has(b)) adj.set(b, /* @__PURE__ */ new Set());
10969
+ adj.get(a).add(b);
10970
+ adj.get(b).add(a);
11576
10971
  }
11577
- function applyContinuumToken(chainId, result) {
11578
- const ctm = ctmTokenAddressOnEvmChain(chainId);
11579
- if (!ctm) return result;
11580
- const present = result.tokens.some((token) => token.address.toLowerCase() === ctm.toLowerCase());
11581
- {
11582
- if (!present) return result;
11583
- return {
11584
- ...result,
11585
- tokens: result.tokens.filter((token) => token.address.toLowerCase() !== ctm.toLowerCase())
11586
- };
10972
+ function swappableCurveGraphNodeKeys(adj) {
10973
+ const out = /* @__PURE__ */ new Set();
10974
+ for (const [k, neigh] of adj) {
10975
+ if (neigh.size > 0) out.add(k);
11587
10976
  }
10977
+ return out;
11588
10978
  }
11589
- async function loadRailgunPopularAssets(args) {
11590
- const network = await railgunNetworkByChainId(args.chainId);
11591
- if (!network) {
11592
- return { tokens: [], notes: "Railgun is not deployed on this chain." };
10979
+
10980
+ // src/protocols/evm/curve-dao/apiSession.ts
10981
+ var CURVE_SESSION_CACHE_TTL_MS = 5 * 60 * 1e3;
10982
+ var curveSessionCache = /* @__PURE__ */ new Map();
10983
+ async function fetchAllCurvePools(curve) {
10984
+ const run = (p) => p.catch(() => void 0);
10985
+ const tasks = [];
10986
+ for (const key of [
10987
+ "factory",
10988
+ "crvUSDFactory",
10989
+ "EYWAFactory",
10990
+ "cryptoFactory",
10991
+ "twocryptoFactory",
10992
+ "tricryptoFactory",
10993
+ "stableNgFactory"
10994
+ ]) {
10995
+ const f = curve[key];
10996
+ if (f?.fetchPools) {
10997
+ tasks.push(run(f.fetchPools()));
10998
+ }
11593
10999
  }
11594
- const cached3 = cache.get(args.chainId);
11595
- if (cached3 && Date.now() - cached3.at < POPULAR_ASSET_CACHE_MS) {
11596
- return applyContinuumToken(args.chainId, {
11597
- tokens: cached3.tokens,
11598
- nativeWrapped: cached3.nativeWrapped,
11599
- notes: cached3.notes
11600
- });
11000
+ await Promise.all(tasks);
11001
+ }
11002
+ async function loadFullCurveSessionForRpc(rpcUrl) {
11003
+ const url = (rpcUrl ?? "").trim();
11004
+ if (!url) {
11005
+ throw new Error("rpcUrl is required.");
11601
11006
  }
11602
- const rpcUrl = args.rpcUrl?.trim() ?? "";
11603
- if (!shieldIndexEndpoint(network.networkName) && !shieldLogReaderOverride) {
11604
- return applyContinuumToken(args.chainId, {
11605
- tokens: [],
11606
- nativeWrapped: network.wrappedAddress,
11607
- notes: "This chain has no indexed Railgun shield feed."
11608
- });
11007
+ const cached3 = curveSessionCache.get(url);
11008
+ if (cached3 && cached3.expiresAt > Date.now()) {
11009
+ return cached3.session;
11609
11010
  }
11610
11011
  try {
11611
- const commitments = await (shieldLogReaderOverride ?? readShieldCommitments)({
11612
- rpcUrl,
11613
- chainId: args.chainId,
11614
- proxy: viem.getAddress(network.proxyContract),
11615
- deploymentBlock: network.deploymentBlock,
11616
- networkName: network.networkName
11617
- });
11618
- const tokens = rankPopularShieldTokens(commitments).map((address) => ({ address }));
11619
- const notes = tokens.length === 0 ? "No recent ERC-20 shields were returned for this chain." : `Top ${tokens.length} ERC-20s by recent indexed shield count.`;
11620
- const entry = {
11621
- at: Date.now(),
11622
- tokens,
11623
- nativeWrapped: network.wrappedAddress,
11624
- notes
11012
+ const { default: curve } = await import('@curvefi/api');
11013
+ await curve.init("JsonRpc", { url }, {});
11014
+ const wrapped = curve.getNetworkConstants().NATIVE_COIN?.wrappedAddress;
11015
+ if (!curve.hasRouter || !curve.hasRouter()) {
11016
+ const session2 = {
11017
+ curve,
11018
+ adj: /* @__PURE__ */ new Map(),
11019
+ swappableNodeKeys: /* @__PURE__ */ new Set(),
11020
+ wrappedNative: wrapped
11021
+ };
11022
+ curveSessionCache.set(url, { session: session2, expiresAt: Date.now() + CURVE_SESSION_CACHE_TTL_MS });
11023
+ return session2;
11024
+ }
11025
+ await fetchAllCurvePools(curve);
11026
+ const adj = buildCurveLiquidityGraphFromApi(curve);
11027
+ addNativeWethBridge(adj, wrapped);
11028
+ const session = {
11029
+ curve,
11030
+ adj,
11031
+ swappableNodeKeys: swappableCurveGraphNodeKeys(adj),
11032
+ wrappedNative: wrapped
11625
11033
  };
11626
- cache.set(args.chainId, entry);
11627
- return applyContinuumToken(args.chainId, { tokens, nativeWrapped: network.wrappedAddress, notes });
11628
- } catch {
11629
- return applyContinuumToken(args.chainId, {
11630
- tokens: [],
11631
- nativeWrapped: network.wrappedAddress,
11632
- notes: "The Railgun shield index could not be read."
11633
- });
11034
+ curveSessionCache.set(url, { session, expiresAt: Date.now() + CURVE_SESSION_CACHE_TTL_MS });
11035
+ return session;
11036
+ } catch (e) {
11037
+ const msg = e instanceof Error ? e.message : String(e);
11038
+ throw new Error(`Curve session init failed for RPC: ${msg}`);
11634
11039
  }
11635
11040
  }
11636
-
11637
- // src/protocols/evm/railgun/index.ts
11638
- var RAILGUN_PROTOCOL_ID = "railgun";
11639
- var railgunProtocolModule = {
11640
- id: RAILGUN_PROTOCOL_ID,
11641
- chainCategory: "evm",
11642
- isChainSupported(ctx) {
11643
- if (ctx.chainCategory !== "evm") return false;
11644
- return loadRailgunSupportedChainIds().then((ids) => ids.has(Number(ctx.chainId)));
11645
- },
11646
- isTokenSupported(token) {
11647
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
11648
- },
11649
- actions: [
11650
- {
11651
- id: "railgun.shield",
11652
- protocolId: RAILGUN_PROTOCOL_ID,
11653
- chainCategory: "evm",
11654
- description: "Shield an ERC-20 into a Railgun 0zk address",
11655
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
11656
- params: {
11657
- tokenAddress: { type: "string", required: true, description: "ERC-20 to shield" },
11658
- amountWei: { type: "string", required: true, description: "Amount in wei" },
11659
- railgunAddress: { type: "string", required: true, description: "Recipient 0zk address" }
11660
- }
11661
- },
11662
- {
11663
- id: "railgun.private-transfer",
11664
- protocolId: RAILGUN_PROTOCOL_ID,
11665
- chainCategory: "evm",
11666
- description: "Private transfer from the unlocked Railgun wallet",
11667
- commonParams: ["purposeText"],
11668
- params: {
11669
- tokenAddress: { type: "string", required: true, description: "Shielded ERC-20" },
11670
- amountWei: { type: "string", required: true, description: "Amount in wei" },
11671
- recipientAddress: {
11672
- type: "string",
11673
- required: false,
11674
- description: "Recipient 0zk address. Omit when toContactName is set."
11675
- },
11676
- toContactName: {
11677
- type: "string",
11678
- required: false,
11679
- description: "Address-book contact name. Uses that contact\u2019s saved 0zk address, not their Ethereum address."
11680
- }
11681
- }
11682
- },
11683
- {
11684
- id: "railgun.unshield",
11685
- protocolId: RAILGUN_PROTOCOL_ID,
11686
- chainCategory: "evm",
11687
- description: "Unshield from the unlocked Railgun wallet to a public address",
11688
- commonParams: ["purposeText"],
11689
- params: {
11690
- tokenAddress: { type: "string", required: true, description: "Shielded ERC-20" },
11691
- amountWei: { type: "string", required: true, description: "Amount in wei" },
11692
- recipientAddress: { type: "string", required: true, description: "Public recipient" }
11693
- }
11694
- }
11695
- ]
11696
- };
11697
- registerProtocolModule(railgunProtocolModule);
11698
11041
  var USDE_ETHEREUM_MAINNET = "0x4c9edd5852cd905f086c759e8383e09bff1e68b3";
11699
11042
  var SUSDE_ETHEREUM_MAINNET = "0x9d39a5de30e57443bff2a8307a4256c8797a3497";
11700
11043
  var USDE_MOST_L2S = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
@@ -11803,352 +11146,286 @@ function listEthenaUsdeEvmNetworkRows() {
11803
11146
  function isEvmChainInEthenaUsdeList(chainId) {
11804
11147
  return usdeTokenAddressOnEvmChain(chainId) != null;
11805
11148
  }
11806
-
11807
- // src/protocols/evm/ethena/index.ts
11808
- var ETHENA_PROTOCOL_ID = "ethena";
11809
- var ethenaProtocolModule = {
11810
- id: ETHENA_PROTOCOL_ID,
11811
- chainCategory: "evm",
11812
- isChainSupported(ctx) {
11813
- if (ctx.chainCategory !== "evm") return false;
11814
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
11815
- return isEvmChainInEthenaUsdeList(n);
11816
- },
11817
- isTokenSupported(token) {
11818
- return token.category === "evm" && token.kind === "erc20";
11819
- },
11820
- actions: [
11821
- { id: "ethena.stake-usde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Stake USDe \u2192 sUSDe", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { amountHuman: { type: "string", required: true, description: "USDe amount" } } },
11822
- { id: "ethena.redeem-susde", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDe \u2192 USDe (no cooldown)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11823
- { id: "ethena.cooldown-shares", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Start sUSDe cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11824
- { id: "ethena.claim-unstake", protocolId: ETHENA_PROTOCOL_ID, chainCategory: "evm", description: "Claim after cooldown", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11825
- ]
11826
- };
11827
- registerProtocolModule(ethenaProtocolModule);
11828
-
11829
- // src/protocols/evm/maple/constants.ts
11830
- function isMapleSyrupSupportedChain(chainId) {
11831
- return chainId === 1 || chainId === 11155111;
11832
- }
11833
- function matchesAssetFilter(opts) {
11834
- const f = (opts.filter ?? "").trim();
11835
- if (!f) return true;
11836
- const addr2 = (opts.address ?? "").trim();
11837
- if (viem.isAddress(f) && viem.isAddress(addr2)) {
11838
- return viem.getAddress(addr2) === viem.getAddress(f);
11839
- }
11840
- const sym = (opts.symbol ?? "").trim();
11841
- if (!sym) return false;
11842
- return sym.toLowerCase() === f.toLowerCase();
11149
+ var LIDO_STETH_CONTRACT_MAINNET = viem.getAddress(
11150
+ "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
11151
+ );
11152
+ var LIDO_WSTETH_CONTRACT_MAINNET = viem.getAddress(
11153
+ "0x7f39C581F595B853cBbF37C12FfeeA971C5a5bEa"
11154
+ );
11155
+ viem.getAddress("0x889edC2eDab5f40e902b864aD4d7AdE8E412F9B1");
11156
+ var LIDO_ETHEREUM_MAINNET_CHAIN_ID = 1;
11157
+ var LIDO_ROBINHOOD_CHAIN_ID = 4663;
11158
+ var LIDO_WSTETH_ROBINHOOD = viem.getAddress("0x2dC99af320BC317c567f24eE95811dcbd5983DfD");
11159
+ function listLidoSupportedChainIds() {
11160
+ return [LIDO_ETHEREUM_MAINNET_CHAIN_ID, LIDO_ROBINHOOD_CHAIN_ID];
11843
11161
  }
11844
11162
 
11845
- // src/protocols/evm/maple/index.ts
11846
- var MAPLE_PROTOCOL_ID = "maple-syrup";
11847
- var mapleProtocolModule = {
11848
- id: MAPLE_PROTOCOL_ID,
11849
- chainCategory: "evm",
11850
- isChainSupported(ctx) {
11851
- if (ctx.chainCategory !== "evm") return false;
11852
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
11853
- return isMapleSyrupSupportedChain(n);
11854
- },
11855
- isTokenSupported(token) {
11856
- return token.category === "evm" && token.kind === "erc20";
11857
- },
11858
- actions: [
11859
- { id: "maple-syrup.deposit", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Maple Syrup pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11860
- { id: "maple-syrup.request-redeem", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Request redeem from pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11861
- ]
11862
- };
11863
- registerProtocolModule(mapleProtocolModule);
11864
-
11865
- // src/protocols/evm/sky/mainnet.ts
11866
- var SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
11867
-
11868
- // src/protocols/evm/sky/index.ts
11869
- var SKY_PROTOCOL_ID = "sky";
11870
- var skyProtocolModule = {
11871
- id: SKY_PROTOCOL_ID,
11872
- chainCategory: "evm",
11873
- isChainSupported(ctx) {
11874
- if (ctx.chainCategory !== "evm") return false;
11875
- return Number(ctx.chainId) === SKY_ETHEREUM_MAINNET_CHAIN_ID;
11876
- },
11877
- isTokenSupported(token) {
11878
- return token.category === "evm" && token.kind === "erc20";
11879
- },
11880
- actions: [
11881
- { id: "sky.lockstake-stake", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Open Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11882
- { id: "sky.lockstake-draw", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Borrow USDS from Lockstake", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11883
- { id: "sky.lockstake-wipe", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Repay Lockstake debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11884
- { id: "sky.lockstake-close", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Close Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11885
- { id: "sky.susds-deposit", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Deposit USDS into sUSDS vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11886
- { id: "sky.susds-redeem", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDS to USDS", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11887
- ]
11888
- };
11889
- registerProtocolModule(skyProtocolModule);
11890
-
11891
- // src/protocols/evm/aave-v4/index.ts
11892
- var AAVE_V4_PROTOCOL_ID = "aave-v4";
11893
- var aaveV4ProtocolModule = {
11894
- id: AAVE_V4_PROTOCOL_ID,
11895
- chainCategory: "evm",
11896
- isChainSupported(ctx) {
11897
- return ctx.chainCategory === "evm";
11898
- },
11899
- isTokenSupported(token) {
11900
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
11901
- },
11902
- actions: [
11903
- { id: "aave-v4.deposit", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Supply to Aave v4 Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11904
- { id: "aave-v4.withdraw", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11905
- { id: "aave-v4.borrow", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Spoke", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11906
- { id: "aave-v4.repay", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Repay Spoke debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11907
- { id: "aave-v4.fetch-merkl-rewards", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "List wallet-wide Merkl claimables on a chain", commonParams: [], params: {} },
11908
- { id: "aave-v4.merkl-claim", protocolId: AAVE_V4_PROTOCOL_ID, chainCategory: "evm", description: "Claim wallet-wide Merkl rewards", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11909
- ]
11910
- };
11911
- registerProtocolModule(aaveV4ProtocolModule);
11912
-
11913
- // src/protocols/evm/euler-v2/eulerV3Api.ts
11914
- init_defiProxy();
11915
- var EULER_V3_API_BASE = "https://v3.euler.finance";
11916
- function qs(params) {
11917
- const u = new URLSearchParams();
11918
- for (const [k, v] of Object.entries(params)) {
11919
- if (v == null) continue;
11920
- u.set(k, String(v));
11921
- }
11922
- const s = u.toString();
11923
- return s ? `?${s}` : "";
11924
- }
11925
- async function eulerV3Get(path, params = {}) {
11926
- const rel = path.startsWith("/") ? path : `/${path}`;
11927
- const query = qs(params);
11928
- const directUrl = `${EULER_V3_API_BASE}${rel}${query}`;
11929
- rel.replace(/^\/v3\/?/, "");
11930
- const proxyUrl = void 0;
11931
- return getJsonViaOptionalProxy({ directUrl, proxyUrl });
11932
- }
11933
- async function paginateV3Vaults(path, chainId, extra = {}) {
11934
- const out = [];
11935
- let offset = 0;
11936
- const limit = 100;
11937
- while (true) {
11938
- const page = await eulerV3Get(path, {
11163
+ // src/protocols/evm/railgun/networks.ts
11164
+ function selectRailgunNetworks(config) {
11165
+ const rows = [];
11166
+ for (const entry of Object.values(config)) {
11167
+ if (!entry || entry.deprecated || entry.isDevOnlyNetwork) continue;
11168
+ const chainId = Number(entry.chain?.id);
11169
+ const proxyContract = String(entry.proxyContract ?? "").trim();
11170
+ const wrappedAddress = String(entry.baseToken?.wrappedAddress ?? "").trim();
11171
+ if (!Number.isFinite(chainId) || chainId <= 0 || !proxyContract || !wrappedAddress) continue;
11172
+ rows.push({
11939
11173
  chainId,
11940
- limit,
11941
- offset,
11942
- ...extra
11943
- });
11944
- const rows = page.data ?? [];
11945
- out.push(...rows);
11946
- const total = typeof page.meta?.total === "number" ? page.meta.total : out.length;
11947
- offset += rows.length;
11948
- if (!rows.length || offset >= total) break;
11949
- }
11950
- return out;
11951
- }
11952
- async function fetchEulerV3EvkVaults(args) {
11953
- return paginateV3Vaults("/v3/evk/vaults", args.chainId, args.asset ? { asset: args.asset } : {});
11954
- }
11955
- async function fetchEulerV3EarnVaults(args) {
11956
- return paginateV3Vaults("/v3/earn/vaults", args.chainId, args.asset ? { asset: args.asset } : {});
11957
- }
11958
- async function fetchEulerV3ActiveChainIds() {
11959
- const page = await eulerV3Get("/v3/chains");
11960
- const ids = [];
11961
- for (const row of page.data ?? []) {
11962
- if (typeof row.id !== "number" || !Number.isFinite(row.id)) continue;
11963
- if ((row.status ?? "active") !== "active") continue;
11964
- ids.push(row.id);
11965
- }
11966
- return ids.sort((a, b) => a - b);
11967
- }
11968
-
11969
- // src/protocols/evm/euler-v2/eulerV2Subgraph.ts
11970
- var EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID = {
11971
- 1: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-mainnet/latest/gn",
11972
- 8453: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-base/latest/gn",
11973
- 1923: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-swell/latest/gn",
11974
- 146: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-sonic/latest/gn",
11975
- 60808: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bob/latest/gn",
11976
- 80094: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-berachain/latest/gn",
11977
- 43114: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-avalanche/latest/gn",
11978
- 42161: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-arbitrum/latest/gn",
11979
- 130: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-unichain/latest/gn",
11980
- 56: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bsc/latest/gn",
11981
- 999: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-hyperevm/latest/gn",
11982
- 239: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-tac/latest/gn",
11983
- 9745: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-plasma/latest/gn",
11984
- 137: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-polygon/latest/gn",
11985
- 59144: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-linea/latest/gn",
11986
- 143: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-monad/latest/gn"
11987
- };
11988
- var WRAPPED_NATIVE_FALLBACK = {
11989
- 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
11990
- 10: "0x4200000000000000000000000000000000000006",
11991
- 56: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
11992
- 100: "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
11993
- 130: "0x4200000000000000000000000000000000000006",
11994
- 137: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
11995
- // Polygon: WPOL
11996
- 143: "0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A",
11997
- // Monad: WMON
11998
- 146: "0x03980325872071166574bcd94670450917897468",
11999
- 239: "0xB63B9f0eb4A6E6f191529D71d4D88cc8900Df2C9",
12000
- // TAC: WTAC (https://docs.tac.build/ecosystem/token-list)
12001
- 480: "0x4200000000000000000000000000000000000006",
12002
- 999: "0x5555555555555555555555555555555555555555",
12003
- // HyperEVM: WHYPE (Hyperliquid docs)
12004
- 1923: "0x4200000000000000000000000000000000000006",
12005
- 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
12006
- 43114: "0xB31f66AA3C1e785363F0875A1B74D27b85FE0459",
12007
- 5e3: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
12008
- // Mantle: WMNT
12009
- 59144: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
12010
- // Linea: WETH
12011
- 57073: "0x4200000000000000000000000000000000000006",
12012
- 60808: "0x4200000000000000000000000000000000000006",
12013
- 80094: "0x6969696969696969696969696969696969696969",
12014
- // Berachain: WBERA (https://docs.berachain.com)
12015
- 8453: "0x4200000000000000000000000000000000000006",
12016
- 9745: "0x6100E367285b01F48D07953803A2d8dCA5D19873"
12017
- // Plasma: WXPL
12018
- };
12019
- for (const id of Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map(Number)) {
12020
- if (WRAPPED_NATIVE_FALLBACK[id] == null) {
12021
- throw new Error(`eulerV2Subgraph: add WRAPPED_NATIVE_FALLBACK for Euler Goldsky chain ${id}`);
11174
+ networkName: String(entry.name ?? ""),
11175
+ publicName: String(entry.publicName ?? entry.name ?? ""),
11176
+ proxyContract,
11177
+ deploymentBlock: Number(entry.deploymentBlock ?? 0),
11178
+ wrappedAddress,
11179
+ wrappedSymbol: String(entry.baseToken?.wrappedSymbol ?? entry.baseToken?.symbol ?? ""),
11180
+ wrappedDecimals: Number(entry.baseToken?.decimals ?? 18),
11181
+ isTestnet: Boolean(entry.isTestnet)
11182
+ });
12022
11183
  }
11184
+ rows.sort((a, b) => a.chainId - b.chainId);
11185
+ return rows;
12023
11186
  }
12024
- async function resolveEulerWrappedNativeToken(chainId) {
12025
- try {
12026
- const fromAave = await fetchAaveV4NativeWrappedToken(chainId);
12027
- if (fromAave) return fromAave;
12028
- } catch {
11187
+ var cached = null;
11188
+ async function loadRailgunNetworks() {
11189
+ if (cached) return cached;
11190
+ const mod = await import('@railgun-community/shared-models');
11191
+ cached = selectRailgunNetworks(mod.NETWORK_CONFIG);
11192
+ return cached;
11193
+ }
11194
+ async function loadRailgunSupportedChainIds() {
11195
+ const rows = await loadRailgunNetworks();
11196
+ return new Set(rows.map((row) => row.chainId));
11197
+ }
11198
+ async function railgunNetworkByChainId(chainId) {
11199
+ const rows = await loadRailgunNetworks();
11200
+ return rows.find((row) => row.chainId === chainId);
11201
+ }
11202
+ var RAILGUN_POPULAR_ASSET_LIMIT = 5;
11203
+ var POPULAR_ASSET_CACHE_MS = 10 * 60 * 1e3;
11204
+ var RECENT_SHIELD_LIMIT = 200;
11205
+ var SHIELD_INDEX_BY_NETWORK_NAME = {
11206
+ Ethereum: "https://rail-squid.squids.live/squid-railgun-ethereum-v2/graphql",
11207
+ BNB_Chain: "https://rail-squid.squids.live/squid-railgun-bsc-v2/graphql",
11208
+ Polygon: "https://rail-squid.squids.live/squid-railgun-polygon-v2/graphql",
11209
+ Arbitrum: "https://rail-squid.squids.live/squid-railgun-arbitrum-v2/graphql"
11210
+ };
11211
+ var RECENT_SHIELDS_QUERY = `query RecentShields($limit: Int!) {
11212
+ shieldCommitments(orderBy: [blockNumber_DESC], limit: $limit) {
11213
+ preimage { token { tokenType tokenAddress } }
12029
11214
  }
12030
- const fb = WRAPPED_NATIVE_FALLBACK[chainId];
12031
- if (fb && viem.isAddress(fb)) return viem.getAddress(fb);
12032
- return null;
11215
+ }`;
11216
+ var cache = /* @__PURE__ */ new Map();
11217
+ function rankPopularShieldTokens(rows, limit = RAILGUN_POPULAR_ASSET_LIMIT) {
11218
+ const counts = /* @__PURE__ */ new Map();
11219
+ for (const row of rows) {
11220
+ if (Number(row.tokenType) !== 0) continue;
11221
+ let address;
11222
+ try {
11223
+ address = viem.getAddress(row.tokenAddress);
11224
+ } catch {
11225
+ continue;
11226
+ }
11227
+ if (address === viem.zeroAddress) continue;
11228
+ const key = address.toLowerCase();
11229
+ counts.set(key, (counts.get(key) ?? 0) + 1);
11230
+ }
11231
+ return [...counts.entries()].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0)).slice(0, limit).map(([address]) => viem.getAddress(address));
12033
11232
  }
12034
- function normAssetAddr(raw) {
12035
- const s = (raw ?? "").trim();
12036
- if (!s || !viem.isAddress(s)) return null;
12037
- return viem.getAddress(s).toLowerCase();
11233
+ function shieldIndexEndpoint(networkName) {
11234
+ return SHIELD_INDEX_BY_NETWORK_NAME[networkName] ?? null;
12038
11235
  }
12039
- function v3VaultShowsBorrow(totalBorrows, explorableBorrow) {
12040
- if (explorableBorrow === true) return true;
12041
- try {
12042
- return BigInt((totalBorrows ?? "0").trim() || "0") > 0n;
12043
- } catch {
12044
- return false;
11236
+ function commitmentsFromShieldIndex(payload) {
11237
+ const rows = payload?.data?.shieldCommitments;
11238
+ if (!Array.isArray(rows)) return [];
11239
+ return rows.map((row) => {
11240
+ const token = row?.preimage?.token;
11241
+ const tokenType = token?.tokenType === "ERC20" || token?.tokenType === 0 ? 0 : Number(token?.tokenType ?? -1);
11242
+ return {
11243
+ tokenAddress: String(token?.tokenAddress ?? ""),
11244
+ tokenType: Number.isFinite(tokenType) ? tokenType : -1
11245
+ };
11246
+ });
11247
+ }
11248
+ var shieldLogReaderOverride = null;
11249
+ async function readShieldCommitments(args) {
11250
+ const endpoint = shieldIndexEndpoint(args.networkName);
11251
+ if (!endpoint) return [];
11252
+ const response = await fetch(endpoint, {
11253
+ method: "POST",
11254
+ headers: { "content-type": "application/json" },
11255
+ body: JSON.stringify({
11256
+ query: RECENT_SHIELDS_QUERY,
11257
+ variables: { limit: RECENT_SHIELD_LIMIT }
11258
+ })
11259
+ });
11260
+ if (!response.ok) throw new Error(`Railgun shield index returned ${response.status}`);
11261
+ return commitmentsFromShieldIndex(await response.json());
11262
+ }
11263
+ function applyContinuumToken(chainId, result) {
11264
+ const ctm = ctmTokenAddressOnEvmChain(chainId);
11265
+ if (!ctm) return result;
11266
+ const present = result.tokens.some((token) => token.address.toLowerCase() === ctm.toLowerCase());
11267
+ {
11268
+ if (!present) return result;
11269
+ return {
11270
+ ...result,
11271
+ tokens: result.tokens.filter((token) => token.address.toLowerCase() !== ctm.toLowerCase())
11272
+ };
12045
11273
  }
12046
11274
  }
12047
- var eulerV2ChainAssetCache = /* @__PURE__ */ new Map();
12048
- async function fetchEulerV2ChainAssetCache(chainId) {
12049
- const [nativeWrapped, evkVaults, earnVaults] = await Promise.all([
12050
- resolveEulerWrappedNativeToken(chainId),
12051
- fetchEulerV3EvkVaults({ chainId }),
12052
- fetchEulerV3EarnVaults({ chainId }).catch(() => [])
12053
- ]);
12054
- const modes = /* @__PURE__ */ new Map();
12055
- const symbols = /* @__PURE__ */ new Map();
12056
- const ambiguousSymbols = /* @__PURE__ */ new Set();
12057
- const bump = (addr2, patch) => {
12058
- const cur = modes.get(addr2) ?? { lend: false, borrow: false, earn: false };
12059
- modes.set(addr2, {
12060
- lend: cur.lend || !!patch.lend,
12061
- borrow: cur.borrow || !!patch.borrow,
12062
- earn: cur.earn || !!patch.earn
11275
+ async function loadRailgunPopularAssets(args) {
11276
+ const network = await railgunNetworkByChainId(args.chainId);
11277
+ if (!network) {
11278
+ return { tokens: [], notes: "Railgun is not deployed on this chain." };
11279
+ }
11280
+ const cached3 = cache.get(args.chainId);
11281
+ if (cached3 && Date.now() - cached3.at < POPULAR_ASSET_CACHE_MS) {
11282
+ return applyContinuumToken(args.chainId, {
11283
+ tokens: cached3.tokens,
11284
+ nativeWrapped: cached3.nativeWrapped,
11285
+ notes: cached3.notes
12063
11286
  });
12064
- };
12065
- const noteSymbol = (symbol, addr2) => {
12066
- const sym = (symbol ?? "").trim().toLowerCase();
12067
- if (!sym || ambiguousSymbols.has(sym) || !viem.isAddress(addr2)) return;
12068
- const checksum = viem.getAddress(addr2);
12069
- const prev = symbols.get(sym);
12070
- if (!prev) {
12071
- symbols.set(sym, checksum);
12072
- return;
12073
- }
12074
- if (prev.toLowerCase() !== checksum.toLowerCase()) {
12075
- symbols.delete(sym);
12076
- ambiguousSymbols.add(sym);
12077
- }
12078
- };
12079
- for (const v of earnVaults) {
12080
- const a = normAssetAddr(v.asset?.address ?? void 0);
12081
- if (a) {
12082
- bump(a, { earn: true });
12083
- noteSymbol(v.asset?.symbol, a);
12084
- }
12085
11287
  }
12086
- for (const v of evkVaults) {
12087
- const a = normAssetAddr(v.asset?.address ?? void 0);
12088
- if (!a) continue;
12089
- const vis = v.visibility;
12090
- bump(a, {
12091
- lend: vis?.explorableLend !== false,
12092
- borrow: v3VaultShowsBorrow(v.totalBorrows, vis?.explorableBorrow)
11288
+ const rpcUrl = args.rpcUrl?.trim() ?? "";
11289
+ if (!shieldIndexEndpoint(network.networkName) && !shieldLogReaderOverride) {
11290
+ return applyContinuumToken(args.chainId, {
11291
+ tokens: [],
11292
+ nativeWrapped: network.wrappedAddress,
11293
+ notes: "This chain has no indexed Railgun shield feed."
12093
11294
  });
12094
- noteSymbol(v.asset?.symbol, a);
12095
11295
  }
12096
- const weth = symbols.get("weth");
12097
- if (weth && !symbols.has("eth") && !ambiguousSymbols.has("eth")) {
12098
- symbols.set("eth", weth);
11296
+ try {
11297
+ const commitments = await (shieldLogReaderOverride ?? readShieldCommitments)({
11298
+ rpcUrl,
11299
+ chainId: args.chainId,
11300
+ proxy: viem.getAddress(network.proxyContract),
11301
+ deploymentBlock: network.deploymentBlock,
11302
+ networkName: network.networkName
11303
+ });
11304
+ const tokens = rankPopularShieldTokens(commitments).map((address) => ({ address }));
11305
+ const notes = tokens.length === 0 ? "No recent ERC-20 shields were returned for this chain." : `Top ${tokens.length} ERC-20s by recent indexed shield count.`;
11306
+ const entry = {
11307
+ at: Date.now(),
11308
+ tokens,
11309
+ nativeWrapped: network.wrappedAddress,
11310
+ notes
11311
+ };
11312
+ cache.set(args.chainId, entry);
11313
+ return applyContinuumToken(args.chainId, { tokens, nativeWrapped: network.wrappedAddress, notes });
11314
+ } catch {
11315
+ return applyContinuumToken(args.chainId, {
11316
+ tokens: [],
11317
+ nativeWrapped: network.wrappedAddress,
11318
+ notes: "The Railgun shield index could not be read."
11319
+ });
12099
11320
  }
12100
- return { nativeWrapped, modesByUnderlying: modes, symbolToAddress: symbols };
12101
11321
  }
12102
- function ensureEulerV2ChainAssetCache(chainId) {
12103
- const hit = eulerV2ChainAssetCache.get(chainId);
12104
- if (hit) return hit;
12105
- const p = fetchEulerV2ChainAssetCache(chainId).catch((e) => {
12106
- eulerV2ChainAssetCache.delete(chainId);
12107
- throw e;
12108
- });
12109
- eulerV2ChainAssetCache.set(chainId, p);
12110
- return p;
11322
+ var UNIVERSAL_ROUTER_SPENDER = {
11323
+ 1: "0x66a9893cc07d91d95644aedd05d03f95e1dba8af",
11324
+ 5: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
11325
+ 11155111: "0x3a9d48ab9751398bbfa63ad67599bb04e4bdf98b",
11326
+ 137: "0x1095692a6237d83c6a72f3f5efedb9a670c49223",
11327
+ 80001: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
11328
+ 10: "0x851116d9223fabed8e56c0e6b8ad0c31d98b3507",
11329
+ 420: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
11330
+ 42161: "0xa51afafe0263b40edaef0df8781ea9aa03e381a3",
11331
+ 421613: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
11332
+ 42220: "0xcb695bc5D3Aa22cAD1E6DF07801b061a05A0233A",
11333
+ 44787: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD",
11334
+ 56: "0x1906c1d672b88cd1b9ac7593301ca990f94eae07",
11335
+ 43114: "0x94b75331ae8d42c1b61065089b7d48fe14aa73b7",
11336
+ 84531: "0xd0872d928672ae2ff74bdb2f5130ac12229cafaf",
11337
+ 8453: "0x6fF5693b99212da76ad316178a184ab56d299b43",
11338
+ 81457: "0xeabbcb3e8e415306207ef514f660a3f820025be3",
11339
+ 7777777: "0x3315ef7ca28db74abadc6c44570efdf06b04b020",
11340
+ 324: "0x28731BCC616B5f51dD52CF2e4dF0E78dD1136C06",
11341
+ 480: "0x8ac7bee993bb44dab564ea4bc9ea67bf9eb5e743",
11342
+ 1301: "0xf70536b3bcc1bd1a972dc186a2cf84cc6da6be5d",
11343
+ 130: "0xef740bf23acae26f6492b10de645d6b98dc8eaf3",
11344
+ 10143: "0x3ae6d8a282d67893e17aa70ebffb33ee5aa65893",
11345
+ 84532: "0x492e6456d9528771018deb9e87ef7750ef184104",
11346
+ 1868: "0x0e2850543f69f678257266e0907ff9a58b3f13de",
11347
+ 143: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
11348
+ 59144: "0x661e93cca42afacb172121ef892830ca3b70f08d",
11349
+ 4217: "0x1febb76be10aaf3a1402f04e8e835f2c382f7914",
11350
+ 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff",
11351
+ /** Robinhood Chain mainnet — Universal Router v2.1.1 (Trade API / interface) */
11352
+ 4663: "0x8876789976decbfcbbbe364623c63652db8c0904",
11353
+ /** Circle Arc mainnet — official Uniswap v4 deployments */
11354
+ 5042: "0x4fcA4a51Ab4F23A7447b3284fBd7D73289A89Fb1"
11355
+ };
11356
+ function isUniswapV4ChainSupported(chainId) {
11357
+ if (chainId == null) return false;
11358
+ const n = parseEvmChainIdToNumber(chainId);
11359
+ if (Number.isNaN(n) || n < 0) return false;
11360
+ const a = UNIVERSAL_ROUTER_SPENDER[n];
11361
+ return typeof a === "string" && a.startsWith("0x");
11362
+ }
11363
+
11364
+ // src/protocols/evm/maple/constants.ts
11365
+ function isMapleSyrupSupportedChain(chainId) {
11366
+ return chainId === 1 || chainId === 11155111;
11367
+ }
11368
+ function defiEvmTransport(rpcUrl, opts) {
11369
+ const url = rpcUrl.trim();
11370
+ return viem.http(url, opts);
12111
11371
  }
12112
-
12113
- // src/protocols/evm/euler-v2/loadEulerV2SupportedChainIds.ts
12114
- var cached2 = null;
12115
- async function loadEulerV2SupportedChainIds() {
12116
- if (cached2) return cached2;
12117
- try {
12118
- const ids = await fetchEulerV3ActiveChainIds();
12119
- if (ids.length) {
12120
- cached2 = new Set(ids);
12121
- return cached2;
12122
- }
12123
- } catch {
11372
+ function matchesAssetFilter(opts) {
11373
+ const f = (opts.filter ?? "").trim();
11374
+ if (!f) return true;
11375
+ const addr2 = (opts.address ?? "").trim();
11376
+ if (viem.isAddress(f) && viem.isAddress(addr2)) {
11377
+ return viem.getAddress(addr2) === viem.getAddress(f);
12124
11378
  }
12125
- cached2 = new Set(Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map((k) => Number(k)));
12126
- return cached2;
11379
+ const sym = (opts.symbol ?? "").trim();
11380
+ if (!sym) return false;
11381
+ return sym.toLowerCase() === f.toLowerCase();
12127
11382
  }
12128
11383
 
12129
- // src/protocols/evm/euler-v2/index.ts
12130
- var EULER_V2_PROTOCOL_ID = "euler-v2";
12131
- var eulerV2ProtocolModule = {
12132
- id: EULER_V2_PROTOCOL_ID,
11384
+ // src/protocols/evm/maple/index.ts
11385
+ var MAPLE_PROTOCOL_ID = "maple-syrup";
11386
+ var mapleProtocolModule = {
11387
+ id: MAPLE_PROTOCOL_ID,
11388
+ chainCategory: "evm",
11389
+ isChainSupported(ctx) {
11390
+ if (ctx.chainCategory !== "evm") return false;
11391
+ const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
11392
+ return isMapleSyrupSupportedChain(n);
11393
+ },
11394
+ isTokenSupported(token) {
11395
+ return token.category === "evm" && token.kind === "erc20";
11396
+ },
11397
+ actions: [
11398
+ { id: "maple-syrup.deposit", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Maple Syrup pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11399
+ { id: "maple-syrup.request-redeem", protocolId: MAPLE_PROTOCOL_ID, chainCategory: "evm", description: "Request redeem from pool", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11400
+ ]
11401
+ };
11402
+ registerProtocolModule(mapleProtocolModule);
11403
+
11404
+ // src/protocols/evm/sky/mainnet.ts
11405
+ var SKY_ETHEREUM_MAINNET_CHAIN_ID = 1;
11406
+
11407
+ // src/protocols/evm/sky/index.ts
11408
+ var SKY_PROTOCOL_ID = "sky";
11409
+ var skyProtocolModule = {
11410
+ id: SKY_PROTOCOL_ID,
12133
11411
  chainCategory: "evm",
12134
11412
  isChainSupported(ctx) {
12135
- return ctx.chainCategory === "evm";
11413
+ if (ctx.chainCategory !== "evm") return false;
11414
+ return Number(ctx.chainId) === SKY_ETHEREUM_MAINNET_CHAIN_ID;
12136
11415
  },
12137
11416
  isTokenSupported(token) {
12138
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
11417
+ return token.category === "evm" && token.kind === "erc20";
12139
11418
  },
12140
11419
  actions: [
12141
- { id: "euler-v2.isolated-lend", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12142
- { id: "euler-v2.isolated-borrow", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12143
- { id: "euler-v2.vault-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Euler vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12144
- { id: "euler-v2.borrow-repay", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Repay Euler borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12145
- { id: "euler-v2.collateral-deposit", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Deposit borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12146
- { id: "euler-v2.collateral-withdraw", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw borrow collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12147
- { id: "euler-v2.fetch-merkl-rewards", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "List wallet-wide Merkl claimables on a chain", commonParams: [], params: {} },
12148
- { id: "euler-v2.merkl-claim", protocolId: EULER_V2_PROTOCOL_ID, chainCategory: "evm", description: "Claim wallet-wide Merkl rewards", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
11420
+ { id: "sky.lockstake-stake", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Open Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11421
+ { id: "sky.lockstake-draw", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Borrow USDS from Lockstake", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11422
+ { id: "sky.lockstake-wipe", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Repay Lockstake debt", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11423
+ { id: "sky.lockstake-close", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Close Lockstake position", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11424
+ { id: "sky.susds-deposit", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Deposit USDS into sUSDS vault", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
11425
+ { id: "sky.susds-redeem", protocolId: SKY_PROTOCOL_ID, chainCategory: "evm", description: "Redeem sUSDS to USDS", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
12149
11426
  ]
12150
11427
  };
12151
- registerProtocolModule(eulerV2ProtocolModule);
11428
+ registerProtocolModule(skyProtocolModule);
12152
11429
 
12153
11430
  // src/protocols/evm/gmx/support.ts
12154
11431
  var GMX_SUPPORTED_CHAIN_IDS = [42161, 43114];
@@ -12307,420 +11584,81 @@ var gmxProtocolModule = {
12307
11584
  symbol: { type: "string", required: true, description: "GMX market symbol e.g. ETH/USD [WETH-USDC]" },
12308
11585
  direction: { type: "string", required: true, description: "long or short" },
12309
11586
  orderType: { type: "string", required: true, description: "market or limit" },
12310
- sizeUsdHuman: { type: "string", required: true, description: "Position size in USD" },
12311
- collateralToken: { type: "string", required: true, description: "Collateral token symbol e.g. USDC" },
12312
- collateralAmountHuman: { type: "string", required: true, description: "Collateral amount in token units" }
12313
- }
12314
- },
12315
- {
12316
- id: "gmx.decrease",
12317
- protocolId: GMX_PROTOCOL_ID,
12318
- chainCategory: "evm",
12319
- description: "Close or reduce a GMX perp position (classic on-chain order)",
12320
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12321
- params: {
12322
- symbol: { type: "string", required: true, description: "GMX market symbol" },
12323
- direction: { type: "string", required: true, description: "long or short" },
12324
- orderType: { type: "string", required: true, description: "market or limit" },
12325
- sizeUsdHuman: { type: "string", required: true, description: "Size to close in USD" },
12326
- collateralToken: { type: "string", required: true, description: "Position collateral token symbol" }
12327
- }
12328
- },
12329
- {
12330
- id: "gmx.cancel",
12331
- protocolId: GMX_PROTOCOL_ID,
12332
- chainCategory: "evm",
12333
- description: "Cancel a pending GMX order (classic on-chain)",
12334
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12335
- params: {
12336
- orderId: { type: "string", required: true, description: "Order key from fetchOrders" }
12337
- }
12338
- },
12339
- {
12340
- id: "gmx.gmDeposit",
12341
- protocolId: GMX_PROTOCOL_ID,
12342
- chainCategory: "evm",
12343
- description: "Deposit collateral into a GMX v2.2c GM liquidity pool (ExchangeRouter multicall)",
12344
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12345
- params: {
12346
- marketSymbol: { type: "string", required: true, description: "GM market symbol e.g. ETH/USD [WETH-USDC]" },
12347
- collateralToken: { type: "string", required: true, description: "Pool collateral token symbol" },
12348
- collateralAmountHuman: { type: "string", required: true, description: "Amount in token units" }
12349
- }
12350
- },
12351
- {
12352
- id: "gmx.gmWithdraw",
12353
- protocolId: GMX_PROTOCOL_ID,
12354
- chainCategory: "evm",
12355
- description: "Withdraw GM market tokens from a GMX v2.2c liquidity pool",
12356
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12357
- params: {
12358
- marketSymbol: { type: "string", required: true, description: "GM market symbol" },
12359
- gmAmountHuman: { type: "string", required: true, description: "GM token amount to withdraw" }
12360
- }
12361
- },
12362
- {
12363
- id: "gmx.stakeGmx",
12364
- protocolId: GMX_PROTOCOL_ID,
12365
- chainCategory: "evm",
12366
- description: "Stake GMX tokens via RewardRouter",
12367
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12368
- params: {
12369
- amountHuman: { type: "string", required: true, description: "GMX amount to stake" }
12370
- }
12371
- },
12372
- {
12373
- id: "gmx.unstakeGmx",
12374
- protocolId: GMX_PROTOCOL_ID,
12375
- chainCategory: "evm",
12376
- description: "Unstake GMX tokens via RewardRouter",
12377
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12378
- params: {
12379
- amountHuman: { type: "string", required: true, description: "GMX amount to unstake" }
12380
- }
12381
- }
12382
- ]
12383
- };
12384
- registerProtocolModule(gmxProtocolModule);
12385
-
12386
- // src/protocols/evm/hyperliquid/support.ts
12387
- var HYPERLIQUID_SUPPORTED_CHAIN_IDS = [999, 998];
12388
- function isHyperliquidChainSupported(chainId) {
12389
- return HYPERLIQUID_SUPPORTED_CHAIN_IDS.includes(chainId);
12390
- }
12391
-
12392
- // src/protocols/evm/hyperliquid/index.ts
12393
- var HYPERLIQUID_PROTOCOL_ID = "hyperliquid";
12394
- var hyperliquidProtocolModule = {
12395
- id: HYPERLIQUID_PROTOCOL_ID,
12396
- chainCategory: "evm",
12397
- isChainSupported(ctx) {
12398
- if (ctx.chainCategory !== "evm") return false;
12399
- const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
12400
- return Number.isFinite(chainId) && isHyperliquidChainSupported(chainId);
12401
- },
12402
- isTokenSupported(token) {
12403
- if (token.category !== "evm") return false;
12404
- return token.kind === "erc20" || token.kind === "native";
12405
- },
12406
- actions: [
12407
- {
12408
- id: "hyperliquid.limitOrder",
12409
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12410
- chainCategory: "evm",
12411
- description: "Place a Hyperliquid limit/IoC order via CoreWriter, or L1 normalTpsl bracket when TP/SL triggers are set",
12412
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12413
- params: {
12414
- coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
12415
- isBuy: { type: "boolean", required: true, description: "true for buy/long, false for sell/short" },
12416
- limitPxHuman: { type: "string", required: true, description: "Limit price" },
12417
- szHuman: { type: "string", required: true, description: "Order size in coin units" },
12418
- marketKind: { type: "string", required: false, description: "perp (default) or spot" },
12419
- tif: { type: "string", required: false, description: "gtc, ioc, or alo" },
12420
- dex: { type: "string", required: false, description: "HIP-3 dex name when applicable" },
12421
- takeProfitTriggerPxHuman: { type: "string", required: false, description: "TP trigger \u2014 enables L1 bracket with SL" },
12422
- stopLossTriggerPxHuman: { type: "string", required: false, description: "SL trigger \u2014 enables L1 bracket with TP" },
12423
- tpslExecMode: { type: "string", required: false, description: "limit_at_trigger (default) or market" },
12424
- trailingOffsetHuman: { type: "string", required: false, description: "Trailing retracement \u2014 EIP-712 trailingStop (cannot combine with SL)" },
12425
- trailingOffsetType: { type: "string", required: false, description: "price or percentage" },
12426
- trailingActivationPxHuman: { type: "string", required: false, description: "Optional activation mark price" }
12427
- }
12428
- },
12429
- {
12430
- id: "hyperliquid.trailingStop",
12431
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12432
- chainCategory: "evm",
12433
- description: "Place a Hyperliquid perp trailing stop via L1 trailingStop action (EIP-712 /exchange)",
12434
- commonParams: ["keyGen", "purposeText"],
12435
- params: {
12436
- coin: { type: "string", required: true, description: "Perp coin" },
12437
- isBuy: { type: "boolean", required: true, description: "false closes a long / opens a short" },
12438
- szHuman: { type: "string", required: true, description: "Size in coin units" },
12439
- trailingOffsetHuman: { type: "string", required: true, description: "Retracement distance or percent" },
12440
- trailingOffsetType: { type: "string", required: false, description: "price or percentage (default)" },
12441
- trailingActivationPxHuman: { type: "string", required: false, description: "Optional activation mark price" },
12442
- reduceOnly: { type: "boolean", required: false, description: "true (default) reduces a position" }
12443
- }
12444
- },
12445
- {
12446
- id: "hyperliquid.close",
12447
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12448
- chainCategory: "evm",
12449
- description: "Close or reduce a perp via IoC reduce-only limit order (CoreWriter)",
12450
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12451
- params: {
12452
- coin: { type: "string", required: true, description: "Market coin" },
12453
- isLong: { type: "boolean", required: true, description: "true if closing a long position" },
12454
- limitPxHuman: { type: "string", required: true, description: "Limit price" },
12455
- szHuman: { type: "string", required: true, description: "Size to close in coin units" }
12456
- }
12457
- },
12458
- {
12459
- id: "hyperliquid.cancel",
12460
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12461
- chainCategory: "evm",
12462
- description: "Cancel a Hyperliquid open order via CoreWriter",
12463
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12464
- params: {
12465
- coin: { type: "string", required: true, description: "Market coin" },
12466
- oid: { type: "number", required: true, description: "Order id from openOrders" }
12467
- }
12468
- },
12469
- {
12470
- id: "hyperliquid.usdTransfer",
12471
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12472
- chainCategory: "evm",
12473
- description: "Move USDC between Hyperliquid spot and perp margin accounts",
12474
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12475
- params: {
12476
- usdHuman: { type: "string", required: true, description: "USD amount" },
12477
- toPerp: { type: "boolean", required: true, description: "true spot\u2192perp, false perp\u2192spot" }
12478
- }
12479
- },
12480
- {
12481
- id: "hyperliquid.vaultDeposit",
12482
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12483
- chainCategory: "evm",
12484
- description: "Deposit USD into a Hyperliquid vault",
12485
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12486
- params: {
12487
- vaultAddress: { type: "string", required: true, description: "Vault address" },
12488
- usdHuman: { type: "string", required: true, description: "USD amount" }
12489
- }
12490
- },
12491
- {
12492
- id: "hyperliquid.vaultWithdraw",
12493
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12494
- chainCategory: "evm",
12495
- description: "Withdraw USD from a Hyperliquid vault (includes accrued PnL)",
12496
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12497
- params: {
12498
- vaultAddress: { type: "string", required: true, description: "Vault address" },
12499
- usdHuman: { type: "string", required: true, description: "USD amount" }
12500
- }
12501
- },
12502
- {
12503
- id: "hyperliquid.stake",
12504
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12505
- chainCategory: "evm",
12506
- description: "Stake HYPE via CoreWriter",
12507
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12508
- params: {
12509
- hypeHuman: { type: "string", required: true, description: "HYPE amount" }
12510
- }
12511
- },
12512
- {
12513
- id: "hyperliquid.unstake",
12514
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12515
- chainCategory: "evm",
12516
- description: "Unstake HYPE via CoreWriter",
12517
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12518
- params: {
12519
- hypeHuman: { type: "string", required: true, description: "HYPE amount" }
12520
- }
12521
- },
12522
- {
12523
- id: "hyperliquid.delegate",
12524
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12525
- chainCategory: "evm",
12526
- description: "Delegate staked HYPE to a validator",
12527
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12528
- params: {
12529
- hypeHuman: { type: "string", required: true, description: "HYPE amount" },
12530
- validator: { type: "string", required: true, description: "Validator address" }
12531
- }
12532
- },
12533
- {
12534
- id: "hyperliquid.bridgeDeposit",
12535
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12536
- chainCategory: "evm",
12537
- description: "Deposit USDC from Arbitrum to Hyperliquid via Bridge2 (ERC20 transfer)",
12538
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12539
- params: {
12540
- usdHuman: { type: "string", required: true, description: "USDC amount (min 5)" }
12541
- }
12542
- },
12543
- {
12544
- id: "hyperliquid.bridgeWithdraw",
12545
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12546
- chainCategory: "evm",
12547
- description: "Withdraw USDC from Hyperliquid to Arbitrum via withdraw3 (EIP-712 /exchange)",
12548
- commonParams: ["keyGen", "purposeText"],
12549
- params: {
12550
- usdHuman: { type: "string", required: true, description: "USDC amount" },
12551
- destination: { type: "string", required: false, description: "Arbitrum recipient (defaults to executor)" }
12552
- }
12553
- },
12554
- {
12555
- id: "hyperliquid.updateLeverage",
12556
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12557
- chainCategory: "evm",
12558
- description: "Update per-market cross/isolated leverage via Hyperliquid L1 /exchange (EIP-712)",
12559
- commonParams: ["keyGen", "purposeText"],
12560
- params: {
12561
- coin: { type: "string", required: true, description: "Market coin e.g. BTC" },
12562
- leverage: { type: "number", required: true, description: "New leverage (1..market max)" },
12563
- isCross: { type: "boolean", required: false, description: "true for cross (default), false for isolated" },
12564
- marketKind: { type: "string", required: false, description: "perp (default) or spot" }
12565
- }
12566
- },
12567
- {
12568
- id: "hyperliquid.lend",
12569
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12570
- chainCategory: "evm",
12571
- description: "Hyperliquid Core borrow/lend via L1 /exchange EIP-712 (supply, withdraw, borrow, repay). Not CoreWriter.",
12572
- commonParams: ["keyGen", "purposeText"],
12573
- params: {
12574
- coin: { type: "string", required: true, description: "Spot token e.g. USDC, USDT, HYPE, BTC/UBTC" },
12575
- operation: { type: "string", required: true, description: "supply | withdraw | borrow | repay" },
12576
- amountHuman: { type: "string", required: false, description: "Amount; omit or max for full withdraw/repay" },
12577
- amountMax: { type: "boolean", required: false, description: "true = full amount (amount null on wire)" }
12578
- }
12579
- },
12580
- {
12581
- id: "hyperliquid.undelegate",
12582
- protocolId: HYPERLIQUID_PROTOCOL_ID,
12583
- chainCategory: "evm",
12584
- description: "Undelegate HYPE from a validator",
12585
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
12586
- params: {
12587
- hypeHuman: { type: "string", required: true, description: "HYPE amount" },
12588
- validator: { type: "string", required: true, description: "Validator address" }
12589
- }
12590
- }
12591
- ]
12592
- };
12593
- registerProtocolModule(hyperliquidProtocolModule);
12594
-
12595
- // src/protocols/evm/arcus/index.ts
12596
- init_support();
12597
- init_support();
12598
- init_constants2();
12599
- init_api();
12600
- init_constants2();
12601
- var arcusProtocolModule = {
12602
- id: ARCUS_PROTOCOL_ID,
12603
- chainCategory: "evm",
12604
- isChainSupported(ctx) {
12605
- if (ctx.chainCategory !== "evm") return false;
12606
- const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
12607
- return Number.isFinite(chainId) && isArcusChainSupported(chainId);
12608
- },
12609
- isTokenSupported(token) {
12610
- if (token.category !== "evm") return false;
12611
- return token.kind === "erc20" || token.kind === "native";
12612
- },
12613
- actions: [
12614
- {
12615
- id: "arcus.createApiKey",
12616
- protocolId: ARCUS_PROTOCOL_ID,
12617
- chainCategory: "evm",
12618
- description: "Register Arcus Ed25519 API key (secp256k1 personal_sign + paired ed25519 KeyGen)",
12619
- commonParams: ["keyGen", "purposeText"],
12620
- params: {
12621
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12622
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id (same GroupId)" },
12623
- apiWalletName: { type: "string", required: false, description: "Label for the API key" }
12624
- }
12625
- },
12626
- {
12627
- id: "arcus.placeOrder",
12628
- protocolId: ARCUS_PROTOCOL_ID,
12629
- chainCategory: "evm",
12630
- description: "Place Arcus perp order with optional TP/SL (Ed25519 payload sign)",
12631
- commonParams: ["keyGen", "purposeText"],
12632
- params: {
12633
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12634
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id" },
12635
- market: { type: "string", required: true, description: "e.g. BTC-USD" },
12636
- isBuy: { type: "boolean", required: true, description: "true for buy/long" },
12637
- limitPxHuman: { type: "string", required: true, description: "Entry limit price" },
12638
- szHuman: { type: "string", required: true, description: "Order size" },
12639
- takeProfitTriggerPxHuman: { type: "string", required: false, description: "Optional TP trigger" },
12640
- stopLossTriggerPxHuman: { type: "string", required: false, description: "Optional SL trigger" }
11587
+ sizeUsdHuman: { type: "string", required: true, description: "Position size in USD" },
11588
+ collateralToken: { type: "string", required: true, description: "Collateral token symbol e.g. USDC" },
11589
+ collateralAmountHuman: { type: "string", required: true, description: "Collateral amount in token units" }
12641
11590
  }
12642
11591
  },
12643
11592
  {
12644
- id: "arcus.spotRfq",
12645
- protocolId: ARCUS_PROTOCOL_ID,
11593
+ id: "gmx.decrease",
11594
+ protocolId: GMX_PROTOCOL_ID,
12646
11595
  chainCategory: "evm",
12647
- description: "Arcus spot Stock Token RFQ buy/sell",
12648
- commonParams: ["keyGen", "purposeText"],
11596
+ description: "Close or reduce a GMX perp position (classic on-chain order)",
11597
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
12649
11598
  params: {
12650
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12651
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id" },
12652
- ticker: { type: "string", required: true, description: "Spot ticker e.g. AAPL" },
12653
- isBuy: { type: "boolean", required: true, description: "true for buy" },
12654
- sizeHuman: { type: "string", required: true, description: "Token size" },
12655
- limitPxHuman: { type: "string", required: false, description: "Optional limit price" }
11599
+ symbol: { type: "string", required: true, description: "GMX market symbol" },
11600
+ direction: { type: "string", required: true, description: "long or short" },
11601
+ orderType: { type: "string", required: true, description: "market or limit" },
11602
+ sizeUsdHuman: { type: "string", required: true, description: "Size to close in USD" },
11603
+ collateralToken: { type: "string", required: true, description: "Position collateral token symbol" }
12656
11604
  }
12657
11605
  },
12658
11606
  {
12659
- id: "arcus.close",
12660
- protocolId: ARCUS_PROTOCOL_ID,
11607
+ id: "gmx.cancel",
11608
+ protocolId: GMX_PROTOCOL_ID,
12661
11609
  chainCategory: "evm",
12662
- description: "Close Arcus perp position with IoC reduce-only limit order",
12663
- commonParams: ["keyGen", "purposeText"],
11610
+ description: "Cancel a pending GMX order (classic on-chain)",
11611
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
12664
11612
  params: {
12665
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12666
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id" },
12667
- market: { type: "string", required: true, description: "Perp market" },
12668
- isLong: { type: "boolean", required: true, description: "true when closing a long position" },
12669
- limitPxHuman: { type: "string", required: true, description: "Limit price for IoC close" },
12670
- szHuman: { type: "string", required: true, description: "Size to close" }
11613
+ orderId: { type: "string", required: true, description: "Order key from fetchOrders" }
12671
11614
  }
12672
11615
  },
12673
11616
  {
12674
- id: "arcus.cancelOrder",
12675
- protocolId: ARCUS_PROTOCOL_ID,
11617
+ id: "gmx.gmDeposit",
11618
+ protocolId: GMX_PROTOCOL_ID,
12676
11619
  chainCategory: "evm",
12677
- description: "Cancel Arcus perp order",
12678
- commonParams: ["keyGen", "purposeText"],
11620
+ description: "Deposit collateral into a GMX v2.2c GM liquidity pool (ExchangeRouter multicall)",
11621
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
12679
11622
  params: {
12680
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12681
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id" },
12682
- market: { type: "string", required: true, description: "Perp market" },
12683
- orderId: { type: "string", required: true, description: "Server order id" }
11623
+ marketSymbol: { type: "string", required: true, description: "GM market symbol e.g. ETH/USD [WETH-USDC]" },
11624
+ collateralToken: { type: "string", required: true, description: "Pool collateral token symbol" },
11625
+ collateralAmountHuman: { type: "string", required: true, description: "Amount in token units" }
12684
11626
  }
12685
11627
  },
12686
11628
  {
12687
- id: "arcus.setLeverage",
12688
- protocolId: ARCUS_PROTOCOL_ID,
11629
+ id: "gmx.gmWithdraw",
11630
+ protocolId: GMX_PROTOCOL_ID,
12689
11631
  chainCategory: "evm",
12690
- description: "Set Arcus perp leverage for a market",
12691
- commonParams: ["keyGen", "purposeText"],
11632
+ description: "Withdraw GM market tokens from a GMX v2.2c liquidity pool",
11633
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
12692
11634
  params: {
12693
- secp256k1KeyGenId: { type: "string", required: true, description: "Custody secp256k1 KeyGen id" },
12694
- ed25519KeyGenId: { type: "string", required: true, description: "Paired ed25519 KeyGen id" },
12695
- market: { type: "string", required: true, description: "Perp market" },
12696
- leverage: { type: "number", required: true, description: "Target leverage" }
11635
+ marketSymbol: { type: "string", required: true, description: "GM market symbol" },
11636
+ gmAmountHuman: { type: "string", required: true, description: "GM token amount to withdraw" }
12697
11637
  }
12698
11638
  },
12699
11639
  {
12700
- id: "arcus.deposit",
12701
- protocolId: ARCUS_PROTOCOL_ID,
11640
+ id: "gmx.stakeGmx",
11641
+ protocolId: GMX_PROTOCOL_ID,
12702
11642
  chainCategory: "evm",
12703
- description: "Deposit USDG on Robinhood Chain into Arcus perp or spot collateral (approve + initiateDeposit). Requires registered API key.",
11643
+ description: "Stake GMX tokens via RewardRouter",
12704
11644
  commonParams: ["keyGen", "purposeText", "useCustomGas"],
12705
11645
  params: {
12706
- usdHuman: { type: "string", required: true, description: "USD amount to deposit" },
12707
- product: { type: "string", required: false, description: "perp (default) or spot" }
11646
+ amountHuman: { type: "string", required: true, description: "GMX amount to stake" }
12708
11647
  }
12709
11648
  },
12710
11649
  {
12711
- id: "arcus.withdraw",
12712
- protocolId: ARCUS_PROTOCOL_ID,
11650
+ id: "gmx.unstakeGmx",
11651
+ protocolId: GMX_PROTOCOL_ID,
12713
11652
  chainCategory: "evm",
12714
- description: "Withdraw USDG collateral from Arcus to wallet (EIP-712 + POST /v1/withdraw)",
12715
- commonParams: ["keyGen", "purposeText"],
11653
+ description: "Unstake GMX tokens via RewardRouter",
11654
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
12716
11655
  params: {
12717
- usdHuman: { type: "string", required: true, description: "USD amount to withdraw" },
12718
- product: { type: "string", required: false, description: "perp (default) or spot" }
11656
+ amountHuman: { type: "string", required: true, description: "GMX amount to unstake" }
12719
11657
  }
12720
11658
  }
12721
11659
  ]
12722
11660
  };
12723
- registerProtocolModule(arcusProtocolModule);
11661
+ registerProtocolModule(gmxProtocolModule);
12724
11662
 
12725
11663
  // src/protocols/evm/morpho/api.ts
12726
11664
  init_defiProxy();
@@ -12909,547 +11847,143 @@ async function ensureMorphoChainAssetCache(chainId) {
12909
11847
  return cache2;
12910
11848
  }
12911
11849
 
12912
- // src/protocols/evm/morpho/index.ts
12913
- init_midnightConstants();
12914
- init_midnightApi();
12915
- var MORPHO_PROTOCOL_ID = "morpho";
12916
- var morphoProtocolModule = {
12917
- id: MORPHO_PROTOCOL_ID,
12918
- chainCategory: "evm",
12919
- isChainSupported(ctx) {
12920
- return ctx.chainCategory === "evm";
12921
- },
12922
- isTokenSupported(token) {
12923
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
12924
- },
12925
- actions: [
12926
- { id: "morpho.fetch-earn-vaults", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Search Morpho-listed earn vaults by asset or name", commonParams: [], params: {} },
12927
- { id: "morpho.vault-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Deposit into Morpho-listed earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12928
- { id: "morpho.vault-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw from Morpho earn vault (V1 or V2)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12929
- { id: "morpho.blue-collateral-deposit", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Supply collateral to Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12930
- { id: "morpho.blue-supply", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Supply loan token to Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12931
- { id: "morpho.blue-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw supplied loan token from Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12932
- { id: "morpho.blue-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Borrow from Morpho Blue market", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12933
- { id: "morpho.blue-repay", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Repay Morpho Blue borrow", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12934
- { id: "morpho.blue-collateral-withdraw", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw Morpho Blue collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12935
- { id: "morpho.fetch-merkl-rewards", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List wallet-wide Merkl claimables on a chain", commonParams: [], params: {} },
12936
- { id: "morpho.merkl-claim", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Claim wallet-wide Merkl rewards", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12937
- { id: "morpho.fetch-blue-markets", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Search Morpho Blue variable-rate markets", commonParams: [], params: {} },
12938
- { id: "morpho.fetch-stock-markets", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Coinbase B20 stock-backed Morpho Blue and Midnight markets on Base", commonParams: [], params: {} },
12939
- { id: "morpho.fetch-positions", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho vault and Blue positions for a user", commonParams: [], params: {} },
12940
- { id: "morpho.fetch-midnight-books", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho Midnight fixed-rate books", commonParams: [], params: {} },
12941
- { id: "morpho.fetch-midnight-quote", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Quote Morpho Midnight lend/borrow fill", commonParams: [], params: {} },
12942
- { id: "morpho.fetch-midnight-positions", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "List Morpho Midnight user positions", commonParams: [], params: {} },
12943
- { id: "morpho.midnight-lend", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight fixed-rate lend (take asks)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12944
- { id: "morpho.midnight-lend-offer", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight lend limit offer parked in Blue until filled", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12945
- { id: "morpho.midnight-cancel-lend-offer", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Cancel a Morpho Midnight lend offer and withdraw unused Blue park", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12946
- { id: "morpho.midnight-borrow", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight fixed-rate borrow (supply collateral + take bids)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
12947
- { id: "morpho.midnight-repay", protocolId: MORPHO_PROTOCOL_ID, chainCategory: "evm", description: "Morpho Midnight repay debt and withdraw collateral", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
12948
- ]
12949
- };
12950
- registerProtocolModule(morphoProtocolModule);
12951
-
12952
- // src/protocols/evm/circle-cctp/constants.ts
12953
- var CIRCLE_CCTP_PROTOCOL_ID = "circle-cctp";
12954
- var TOKEN_MESSENGER_V2_MAINNET = "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d";
12955
- var TOKEN_MESSENGER_V2_TESTNET = "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA";
12956
- var CCTP_EVM_CHAINS = [
12957
- {
12958
- chainId: 1,
12959
- domain: 0,
12960
- network: "mainnet",
12961
- usdc: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
12962
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
12963
- label: "Ethereum"
12964
- },
12965
- {
12966
- chainId: 43114,
12967
- domain: 1,
12968
- network: "mainnet",
12969
- usdc: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
12970
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
12971
- label: "Avalanche"
12972
- },
12973
- {
12974
- chainId: 10,
12975
- domain: 2,
12976
- network: "mainnet",
12977
- usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
12978
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
12979
- label: "OP Mainnet"
12980
- },
12981
- {
12982
- chainId: 42161,
12983
- domain: 3,
12984
- network: "mainnet",
12985
- usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
12986
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
12987
- label: "Arbitrum"
12988
- },
12989
- {
12990
- chainId: 8453,
12991
- domain: 6,
12992
- network: "mainnet",
12993
- usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
12994
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
12995
- label: "Base"
12996
- },
12997
- {
12998
- chainId: 137,
12999
- domain: 7,
13000
- network: "mainnet",
13001
- usdc: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
13002
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
13003
- label: "Polygon PoS"
13004
- },
13005
- {
13006
- chainId: 11155111,
13007
- domain: 0,
13008
- network: "testnet",
13009
- usdc: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
13010
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13011
- label: "Ethereum Sepolia"
13012
- },
13013
- {
13014
- chainId: 43113,
13015
- domain: 1,
13016
- network: "testnet",
13017
- usdc: "0x5425890298aed601595a70AB815c96711a31Bc65",
13018
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13019
- label: "Avalanche Fuji"
13020
- },
13021
- {
13022
- chainId: 11155420,
13023
- domain: 2,
13024
- network: "testnet",
13025
- usdc: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7",
13026
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13027
- label: "OP Sepolia"
13028
- },
13029
- {
13030
- chainId: 421614,
13031
- domain: 3,
13032
- network: "testnet",
13033
- usdc: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
13034
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13035
- label: "Arbitrum Sepolia"
13036
- },
13037
- {
13038
- chainId: 84532,
13039
- domain: 6,
13040
- network: "testnet",
13041
- usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
13042
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13043
- label: "Base Sepolia"
13044
- },
13045
- {
13046
- chainId: 80002,
13047
- domain: 7,
13048
- network: "testnet",
13049
- usdc: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
13050
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13051
- label: "Polygon Amoy"
13052
- },
13053
- {
13054
- chainId: 5042,
13055
- domain: 26,
13056
- network: "mainnet",
13057
- usdc: "0x3600000000000000000000000000000000000000",
13058
- tokenMessenger: TOKEN_MESSENGER_V2_MAINNET,
13059
- label: "Arc"
13060
- },
13061
- {
13062
- chainId: 5042002,
13063
- domain: 26,
13064
- network: "testnet",
13065
- usdc: "0x3600000000000000000000000000000000000000",
13066
- tokenMessenger: TOKEN_MESSENGER_V2_TESTNET,
13067
- label: "Arc Testnet"
13068
- }
13069
- ];
13070
- function cctpChainConfig(chainId) {
13071
- return CCTP_EVM_CHAINS.find((c) => c.chainId === chainId) ?? null;
13072
- }
13073
- function parseCctpEvmChainId(chainId) {
13074
- if (typeof chainId === "number") {
13075
- return Number.isFinite(chainId) ? chainId : Number.NaN;
13076
- }
13077
- const t = String(chainId).trim();
13078
- if (!t) return Number.NaN;
13079
- const low = t.toLowerCase();
13080
- if (low.startsWith("eip155:")) {
13081
- const n2 = Number.parseInt(t.slice("eip155:".length).trim(), 10);
13082
- return Number.isFinite(n2) ? n2 : Number.NaN;
13083
- }
13084
- if (low.startsWith("0x")) {
13085
- const n2 = Number.parseInt(t, 16);
13086
- return Number.isFinite(n2) ? n2 : Number.NaN;
13087
- }
13088
- const n = Number.parseInt(t, 10);
13089
- return Number.isFinite(n) ? n : Number.NaN;
13090
- }
13091
- function isCctpSourceChainSupported(chainId) {
13092
- const n = parseCctpEvmChainId(chainId);
13093
- return Number.isFinite(n) && cctpChainConfig(n) != null;
13094
- }
11850
+ // src/protocols/evm/hyperliquid/support.ts
11851
+ var HYPERLIQUID_SUPPORTED_CHAIN_IDS = [999, 998];
13095
11852
 
13096
- // src/protocols/evm/circle-cctp/index.ts
13097
- var circleCctpProtocolModule = {
13098
- id: CIRCLE_CCTP_PROTOCOL_ID,
13099
- chainCategory: "evm",
13100
- isChainSupported(ctx) {
13101
- if (ctx.chainCategory !== "evm") return false;
13102
- return isCctpSourceChainSupported(ctx.chainId);
13103
- },
13104
- isTokenSupported(token) {
13105
- return token.category === "evm" && token.kind === "erc20";
13106
- },
13107
- actions: [
13108
- {
13109
- id: "circle-cctp.fetch-routes",
13110
- protocolId: CIRCLE_CCTP_PROTOCOL_ID,
13111
- chainCategory: "evm",
13112
- description: "List supported CCTP Forwarding Service routes (EVM)",
13113
- commonParams: [],
13114
- params: {
13115
- network: { type: "string", required: false, description: "mainnet | testnet" }
13116
- }
13117
- },
13118
- {
13119
- id: "circle-cctp.fetch-fees",
13120
- protocolId: CIRCLE_CCTP_PROTOCOL_ID,
13121
- chainCategory: "evm",
13122
- description: "Quote Iris forwarding fee plus fast-transfer protocol fee for a route",
13123
- commonParams: [],
13124
- params: {
13125
- sourceChainId: { type: "number", required: true, description: "Source EIP-155 chain id" },
13126
- destChainId: { type: "number", required: true, description: "Destination EIP-155 chain id" },
13127
- transferAmountHuman: { type: "string", required: true, description: "USDC amount recipient receives" }
13128
- }
13129
- },
13130
- {
13131
- id: "circle-cctp.burn-forward",
13132
- protocolId: CIRCLE_CCTP_PROTOCOL_ID,
13133
- chainCategory: "evm",
13134
- description: "Burn USDC on source chain via CCTP Forwarding Service (approve + depositForBurnWithHook batch)",
13135
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13136
- params: {
13137
- sourceChainId: { type: "number", required: true, description: "Source EIP-155 chain id" },
13138
- destChainId: { type: "number", required: true, description: "Destination EIP-155 chain id" },
13139
- transferAmountHuman: { type: "string", required: true, description: "USDC amount recipient receives" },
13140
- mintRecipient: { type: "address", required: false, description: "Destination mint recipient (default executor)" }
13141
- }
13142
- }
13143
- ]
13144
- };
13145
- registerProtocolModule(circleCctpProtocolModule);
11853
+ // src/protocols/evm/arcus/support.ts
11854
+ var ARCUS_SUPPORTED_CHAIN_IDS = [4663];
13146
11855
  var VENICE_PROTOCOL_ID = "venice";
13147
11856
  var VENICE_BASE_CHAIN_ID = 8453;
13148
11857
  var VVV_BASE = "0xacfE6019Ed1A7Dc6f7B508C02d1b04ec88cC21bf";
13149
11858
  var DIEM_BASE = "0xF4d97F2da56e8c3098f3a8D538DB630A2606a024";
13150
- function isVeniceBaseChain(chainId) {
13151
- return chainId === VENICE_BASE_CHAIN_ID;
13152
- }
13153
-
13154
- // src/protocols/evm/venice/index.ts
13155
- var veniceProtocolModule = {
13156
- id: VENICE_PROTOCOL_ID,
13157
- chainCategory: "evm",
13158
- isChainSupported(ctx) {
13159
- if (ctx.chainCategory !== "evm") return false;
13160
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
13161
- return isVeniceBaseChain(n);
13162
- },
13163
- isTokenSupported(token) {
13164
- return token.category === "evm" && token.kind === "erc20";
13165
- },
13166
- actions: [
13167
- {
13168
- id: "venice.stake-vvv",
13169
- protocolId: VENICE_PROTOCOL_ID,
13170
- chainCategory: "evm",
13171
- description: "Stake VVV \u2192 sVVV on Base",
13172
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13173
- params: { amountHuman: { type: "string", required: true, description: "VVV amount" } }
13174
- },
13175
- {
13176
- id: "venice.initiate-unstake-svvv",
13177
- protocolId: VENICE_PROTOCOL_ID,
13178
- chainCategory: "evm",
13179
- description: "Start sVVV unstake (7-day cooldown)",
13180
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13181
- params: { amountHuman: { type: "string", required: true, description: "sVVV amount" } }
13182
- },
13183
- {
13184
- id: "venice.complete-unstake-svvv",
13185
- protocolId: VENICE_PROTOCOL_ID,
13186
- chainCategory: "evm",
13187
- description: "Claim VVV after sVVV unstake cooldown",
13188
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13189
- params: {}
13190
- },
13191
- {
13192
- id: "venice.mint-diem",
13193
- protocolId: VENICE_PROTOCOL_ID,
13194
- chainCategory: "evm",
13195
- description: "Lock sVVV and mint DIEM",
13196
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13197
- params: {
13198
- svvvLockAmountHuman: { type: "string", required: true, description: "sVVV to lock" },
13199
- slippageBps: { type: "number", required: false, description: "Min DIEM slippage bps (default 50)" }
13200
- }
13201
- },
13202
- {
13203
- id: "venice.burn-diem",
13204
- protocolId: VENICE_PROTOCOL_ID,
13205
- chainCategory: "evm",
13206
- description: "Burn DIEM to unlock locked sVVV",
13207
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13208
- params: { amountHuman: { type: "string", required: true, description: "DIEM to burn" } }
13209
- },
13210
- {
13211
- id: "venice.stake-diem",
13212
- protocolId: VENICE_PROTOCOL_ID,
13213
- chainCategory: "evm",
13214
- description: "Stake DIEM for Venice API credits ($1/day per DIEM)",
13215
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13216
- params: { amountHuman: { type: "string", required: true, description: "DIEM amount" } }
13217
- },
13218
- {
13219
- id: "venice.initiate-unstake-diem",
13220
- protocolId: VENICE_PROTOCOL_ID,
13221
- chainCategory: "evm",
13222
- description: "Start DIEM unstake (1-day cooldown)",
13223
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13224
- params: { amountHuman: { type: "string", required: true, description: "Staked DIEM amount" } }
13225
- },
13226
- {
13227
- id: "venice.complete-unstake-diem",
13228
- protocolId: VENICE_PROTOCOL_ID,
13229
- chainCategory: "evm",
13230
- description: "Claim DIEM after unstake cooldown",
13231
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13232
- params: {}
13233
- }
13234
- ]
13235
- };
13236
- registerProtocolModule(veniceProtocolModule);
13237
-
13238
- // src/protocols/evm/aerodrome/index.ts
13239
- init_support2();
13240
- init_support2();
13241
- init_addresses();
13242
- init_stockTokens();
13243
- init_discover();
13244
- init_yields();
13245
- var aerodromeProtocolModule = {
13246
- id: AERODROME_PROTOCOL_ID,
13247
- chainCategory: "evm",
13248
- isChainSupported(ctx) {
13249
- if (ctx.chainCategory !== "evm") return false;
13250
- return isAerodromeChainSupported(ctx.chainId);
13251
- },
13252
- isTokenSupported(token) {
13253
- if (token.category !== "evm") return false;
13254
- return token.kind === "native" || token.kind === "erc20";
13255
- },
13256
- actions: [
13257
- {
13258
- id: "aerodrome.quote",
13259
- protocolId: AERODROME_PROTOCOL_ID,
13260
- chainCategory: "evm",
13261
- description: "Quote an Aero swap (protocol id aerodrome) via factory discovery and pool getAmountOut / Metaquoter. Base 8453 by default; also Ethereum, OP Mainnet, Arbitrum, Robinhood, Arc, and Ink. Tickers (AAPLc, USDC, ETH) accepted. Stock tickers are Base only.",
13262
- commonParams: [],
13263
- params: {
13264
- chainId: { type: "number", required: true, description: "Aero chain: 8453 (Base, default), 1, 10, 42161, 4663, 5042, or 57073." },
13265
- tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
13266
- tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
13267
- amountHuman: { type: "string", required: true, description: "Human-readable input amount (B20 stocks are 8 decimals)" }
13268
- }
13269
- },
13270
- {
13271
- id: "aerodrome.swap",
13272
- protocolId: AERODROME_PROTOCOL_ID,
13273
- chainCategory: "evm",
13274
- description: "Swap via Aerodrome Router / Slipstream SwapRouter (optional ERC-20 approve batch)",
13275
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13276
- params: {
13277
- tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
13278
- tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
13279
- amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
13280
- slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
13281
- }
13282
- },
13283
- {
13284
- id: "aerodrome.add-liquidity",
13285
- protocolId: AERODROME_PROTOCOL_ID,
13286
- chainCategory: "evm",
13287
- description: "Deposit into a basic vAMM/sAMM pool (one-sided amounts; tickers OK)",
13288
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13289
- params: {
13290
- tokenA: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
13291
- tokenB: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
13292
- stable: { type: "boolean", required: true, description: "true = sAMM, false = vAMM" },
13293
- amountAHuman: { type: "string", required: false, description: "Amount A; omit to solve from B" },
13294
- amountBHuman: { type: "string", required: false, description: "Amount B; omit to solve from A" },
13295
- slippagePercent: { type: "number", required: true, description: "Slippage percent" }
13296
- }
13297
- },
13298
- {
13299
- id: "aerodrome.remove-liquidity",
13300
- protocolId: AERODROME_PROTOCOL_ID,
13301
- chainCategory: "evm",
13302
- description: "Withdraw from a basic vAMM/sAMM pool",
13303
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13304
- params: {
13305
- lpToken: { type: "address", required: true, description: "LP token" },
13306
- liquidityHuman: { type: "string", required: true, description: "LP amount" }
13307
- }
13308
- },
13309
- {
13310
- id: "aerodrome.cl-mint",
13311
- protocolId: AERODROME_PROTOCOL_ID,
13312
- chainCategory: "evm",
13313
- description: "Mint a Slipstream concentrated liquidity NFT",
13314
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13315
- params: {
13316
- token0: { type: "address", required: true, description: "Token0" },
13317
- token1: { type: "address", required: true, description: "Token1" },
13318
- tickSpacing: { type: "number", required: true, description: "Pool tick spacing" },
13319
- tickLower: { type: "number", required: true, description: "Lower tick" },
13320
- tickUpper: { type: "number", required: true, description: "Upper tick" }
13321
- }
13322
- },
13323
- {
13324
- id: "aerodrome.gauge-stake",
13325
- protocolId: AERODROME_PROTOCOL_ID,
13326
- chainCategory: "evm",
13327
- description: "Stake basic LP tokens or a Slipstream NFT in a gauge",
13328
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13329
- params: {
13330
- gauge: { type: "address", required: true, description: "Gauge address" }
13331
- }
13332
- },
13333
- {
13334
- id: "aerodrome.claim-fees",
13335
- protocolId: AERODROME_PROTOCOL_ID,
13336
- chainCategory: "evm",
13337
- description: "Claim unstaked fees from the pool (not the gauge)",
13338
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13339
- params: { pool: { type: "address", required: true, description: "Pool lp from fetch_positions claimFees.pool" } }
13340
- },
13341
- {
13342
- id: "aerodrome.claim-emissions",
13343
- protocolId: AERODROME_PROTOCOL_ID,
13344
- chainCategory: "evm",
13345
- description: "Claim gauge emissions in AERO (not the pool)",
13346
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
13347
- params: { gauge: { type: "address", required: true, description: "Gauge from fetch_positions claimEmissions" } }
13348
- }
13349
- ]
11859
+ var AERODROME_PROTOCOL_ID = "aerodrome";
11860
+ var AERODROME_CHAIN_ID = 8453;
11861
+ var AERO_CHAIN_IDS = [8453, 1, 10, 42161, 4663, 5042, 57073];
11862
+ var AERO_CHAIN_LABEL = {
11863
+ 1: "Ethereum",
11864
+ 10: "OP Mainnet",
11865
+ 42161: "Arbitrum",
11866
+ 4663: "Robinhood Chain",
11867
+ 5042: "Arc",
11868
+ 8453: "Base",
11869
+ 57073: "Ink"
13350
11870
  };
13351
- registerProtocolModule(aerodromeProtocolModule);
13352
-
13353
- // src/protocols/evm/continuum-dao/index.ts
13354
- init_constants();
13355
-
13356
- // src/protocols/evm/continuum-dao/marketplaceModule.ts
13357
- init_constants();
13358
- var common = ["keyGen", "purposeText", "useCustomGas"];
13359
- var continuumDaoMarketplaceProtocolModule = {
13360
- id: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID,
13361
- chainCategory: "evm",
13362
- isChainSupported(ctx) {
13363
- if (ctx.chainCategory !== "evm") return false;
13364
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
13365
- return n === CONTINUUM_DAO_LINEA_CHAIN_ID;
13366
- },
13367
- isTokenSupported(token) {
13368
- return token.category === "evm" && (token.kind === "erc20" || token.kind === "erc721");
13369
- },
13370
- actions: [
13371
- { id: "continuum-dao-marketplace.fetch-config", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Marketplace payment tokens, durations, and fees", commonParams: [], params: {} },
13372
- { id: "continuum-dao-marketplace.search", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Rank veCTMs for sale by price, locked CTM, or unlock time", commonParams: [], params: {} },
13373
- { id: "continuum-dao-marketplace.fee-alternative", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "One qualifying direct listing beside 12 times the KeyGen monthly fee", commonParams: [], params: {} },
13374
- { id: "continuum-dao-marketplace.fetch-listings", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Open listings, or past sales when includeInactive is set", commonParams: [], params: {} },
13375
- { id: "continuum-dao-marketplace.fetch-offerings", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Open offerings, or closed offers when includeInactive is set", commonParams: [], params: {} },
13376
- { id: "continuum-dao-marketplace.fetch-auctions", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Live auctions, or settled auctions when includeInactive is set. Each row includes bids.", commonParams: [], params: {} },
13377
- { id: "continuum-dao-marketplace.fetch-token", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "One veCTM: live orders plus history of sales and auctions", commonParams: [], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13378
- { id: "continuum-dao-marketplace.fetch-activity", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "An address\u2019s sales, buys, and auctions including bids", commonParams: [], params: { address: { type: "string", required: true, description: "KeyGen or wallet" } } },
13379
- { id: "continuum-dao-marketplace.fetch-fee-preview", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Protocol fee for a price and veCTM", commonParams: [], params: {} },
13380
- { id: "continuum-dao-marketplace.create-listing", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Approve veCTM if needed and create a listing", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" }, askWei: { type: "string", required: true, description: "Ask in payment-token wei" } } },
13381
- { id: "continuum-dao-marketplace.delist", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Delist an open listing", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13382
- { id: "continuum-dao-marketplace.fulfill-listing", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Buy a listed veCTM", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13383
- { id: "continuum-dao-marketplace.create-offering", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Make an offering on a veCTM", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13384
- { id: "continuum-dao-marketplace.rescind", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Rescind an open offering", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13385
- { id: "continuum-dao-marketplace.fulfill-offering", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Accept an offering on a veCTM you own", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13386
- { id: "continuum-dao-marketplace.create-auction", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Escrow a veCTM into an auction", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13387
- { id: "continuum-dao-marketplace.cancel-auction", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Cancel a pending auction with no bids", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13388
- { id: "continuum-dao-marketplace.auction-bid", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Bid on a live auction", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13389
- { id: "continuum-dao-marketplace.settle-auction", protocolId: CONTINUUM_DAO_MARKETPLACE_PROTOCOL_ID, chainCategory: "evm", description: "Settle a completed or expired auction", commonParams: [...common], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } }
13390
- ]
11871
+ function isAerodromeChainSupported(chainId) {
11872
+ const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
11873
+ return AERO_CHAIN_IDS.includes(n);
11874
+ }
11875
+ function aerodromeUnsupportedChainMessage(chainId) {
11876
+ const listed = AERO_CHAIN_IDS.map((id) => `${AERO_CHAIN_LABEL[id]} ${id}`).join(", ");
11877
+ return `Aero is not deployed on chain ${chainId}. Launch chains: ${listed}.`;
11878
+ }
11879
+ var AERODROME_BASE_ADDRESSES_FALLBACK = {
11880
+ router: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
11881
+ rewardsDistributor: "0x227f65131A261548b057215bB1D5Ab2997964C7d",
11882
+ universalRouter: "0x6Cb442acF35158D5eDa88fe602221b67B400Be3E",
11883
+ pricesOracle: "0xee717411f6E44F9feE011835C8E6FAaC5dEfF166",
11884
+ slipstreamHelper: "0x0AD09A66af0154a84e86F761313d02d0abB6edd5",
11885
+ lpSugar: "0x69dD9db6d8f8E7d83887A704f447b1a584b599A1",
11886
+ sugarSlipstreamHelper: "0x9c62ab10577fB3C20A22E231b7703Ed6D456CC7a",
11887
+ swapper: "0x91616a7B9CF6D23f8C17845581051EBdC4BcB916"};
11888
+ var AERO_TOKEN_BASE = "0x3f5bF3EdAc59d650D8fDf9657a71F2f904A3a4Ee";
11889
+ var AERO_METAROUTER = "0x0fEf9e88A7b76BCDBF451780C6774FE32965Ee98";
11890
+ var AERO_METAQUOTER = "0x1dDfeC5058180C207F55BB77D95AcDd0d8227868";
11891
+ var AERO_STABLE_POOL_FACTORY = "0x78589E876edcEbdce72ee3436ab3c9AD3a7cEF2D";
11892
+ var AERO_VOLATILE_POOL_FACTORY = "0x8E6a9FCd1d638CC760Ffba397605Fe3355dE76D2";
11893
+ var AERO_NFPM = "0x4857DB576eE0e45F10525eC59527BfD10beeC60b";
11894
+ var AERO_SWAP_ROUTER = "0x9Ee35Bf1bd69a03c6F0393582030fCe8Bb93D418";
11895
+ var AERO_LEAF_VOTER = "0x382409fad8503FbCdbB27A4211551fa03e884078";
11896
+ var AERO_RECEIPT_BY_CHAIN = {
11897
+ 8453: "0x6CdDa0E730744DC6fF67654B35350Adad05EceE7",
11898
+ 10: "0xbdEaeA5205d16f34Cb40038052d91235D87B4C54",
11899
+ 42161: "0x436a085B2751cB87db270FFa66f8d698F87bEC82",
11900
+ 1: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
11901
+ 57073: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
11902
+ 4663: "0x9e148C5716b5aAdCFD3B71cEAE9EE7a9e22C29E2",
11903
+ 5042: "0x20077cC0d5E385A0Fe9C91bbC7DC744f51559307"
13391
11904
  };
13392
-
13393
- // src/protocols/evm/continuum-dao/index.ts
13394
- init_constants();
13395
- init_committeeList();
13396
- init_proposalCatalog();
13397
- init_governance();
13398
- init_simulateProposal();
13399
- init_foundryProposalScript();
13400
- init_explainProposal();
13401
- init_forum();
13402
- registerProtocolModule(continuumDaoMarketplaceProtocolModule);
13403
- var continuumDaoProtocolModule = {
13404
- id: CONTINUUM_DAO_PROTOCOL_ID,
13405
- chainCategory: "evm",
13406
- isChainSupported(ctx) {
13407
- if (ctx.chainCategory !== "evm") return false;
13408
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
13409
- return isContinuumDaoSupportedChainId(n);
13410
- },
13411
- isTokenSupported(token) {
13412
- return token.category === "evm" && (token.kind === "erc20" || token.kind === "erc721");
13413
- },
13414
- actions: [
13415
- { id: "continuum-dao.create-lock", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Approve CTM + create_lock", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { amountHuman: { type: "string", required: true, description: "CTM amount" }, lockDurationSeconds: { type: "string", required: true, description: "Lock duration in seconds" } } },
13416
- { id: "continuum-dao.increase-amount", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Increase lock amount", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "veCTM token id" }, amountHuman: { type: "string", required: true, description: "CTM amount to add" } } },
13417
- { id: "continuum-dao.increase-unlock-time", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Increase unlock time", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "veCTM token id" }, lockDurationSeconds: { type: "string", required: true, description: "Duration from week boundary to new unlock" } } },
13418
- { id: "continuum-dao.split", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Split a veCTM lock", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "Source token id" }, extractedHuman: { type: "string", required: true, description: "CTM extracted into the new lock" } } },
13419
- { id: "continuum-dao.merge", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Merge two veCTM locks", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { fromTokenId: { type: "string", required: true, description: "Burned token id" }, toTokenId: { type: "string", required: true, description: "Surviving token id" } } },
13420
- { id: "continuum-dao.withdraw", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Withdraw an expired lock", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13421
- { id: "continuum-dao.liquidate", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Liquidate a lock", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "veCTM token id" } } },
13422
- { id: "continuum-dao.delegate", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Delegate voting power", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { delegatee: { type: "string", required: true, description: "Delegatee address" } } },
13423
- { id: "continuum-dao.undelegate", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Return voting power to the KeyGen (delegate to self)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
13424
- { id: "continuum-dao.fetch-delegates", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Read VotingEscrow.delegates(account)", commonParams: [], params: { account: { type: "string", required: true, description: "KeyGen or wallet address" } } },
13425
- { id: "continuum-dao.transfer", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Transfer a veCTM NFT", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "veCTM token id" }, to: { type: "string", required: true, description: "Recipient" } } },
13426
- { id: "continuum-dao.attach", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Attach veCTM to the node (authority KeyGen). groupId is implicit from that KeyGen and binds the fee waiver. A second group attaches after rotating authority.", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { nodeKey: { type: "string", required: true, description: "Node key" }, tokenId: { type: "string", required: true, description: "veCTM token id" }, mpaWallet: { type: "string", required: true, description: "MultiSignAgentWallet address" } } },
13427
- { id: "continuum-dao.request-detach", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Request governance detach", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { tokenId: { type: "string", required: true, description: "Attached token id" }, nodeProperties: { type: "string", required: true, description: "NodeProperties address" } } },
13428
- { id: "continuum-dao.propose-bravo", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Propose a Bravo (For/Against/Abstain) proposal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { title: { type: "string", required: true, description: "On-chain description (title)" }, forumKey: { type: "string", required: true, description: "Created forum thread URL from forum_create_topic" } } },
13429
- { id: "continuum-dao.propose-delta", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Propose a Delta multi-option proposal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { title: { type: "string", required: true, description: "On-chain description (title)" }, nWinners: { type: "number", required: true, description: "Winning options to execute" }, forumKey: { type: "string", required: true, description: "Created forum thread URL from forum_create_topic" } } },
13430
- { id: "continuum-dao.simulate-proposal", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Dry-run a Bravo/Delta proposal; returns sequential Foundry forge scripts (not isolated eth_call)", commonParams: [], params: { account: { type: "string", required: false, description: "Proposer EOA; defaults to KeyGen when keyGenId is set" }, configuration: { type: "string", required: true, description: "bravo or delta" } } },
13431
- { id: "continuum-dao.compose-proposal-action", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Look up a contract function ABI, type-check parameter values, and preview a Bravo/Delta draft table", commonParams: [], params: { target: { type: "string", required: false, description: "Action contract address" }, functionName: { type: "string", required: false, description: "Function name or signature" }, configuration: { type: "string", required: false, description: "bravo or delta for preview" } } },
13432
- { id: "continuum-dao.cast-vote-bravo", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Cast a Bravo vote", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { proposalId: { type: "string", required: true, description: "Catalog id or governor proposal hash" }, support: { type: "number", required: true, description: "0 against, 1 for, 2 abstain" } } },
13433
- { id: "continuum-dao.cast-vote-delta", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Cast a Delta vote including NOTA", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { proposalId: { type: "string", required: true, description: "Catalog id or governor proposal hash" } } },
13434
- { id: "continuum-dao.execute", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Execute a succeeded proposal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { proposalId: { type: "string", required: true, description: "Catalog id or governor proposal hash" } } },
13435
- { id: "continuum-dao.cancel", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Cancel a proposal", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: { proposalId: { type: "string", required: true, description: "Catalog id or governor proposal hash" } } },
13436
- { id: "continuum-dao.fetch-live-proposals", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "List live/pending/succeeded proposals with on-chain state overlay", commonParams: [], params: { chainId: { type: "number", required: false, description: "Linea chain id" }, rpcUrl: { type: "string", required: false, description: "Linea RPC for state overlay" } } },
13437
- { id: "continuum-dao.explain-proposal", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Deconstruct a proposal into a readable briefing (actions, C3, no-ops, risks)", commonParams: [], params: { id: { type: "string", required: false, description: "Backend proposal id" }, onchainId: { type: "string", required: false, description: "Governor proposal id" } } },
13438
- { id: "continuum-dao.fetch-proposal-votes", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Who voted on a proposal and how (VoteCast / VoteCastWithParams)", commonParams: [], params: { proposalId: { type: "string", required: true, description: "Catalog id or governor proposal hash" } } },
13439
- { id: "continuum-dao.forum-sign-in", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "EIP-712 forum login (veCTM gate first)", commonParams: ["keyGen", "purposeText"], params: { nodeKey: { type: "string", required: false, description: "Attached node key" }, username: { type: "string", required: false, description: "Username when there is no node key" } } },
13440
- { id: "continuum-dao.forum-sign-in-eligible", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Check veCTM forum login eligibility", commonParams: [], params: { address: { type: "string", required: true, description: "KeyGen or wallet address" } } },
13441
- { id: "continuum-dao.forum-sign-out", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Revoke forum ticket and sessions", commonParams: [], params: { ticket: { type: "string", required: true, description: "Forum write ticket" } } },
13442
- { id: "continuum-dao.forum-create-topic", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Create a Governance proposal thread (not Ideas)", commonParams: [], params: { section: { type: "string", required: false, description: "decision | election | treasury | constitution | admin" }, title: { type: "string", required: true, description: "Thread title" }, content: { type: "string", required: true, description: "Proposal body" } } },
13443
- { id: "continuum-dao.forum-create-idea", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Post an Idea or Suggestion (not a proposal)", commonParams: [], params: { title: { type: "string", required: true, description: "Thread title" }, content: { type: "string", required: true, description: "Idea body" } } },
13444
- { id: "continuum-dao.forum-search", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Search forum titles and bodies; optional hours/since", commonParams: [], params: { query: { type: "string", required: false, description: "Case-insensitive title or body substring" }, hours: { type: "number", required: false, description: "Only posts from the last X hours" }, since: { type: "string", required: false, description: "Only posts since this ISO date or unix timestamp" } } },
13445
- { id: "continuum-dao.forum-recent", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "List recent readable posts (id, title, username, createdAt); requires hours or since", commonParams: [], params: { hours: { type: "number", required: false, description: "Only posts from the last X hours" }, since: { type: "string", required: false, description: "Only posts since this ISO date or unix timestamp" } } },
13446
- { id: "continuum-dao.forum-delete", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Admin/moderator soft-delete a post, thread, or a user\u2019s posts", commonParams: [], params: { pid: { type: "string", required: false, description: "Post id" }, tid: { type: "string", required: false, description: "Thread id" }, username: { type: "string", required: false, description: "Delete all posts by this user" }, hours: { type: "number", required: false, description: "Only in the last X hours (default all)" }, since: { type: "string", required: false, description: "Only since this date (default all)" } } },
13447
- { id: "continuum-dao.forum-unread", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "List unread topics for the logged-in user", commonParams: [], params: { filter: { type: "string", required: false, description: "all | new | watched | unreplied" } } },
13448
- { id: "continuum-dao.forum-mark-read", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Mark topic(s) read (tid/url, tids, or all)", commonParams: [], params: { tid: { type: "string", required: false, description: "Thread id" }, all: { type: "boolean", required: false, description: "Mark every unread topic read" } } },
13449
- { id: "continuum-dao.forum-mark-unread", protocolId: CONTINUUM_DAO_PROTOCOL_ID, chainCategory: "evm", description: "Mark one topic unread", commonParams: [], params: { tid: { type: "string", required: false, description: "Thread id" } } }
13450
- ]
11905
+ var AERO_FACTORY_REGISTRY_BY_CHAIN = {
11906
+ 8453: "0x7b2A2c12dC5Ea2a31455952a05031C3E4BB28F3E",
11907
+ 10: "0xb6F9705A631CC1C0E8570FFde48882C95E2Df408",
11908
+ 42161: "0x9E635b2c689fC52201DF7eF1C9FA607c2F58f666",
11909
+ 1: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
11910
+ 57073: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
11911
+ 4663: "0xdd1705e23762F4D6e44D8C31BD8Ea80c54612239",
11912
+ 5042: "0xCe44907DC45D3BFa3f5f6035B0e6E8B22D780A42"
13451
11913
  };
13452
- registerProtocolModule(continuumDaoProtocolModule);
11914
+ var AERO_CL_FACTORY_BY_CHAIN = {
11915
+ 8453: "0x9CB220581b91b0C83223012FE69688b92aD07a76",
11916
+ 10: "0xfeaB42D90055db3a0616249f76B6002D72266778",
11917
+ 42161: "0x88a60ee77392577c355C0acb2A8d476D5a4EC03a",
11918
+ 1: "0xF4Fd2E6c5B60c5b365cd1B96DD6245E6D60414c2",
11919
+ 57073: "0x7660BF2aDefC687C22906112ca323d60A00358cF",
11920
+ 4663: "0xc63d7338c178e805c544B8f897066bD3BBcBE136",
11921
+ 5042: "0x7F83235643181E440433400a027618Cd50879751"
11922
+ };
11923
+ var OP_STACK_WETH = "0x4200000000000000000000000000000000000006";
11924
+ var AERO_WETH_BY_CHAIN = {
11925
+ 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
11926
+ 10: OP_STACK_WETH,
11927
+ 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
11928
+ 8453: OP_STACK_WETH,
11929
+ 57073: OP_STACK_WETH,
11930
+ 4663: "0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73"
11931
+ };
11932
+ var AERO_USDC_BY_CHAIN = {
11933
+ 1: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
11934
+ 10: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
11935
+ 42161: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
11936
+ 8453: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
11937
+ };
11938
+ function addr(raw) {
11939
+ return viem.getAddress(raw);
11940
+ }
11941
+ function aeroUsdcAddress(chainId) {
11942
+ const raw = AERO_USDC_BY_CHAIN[chainId];
11943
+ return raw ? addr(raw) : null;
11944
+ }
11945
+ function aeroWrappedNativeAddress(chainId) {
11946
+ const raw = AERO_WETH_BY_CHAIN[chainId];
11947
+ return raw ? addr(raw) : null;
11948
+ }
11949
+ function aeroAddressesForChain(chainId) {
11950
+ const fb = AERODROME_BASE_ADDRESSES_FALLBACK;
11951
+ const cl = addr(AERO_CL_FACTORY_BY_CHAIN[chainId] ?? AERO_CL_FACTORY_BY_CHAIN[AERODROME_CHAIN_ID]);
11952
+ const receipt = addr(AERO_RECEIPT_BY_CHAIN[chainId] ?? AERO_RECEIPT_BY_CHAIN[AERODROME_CHAIN_ID]);
11953
+ const weth = aeroWrappedNativeAddress(chainId) ?? addr("0x0000000000000000000000000000000000000000");
11954
+ const token = chainId === AERODROME_CHAIN_ID ? addr(AERO_TOKEN_BASE) : receipt;
11955
+ return {
11956
+ chainId,
11957
+ aero: token,
11958
+ router: chainId === AERODROME_CHAIN_ID ? addr(fb.router) : addr(AERO_METAROUTER),
11959
+ poolFactory: addr(AERO_VOLATILE_POOL_FACTORY),
11960
+ factoryRegistry: addr(AERO_FACTORY_REGISTRY_BY_CHAIN[chainId] ?? AERO_FACTORY_REGISTRY_BY_CHAIN[AERODROME_CHAIN_ID]),
11961
+ voter: addr(AERO_LEAF_VOTER),
11962
+ votingEscrow: addr("0xBF7977E1521e9a3032bf7243Ee4712f311f13915"),
11963
+ rewardsDistributor: addr(fb.rewardsDistributor),
11964
+ mixedQuoter: addr(AERO_METAQUOTER),
11965
+ mixedQuoterV3: addr(AERO_METAQUOTER),
11966
+ nfpm: addr(AERO_NFPM),
11967
+ clFactory: cl,
11968
+ clFactory2: cl,
11969
+ clFactory3: cl,
11970
+ universalRouter: addr(fb.universalRouter),
11971
+ swapRouter: addr(AERO_SWAP_ROUTER),
11972
+ swapRouter2: addr(AERO_SWAP_ROUTER),
11973
+ swapRouter3: addr(AERO_SWAP_ROUTER),
11974
+ pricesOracle: addr(fb.pricesOracle),
11975
+ slipstreamHelper: addr(fb.slipstreamHelper),
11976
+ lpSugar: chainId === AERODROME_CHAIN_ID ? addr(fb.lpSugar) : addr("0x0000000000000000000000000000000000000000"),
11977
+ sugarSlipstreamHelper: addr(fb.sugarSlipstreamHelper),
11978
+ swapper: addr(fb.swapper),
11979
+ weth,
11980
+ stablePoolFactory: addr(AERO_STABLE_POOL_FACTORY),
11981
+ volatilePoolFactory: addr(AERO_VOLATILE_POOL_FACTORY),
11982
+ metarouter: addr(AERO_METAROUTER),
11983
+ metaquoter: addr(AERO_METAQUOTER),
11984
+ receiptToken: receipt
11985
+ };
11986
+ }
13453
11987
  var COMPOUND_V3_PROTOCOL_ID = "compound-v3";
13454
11988
  var COMPOUND_V3_CHAIN_IDS = [1, 8453, 42161, 10, 137, 5e3, 130, 59144];
13455
11989
  var COMPOUND_V3_WRAPPED_NATIVE = {
@@ -13858,9 +12392,6 @@ async function fetchCompoundV3SubgraphMarkets(args) {
13858
12392
  return null;
13859
12393
  }
13860
12394
  }
13861
-
13862
- // src/protocols/evm/compound-v3/reads.ts
13863
- init_defiEvmClient();
13864
12395
  function publicClient(rpcUrl, chainId) {
13865
12396
  const chain = viem.defineChain({
13866
12397
  id: chainId,
@@ -14082,61 +12613,221 @@ async function ensureCompoundV3ChainAssetCache(args) {
14082
12613
  return map;
14083
12614
  }
14084
12615
 
14085
- // src/protocols/evm/compound-v3/index.ts
14086
- var compoundV3ProtocolModule = {
14087
- id: COMPOUND_V3_PROTOCOL_ID,
14088
- chainCategory: "evm",
14089
- isChainSupported(ctx) {
14090
- const id = typeof ctx.chainId === "string" ? Number(ctx.chainId) : ctx.chainId;
14091
- return ctx.chainCategory === "evm" && isCompoundV3ChainSupported(id);
14092
- },
14093
- isTokenSupported(token) {
14094
- return token.category === "evm" && (token.kind === "native" || token.kind === "erc20");
14095
- },
14096
- actions: [
14097
- {
14098
- id: "compound-v3.supply",
14099
- protocolId: COMPOUND_V3_PROTOCOL_ID,
14100
- chainCategory: "evm",
14101
- description: "Supply base (earn/repay) or collateral to a Comet proxy",
14102
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14103
- params: {}
14104
- },
14105
- {
14106
- id: "compound-v3.withdraw",
14107
- protocolId: COMPOUND_V3_PROTOCOL_ID,
14108
- chainCategory: "evm",
14109
- description: "Withdraw collateral or base (withdraw of base while undercollateralized = borrow)",
14110
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14111
- params: {}
14112
- },
14113
- {
14114
- id: "compound-v3.repay",
14115
- protocolId: COMPOUND_V3_PROTOCOL_ID,
14116
- chainCategory: "evm",
14117
- description: "Repay base debt by supplying base",
14118
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14119
- params: {}
14120
- },
14121
- {
14122
- id: "compound-v3.claim-rewards",
14123
- protocolId: COMPOUND_V3_PROTOCOL_ID,
14124
- chainCategory: "evm",
14125
- description: "Claim COMP / reward token from CometRewards",
14126
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14127
- params: {}
14128
- },
14129
- {
14130
- id: "compound-v3.bulker",
14131
- protocolId: COMPOUND_V3_PROTOCOL_ID,
14132
- chainCategory: "evm",
14133
- description: "Combined Bulker.invoke (optional)",
14134
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14135
- params: {}
12616
+ // src/protocols/evm/euler-v2/eulerV3Api.ts
12617
+ init_defiProxy();
12618
+ var EULER_V3_API_BASE = "https://v3.euler.finance";
12619
+ function qs(params) {
12620
+ const u = new URLSearchParams();
12621
+ for (const [k, v] of Object.entries(params)) {
12622
+ if (v == null) continue;
12623
+ u.set(k, String(v));
12624
+ }
12625
+ const s = u.toString();
12626
+ return s ? `?${s}` : "";
12627
+ }
12628
+ async function eulerV3Get(path, params = {}) {
12629
+ const rel = path.startsWith("/") ? path : `/${path}`;
12630
+ const query = qs(params);
12631
+ const directUrl = `${EULER_V3_API_BASE}${rel}${query}`;
12632
+ rel.replace(/^\/v3\/?/, "");
12633
+ const proxyUrl = void 0;
12634
+ return getJsonViaOptionalProxy({ directUrl, proxyUrl });
12635
+ }
12636
+ async function paginateV3Vaults(path, chainId, extra = {}) {
12637
+ const out = [];
12638
+ let offset = 0;
12639
+ const limit = 100;
12640
+ while (true) {
12641
+ const page = await eulerV3Get(path, {
12642
+ chainId,
12643
+ limit,
12644
+ offset,
12645
+ ...extra
12646
+ });
12647
+ const rows = page.data ?? [];
12648
+ out.push(...rows);
12649
+ const total = typeof page.meta?.total === "number" ? page.meta.total : out.length;
12650
+ offset += rows.length;
12651
+ if (!rows.length || offset >= total) break;
12652
+ }
12653
+ return out;
12654
+ }
12655
+ async function fetchEulerV3EvkVaults(args) {
12656
+ return paginateV3Vaults("/v3/evk/vaults", args.chainId, args.asset ? { asset: args.asset } : {});
12657
+ }
12658
+ async function fetchEulerV3EarnVaults(args) {
12659
+ return paginateV3Vaults("/v3/earn/vaults", args.chainId, args.asset ? { asset: args.asset } : {});
12660
+ }
12661
+ async function fetchEulerV3ActiveChainIds() {
12662
+ const page = await eulerV3Get("/v3/chains");
12663
+ const ids = [];
12664
+ for (const row of page.data ?? []) {
12665
+ if (typeof row.id !== "number" || !Number.isFinite(row.id)) continue;
12666
+ if ((row.status ?? "active") !== "active") continue;
12667
+ ids.push(row.id);
12668
+ }
12669
+ return ids.sort((a, b) => a - b);
12670
+ }
12671
+
12672
+ // src/protocols/evm/euler-v2/eulerV2Subgraph.ts
12673
+ var EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID = {
12674
+ 1: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-mainnet/latest/gn",
12675
+ 8453: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-base/latest/gn",
12676
+ 1923: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-swell/latest/gn",
12677
+ 146: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-sonic/latest/gn",
12678
+ 60808: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bob/latest/gn",
12679
+ 80094: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-berachain/latest/gn",
12680
+ 43114: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-avalanche/latest/gn",
12681
+ 42161: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-arbitrum/latest/gn",
12682
+ 130: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-unichain/latest/gn",
12683
+ 56: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-bsc/latest/gn",
12684
+ 999: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-hyperevm/latest/gn",
12685
+ 239: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-tac/latest/gn",
12686
+ 9745: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-plasma/latest/gn",
12687
+ 137: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-polygon/latest/gn",
12688
+ 59144: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-linea/latest/gn",
12689
+ 143: "https://api.goldsky.com/api/public/project_cm4iagnemt1wp01xn4gh1agft/subgraphs/euler-simple-monad/latest/gn"
12690
+ };
12691
+ var WRAPPED_NATIVE_FALLBACK = {
12692
+ 1: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
12693
+ 10: "0x4200000000000000000000000000000000000006",
12694
+ 56: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
12695
+ 100: "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
12696
+ 130: "0x4200000000000000000000000000000000000006",
12697
+ 137: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
12698
+ // Polygon: WPOL
12699
+ 143: "0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A",
12700
+ // Monad: WMON
12701
+ 146: "0x03980325872071166574bcd94670450917897468",
12702
+ 239: "0xB63B9f0eb4A6E6f191529D71d4D88cc8900Df2C9",
12703
+ // TAC: WTAC (https://docs.tac.build/ecosystem/token-list)
12704
+ 480: "0x4200000000000000000000000000000000000006",
12705
+ 999: "0x5555555555555555555555555555555555555555",
12706
+ // HyperEVM: WHYPE (Hyperliquid docs)
12707
+ 1923: "0x4200000000000000000000000000000000000006",
12708
+ 42161: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
12709
+ 43114: "0xB31f66AA3C1e785363F0875A1B74D27b85FE0459",
12710
+ 5e3: "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8",
12711
+ // Mantle: WMNT
12712
+ 59144: "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
12713
+ // Linea: WETH
12714
+ 57073: "0x4200000000000000000000000000000000000006",
12715
+ 60808: "0x4200000000000000000000000000000000000006",
12716
+ 80094: "0x6969696969696969696969696969696969696969",
12717
+ // Berachain: WBERA (https://docs.berachain.com)
12718
+ 8453: "0x4200000000000000000000000000000000000006",
12719
+ 9745: "0x6100E367285b01F48D07953803A2d8dCA5D19873"
12720
+ // Plasma: WXPL
12721
+ };
12722
+ for (const id of Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map(Number)) {
12723
+ if (WRAPPED_NATIVE_FALLBACK[id] == null) {
12724
+ throw new Error(`eulerV2Subgraph: add WRAPPED_NATIVE_FALLBACK for Euler Goldsky chain ${id}`);
12725
+ }
12726
+ }
12727
+ async function resolveEulerWrappedNativeToken(chainId) {
12728
+ try {
12729
+ const fromAave = await fetchAaveV4NativeWrappedToken(chainId);
12730
+ if (fromAave) return fromAave;
12731
+ } catch {
12732
+ }
12733
+ const fb = WRAPPED_NATIVE_FALLBACK[chainId];
12734
+ if (fb && viem.isAddress(fb)) return viem.getAddress(fb);
12735
+ return null;
12736
+ }
12737
+ function normAssetAddr(raw) {
12738
+ const s = (raw ?? "").trim();
12739
+ if (!s || !viem.isAddress(s)) return null;
12740
+ return viem.getAddress(s).toLowerCase();
12741
+ }
12742
+ function v3VaultShowsBorrow(totalBorrows, explorableBorrow) {
12743
+ if (explorableBorrow === true) return true;
12744
+ try {
12745
+ return BigInt((totalBorrows ?? "0").trim() || "0") > 0n;
12746
+ } catch {
12747
+ return false;
12748
+ }
12749
+ }
12750
+ var eulerV2ChainAssetCache = /* @__PURE__ */ new Map();
12751
+ async function fetchEulerV2ChainAssetCache(chainId) {
12752
+ const [nativeWrapped, evkVaults, earnVaults] = await Promise.all([
12753
+ resolveEulerWrappedNativeToken(chainId),
12754
+ fetchEulerV3EvkVaults({ chainId }),
12755
+ fetchEulerV3EarnVaults({ chainId }).catch(() => [])
12756
+ ]);
12757
+ const modes = /* @__PURE__ */ new Map();
12758
+ const symbols = /* @__PURE__ */ new Map();
12759
+ const ambiguousSymbols = /* @__PURE__ */ new Set();
12760
+ const bump = (addr2, patch) => {
12761
+ const cur = modes.get(addr2) ?? { lend: false, borrow: false, earn: false };
12762
+ modes.set(addr2, {
12763
+ lend: cur.lend || !!patch.lend,
12764
+ borrow: cur.borrow || !!patch.borrow,
12765
+ earn: cur.earn || !!patch.earn
12766
+ });
12767
+ };
12768
+ const noteSymbol = (symbol, addr2) => {
12769
+ const sym = (symbol ?? "").trim().toLowerCase();
12770
+ if (!sym || ambiguousSymbols.has(sym) || !viem.isAddress(addr2)) return;
12771
+ const checksum = viem.getAddress(addr2);
12772
+ const prev = symbols.get(sym);
12773
+ if (!prev) {
12774
+ symbols.set(sym, checksum);
12775
+ return;
12776
+ }
12777
+ if (prev.toLowerCase() !== checksum.toLowerCase()) {
12778
+ symbols.delete(sym);
12779
+ ambiguousSymbols.add(sym);
12780
+ }
12781
+ };
12782
+ for (const v of earnVaults) {
12783
+ const a = normAssetAddr(v.asset?.address ?? void 0);
12784
+ if (a) {
12785
+ bump(a, { earn: true });
12786
+ noteSymbol(v.asset?.symbol, a);
12787
+ }
12788
+ }
12789
+ for (const v of evkVaults) {
12790
+ const a = normAssetAddr(v.asset?.address ?? void 0);
12791
+ if (!a) continue;
12792
+ const vis = v.visibility;
12793
+ bump(a, {
12794
+ lend: vis?.explorableLend !== false,
12795
+ borrow: v3VaultShowsBorrow(v.totalBorrows, vis?.explorableBorrow)
12796
+ });
12797
+ noteSymbol(v.asset?.symbol, a);
12798
+ }
12799
+ const weth = symbols.get("weth");
12800
+ if (weth && !symbols.has("eth") && !ambiguousSymbols.has("eth")) {
12801
+ symbols.set("eth", weth);
12802
+ }
12803
+ return { nativeWrapped, modesByUnderlying: modes, symbolToAddress: symbols };
12804
+ }
12805
+ function ensureEulerV2ChainAssetCache(chainId) {
12806
+ const hit = eulerV2ChainAssetCache.get(chainId);
12807
+ if (hit) return hit;
12808
+ const p = fetchEulerV2ChainAssetCache(chainId).catch((e) => {
12809
+ eulerV2ChainAssetCache.delete(chainId);
12810
+ throw e;
12811
+ });
12812
+ eulerV2ChainAssetCache.set(chainId, p);
12813
+ return p;
12814
+ }
12815
+
12816
+ // src/protocols/evm/euler-v2/loadEulerV2SupportedChainIds.ts
12817
+ var cached2 = null;
12818
+ async function loadEulerV2SupportedChainIds() {
12819
+ if (cached2) return cached2;
12820
+ try {
12821
+ const ids = await fetchEulerV3ActiveChainIds();
12822
+ if (ids.length) {
12823
+ cached2 = new Set(ids);
12824
+ return cached2;
14136
12825
  }
14137
- ]
14138
- };
14139
- registerProtocolModule(compoundV3ProtocolModule);
12826
+ } catch {
12827
+ }
12828
+ cached2 = new Set(Object.keys(EULER_V2_GOLDSKY_SUBGRAPH_URL_BY_CHAIN_ID).map((k) => Number(k)));
12829
+ return cached2;
12830
+ }
14140
12831
 
14141
12832
  // src/protocols/evm/pendle/support.ts
14142
12833
  var PENDLE_PROTOCOL_ID = "pendle";
@@ -14451,40 +13142,14 @@ async function pendleFetchMarketsSummary(args) {
14451
13142
  };
14452
13143
  }
14453
13144
 
14454
- // src/protocols/evm/pendle/index.ts
14455
- var pendleProtocolModule = {
14456
- id: PENDLE_PROTOCOL_ID,
14457
- chainCategory: "evm",
14458
- isChainSupported(ctx) {
14459
- if (ctx.chainCategory !== "evm") return false;
14460
- const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
14461
- if (!Number.isFinite(n)) return false;
14462
- return isPendleChainSupported(n);
14463
- },
14464
- isTokenSupported(token) {
14465
- if (token.category !== "evm") return false;
14466
- return token.kind === "native" || token.kind === "erc20";
14467
- },
14468
- actions: [
14469
- { id: "pendle.fetch-markets", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "List live Pendle markets (TVL-ranked, cap 100, matured omitted)", commonParams: [], params: {} },
14470
- { id: "pendle.search-assets", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Search live PT/YT/SY/underlying (matured only if address-pinned)", commonParams: [], params: {} },
14471
- { id: "pendle.swap", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Swap token \u2194 PT/YT via Hosted SDK convert", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
14472
- { id: "pendle.mint-py", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Mint PT + YT", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
14473
- { id: "pendle.redeem-py", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Redeem PT + YT (PT only after expiry)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
14474
- { id: "pendle.add-liquidity", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Add Pendle AMM liquidity", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
14475
- { id: "pendle.fetch-positions", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "List this wallet\u2019s Pendle LP (including matured)", commonParams: [], params: {} },
14476
- { id: "pendle.remove-liquidity", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Remove Pendle AMM liquidity", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
14477
- { id: "pendle.redeem-rewards", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Redeem on-chain SY/YT/LP interest and incentives (not merkle airdrops)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
14478
- ]
14479
- };
14480
- registerProtocolModule(pendleProtocolModule);
14481
-
14482
13145
  // src/protocols/evm/derive/constants.ts
14483
13146
  var DERIVE_PROTOCOL_ID = "derive";
14484
13147
  var DERIVE_MAINNET_API = "https://api.derive.xyz/v3";
14485
13148
  var DERIVE_TESTNET_API = "https://testnet.api.derive.xyz/v3";
14486
13149
  var DERIVE_MAINNET_API_V2 = "https://api.lyra.finance";
14487
13150
  var DERIVE_TESTNET_API_V2 = "https://api-demo.lyra.finance";
13151
+
13152
+ // src/protocols/evm/derive/support.ts
14488
13153
  function deriveNetworkFromChainId(chainId) {
14489
13154
  return chainId === 11155111 ? "testnet" : "mainnet";
14490
13155
  }
@@ -14654,132 +13319,8 @@ async function deriveFetchCurrenciesRaw(args) {
14654
13319
  }
14655
13320
  return [];
14656
13321
  }
14657
-
14658
- // src/protocols/evm/derive/index.ts
14659
- var deriveProtocolModule = {
14660
- id: DERIVE_PROTOCOL_ID,
14661
- chainCategory: "evm",
14662
- isChainSupported(ctx) {
14663
- if (ctx.chainCategory !== "evm") return false;
14664
- const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
14665
- return Number.isFinite(chainId) && isDeriveChainSupported(chainId);
14666
- },
14667
- isTokenSupported(token) {
14668
- if (token.category !== "evm") return false;
14669
- return token.kind === "erc20" || token.kind === "native";
14670
- },
14671
- actions: [
14672
- {
14673
- id: "derive.depositNewSubaccount",
14674
- protocolId: DERIVE_PROTOCOL_ID,
14675
- chainCategory: "evm",
14676
- description: "Ethereum L1 approve + ACTION_MANAGER.depositToNewSubaccount. First credit creates the trading + fallback subaccounts. chainId 1 / 11155111. Arb/OP/Base use derive.socketDeposit; HyperEVM HYPE uses derive.hypeVaultDeposit.",
14677
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14678
- params: {
14679
- protocolAsset: { type: "string", required: true, description: "Risk-universe collateral protocol asset" },
14680
- underlyingErc20: { type: "string", required: true, description: "L1 ERC-20 to approve (usually USDC)" },
14681
- amountHuman: { type: "string", required: true, description: "Deposit amount in underlying decimals" },
14682
- managerId: { type: "number", required: true, description: "Risk-universe manager_id" }
14683
- }
14684
- },
14685
- {
14686
- id: "derive.depositAddressTransfer",
14687
- protocolId: DERIVE_PROTOCOL_ID,
14688
- chainCategory: "evm",
14689
- description: "Ethereum L1 ERC-20 transfer to a registered Derive deposit address (standard / keeper sweep). Call register_deposit_address first.",
14690
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14691
- params: {
14692
- underlyingErc20: { type: "string", required: true, description: "L1 ERC-20 to send (usually USDC)" },
14693
- amountHuman: { type: "string", required: true, description: "Transfer amount in token units" },
14694
- depositAddress: { type: "string", required: true, description: "From register_deposit_address" }
14695
- }
14696
- },
14697
- {
14698
- id: "derive.socketDeposit",
14699
- protocolId: DERIVE_PROTOCOL_ID,
14700
- chainCategory: "evm",
14701
- description: "Socket FAST deposit of USDC/WETH/WBTC on Ethereum, Optimism, Base, or Arbitrum into Derive Chain. Native ETH wraps to WETH first. useCustomGas.",
14702
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14703
- params: {
14704
- token: { type: "string", required: true, description: "Row ERC-20 or native 0x0 (wraps to WETH)" },
14705
- amountHuman: { type: "string", required: true, description: "Deposit amount in token units" }
14706
- }
14707
- },
14708
- {
14709
- id: "derive.hypeVaultDeposit",
14710
- protocolId: DERIVE_PROTOCOL_ID,
14711
- chainCategory: "evm",
14712
- description: "HyperEVM (999): wrap native HYPE to WHYPE if needed, approve Derive vault, deposit.",
14713
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14714
- params: {
14715
- amountHuman: { type: "string", required: true, description: "HYPE amount" },
14716
- token: { type: "string", required: false, description: "Native 0x0 or WHYPE" }
14717
- }
14718
- },
14719
- {
14720
- id: "derive.placeOrder",
14721
- protocolId: DERIVE_PROTOCOL_ID,
14722
- chainCategory: "evm",
14723
- description: "Place a Derive options limit order via EIP-712 Action (delivery derive_exchange). Does not spend the current-chain token.",
14724
- commonParams: ["keyGen", "purposeText"],
14725
- params: {
14726
- instrumentName: { type: "string", required: true, description: "e.g. ETH-20260626-3000-C" },
14727
- direction: { type: "string", required: true, description: "buy or sell" },
14728
- amount: { type: "string", required: true, description: "Contract size" },
14729
- limitPrice: { type: "string", required: true, description: "Limit price" },
14730
- maxFee: { type: "string", required: true, description: "Max fee (e18-scaled, \u226412 decimals)" },
14731
- subaccountId: { type: "number", required: true, description: "From fetch_subaccounts \u2014 never 0" }
14732
- }
14733
- },
14734
- {
14735
- id: "derive.replaceOrder",
14736
- protocolId: DERIVE_PROTOCOL_ID,
14737
- chainCategory: "evm",
14738
- description: "Replace a Derive open order (EIP-712 Action + orderIdToCancel or nonceToCancel).",
14739
- commonParams: ["keyGen", "purposeText"],
14740
- params: {
14741
- instrumentName: { type: "string", required: true, description: "Instrument of the replacement order" },
14742
- direction: { type: "string", required: true, description: "buy or sell" },
14743
- amount: { type: "string", required: true, description: "Contract size" },
14744
- limitPrice: { type: "string", required: true, description: "Limit price" },
14745
- maxFee: { type: "string", required: true, description: "Max fee" },
14746
- subaccountId: { type: "number", required: true, description: "From fetch_subaccounts" },
14747
- orderIdToCancel: { type: "string", required: false, description: "Existing order id (xor nonceToCancel)" },
14748
- nonceToCancel: { type: "string", required: false, description: "Existing order nonce (xor orderIdToCancel)" }
14749
- }
14750
- },
14751
- {
14752
- id: "derive.cancel",
14753
- protocolId: DERIVE_PROTOCOL_ID,
14754
- chainCategory: "evm",
14755
- description: "Cancel a Derive open order. v3 cancel is session-auth; this signs EIP-191 login for private/cancel delivery.",
14756
- commonParams: ["keyGen", "purposeText"],
14757
- params: {
14758
- instrumentName: { type: "string", required: true, description: "Instrument of the open order" },
14759
- orderId: { type: "string", required: true, description: "order_id from fetch_open_orders" },
14760
- subaccountId: { type: "number", required: true, description: "From fetch_subaccounts" }
14761
- }
14762
- },
14763
- {
14764
- id: "derive.transferSpot",
14765
- protocolId: DERIVE_PROTOCOL_ID,
14766
- chainCategory: "evm",
14767
- description: "EIP-712 transfer_spot. Use toSubaccountId 0 + newSubaccountManager to create an extra subaccount after the first funded one.",
14768
- commonParams: ["keyGen", "purposeText"],
14769
- params: {
14770
- fromSubaccountId: { type: "number", required: true, description: "Funded source subaccount" },
14771
- toSubaccountId: { type: "number", required: true, description: "0 to create an extra subaccount" },
14772
- newSubaccountManager: { type: "number", required: true, description: "Required when toSubaccountId is 0" },
14773
- asset: { type: "string", required: true, description: "Protocol asset address" },
14774
- amount: { type: "string", required: true, description: "Transfer amount" }
14775
- }
14776
- }
14777
- ]
14778
- };
14779
- registerProtocolModule(deriveProtocolModule);
14780
13322
  var TRUEO_PROTOCOL_ID = "trueo";
14781
13323
  var TRUEO_BASE_CHAIN_ID = 8453;
14782
- var TRUEO_CHAIN_IDS = [TRUEO_BASE_CHAIN_ID];
14783
13324
  var TRUEO_TYD = viem.getAddress("0xb13CF163d916917d9cD6E836905cA5f12a1dEF4B");
14784
13325
  var TRUEO_TRUE = viem.getAddress("0x21CFCFc3d8F98fC728f48341D10Ad8283F6EB7AB");
14785
13326
  var TRUEO_USDC = viem.getAddress("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913");
@@ -14789,235 +13330,8 @@ viem.getAddress("0x0A1AFc2121B4441127a02DEF72928F61f564034a");
14789
13330
  viem.getAddress("0x6E08d24AEf78F6d1a97503F64E84fDF65f8125E1");
14790
13331
  viem.getAddress("0x3E83479B2276EcFb7C7181F67b5d092d3511e0C4");
14791
13332
  viem.getAddress("0x000000000022D473030F116dDEE9F6B43aC78BA3");
14792
- function isTrueoChainSupported(chainId) {
14793
- return TRUEO_CHAIN_IDS.includes(chainId);
14794
- }
14795
-
14796
- // src/protocols/evm/hyperliquidOutcome/api.ts
14797
- var HYPERLIQUID_OUTCOME_PROTOCOL_ID = "hyperliquidOutcome";
14798
-
14799
- // src/protocols/evm/trueo/index.ts
14800
- var trueoProtocolModule = {
14801
- id: TRUEO_PROTOCOL_ID,
14802
- chainCategory: "evm",
14803
- isChainSupported(ctx) {
14804
- const id = typeof ctx.chainId === "string" ? Number(ctx.chainId) : ctx.chainId;
14805
- return ctx.chainCategory === "evm" && isTrueoChainSupported(id);
14806
- },
14807
- isTokenSupported(token) {
14808
- return token.category === "evm" && (token.kind === "erc20" || token.kind === "ctmerc20");
14809
- },
14810
- actions: [
14811
- {
14812
- id: "trueo.wrap-tyd",
14813
- protocolId: TRUEO_PROTOCOL_ID,
14814
- chainCategory: "evm",
14815
- description: "Mint TYD by depositing Base USDC into the Yearn ERC-4626 vault",
14816
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14817
- params: {}
14818
- },
14819
- {
14820
- id: "trueo.unwrap-tyd",
14821
- protocolId: TRUEO_PROTOCOL_ID,
14822
- chainCategory: "evm",
14823
- description: "Redeem TYD shares back to Base USDC",
14824
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14825
- params: {}
14826
- },
14827
- {
14828
- id: "trueo.mint",
14829
- protocolId: TRUEO_PROTOCOL_ID,
14830
- chainCategory: "evm",
14831
- description: "Mint YES+NO from TYD (or USDC via adapter)",
14832
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14833
- params: {}
14834
- },
14835
- {
14836
- id: "trueo.burn",
14837
- protocolId: TRUEO_PROTOCOL_ID,
14838
- chainCategory: "evm",
14839
- description: "Burn equal YES+NO back to TYD",
14840
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14841
- params: {}
14842
- },
14843
- {
14844
- id: "trueo.redeem",
14845
- protocolId: TRUEO_PROTOCOL_ID,
14846
- chainCategory: "evm",
14847
- description: "Redeem winning outcome tokens after resolution",
14848
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14849
- params: {}
14850
- },
14851
- {
14852
- id: "trueo.swap",
14853
- protocolId: TRUEO_PROTOCOL_ID,
14854
- chainCategory: "evm",
14855
- description: "Buy Yes or No with TYD via UniversalRouterAdapter V4 swap",
14856
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14857
- params: {}
14858
- },
14859
- {
14860
- id: "trueo.create-order",
14861
- protocolId: TRUEO_PROTOCOL_ID,
14862
- chainCategory: "evm",
14863
- description: "Create an on-chain OrderManager limit order",
14864
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14865
- params: {}
14866
- },
14867
- {
14868
- id: "trueo.cancel-order",
14869
- protocolId: TRUEO_PROTOCOL_ID,
14870
- chainCategory: "evm",
14871
- description: "Cancel an on-chain OrderManager order",
14872
- commonParams: ["keyGen", "purposeText", "useCustomGas"],
14873
- params: {}
14874
- }
14875
- ]
14876
- };
14877
- registerProtocolModule(trueoProtocolModule);
14878
-
14879
- // src/protocols/evm/hyperliquidOutcome/index.ts
14880
- var hyperliquidOutcomeProtocolModule = {
14881
- id: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14882
- chainCategory: "evm",
14883
- isChainSupported(ctx) {
14884
- if (ctx.chainCategory !== "evm") return false;
14885
- const chainId = typeof ctx.chainId === "number" ? ctx.chainId : Number(ctx.chainId);
14886
- return Number.isFinite(chainId) && isHyperliquidChainSupported(chainId);
14887
- },
14888
- isTokenSupported(token) {
14889
- return token.category === "evm" && token.kind === "native";
14890
- },
14891
- actions: [
14892
- {
14893
- id: "hyperliquidOutcome.order",
14894
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14895
- chainCategory: "evm",
14896
- description: "Limit buy or sell a HIP-4 outcome side via Hyperliquid /exchange",
14897
- commonParams: ["keyGen", "purposeText"],
14898
- params: {}
14899
- },
14900
- {
14901
- id: "hyperliquidOutcome.cancel",
14902
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14903
- chainCategory: "evm",
14904
- description: "Cancel a resting HIP-4 outcome order",
14905
- commonParams: ["keyGen", "purposeText"],
14906
- params: {}
14907
- },
14908
- {
14909
- id: "hyperliquidOutcome.split",
14910
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14911
- chainCategory: "evm",
14912
- description: "Split quote tokens into Yes and No shares",
14913
- commonParams: ["keyGen", "purposeText"],
14914
- params: {}
14915
- },
14916
- {
14917
- id: "hyperliquidOutcome.merge",
14918
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14919
- chainCategory: "evm",
14920
- description: "Merge Yes and No shares back into quote tokens",
14921
- commonParams: ["keyGen", "purposeText"],
14922
- params: {}
14923
- },
14924
- {
14925
- id: "hyperliquidOutcome.merge-question",
14926
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14927
- chainCategory: "evm",
14928
- description: "Merge Yes shares across a question into quote tokens",
14929
- commonParams: ["keyGen", "purposeText"],
14930
- params: {}
14931
- },
14932
- {
14933
- id: "hyperliquidOutcome.negate",
14934
- protocolId: HYPERLIQUID_OUTCOME_PROTOCOL_ID,
14935
- chainCategory: "evm",
14936
- description: "Convert No shares of one outcome into Yes shares of the other outcomes",
14937
- commonParams: ["keyGen", "purposeText"],
14938
- params: {}
14939
- }
14940
- ]
14941
- };
14942
- registerProtocolModule(hyperliquidOutcomeProtocolModule);
14943
- var skillsDir = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('catalog.cjs', document.baseURI).href)))), "skills");
14944
- var SKILL_PROTOCOL_IDS = [
14945
- "aave-v4",
14946
- "lido",
14947
- "railgun",
14948
- "uniswap-v4",
14949
- "curve-dao",
14950
- "ethena",
14951
- "euler-v2",
14952
- "maple-syrup",
14953
- "sky",
14954
- "gmx",
14955
- "hyperliquid",
14956
- "arcus",
14957
- "morpho",
14958
- "circle-cctp",
14959
- "aerodrome",
14960
- "pendle",
14961
- "continuum-dao",
14962
- "continuum-dao-marketplace",
14963
- "compound-v3",
14964
- "derive",
14965
- "trueo",
14966
- "hyperliquidOutcome",
14967
- "yield-compare"
14968
- ];
14969
- function getToolsForProtocol(protocolId) {
14970
- return MCP_TOOL_DEFINITIONS.filter((t) => t.protocolId === protocolId);
14971
- }
14972
- function readSharedMultisignMcpGasSection() {
14973
- try {
14974
- return fs.readFileSync(path.join(skillsDir, "_shared", "multisign-mcp-gas.md"), "utf8").trim();
14975
- } catch {
14976
- return "";
14977
- }
14978
- }
14979
- function getProtocolSkill(protocolId) {
14980
- if (!SKILL_PROTOCOL_IDS.includes(protocolId)) {
14981
- return void 0;
14982
- }
14983
- try {
14984
- const skill = fs.readFileSync(path.join(skillsDir, protocolId, "SKILL.md"), "utf8").trim();
14985
- const shared = readSharedMultisignMcpGasSection();
14986
- if (!shared) return skill;
14987
- if (skill.includes("## Gas and MCP submit")) return skill;
14988
- return `${skill}
14989
13333
 
14990
- ${shared}
14991
- `;
14992
- } catch {
14993
- return void 0;
14994
- }
14995
- }
14996
- function listProtocolsWithSkills() {
14997
- return [...SKILL_PROTOCOL_IDS];
14998
- }
14999
- function getProtocolDiscoverySummary(protocolId) {
15000
- const mod = getProtocolModules().find((p) => p.id === protocolId);
15001
- if (!mod) return void 0;
15002
- return {
15003
- protocolId: mod.id,
15004
- chainCategory: mod.chainCategory,
15005
- actions: mod.actions.map((a) => ({ id: a.id, description: a.description })),
15006
- tools: getToolsForProtocol(protocolId).map((t) => ({
15007
- name: t.name,
15008
- actionId: t.actionId,
15009
- description: t.description,
15010
- prerequisites: t.prerequisites,
15011
- followUp: t.followUp
15012
- }))
15013
- };
15014
- }
15015
- init_coinbaseB20();
15016
- init_support();
15017
- init_support2();
15018
- init_addresses();
15019
- init_stockTokens();
15020
- init_constants();
13334
+ // src/agent/support/advisors.ts
15021
13335
  function advisor(protocolId, tokenFilter, impl) {
15022
13336
  return { protocolId, tokenFilter, ...impl };
15023
13337
  }
@@ -15661,6 +13975,10 @@ function listProtocolSupportAdvisorIds() {
15661
13975
 
15662
13976
  // src/agent/catalog.ts
15663
13977
  function getAgentCatalog() {
13978
+ const named = {};
13979
+ for (const entry of PROTOCOL_MANIFEST) {
13980
+ named[entry.catalogKey] = getProtocolModule(entry.id);
13981
+ }
15664
13982
  return {
15665
13983
  protocols: getProtocolModules(),
15666
13984
  byCategory: {
@@ -15668,28 +13986,7 @@ function getAgentCatalog() {
15668
13986
  solana: getActionsByChainCategory("solana"),
15669
13987
  near: getActionsByChainCategory("near")
15670
13988
  },
15671
- uniswapV4: uniswapV4ProtocolModule,
15672
- curveDao: curveDaoProtocolModule,
15673
- lido: lidoProtocolModule,
15674
- railgun: railgunProtocolModule,
15675
- ethena: ethenaProtocolModule,
15676
- maple: mapleProtocolModule,
15677
- sky: skyProtocolModule,
15678
- aaveV4: aaveV4ProtocolModule,
15679
- eulerV2: eulerV2ProtocolModule,
15680
- gmx: gmxProtocolModule,
15681
- hyperliquid: hyperliquidProtocolModule,
15682
- arcus: arcusProtocolModule,
15683
- morpho: morphoProtocolModule,
15684
- circleCctp: circleCctpProtocolModule,
15685
- venice: veniceProtocolModule,
15686
- aerodrome: aerodromeProtocolModule,
15687
- continuumDao: continuumDaoProtocolModule,
15688
- compoundV3: compoundV3ProtocolModule,
15689
- pendle: pendleProtocolModule,
15690
- derive: deriveProtocolModule,
15691
- trueo: trueoProtocolModule,
15692
- hyperliquidOutcome: hyperliquidOutcomeProtocolModule,
13989
+ ...named,
15693
13990
  /** Prefer getAgentCatalogForMcp() or getMcpToolDefinitions() for MCP servers. */
15694
13991
  mcp: getAgentCatalogForMcp()
15695
13992
  };
@@ -15703,6 +14000,7 @@ exports.MCP_TOOL_INPUT_SCHEMAS = MCP_TOOL_INPUT_SCHEMAS;
15703
14000
  exports.MCP_TOOL_OUTPUT_SCHEMAS = MCP_TOOL_OUTPUT_SCHEMAS;
15704
14001
  exports.MULTISIGN_OUTPUT_DOC = MULTISIGN_OUTPUT_DOC;
15705
14002
  exports.MULTISIGN_SUBMIT_OUTPUT_DOC = MULTISIGN_SUBMIT_OUTPUT_DOC;
14003
+ exports.PROTOCOL_MANIFEST = PROTOCOL_MANIFEST;
15706
14004
  exports.PROTOCOL_SUPPORT_ADVISORS = PROTOCOL_SUPPORT_ADVISORS;
15707
14005
  exports.agentEvmChainIdSchema = agentEvmChainIdSchema;
15708
14006
  exports.chainDetailSchema = chainDetailSchema;
@@ -16228,6 +14526,7 @@ exports.parseAgentEvmChainId = parseAgentEvmChainId;
16228
14526
  exports.parseMcpToolInput = parseMcpToolInput;
16229
14527
  exports.parseMcpToolOutput = parseMcpToolOutput;
16230
14528
  exports.parseMultisignBuilderOutput = parseMultisignBuilderOutput;
14529
+ exports.protocolManifestEntry = protocolManifestEntry;
16231
14530
  exports.uniswapQuoteTradeTypeSchema = uniswapQuoteTradeTypeSchema;
16232
14531
  exports.zodSchemaToMcpJsonSchema = zodSchemaToMcpJsonSchema;
16233
14532
  //# sourceMappingURL=catalog.cjs.map