@continuumdao/ctm-mpc-defi 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +16 -1
  2. package/dist/agent/catalog.cjs +913 -142
  3. package/dist/agent/catalog.cjs.map +1 -1
  4. package/dist/agent/catalog.d.cts +834 -12
  5. package/dist/agent/catalog.d.ts +834 -12
  6. package/dist/agent/catalog.js +863 -143
  7. package/dist/agent/catalog.js.map +1 -1
  8. package/dist/chains/evm/index.cjs +13 -0
  9. package/dist/chains/evm/index.cjs.map +1 -1
  10. package/dist/chains/evm/index.d.cts +3 -1
  11. package/dist/chains/evm/index.d.ts +3 -1
  12. package/dist/chains/evm/index.js +13 -1
  13. package/dist/chains/evm/index.js.map +1 -1
  14. package/dist/core/index.cjs +76 -0
  15. package/dist/core/index.cjs.map +1 -1
  16. package/dist/core/index.d.cts +35 -2
  17. package/dist/core/index.d.ts +35 -2
  18. package/dist/core/index.js +70 -1
  19. package/dist/core/index.js.map +1 -1
  20. package/dist/index.cjs +934 -141
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +3 -2
  23. package/dist/index.d.ts +3 -2
  24. package/dist/index.js +927 -142
  25. package/dist/index.js.map +1 -1
  26. package/dist/protocols/evm/aave-v4/index.cjs +1987 -0
  27. package/dist/protocols/evm/aave-v4/index.cjs.map +1 -0
  28. package/dist/protocols/evm/aave-v4/index.d.cts +500 -0
  29. package/dist/protocols/evm/aave-v4/index.d.ts +500 -0
  30. package/dist/protocols/evm/aave-v4/index.js +1943 -0
  31. package/dist/protocols/evm/aave-v4/index.js.map +1 -0
  32. package/dist/protocols/evm/ethena/index.cjs +965 -0
  33. package/dist/protocols/evm/ethena/index.cjs.map +1 -0
  34. package/dist/protocols/evm/ethena/index.d.cts +161 -0
  35. package/dist/protocols/evm/ethena/index.d.ts +161 -0
  36. package/dist/protocols/evm/ethena/index.js +943 -0
  37. package/dist/protocols/evm/ethena/index.js.map +1 -0
  38. package/dist/protocols/evm/euler-v2/index.cjs +2263 -0
  39. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -0
  40. package/dist/protocols/evm/euler-v2/index.d.cts +317 -0
  41. package/dist/protocols/evm/euler-v2/index.d.ts +317 -0
  42. package/dist/protocols/evm/euler-v2/index.js +2238 -0
  43. package/dist/protocols/evm/euler-v2/index.js.map +1 -0
  44. package/dist/protocols/evm/lido/index.cjs +834 -0
  45. package/dist/protocols/evm/lido/index.cjs.map +1 -0
  46. package/dist/protocols/evm/lido/index.d.cts +120 -0
  47. package/dist/protocols/evm/lido/index.d.ts +120 -0
  48. package/dist/protocols/evm/lido/index.js +809 -0
  49. package/dist/protocols/evm/lido/index.js.map +1 -0
  50. package/dist/protocols/evm/maple/index.cjs +707 -0
  51. package/dist/protocols/evm/maple/index.cjs.map +1 -0
  52. package/dist/protocols/evm/maple/index.d.cts +109 -0
  53. package/dist/protocols/evm/maple/index.d.ts +109 -0
  54. package/dist/protocols/evm/maple/index.js +693 -0
  55. package/dist/protocols/evm/maple/index.js.map +1 -0
  56. package/dist/protocols/evm/sky/index.cjs +1254 -0
  57. package/dist/protocols/evm/sky/index.cjs.map +1 -0
  58. package/dist/protocols/evm/sky/index.d.cts +218 -0
  59. package/dist/protocols/evm/sky/index.d.ts +218 -0
  60. package/dist/protocols/evm/sky/index.js +1229 -0
  61. package/dist/protocols/evm/sky/index.js.map +1 -0
  62. package/dist/protocols/evm/uniswap-v4/index.cjs +31 -11
  63. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  64. package/dist/protocols/evm/uniswap-v4/index.d.cts +2 -1
  65. package/dist/protocols/evm/uniswap-v4/index.d.ts +2 -1
  66. package/dist/protocols/evm/uniswap-v4/index.js +31 -11
  67. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  68. package/package.json +37 -3
@@ -160,7 +160,8 @@ declare function formatUniswapQuoteForDisplay(res: Record<string, unknown>, args
160
160
  };
161
161
 
