@continuumdao/ctm-mpc-defi 0.1.3 → 0.1.4
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.
- package/README.md +16 -1
- package/dist/agent/catalog.cjs +36 -2
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.cts +79 -1
- package/dist/agent/catalog.d.ts +79 -1
- package/dist/agent/catalog.js +36 -3
- package/dist/agent/catalog.js.map +1 -1
- package/dist/core/index.cjs +76 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +35 -2
- package/dist/core/index.d.ts +35 -2
- package/dist/core/index.js +70 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +111 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +105 -3
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.cjs +31 -11
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/uniswap-v4/index.d.cts +2 -1
- package/dist/protocols/evm/uniswap-v4/index.d.ts +2 -1
- package/dist/protocols/evm/uniswap-v4/index.js +31 -11
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -580,16 +580,36 @@ function parseExtraJsonObject(detail) {
|
|
|
580
580
|
}
|
|
581
581
|
return null;
|
|
582
582
|
}
|
|
583
|
+
function uniswapV4EvmTypeFromBatchMeta(ex, batchIndex) {
|
|
584
|
+
if (!ex) return false;
|
|
585
|
+
const bm = ex.batchMeta;
|
|
586
|
+
if (!Array.isArray(bm) || !bm[batchIndex] || typeof bm[batchIndex] !== "object" || Array.isArray(bm[batchIndex])) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
const evm0 = bm[batchIndex].evm;
|
|
590
|
+
if (!evm0 || typeof evm0 !== "object" || Array.isArray(evm0)) return false;
|
|
591
|
+
return String(evm0.type ?? "") === "uniswap_v4_swap_tx";
|
|
592
|
+
}
|
|
593
|
+
function uniswapV4AuditFromDetail(ex, batchIndex) {
|
|
594
|
+
if (!ex) return void 0;
|
|
595
|
+
const index = batchIndex != null && batchIndex >= 0 ? batchIndex : 0;
|
|
596
|
+
const bm = ex.batchMeta;
|
|
597
|
+
if (Array.isArray(bm) && bm[index] && typeof bm[index] === "object" && !Array.isArray(bm[index])) {
|
|
598
|
+
const nested = bm[index].uniswapV4;
|
|
599
|
+
if (nested && typeof nested === "object" && !Array.isArray(nested)) {
|
|
600
|
+
return nested;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
const root = ex.uniswapV4;
|
|
604
|
+
if (root && typeof root === "object" && !Array.isArray(root)) return root;
|
|
605
|
+
return void 0;
|
|
606
|
+
}
|
|
583
607
|
function isUniswapV4SwapEvmSignRequest(detail, batchIndex) {
|
|
584
608
|
const ex = parseExtraJsonObject(detail);
|
|
585
|
-
if (batchIndex != null && batchIndex >= 0
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
if (evm0 && typeof evm0 === "object" && !Array.isArray(evm0)) {
|
|
590
|
-
if (String(evm0.type ?? "") === "uniswap_v4_swap_tx") return true;
|
|
591
|
-
}
|
|
592
|
-
}
|
|
609
|
+
if (batchIndex != null && batchIndex >= 0) {
|
|
610
|
+
if (uniswapV4EvmTypeFromBatchMeta(ex, batchIndex)) return true;
|
|
611
|
+
} else if (uniswapV4EvmTypeFromBatchMeta(ex, 0)) {
|
|
612
|
+
return true;
|
|
593
613
|
}
|
|
594
614
|
const evm = ex?.evm;
|
|
595
615
|
if (!evm || typeof evm !== "object" || Array.isArray(evm)) return false;
|
|
@@ -619,10 +639,10 @@ function resolveRouterSwapGasUnitsFromSignRequest(detail, batchIndex) {
|
|
|
619
639
|
}
|
|
620
640
|
}
|
|
621
641
|
const ex = parseExtraJsonObject(detail);
|
|
622
|
-
const u4 = ex
|
|
623
|
-
if (u4
|
|
642
|
+
const u4 = uniswapV4AuditFromDetail(ex, batchIndex);
|
|
643
|
+
if (u4) {
|
|
624
644
|
const uc = u4.uniswapCreateSwap;
|
|
625
|
-
const gb = uc?.gasBuild;
|
|
645
|
+
const gb = uc?.gasBuildSwap ?? uc?.gasBuild;
|
|
626
646
|
const base = parseOptionalGasLimitString(gb?.baseGasUnits);
|
|
627
647
|
if (base != null && base > 0n) return base;
|
|
628
648
|
const snap = u4.fullQuoteFromPermitSnapshot;
|