@varun-ai07/covenant-mcp 1.0.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.
- package/README.md +1078 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +195 -0
- package/dist/cli.js.map +1 -0
- package/dist/colors.d.ts +14 -0
- package/dist/colors.d.ts.map +1 -0
- package/dist/colors.js +14 -0
- package/dist/colors.js.map +1 -0
- package/dist/config.d.ts +396 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +191 -0
- package/dist/config.js.map +1 -0
- package/dist/handlers/transactions.d.ts +5 -0
- package/dist/handlers/transactions.d.ts.map +1 -0
- package/dist/handlers/transactions.js +82 -0
- package/dist/handlers/transactions.js.map +1 -0
- package/dist/handlers/wallet.d.ts +24 -0
- package/dist/handlers/wallet.d.ts.map +1 -0
- package/dist/handlers/wallet.js +264 -0
- package/dist/handlers/wallet.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +11 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +31 -0
- package/dist/logger.js.map +1 -0
- package/dist/postinstall.d.ts +3 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +38 -0
- package/dist/postinstall.js.map +1 -0
- package/dist/schemas.d.ts +48 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +114 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +23 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +51 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/batches.d.ts +3 -0
- package/dist/tools/batches.d.ts.map +1 -0
- package/dist/tools/batches.js +167 -0
- package/dist/tools/batches.js.map +1 -0
- package/dist/tools/collectives.d.ts +3 -0
- package/dist/tools/collectives.d.ts.map +1 -0
- package/dist/tools/collectives.js +168 -0
- package/dist/tools/collectives.js.map +1 -0
- package/dist/tools/disputes.d.ts +3 -0
- package/dist/tools/disputes.d.ts.map +1 -0
- package/dist/tools/disputes.js +129 -0
- package/dist/tools/disputes.js.map +1 -0
- package/dist/tools/escrow.d.ts +3 -0
- package/dist/tools/escrow.d.ts.map +1 -0
- package/dist/tools/escrow.js +238 -0
- package/dist/tools/escrow.js.map +1 -0
- package/dist/tools/insurance.d.ts +3 -0
- package/dist/tools/insurance.d.ts.map +1 -0
- package/dist/tools/insurance.js +101 -0
- package/dist/tools/insurance.js.map +1 -0
- package/dist/tools/market.d.ts +3 -0
- package/dist/tools/market.d.ts.map +1 -0
- package/dist/tools/market.js +303 -0
- package/dist/tools/market.js.map +1 -0
- package/dist/tools/protocol.d.ts +3 -0
- package/dist/tools/protocol.d.ts.map +1 -0
- package/dist/tools/protocol.js +121 -0
- package/dist/tools/protocol.js.map +1 -0
- package/dist/tools/receipts.d.ts +3 -0
- package/dist/tools/receipts.d.ts.map +1 -0
- package/dist/tools/receipts.js +88 -0
- package/dist/tools/receipts.js.map +1 -0
- package/dist/tools/registry.d.ts +3 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +136 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/transports/http.d.ts +3 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +121 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/transports/stdio.d.ts +7 -0
- package/dist/transports/stdio.d.ts.map +1 -0
- package/dist/transports/stdio.js +9 -0
- package/dist/transports/stdio.js.map +1 -0
- package/dist/types.d.ts +89 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +24 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COVENANT MCP Server Configuration
|
|
3
|
+
* Reuses agents/lib/config.ts patterns but standalone for MCP context.
|
|
4
|
+
*/
|
|
5
|
+
import * as dotenv from "dotenv";
|
|
6
|
+
import { createWalletClient, createPublicClient, http, defineChain, } from "viem";
|
|
7
|
+
import { baseSepolia } from "viem/chains";
|
|
8
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
9
|
+
dotenv.config();
|
|
10
|
+
// ============================================================
|
|
11
|
+
// Network
|
|
12
|
+
// ============================================================
|
|
13
|
+
export const RPC_URL = process.env.BASE_SEPOLIA_RPC_URL || "https://sepolia.base.org";
|
|
14
|
+
const hardhatLocal = defineChain({
|
|
15
|
+
id: 31337,
|
|
16
|
+
name: "Hardhat Local",
|
|
17
|
+
nativeCurrency: { decimals: 18, name: "Ether", symbol: "ETH" },
|
|
18
|
+
rpcUrls: { default: { http: ["http://127.0.0.1:8545"] } },
|
|
19
|
+
});
|
|
20
|
+
export const CHAIN = RPC_URL.includes("127.0.0.1") || RPC_URL.includes("localhost")
|
|
21
|
+
? hardhatLocal
|
|
22
|
+
: baseSepolia;
|
|
23
|
+
// ============================================================
|
|
24
|
+
// Contract Addresses
|
|
25
|
+
// ============================================================
|
|
26
|
+
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
27
|
+
export const CONTRACTS = {
|
|
28
|
+
AgentRegistry: (process.env.REGISTRY_ADDRESS || "0x3e4a9013Ec6315eF0e13B4f768e07cf43c6c3369"),
|
|
29
|
+
TaskEscrow: (process.env.ESCROW_ADDRESS || "0xb2a2b7f046fa82A020B3008A71E61d16603BAa05"),
|
|
30
|
+
ReceiptVerifier: (process.env.VERIFIER_ADDRESS || "0xabd07d380FBC7807bF25e8d969E7FF5192117Ec5"),
|
|
31
|
+
OpenTaskMarket: (process.env.MARKET_ADDRESS || "0xf930b3060020a931dccabC9BfA1e6C2a8EB6D5d5"),
|
|
32
|
+
ParallelTaskBatch: (process.env.BATCH_ADDRESS || "0xfD9314cA51374aDc879AB794844f6be3CA85a645"),
|
|
33
|
+
AgentCollective: (process.env.COLLECTIVE_ADDRESS || "0x378B0Fb03d8B2CE34Da90D1e587CEBb7b22dA856"),
|
|
34
|
+
AgentInsurance: (process.env.INSURANCE_ADDRESS || "0x87933103cA13e1969b24d40eFe2C7c9C008Fc1Dc"),
|
|
35
|
+
DisputeArbitration: (process.env.DISPUTE_ADDRESS || "0xC98ebfAE496e297a84a960085418C8240891E6CD"),
|
|
36
|
+
};
|
|
37
|
+
// ============================================================
|
|
38
|
+
// Wallet Mode
|
|
39
|
+
// ============================================================
|
|
40
|
+
export const WALLET_MODE = process.env.COVENANT_WALLET_MODE || "autonomous";
|
|
41
|
+
export const HTTP_PORT = parseInt(process.env.MCP_HTTP_PORT || "3001", 10);
|
|
42
|
+
// ============================================================
|
|
43
|
+
// Configuration Validation
|
|
44
|
+
// ============================================================
|
|
45
|
+
/**
|
|
46
|
+
* Validates configuration on startup.
|
|
47
|
+
* Throws error if critical configuration is invalid.
|
|
48
|
+
*/
|
|
49
|
+
export function validateConfig() {
|
|
50
|
+
const errors = [];
|
|
51
|
+
// Validate PRIVATE_KEY format if present
|
|
52
|
+
const key = process.env.PRIVATE_KEY;
|
|
53
|
+
if (key) {
|
|
54
|
+
const normalized = key.startsWith("0x") ? key : `0x${key}`;
|
|
55
|
+
const keyRegex = /^0x[0-9a-fA-F]{64}$/;
|
|
56
|
+
if (!keyRegex.test(normalized)) {
|
|
57
|
+
errors.push(`PRIVATE_KEY must be a 64-character hex string (got ${normalized.length} characters)`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Warn about missing MCP_API_KEY in HTTP mode
|
|
61
|
+
if (process.env.MCP_API_KEY === undefined) {
|
|
62
|
+
console.error("[WARN] MCP_API_KEY not set - HTTP requests will be rejected");
|
|
63
|
+
}
|
|
64
|
+
if (errors.length > 0) {
|
|
65
|
+
throw new Error(`Configuration errors:\n${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// ============================================================
|
|
69
|
+
// Wallet Setup
|
|
70
|
+
// ============================================================
|
|
71
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
72
|
+
let _publicClient = null;
|
|
73
|
+
let _walletClient = null;
|
|
74
|
+
let _account = null;
|
|
75
|
+
function getPrivateKey() {
|
|
76
|
+
const key = process.env.PRIVATE_KEY;
|
|
77
|
+
if (!key)
|
|
78
|
+
return null;
|
|
79
|
+
const normalized = key.startsWith("0x") ? key : `0x${key}`;
|
|
80
|
+
// Validate key format (64 hex chars after 0x)
|
|
81
|
+
const keyRegex = /^0x[0-9a-fA-F]{64}$/;
|
|
82
|
+
if (!keyRegex.test(normalized)) {
|
|
83
|
+
throw new Error(`PRIVATE_KEY must be a 64-character hex string (with or without 0x prefix). ` +
|
|
84
|
+
`Got ${normalized.length} characters.`);
|
|
85
|
+
}
|
|
86
|
+
return normalized;
|
|
87
|
+
}
|
|
88
|
+
export function getPublicClient() {
|
|
89
|
+
if (!_publicClient) {
|
|
90
|
+
_publicClient = createPublicClient({
|
|
91
|
+
chain: CHAIN,
|
|
92
|
+
transport: http(RPC_URL),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return _publicClient;
|
|
96
|
+
}
|
|
97
|
+
export function getWalletClient() {
|
|
98
|
+
if (WALLET_MODE !== "autonomous")
|
|
99
|
+
return null;
|
|
100
|
+
const key = getPrivateKey();
|
|
101
|
+
if (!key)
|
|
102
|
+
return null;
|
|
103
|
+
if (!_walletClient) {
|
|
104
|
+
_account = privateKeyToAccount(key);
|
|
105
|
+
_walletClient = createWalletClient({
|
|
106
|
+
account: _account,
|
|
107
|
+
chain: CHAIN,
|
|
108
|
+
transport: http(RPC_URL),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return _walletClient;
|
|
112
|
+
}
|
|
113
|
+
export function getAccount() {
|
|
114
|
+
if (!_account) {
|
|
115
|
+
const key = getPrivateKey();
|
|
116
|
+
if (!key)
|
|
117
|
+
return null;
|
|
118
|
+
_account = privateKeyToAccount(key);
|
|
119
|
+
}
|
|
120
|
+
return _account;
|
|
121
|
+
}
|
|
122
|
+
// ============================================================
|
|
123
|
+
// Contract ABIs (loaded lazily from agents/abis/)
|
|
124
|
+
// ============================================================
|
|
125
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
126
|
+
import { resolve, dirname } from "node:path";
|
|
127
|
+
import { fileURLToPath } from "node:url";
|
|
128
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
129
|
+
const __dirname = dirname(__filename);
|
|
130
|
+
// Look for abis in ../agents/abis/ relative to mcp/
|
|
131
|
+
const ABIS_DIR = resolve(__dirname, "../../agents/abis");
|
|
132
|
+
// Allowlist of known contracts to prevent path traversal
|
|
133
|
+
const ALLOWED_CONTRACTS = [
|
|
134
|
+
"AgentRegistry",
|
|
135
|
+
"TaskEscrow",
|
|
136
|
+
"ReceiptVerifier",
|
|
137
|
+
"OpenTaskMarket",
|
|
138
|
+
"ParallelTaskBatch",
|
|
139
|
+
"AgentCollective",
|
|
140
|
+
"AgentInsurance",
|
|
141
|
+
"DisputeArbitration",
|
|
142
|
+
];
|
|
143
|
+
const abiCache = {};
|
|
144
|
+
export function loadAbi(contractName) {
|
|
145
|
+
if (abiCache[contractName])
|
|
146
|
+
return abiCache[contractName];
|
|
147
|
+
// Security: validate against allowlist
|
|
148
|
+
if (!ALLOWED_CONTRACTS.includes(contractName)) {
|
|
149
|
+
throw new Error(`Unknown contract: ${contractName}`);
|
|
150
|
+
}
|
|
151
|
+
// Security: prevent path traversal characters
|
|
152
|
+
if (contractName.includes("/") ||
|
|
153
|
+
contractName.includes("\\") ||
|
|
154
|
+
contractName.includes("..")) {
|
|
155
|
+
throw new Error(`Invalid contract name: ${contractName}`);
|
|
156
|
+
}
|
|
157
|
+
const abiPath = resolve(ABIS_DIR, `${contractName}.json`);
|
|
158
|
+
if (!existsSync(abiPath)) {
|
|
159
|
+
throw new Error(`ABI not found for ${contractName}. Run 'npx hardhat compile' in contracts/ first.`);
|
|
160
|
+
}
|
|
161
|
+
const artifact = JSON.parse(readFileSync(abiPath, "utf-8"));
|
|
162
|
+
abiCache[contractName] = artifact.abi;
|
|
163
|
+
return artifact.abi;
|
|
164
|
+
}
|
|
165
|
+
// ============================================================
|
|
166
|
+
// Chain helpers
|
|
167
|
+
// ============================================================
|
|
168
|
+
export function getExplorerTxUrl(hash) {
|
|
169
|
+
const chainId = CHAIN.id;
|
|
170
|
+
if (chainId === 84532) {
|
|
171
|
+
return `https://sepolia.basescan.org/tx/${hash}`;
|
|
172
|
+
}
|
|
173
|
+
if (chainId === 8453) {
|
|
174
|
+
return `https://basescan.org/tx/${hash}`;
|
|
175
|
+
}
|
|
176
|
+
if (chainId === 31337) {
|
|
177
|
+
return `localhost tx: ${hash}`;
|
|
178
|
+
}
|
|
179
|
+
return `https://sepolia.basescan.org/tx/${hash}`;
|
|
180
|
+
}
|
|
181
|
+
export function getExplorerAddressUrl(address) {
|
|
182
|
+
const chainId = CHAIN.id;
|
|
183
|
+
if (chainId === 84532) {
|
|
184
|
+
return `https://sepolia.basescan.org/address/${address}`;
|
|
185
|
+
}
|
|
186
|
+
if (chainId === 8453) {
|
|
187
|
+
return `https://basescan.org/address/${address}`;
|
|
188
|
+
}
|
|
189
|
+
return address;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,EAEJ,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,MAAM,CAAC,MA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;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,EAAY,CAAC;IACnC,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,wCAAwC,OAAO,EAAE,CAAC;IAC3D,CAAC;IACD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,gCAAgC,OAAO,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TxResult, ToolResult } from "../types.js";
|
|
2
|
+
export declare function formatTxResult(result: TxResult): ToolResult;
|
|
3
|
+
export declare function formatReadResult(data: any, label?: string): ToolResult;
|
|
4
|
+
export declare function formatError(error: unknown): ToolResult;
|
|
5
|
+
//# sourceMappingURL=transactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/handlers/transactions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMxD,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CA0D3D;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAkBtE;AAMD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAOtD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getExplorerTxUrl } from "../config.js";
|
|
2
|
+
import { sanitizeErrorMessage } from "../schemas.js";
|
|
3
|
+
// ============================================================
|
|
4
|
+
// Format tx result for MCP tool response
|
|
5
|
+
// ============================================================
|
|
6
|
+
export function formatTxResult(result) {
|
|
7
|
+
if (result.status === "success") {
|
|
8
|
+
return {
|
|
9
|
+
content: [
|
|
10
|
+
{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: JSON.stringify({
|
|
13
|
+
success: true,
|
|
14
|
+
txHash: result.txHash,
|
|
15
|
+
explorer: getExplorerTxUrl(result.txHash),
|
|
16
|
+
blockNumber: result.blockNumber.toString(),
|
|
17
|
+
gasUsed: result.gasUsed.toString(),
|
|
18
|
+
}, null, 2),
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (result.status === "prepared") {
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: "text",
|
|
28
|
+
text: JSON.stringify({
|
|
29
|
+
prepared: true,
|
|
30
|
+
to: result.to,
|
|
31
|
+
data: result.data,
|
|
32
|
+
value: result.value.toString(),
|
|
33
|
+
chainId: result.chainId,
|
|
34
|
+
nonce: result.nonce,
|
|
35
|
+
expiresAt: result.expiresAt,
|
|
36
|
+
instruction: "Sign this calldata with your wallet and broadcast to the chain. " +
|
|
37
|
+
"Validate nonce and expiry before signing.",
|
|
38
|
+
}, null, 2),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Error
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: `Error: ${result.error}${result.reason ? `\nReason: ${result.reason}` : ""}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
isError: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// ============================================================
|
|
55
|
+
// Format read result for MCP tool response
|
|
56
|
+
// ============================================================
|
|
57
|
+
export function formatReadResult(data, label) {
|
|
58
|
+
// Convert BigInts to strings for JSON serialization
|
|
59
|
+
const serialized = JSON.parse(JSON.stringify(data, (_key, value) => typeof value === "bigint" ? value.toString() : value));
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: label
|
|
65
|
+
? `${label}:\n${JSON.stringify(serialized, null, 2)}`
|
|
66
|
+
: JSON.stringify(serialized, null, 2),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// ============================================================
|
|
72
|
+
// Format error for MCP tool response
|
|
73
|
+
// ============================================================
|
|
74
|
+
export function formatError(error) {
|
|
75
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
76
|
+
const sanitized = sanitizeErrorMessage(msg);
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: `Error: ${sanitized}` }],
|
|
79
|
+
isError: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=transactions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../src/handlers/transactions.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,gBAAgB,EAAS,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,+DAA+D;AAC/D,yCAAyC;AACzC,+DAA+D;AAE/D,MAAM,UAAU,cAAc,CAAC,MAAgB;IAC7C,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,OAAO,EAAE,IAAI;wBACb,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC;wBACzC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE;wBAC1C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE;qBACnC,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO;YACL,OAAO,EAAE;gBAC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AE,CAAC,CAAC,EAAE;oBACrD,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;aACxC;SACF;KACF,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,qCAAqC;AACrC,+DAA+D;AAE/D,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,MAAM,SAAS,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC5C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,SAAS,EAAE,EAAE,CAAC;QACjE,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dual-mode wallet handler for COVENANT MCP Server.
|
|
3
|
+
*
|
|
4
|
+
* autonomous: Server holds private key, signs + sends txs immediately.
|
|
5
|
+
* prepare-only: Returns unsigned calldata for external signing.
|
|
6
|
+
*
|
|
7
|
+
* Security features:
|
|
8
|
+
* - Gas limit caps to prevent DoS
|
|
9
|
+
* - Nonce + expiry for replay protection
|
|
10
|
+
* - Permission pre-checks for sensitive operations
|
|
11
|
+
*/
|
|
12
|
+
import { type Abi, type Address } from "viem";
|
|
13
|
+
import type { TxResult } from "../types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the current account has permission to execute a function.
|
|
16
|
+
* Returns early error message if not allowed, preventing wasted gas.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkPermission(contractName: string, functionName: string, args: readonly unknown[]): Promise<{
|
|
19
|
+
allowed: boolean;
|
|
20
|
+
reason?: string;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function executeOrPrepare(contractAddress: Address, abi: Abi, functionName: string, args: readonly unknown[], value?: bigint, contractName?: string): Promise<TxResult>;
|
|
23
|
+
export declare function readContract(contractAddress: Address, abi: Abi, functionName: string, args?: readonly unknown[]): Promise<any>;
|
|
24
|
+
//# sourceMappingURL=wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/handlers/wallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,OAAO,EAEb,MAAM,MAAM,CAAC;AAYd,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,aAAa,CAAC;AAS5E;;;GAGG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,SAAS,OAAO,EAAE,GACvB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6FhD;AAMD,wBAAsB,gBAAgB,CACpC,eAAe,EAAE,OAAO,EACxB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,QAAQ,CAAC,CAgBnB;AA6JD,wBAAsB,YAAY,CAChC,eAAe,EAAE,OAAO,EACxB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,MAAM,EACpB,IAAI,GAAE,SAAS,OAAO,EAAO,GAC5B,OAAO,CAAC,GAAG,CAAC,CAed"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dual-mode wallet handler for COVENANT MCP Server.
|
|
3
|
+
*
|
|
4
|
+
* autonomous: Server holds private key, signs + sends txs immediately.
|
|
5
|
+
* prepare-only: Returns unsigned calldata for external signing.
|
|
6
|
+
*
|
|
7
|
+
* Security features:
|
|
8
|
+
* - Gas limit caps to prevent DoS
|
|
9
|
+
* - Nonce + expiry for replay protection
|
|
10
|
+
* - Permission pre-checks for sensitive operations
|
|
11
|
+
*/
|
|
12
|
+
import { encodeFunctionData, } from "viem";
|
|
13
|
+
import { getWalletClient, getPublicClient, getAccount, WALLET_MODE, CHAIN, getExplorerTxUrl, CONTRACTS, loadAbi, } from "../config.js";
|
|
14
|
+
// Maximum gas limit to prevent DoS via expensive calls
|
|
15
|
+
const GAS_LIMIT_MAX = 10000000n; // 10M gas
|
|
16
|
+
// ============================================================
|
|
17
|
+
// Permission Pre-Checks
|
|
18
|
+
// ============================================================
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the current account has permission to execute a function.
|
|
21
|
+
* Returns early error message if not allowed, preventing wasted gas.
|
|
22
|
+
*/
|
|
23
|
+
export async function checkPermission(contractName, functionName, args) {
|
|
24
|
+
const account = getAccount();
|
|
25
|
+
if (!account) {
|
|
26
|
+
return { allowed: false, reason: "No account configured" };
|
|
27
|
+
}
|
|
28
|
+
const accountAddress = account.address;
|
|
29
|
+
// TaskEscrow: verifyTask - only task client
|
|
30
|
+
if (contractName === "TaskEscrow" && functionName === "verifyTask") {
|
|
31
|
+
const taskId = args[0];
|
|
32
|
+
try {
|
|
33
|
+
const task = await readContract(CONTRACTS.TaskEscrow, loadAbi("TaskEscrow"), "getTask", [taskId]);
|
|
34
|
+
if (task.client !== accountAddress) {
|
|
35
|
+
return { allowed: false, reason: "Only task client can verify" };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return { allowed: false, reason: "Task not found" };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// TaskEscrow: disputeTask - only task client or worker
|
|
43
|
+
if (contractName === "TaskEscrow" && functionName === "disputeTask") {
|
|
44
|
+
const taskId = args[0];
|
|
45
|
+
try {
|
|
46
|
+
const task = await readContract(CONTRACTS.TaskEscrow, loadAbi("TaskEscrow"), "getTask", [taskId]);
|
|
47
|
+
if (task.client !== accountAddress && task.worker !== accountAddress) {
|
|
48
|
+
return { allowed: false, reason: "Only task client or worker can dispute" };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return { allowed: false, reason: "Task not found" };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// OpenTaskMarket: selectWorker - only task client
|
|
56
|
+
if (contractName === "OpenTaskMarket" && functionName === "selectWorker") {
|
|
57
|
+
const taskId = args[0];
|
|
58
|
+
try {
|
|
59
|
+
const task = await readContract(CONTRACTS.OpenTaskMarket, loadAbi("OpenTaskMarket"), "getTask", [taskId]);
|
|
60
|
+
if (task.client !== accountAddress) {
|
|
61
|
+
return { allowed: false, reason: "Only task client can select worker" };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return { allowed: false, reason: "Task not found" };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// OpenTaskMarket: makeCounterOffer - only task client
|
|
69
|
+
if (contractName === "OpenTaskMarket" && functionName === "makeCounterOffer") {
|
|
70
|
+
const taskId = args[0];
|
|
71
|
+
try {
|
|
72
|
+
const task = await readContract(CONTRACTS.OpenTaskMarket, loadAbi("OpenTaskMarket"), "getTask", [taskId]);
|
|
73
|
+
if (task.client !== accountAddress) {
|
|
74
|
+
return { allowed: false, reason: "Only task client can make counter offers" };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return { allowed: false, reason: "Task not found" };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// OpenTaskMarket: cancelTask - only task client
|
|
82
|
+
if (contractName === "OpenTaskMarket" && functionName === "cancelTask") {
|
|
83
|
+
const taskId = args[0];
|
|
84
|
+
try {
|
|
85
|
+
const task = await readContract(CONTRACTS.OpenTaskMarket, loadAbi("OpenTaskMarket"), "getTask", [taskId]);
|
|
86
|
+
if (task.client !== accountAddress) {
|
|
87
|
+
return { allowed: false, reason: "Only task client can cancel" };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return { allowed: false, reason: "Task not found" };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// DisputeArbitration: castVote - only selected jurors
|
|
95
|
+
if (contractName === "DisputeArbitration" && functionName === "castVote") {
|
|
96
|
+
const disputeId = args[0];
|
|
97
|
+
try {
|
|
98
|
+
const dispute = await readContract(CONTRACTS.DisputeArbitration, loadAbi("DisputeArbitration"), "getDispute", [disputeId]);
|
|
99
|
+
const jurors = dispute.jurors;
|
|
100
|
+
if (!jurors.includes(accountAddress)) {
|
|
101
|
+
return { allowed: false, reason: "Only selected jurors can vote" };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return { allowed: false, reason: "Dispute not found" };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { allowed: true };
|
|
109
|
+
}
|
|
110
|
+
// ============================================================
|
|
111
|
+
// Core execute-or-prepare function
|
|
112
|
+
// ============================================================
|
|
113
|
+
export async function executeOrPrepare(contractAddress, abi, functionName, args, value, contractName) {
|
|
114
|
+
// Permission check for sensitive operations
|
|
115
|
+
if (contractName) {
|
|
116
|
+
const permission = await checkPermission(contractName, functionName, args);
|
|
117
|
+
if (!permission.allowed) {
|
|
118
|
+
return {
|
|
119
|
+
status: "error",
|
|
120
|
+
error: permission.reason || "Permission denied",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (WALLET_MODE === "prepare-only") {
|
|
125
|
+
return prepareTx(contractAddress, abi, functionName, args, value);
|
|
126
|
+
}
|
|
127
|
+
return executeTx(contractAddress, abi, functionName, args, value);
|
|
128
|
+
}
|
|
129
|
+
// ============================================================
|
|
130
|
+
// Autonomous mode: sign + send immediately
|
|
131
|
+
// ============================================================
|
|
132
|
+
async function executeTx(contractAddress, abi, functionName, args, value) {
|
|
133
|
+
const wallet = getWalletClient();
|
|
134
|
+
const publicClient = getPublicClient();
|
|
135
|
+
const account = getAccount();
|
|
136
|
+
if (!wallet || !account) {
|
|
137
|
+
return {
|
|
138
|
+
status: "error",
|
|
139
|
+
error: "No private key configured. Check server configuration.",
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
// Estimate gas with capped limit
|
|
144
|
+
const { request } = await publicClient.simulateContract({
|
|
145
|
+
address: contractAddress,
|
|
146
|
+
abi,
|
|
147
|
+
functionName,
|
|
148
|
+
args: args,
|
|
149
|
+
account,
|
|
150
|
+
value,
|
|
151
|
+
gas: GAS_LIMIT_MAX,
|
|
152
|
+
});
|
|
153
|
+
// Send transaction
|
|
154
|
+
const hash = await wallet.writeContract(request);
|
|
155
|
+
console.error(`[TX] Sent: ${hash}`);
|
|
156
|
+
console.error(`[TX] Explorer: ${getExplorerTxUrl(hash)}`);
|
|
157
|
+
// Wait for confirmation
|
|
158
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
159
|
+
hash,
|
|
160
|
+
timeout: 60_000,
|
|
161
|
+
});
|
|
162
|
+
console.error(`[TX] Confirmed in block ${receipt.blockNumber} — gas: ${receipt.gasUsed}`);
|
|
163
|
+
return {
|
|
164
|
+
status: "success",
|
|
165
|
+
txHash: hash,
|
|
166
|
+
blockNumber: receipt.blockNumber,
|
|
167
|
+
gasUsed: receipt.gasUsed,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return parseViemError(error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// ============================================================
|
|
175
|
+
// Prepare-only mode: return unsigned calldata
|
|
176
|
+
// ============================================================
|
|
177
|
+
async function prepareTx(contractAddress, abi, functionName, args, value) {
|
|
178
|
+
const publicClient = getPublicClient();
|
|
179
|
+
const account = getAccount();
|
|
180
|
+
const data = encodeFunctionData({
|
|
181
|
+
abi,
|
|
182
|
+
functionName,
|
|
183
|
+
args: args,
|
|
184
|
+
});
|
|
185
|
+
// Include nonce and expiry for replay protection
|
|
186
|
+
let nonce = 0;
|
|
187
|
+
if (account) {
|
|
188
|
+
nonce = await publicClient.getTransactionCount({ address: account.address });
|
|
189
|
+
}
|
|
190
|
+
const expiresAt = Math.floor(Date.now() / 1000) + 3600; // 1 hour expiry
|
|
191
|
+
return {
|
|
192
|
+
status: "prepared",
|
|
193
|
+
to: contractAddress,
|
|
194
|
+
data,
|
|
195
|
+
value: value || 0n,
|
|
196
|
+
chainId: CHAIN.id,
|
|
197
|
+
nonce,
|
|
198
|
+
expiresAt,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
// ============================================================
|
|
202
|
+
// Error parsing
|
|
203
|
+
// ============================================================
|
|
204
|
+
function parseViemError(error) {
|
|
205
|
+
const msg = error?.message || String(error);
|
|
206
|
+
// Extract revert reason
|
|
207
|
+
const revertMatch = msg.match(/revert(?:ed| reason)?\s*:?\s*"?([^"\n]+)"?/i);
|
|
208
|
+
if (revertMatch) {
|
|
209
|
+
return {
|
|
210
|
+
status: "error",
|
|
211
|
+
error: `Transaction reverted: ${revertMatch[1]}`,
|
|
212
|
+
reason: revertMatch[1],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
// Gas estimation failure
|
|
216
|
+
if (msg.includes("gas") || msg.includes("Gas")) {
|
|
217
|
+
return {
|
|
218
|
+
status: "error",
|
|
219
|
+
error: "Gas estimation failed. Check contract conditions (insufficient funds, wrong arguments, or state issue).",
|
|
220
|
+
reason: msg.slice(0, 200),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Insufficient funds
|
|
224
|
+
if (msg.includes("insufficient funds")) {
|
|
225
|
+
return {
|
|
226
|
+
status: "error",
|
|
227
|
+
error: "Insufficient funds for transaction.",
|
|
228
|
+
reason: msg,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
// Contract not deployed
|
|
232
|
+
if (msg.includes("contract") && msg.includes("not deployed")) {
|
|
233
|
+
return {
|
|
234
|
+
status: "error",
|
|
235
|
+
error: "Contract not deployed at this address on the current network.",
|
|
236
|
+
reason: msg,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
status: "error",
|
|
241
|
+
error: msg.slice(0, 500),
|
|
242
|
+
reason: msg,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// ============================================================
|
|
246
|
+
// Read-only calls (no wallet needed)
|
|
247
|
+
// ============================================================
|
|
248
|
+
export async function readContract(contractAddress, abi, functionName, args = []) {
|
|
249
|
+
const publicClient = getPublicClient();
|
|
250
|
+
try {
|
|
251
|
+
const result = await publicClient.readContract({
|
|
252
|
+
address: contractAddress,
|
|
253
|
+
abi,
|
|
254
|
+
functionName,
|
|
255
|
+
args: args,
|
|
256
|
+
});
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
const msg = error?.message || String(error);
|
|
261
|
+
throw new Error(`Contract read failed (${functionName}): ${msg.slice(0, 300)}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../src/handlers/wallet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,kBAAkB,GAInB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,eAAe,EACf,eAAe,EACf,UAAU,EACV,WAAW,EACX,KAAK,EACL,gBAAgB,EAEhB,SAAS,EACT,OAAO,GACR,MAAM,cAAc,CAAC;AAGtB,uDAAuD;AACvD,MAAM,aAAa,GAAG,SAAW,CAAC,CAAC,UAAU;AAE7C,+DAA+D;AAC/D,wBAAwB;AACxB,+DAA+D;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,YAAoB,EACpB,YAAoB,EACpB,IAAwB;IAExB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,I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