@continuumdao/ctm-mpc-defi 0.2.1 → 0.2.2

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 (57) hide show
  1. package/dist/agent/catalog.cjs +62 -11
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +27 -1
  4. package/dist/agent/catalog.js +61 -12
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/curve-dao/SKILL.md +2 -1
  7. package/dist/chains/evm/index.cjs +54 -0
  8. package/dist/chains/evm/index.cjs.map +1 -1
  9. package/dist/chains/evm/index.d.ts +13 -1
  10. package/dist/chains/evm/index.js +52 -2
  11. package/dist/chains/evm/index.js.map +1 -1
  12. package/dist/core/index.cjs +64 -0
  13. package/dist/core/index.cjs.map +1 -1
  14. package/dist/core/index.d.ts +20 -1
  15. package/dist/core/index.js +56 -1
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/index.cjs +131 -0
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +120 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/protocols/evm/aave-v4/index.cjs +766 -6
  23. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
  24. package/dist/protocols/evm/aave-v4/index.d.ts +417 -1
  25. package/dist/protocols/evm/aave-v4/index.js +741 -8
  26. package/dist/protocols/evm/aave-v4/index.js.map +1 -1
  27. package/dist/protocols/evm/curve-dao/index.cjs +233 -7
  28. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  29. package/dist/protocols/evm/curve-dao/index.d.ts +66 -1
  30. package/dist/protocols/evm/curve-dao/index.js +227 -9
  31. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  32. package/dist/protocols/evm/ethena/index.cjs +104 -0
  33. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  34. package/dist/protocols/evm/ethena/index.d.ts +46 -1
  35. package/dist/protocols/evm/ethena/index.js +99 -1
  36. package/dist/protocols/evm/ethena/index.js.map +1 -1
  37. package/dist/protocols/evm/euler-v2/index.cjs +2334 -37
  38. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  39. package/dist/protocols/evm/euler-v2/index.d.ts +464 -1
  40. package/dist/protocols/evm/euler-v2/index.js +2286 -39
  41. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  42. package/dist/protocols/evm/lido/index.cjs +110 -0
  43. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  44. package/dist/protocols/evm/lido/index.d.ts +33 -2
  45. package/dist/protocols/evm/lido/index.js +107 -2
  46. package/dist/protocols/evm/lido/index.js.map +1 -1
  47. package/dist/protocols/evm/maple/index.cjs +83 -0
  48. package/dist/protocols/evm/maple/index.cjs.map +1 -1
  49. package/dist/protocols/evm/maple/index.d.ts +22 -1
  50. package/dist/protocols/evm/maple/index.js +82 -1
  51. package/dist/protocols/evm/maple/index.js.map +1 -1
  52. package/dist/protocols/evm/sky/index.cjs +217 -0
  53. package/dist/protocols/evm/sky/index.cjs.map +1 -1
  54. package/dist/protocols/evm/sky/index.d.ts +56 -1
  55. package/dist/protocols/evm/sky/index.js +210 -2
  56. package/dist/protocols/evm/sky/index.js.map +1 -1
  57. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export { C as ChainCategory, a as ChainSupportContext, E as EvmTokenKind, K as KeyGenSubset, b as KeyGenSubsetForPermit, M as MultisignBuildResult, c as MultisignCommonArgs, N as NearTokenKind, P as ParamDoc, d as ProtocolActionDescriptor, e as ProtocolModule, S as SolanaTokenKind, T as TokenRef } from './types-BfjWdw1j.js';
2
2
  export { getClientIdFromKeyGenResult as firstClientIdFromKeyGen } from '@continuumdao/continuum-node-sdk';
3
- export { mergePurposeText } from './core/index.js';
3
+ export { getAaveGraphqlProxyUrl, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, mergePurposeText, postJsonViaOptionalProxy, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl } from './core/index.js';
4
4
  export { C as ChainCategoryBuildInput, a as ChainCategoryModule, M as MultisignLeg, c as coreChainCategoryModule, f as finalizeMultisign } from './envelope-CpBUh9eP.js';
5
5
  export { g as getActionsByChainCategory, a as getProtocolModule, b as getProtocolModules, r as registerProtocolModule } from './registry-Bv5o37_w.js';
6
6
  export { E as EvmChainDetail, a as EvmProtocolContext, b as EvmTxStep, i as isEvmNativeToken, m as matchEvmTokenKind } from './types-DUeNJLr9.js';
7
- export { EvmBatchMetaBuilder, EvmBuildBatchArgs, buildEvmMultisignBatch, evmChainCategoryModule, parseEvmChainIdToNumber, routerSwapGasLimitFromEstimate } from './chains/evm/index.js';
7
+ export { COINGECKO_PLATFORM_BY_CHAIN_ID, EvmBatchMetaBuilder, EvmBuildBatchArgs, buildEvmMultisignBatch, coingeckoPlatformForChainId, evmChainCategoryModule, normalizeCurveRouterAmountString, normalizeHumanDecimalAmount, parseEvmChainIdToNumber, routerSwapGasLimitFromEstimate } from './chains/evm/index.js';
8
8
  export { SOLANA_CHAIN_CATEGORY, solanaChainCategoryModule } from './chains/solana/index.js';
