@continuumdao/ctm-mpc-defi 0.2.12 → 0.2.13
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/dist/agent/catalog.cjs
CHANGED
|
@@ -527,6 +527,41 @@ function zodSchemaToMcpJsonSchema(schema) {
|
|
|
527
527
|
}
|
|
528
528
|
return raw;
|
|
529
529
|
}
|
|
530
|
+
function parseAgentBoolean(raw, defaultValue = false) {
|
|
531
|
+
if (raw === void 0 || raw === null) return defaultValue;
|
|
532
|
+
if (typeof raw === "boolean") return raw;
|
|
533
|
+
if (typeof raw === "number") return raw !== 0;
|
|
534
|
+
if (typeof raw === "string") {
|
|
535
|
+
const t = raw.trim().toLowerCase();
|
|
536
|
+
if (t === "true" || t === "1" || t === "yes") return true;
|
|
537
|
+
if (t === "false" || t === "0" || t === "no" || t === "") return false;
|
|
538
|
+
}
|
|
539
|
+
return Boolean(raw);
|
|
540
|
+
}
|
|
541
|
+
var CHAIN_ID_DECIMAL_HEX_TYPOS = {
|
|
542
|
+
33875: 8453
|
|
543
|
+
};
|
|
544
|
+
function parseAgentEvmChainId(raw) {
|
|
545
|
+
if (typeof raw === "number" && Number.isInteger(raw) && raw > 0) return raw;
|
|
546
|
+
if (typeof raw !== "string") return Number.NaN;
|
|
547
|
+
const t = raw.trim();
|
|
548
|
+
if (!t) return Number.NaN;
|
|
549
|
+
if (t.toLowerCase().startsWith("0x")) {
|
|
550
|
+
const hexVal = Number.parseInt(t, 16);
|
|
551
|
+
if (!Number.isFinite(hexVal) || hexVal <= 0) return Number.NaN;
|
|
552
|
+
return CHAIN_ID_DECIMAL_HEX_TYPOS[hexVal] ?? hexVal;
|
|
553
|
+
}
|
|
554
|
+
const dec = Number.parseInt(t, 10);
|
|
555
|
+
return Number.isFinite(dec) && dec > 0 ? dec : Number.NaN;
|
|
556
|
+
}
|
|
557
|
+
var agentBooleanSchema = (defaultValue = false) => zod.z.preprocess((val) => parseAgentBoolean(val, defaultValue), zod.z.boolean());
|
|
558
|
+
var agentOptionalBooleanSchema = () => zod.z.preprocess((val) => val === void 0 || val === null ? void 0 : parseAgentBoolean(val, false), zod.z.boolean().optional());
|
|
559
|
+
var agentEvmChainIdSchema = zod.z.preprocess(
|
|
560
|
+
(val) => parseAgentEvmChainId(val),
|
|
561
|
+
zod.z.number().int().positive().describe("EVM chain id (decimal, e.g. 8453 for Base \u2014 not 0x8453).")
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
// src/agent/schemas/common.ts
|
|
530
565
|
var evmAddressSchema = zod.z.string().min(1).describe("EVM address (0x-prefixed, 40 hex nibbles)");
|
|
531
566
|
var keyGenSchema = zod.z.object({
|
|
532
567
|
pubkeyhex: zod.z.string().min(1).describe("MPC secp256k1 public key hex (required for multiSignRequest pubKey)"),
|
|
@@ -554,10 +589,10 @@ var evmMultisignCommonInputSchema = zod.z.object({
|
|
|
554
589
|
purposeText: zod.z.string().min(1).describe(
|
|
555
590
|
"Human-readable purpose for the sign request. Stored in bodyForSign.purpose (may be appended with an automatic batch suffix)."
|
|
556
591
|
),
|
|
557
|
-
useCustomGas:
|
|
558
|
-
"
|
|
592
|
+
useCustomGas: agentBooleanSchema(false).describe(
|
|
593
|
+
"JSON boolean only: false = live RPC fees (default), true = chain registry Custom Gas Config. Omitted baseFee/priorityFee is valid when true."
|
|
559
594
|
),
|
|
560
|
-
chainId:
|
|
595
|
+
chainId: agentEvmChainIdSchema,
|
|
561
596
|
rpcUrl: zod.z.string().min(1).optional().describe("Server-filled from chain registry when keyGenId is set. Agents must not pass rpcUrl."),
|
|
562
597
|
executorAddress: evmAddressSchema.optional().describe("Server-filled MPC wallet from keyGenId. Agents must not pass executorAddress."),
|
|
563
598
|
chainDetail: chainDetailSchema.optional().describe("Server-filled gas row from chain registry when keyGenId is set."),
|
|
@@ -979,7 +1014,7 @@ var mcpMorphoVaultDepositInputSchema = mcpMultisignInput({
|
|
|
979
1014
|
vault: evmAddressSchema,
|
|
980
1015
|
underlying: evmAddressSchema.describe("Underlying asset; use wrapped native with isNativeIn for ETH."),
|
|
981
1016
|
amountHuman: zod.z.string().min(1),
|
|
982
|
-
isNativeIn:
|
|
1017
|
+
isNativeIn: agentOptionalBooleanSchema()
|
|
983
1018
|
});
|
|
984
1019
|
var mcpMorphoVaultWithdrawInputSchema = mcpMultisignInput({
|
|
985
1020
|
vault: evmAddressSchema,
|
|
@@ -989,7 +1024,7 @@ var mcpMorphoBlueCollateralDepositInputSchema = mcpMultisignInput({
|
|
|
989
1024
|
marketId: zod.z.string().min(1).describe("Morpho Blue marketId from API."),
|
|
990
1025
|
collateralToken: evmAddressSchema,
|
|
991
1026
|
amountHuman: zod.z.string().min(1),
|
|
992
|
-
isNativeIn:
|
|
1027
|
+
isNativeIn: agentOptionalBooleanSchema()
|
|
993
1028
|
});
|
|
994
1029
|
var mcpMorphoBlueBorrowInputSchema = mcpMultisignInput({
|
|
995
1030
|
marketId: zod.z.string().min(1),
|
|
@@ -4035,6 +4070,8 @@ exports.mcpUniswapV4RegisterPositionFromMintTxOutputSchema = mcpUniswapV4Registe
|
|
|
4035
4070
|
exports.mcpUniswapV4RegisterPositionNftInputSchema = mcpUniswapV4RegisterPositionNftInputSchema;
|
|
4036
4071
|
exports.mcpUniswapV4RegisterPositionNftOutputSchema = mcpUniswapV4RegisterPositionNftOutputSchema;
|
|
4037
4072
|
exports.multisignOutputSchema = multisignOutputSchema;
|
|
4073
|
+
exports.parseAgentBoolean = parseAgentBoolean;
|
|
4074
|
+
exports.parseAgentEvmChainId = parseAgentEvmChainId;
|
|
4038
4075
|
exports.parseMcpToolInput = parseMcpToolInput;
|
|
4039
4076
|
exports.parseMcpToolOutput = parseMcpToolOutput;
|
|
4040
4077
|
exports.parseMultisignBuilderOutput = parseMultisignBuilderOutput;
|