@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
|
@@ -160,7 +160,8 @@ declare function formatUniswapQuoteForDisplay(res: Record<string, unknown>, args
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
* When `batchIndex` is set,
|
|
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,
|
|
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
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
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
|
|
621
|
-
if (u4
|
|
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;
|