9
9
  export { NEAR_CHAIN_CATEGORY, nearChainCategoryModule } from './chains/near/index.js';
10
10
  export { uniswapV4, uniswapV4ProtocolModule } from './protocols/evm/uniswap-v4/index.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getClientIdFromKeyGenResult, gasLimitFromEstimateAndChainConfig, fetchChainFeeParams, gweiToDecimalString, proposalTxParamsToFeeSnapshot, alignEip1559FeesWithLatestBase, nodeFetchWithReadAuth } from '@continuumdao/continuum-node-sdk';
2
2
  export { getClientIdFromKeyGenResult as firstClientIdFromKeyGen } from '@continuumdao/continuum-node-sdk';
3
- import { getAddress, zeroAddress, defineChain, createPublicClient, http, parseGwei, serializeTransaction, keccak256, encodeFunctionData, erc20Abi, parseAbi, parseUnits, decodeFunctionData, isAddress } from 'viem';
3
+ import { getAddress, zeroAddress, defineChain, createPublicClient, http, parseGwei, serializeTransaction, keccak256, parseUnits, formatUnits, encodeFunctionData, erc20Abi, parseAbi, decodeFunctionData, isAddress } from 'viem';
4
4
 
5
5
  // src/core/index.ts
6
6
 
@@ -86,6 +86,61 @@ function getProtocolModule(id) {
86
86
  function getActionsByChainCategory(category) {
87
87
  return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions);
88
88
  }