162
162
  /**
163
- * When `batchIndex` is set, allow per-item `batchMeta[i].evm` when present; else top-level `evm` in ExtraJSON.
163
+ * When `batchIndex` is set, check `batchMeta[i].evm`. Without `batchIndex`, also check `batchMeta[0]`
164
+ * (native ETH-in single-tx requests store evm only under batchMeta, not top-level extraJSON.evm).
164
165
  */
165
166
  declare function isUniswapV4SwapEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
166
167
  /**
@@ -160,7 +160,8 @@ declare function formatUniswapQuoteForDisplay(res: Record<string, unknown>, args
160
160
  };
161
161
 
162
162
  /**
163
- * When `batchIndex` is set, allow per-item `batchMeta[i].evm` when present; else top-level `evm` in ExtraJSON.
163
+ * When `batchIndex` is set, check `batchMeta[i].evm`. Without `batchIndex`, also check `batchMeta[0]`
164
+ * (native ETH-in single-tx requests store evm only under batchMeta, not top-level extraJSON.evm).
164
165
  */
165
166
  declare function isUniswapV4SwapEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
166
167
  /**
@@ -578,16 +578,36 @@ function parseExtraJsonObject(detail) {
578
578
  }
579
579
  return null;
580
580
  }
581
+ function uniswapV4EvmTypeFromBatchMeta(ex, batchIndex) {
582
+ if (!ex) return false;
583
+ const bm = ex.batchMeta;
584
+ if (!Array.isArray(bm) || !bm[batchIndex] || typeof bm[batchIndex] !== "object" || Array.isArray(bm[batchIndex])) {
585
+ return false;
586
+ }
587
+ const evm0 = bm[batchIndex].evm;
588
+ if (!evm0 || typeof evm0 !== "object" || Array.isArray(evm0)) return false;
589
+ return String(evm0.type ?? "") === "uniswap_v4_swap_tx";
590
+ }
591
+ function uniswapV4AuditFromDetail(ex, batchIndex) {
592
+ if (!ex) return void 0;
593
+ const index = batchIndex != null && batchIndex >= 0 ? batchIndex : 0;
594
+ const bm = ex.batchMeta;
595
+ if (Array.isArray(bm) && bm[index] && typeof bm[index] === "object" && !Array.isArray(bm[index])) {
596
+ const nested = bm[index].uniswapV4;
597
+ if (nested && typeof nested === "object" && !Array.isArray(nested)) {
598
+ return nested;
599
+ }
600
+ }
601
+ const root = ex.uniswapV4;
602
+ if (root && typeof root === "object" && !Array.isArray(root)) return root;
603
+ return void 0;
604
+ }
581
605
  function isUniswapV4SwapEvmSignRequest(detail, batchIndex) {
582
606
  const ex = parseExtraJsonObject(detail);
583
- if (batchIndex != null && batchIndex >= 0 && ex) {
584
- const bm = ex.batchMeta;
585
- if (Array.isArray(bm) && bm[batchIndex] && typeof bm[batchIndex] === "object" && !Array.isArray(bm[batchIndex])) {
586
- const evm0 = bm[batchIndex].evm;
587
- if (evm0 && typeof evm0 === "object" && !Array.isArray(evm0)) {
588
- if (String(evm0.type ?? "") === "uniswap_v4_swap_tx") return true;
589
- }
590
- }
607
+ if (batchIndex != null && batchIndex >= 0) {
608
+ if (uniswapV4EvmTypeFromBatchMeta(ex, batchIndex)) return true;
609
+ } else if (uniswapV4EvmTypeFromBatchMeta(ex, 0)) {
610
+ return true;
591
611
  }
592
612
  const evm = ex?.evm;
593
613
  if (!evm || typeof evm !== "object" || Array.isArray(evm)) return false;
@@ -617,10 +637,10 @@ function resolveRouterSwapGasUnitsFromSignRequest(detail, batchIndex) {
617
637
  }
618
638
  }
619
639
  const ex = parseExtraJsonObject(detail);
620
- const u4 = ex?.uniswapV4;
621
- if (u4 && typeof u4 === "object") {
640
+ const u4 = uniswapV4AuditFromDetail(ex, batchIndex);
641
+ if (u4) {
622
642
  const uc = u4.uniswapCreateSwap;
623
- const gb = uc?.gasBuild;
643
+ const gb = uc?.gasBuildSwap ?? uc?.gasBuild;
624
644
  const base = parseOptionalGasLimitString(gb?.baseGasUnits);
625
645
  if (base != null && base > 0n) return base;
626
646
  const snap = u4.fullQuoteFromPermitSnapshot;