89
+
90
+ // src/core/defiProxy.ts
91
+ var aaveGraphqlProxyUrl;
92
+ var eulerGraphqlProxyUrl;
93
+ var mapleGraphqlProxyUrl;
94
+ var coingeckoProxyUrl;
95
+ function setAaveGraphqlProxyUrl(url) {
96
+ aaveGraphqlProxyUrl = url?.trim() || void 0;
97
+ }
98
+ function getAaveGraphqlProxyUrl() {
99
+ return aaveGraphqlProxyUrl;
100
+ }
101
+ function setEulerGraphqlProxyUrl(url) {
102
+ eulerGraphqlProxyUrl = url?.trim() || void 0;
103
+ }
104
+ function getEulerGraphqlProxyUrl() {
105
+ return eulerGraphqlProxyUrl;
106
+ }
107
+ function setMapleGraphqlProxyUrl(url) {
108
+ mapleGraphqlProxyUrl = url?.trim() || void 0;
109
+ }
110
+ function getMapleGraphqlProxyUrl() {
111
+ return mapleGraphqlProxyUrl;
112
+ }
113
+ function setCoingeckoProxyUrl(url) {
114
+ coingeckoProxyUrl = url?.trim() || void 0;
115
+ }
116
+ function getCoingeckoProxyUrl() {
117
+ return coingeckoProxyUrl;
118
+ }
119
+ async function postJsonViaOptionalProxy(args) {
120
+ const proxy = args.proxyUrl?.trim();
121
+ if (proxy) {
122
+ const r2 = await fetch(proxy, {
123
+ method: "POST",
124
+ headers: { "content-type": "application/json" },
125
+ body: JSON.stringify(args.proxyEnvelope ?? args.body)
126
+ });
127
+ if (!r2.ok) {
128
+ const t = await r2.text().catch(() => "");
129
+ throw new Error(t ? `Proxy HTTP ${r2.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r2.status}`);
130
+ }
131
+ return await r2.json();
132
+ }
133
+ const r = await fetch(args.directUrl, {
134
+ method: "POST",
135
+ headers: { "content-type": "application/json" },
136
+ body: JSON.stringify(args.body)
137
+ });
138
+ if (!r.ok) {
139
+ const t = await r.text().catch(() => "");
140
+ throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`);
141
+ }
142
+ return await r.json();
143
+ }
89
144
  function isEvmNativeToken(address) {
90
145
  try {
91
146
  return getAddress(address) === zeroAddress;
@@ -298,6 +353,56 @@ function parseEvmChainIdToNumber(chainId) {
298
353
  }
299
354
  return Number.parseInt(t, 10);
300
355
  }
356
+ function normalizeHumanDecimalAmount(raw, tokenDecimals) {
357
+ const t = raw.trim().replace(/,/g, "");
358
+ if (!t) return "";
359
+ if (!Number.isInteger(tokenDecimals) || tokenDecimals < 0 || tokenDecimals > 18) {
360
+ throw new Error("Invalid token decimals for amount normalization.");
361
+ }
362
+ const wei = parseUnits(t, tokenDecimals);
363
+ return formatUnits(wei, tokenDecimals);
364
+ }
365
+ var normalizeCurveRouterAmountString = normalizeHumanDecimalAmount;
366
+
367
+ // src/chains/evm/coingecko.ts
368
+ var COINGECKO_PLATFORM_BY_CHAIN_ID = {
369
+ "1": "ethereum",
370
+ "56": "binance-smart-chain",
371
+ "137": "polygon-pos",
372
+ "42161": "arbitrum-one",
373
+ "10": "optimistic-ethereum",
374
+ "43114": "avalanche",
375
+ "8453": "base",
376
+ "324": "zk-sync-era",
377
+ "42220": "celo",
378
+ "250": "fantom",
379
+ "100": "gnosis",
380
+ "204": "op-bnb",
381
+ "534352": "scroll",
382
+ "5000": "mantle",
383
+ "169": "manta-pacific",
384
+ "1116": "core",
385
+ "30": "rootstock",
386
+ "288": "boba",
387
+ "1088": "metis-andromeda",
388
+ "34443": "mode",
389
+ "80084": "berachain",
390
+ "146": "sonic",
391
+ "60808": "bob-network",
392
+ "80094": "berachain",
393
+ "130": "unichain",
394
+ "57073": "ink",
395
+ "999": "hyperevm",
396
+ "239": "tac",
397
+ "9745": "plasma",
398
+ "1923": "swellchain",
399
+ "59144": "linea",
400
+ "81457": "blast",
401
+ "7777777": "zora"
402
+ };
403
+ function coingeckoPlatformForChainId(chainId) {
404
+ return COINGECKO_PLATFORM_BY_CHAIN_ID[String(chainId).trim()];
405
+ }
301
406
 
302
407
  // src/chains/solana/types.ts
303
408
  var solanaChainCategoryModule = {
@@ -1588,6 +1693,19 @@ var curveDaoProtocolModule = {
1588
1693
  return token.kind === "native" || token.kind === "erc20";
1589
1694
  },
1590
1695
  actions: [
1696
+ {
1697
+ id: "curve-dao.quote",
1698
+ protocolId: CURVE_DAO_PROTOCOL_ID,
1699
+ chainCategory: "evm",
1700
+ description: "Quote swap via Curve Router NG (getBestRouteAndOutput)",
1701
+ commonParams: [],
1702
+ params: {
1703
+ chainId: { type: "number", required: true, description: "EVM chain id" },
1704
+ tokenIn: { type: "address", required: true, description: "Token in or native placeholder" },
1705
+ tokenOut: { type: "address", required: true, description: "Token out or native placeholder" },
1706
+ amountHuman: { type: "string", required: true, description: "Human-readable input amount" }
1707
+ }
1708
+ },
1591
1709
  {
1592
1710
  id: "curve-dao.swap",
1593
1711
  protocolId: CURVE_DAO_PROTOCOL_ID,
@@ -1614,6 +1732,6 @@ var curveDao = {
1614
1732
  registerProtocolModule(uniswapV4ProtocolModule);
1615
1733
  registerProtocolModule(curveDaoProtocolModule);
1616
1734
 
1617
- export { NEAR_CHAIN_CATEGORY, SOLANA_CHAIN_CATEGORY, buildEvmMultisignBatch, coreChainCategoryModule, curveDao, curveDaoProtocolModule, evmChainCategoryModule, finalizeMultisign, getActionsByChainCategory, getProtocolModule, getProtocolModules, isEvmNativeToken, matchEvmTokenKind, mergePurposeText, nearChainCategoryModule, parseEvmChainIdToNumber, registerProtocolModule, routerSwapGasLimitFromEstimate, solanaChainCategoryModule, uniswapV4, uniswapV4ProtocolModule };
1735
+ export { COINGECKO_PLATFORM_BY_CHAIN_ID, NEAR_CHAIN_CATEGORY, SOLANA_CHAIN_CATEGORY, buildEvmMultisignBatch, coingeckoPlatformForChainId, coreChainCategoryModule, curveDao, curveDaoProtocolModule, evmChainCategoryModule, finalizeMultisign, getAaveGraphqlProxyUrl, getActionsByChainCategory, getCoingeckoProxyUrl, getEulerGraphqlProxyUrl, getMapleGraphqlProxyUrl, getProtocolModule, getProtocolModules, isEvmNativeToken, matchEvmTokenKind, mergePurposeText, nearChainCategoryModule, normalizeCurveRouterAmountString, normalizeHumanDecimalAmount, parseEvmChainIdToNumber, postJsonViaOptionalProxy, registerProtocolModule, routerSwapGasLimitFromEstimate, setAaveGraphqlProxyUrl, setCoingeckoProxyUrl, setEulerGraphqlProxyUrl, setMapleGraphqlProxyUrl, solanaChainCategoryModule, uniswapV4, uniswapV4ProtocolModule };
1618
1736
  //# sourceMappingURL=index.js.map
1619
1737
  //# sourceMappingURL=index.js.map