shll-skills 6.0.1 → 6.0.2
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/SKILL.md +4 -4
- package/dist/{chunk-5GV6AGSA.mjs → chunk-MPUPO5EJ.mjs} +39 -63
- package/dist/index.js +39 -68
- package/dist/index.mjs +4 -9
- package/dist/mcp.js +41 -72
- package/dist/mcp.mjs +6 -13
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: shll-run
|
|
3
3
|
description: Execute DeFi transactions on BSC via SHLL AgentNFA. The AI handles all commands and users only need to chat.
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.2
|
|
5
5
|
author: SHLL Team
|
|
6
6
|
website: https://shll.run
|
|
7
7
|
twitter: https://twitter.com/shllrun
|
|
@@ -68,7 +68,7 @@ On-chain guardrails:
|
|
|
68
68
|
- Spending limits, cooldowns, whitelist rules, and protocol rules are enforced on-chain.
|
|
69
69
|
- Raw calldata is blocked if the recipient cannot be decoded safely.
|
|
70
70
|
|
|
71
|
-
## Current Critical Constraints (v6.0.
|
|
71
|
+
## Current Critical Constraints (v6.0.2)
|
|
72
72
|
|
|
73
73
|
1. `init` command is disabled. Do not use it.
|
|
74
74
|
2. Raw calldata remains high risk; rely on strict recipient safety checks.
|
|
@@ -146,11 +146,10 @@ Write commands include:
|
|
|
146
146
|
- `raw`
|
|
147
147
|
- `lend`
|
|
148
148
|
- `redeem`
|
|
149
|
-
- `config`
|
|
150
149
|
- `four_buy`
|
|
151
150
|
- `four_sell`
|
|
152
151
|
|
|
153
|
-
Read-only commands
|
|
152
|
+
Read-only commands (no confirmation needed): `config`, `policies`, `status`, `history`, `portfolio`, `price`, `tokens`, `search`, `balance`, `four_info`.
|
|
154
153
|
|
|
155
154
|
## CLI Commands
|
|
156
155
|
|
|
@@ -187,6 +186,7 @@ If `-l/--listing` is omitted, `setup-guide` auto-selects an active listing from
|
|
|
187
186
|
|
|
188
187
|
### Read-only and audit
|
|
189
188
|
|
|
189
|
+
- `shll-run config -k <tokenId>` (view-only; modify via web console)
|
|
190
190
|
- `shll-run portfolio -k <tokenId>`
|
|
191
191
|
- `shll-run price --token <symbolOrAddress>`
|
|
192
192
|
- `shll-run search --query <text>`
|
|
@@ -6,7 +6,7 @@ var MEV_PROTECTED_RPC = "https://bscrpc.pancakeswap.finance";
|
|
|
6
6
|
var DEFAULT_LISTING_MANAGER = "0x1f9CE85bD0FF75acc3D92eB79f1Eb472f0865071";
|
|
7
7
|
var DEFAULT_LISTING_ID = "0x64083b44e38db02749e6e16bf84ce6c19146cc42a108e53324e11f250b15a0b7";
|
|
8
8
|
var DEFAULT_INDEXER = "https://indexer-mainnet.shll.run";
|
|
9
|
-
var SKILL_VERSION = "6.0.
|
|
9
|
+
var SKILL_VERSION = "6.0.2";
|
|
10
10
|
var BINDINGS_UPDATED_AT = "2026-03-06";
|
|
11
11
|
var PANCAKE_V2_ROUTER = "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
12
12
|
var PANCAKE_V3_SMART_ROUTER = "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4";
|
|
@@ -170,16 +170,11 @@ var LISTING_MANAGER_ABI = [
|
|
|
170
170
|
}
|
|
171
171
|
];
|
|
172
172
|
var SPENDING_LIMIT_ABI = [
|
|
173
|
-
{ type: "function", name: "setLimits", inputs: [{ name: "instanceId", type: "uint256" }, { name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
174
173
|
{ type: "function", name: "instanceLimits", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], stateMutability: "view" },
|
|
175
174
|
{ type: "function", name: "tokenRestrictionEnabled", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "bool" }], stateMutability: "view" },
|
|
176
|
-
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
177
|
-
{ type: "function", name: "addToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
178
|
-
{ type: "function", name: "removeToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
179
|
-
{ type: "function", name: "setTokenRestriction", inputs: [{ name: "instanceId", type: "uint256" }, { name: "enabled", type: "bool" }], outputs: [], stateMutability: "nonpayable" }
|
|
175
|
+
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
180
176
|
];
|
|
181
177
|
var COOLDOWN_ABI = [
|
|
182
|
-
{ type: "function", name: "setCooldown", inputs: [{ name: "instanceId", type: "uint256" }, { name: "seconds_", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
183
178
|
{ type: "function", name: "cooldownSeconds", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "uint256" }], stateMutability: "view" }
|
|
184
179
|
];
|
|
185
180
|
var FOUR_MEME_HELPER_ABI = [
|
|
@@ -293,7 +288,7 @@ async function resolveTokenAsync(publicClient, input) {
|
|
|
293
288
|
}
|
|
294
289
|
|
|
295
290
|
// src/shared/clients.ts
|
|
296
|
-
import { createPublicClient as createPublicClient2,
|
|
291
|
+
import { createPublicClient as createPublicClient2, http as http2 } from "viem";
|
|
297
292
|
import { privateKeyToAccount as privateKeyToAccount2, generatePrivateKey } from "viem/accounts";
|
|
298
293
|
import { bsc as bsc2 } from "viem/chains";
|
|
299
294
|
|
|
@@ -823,14 +818,6 @@ function createClients(rpcUrl) {
|
|
|
823
818
|
});
|
|
824
819
|
return { account, publicClient, policyClient, rpc: writeRpc };
|
|
825
820
|
}
|
|
826
|
-
function createWallet(rpcUrl) {
|
|
827
|
-
const privateKey = process.env.RUNNER_PRIVATE_KEY;
|
|
828
|
-
if (!privateKey) throw new Error("RUNNER_PRIVATE_KEY environment variable is required");
|
|
829
|
-
const rpc = rpcUrl || DEFAULT_RPC;
|
|
830
|
-
const account = privateKeyToAccount2(toHex(privateKey));
|
|
831
|
-
const walletClient = createWalletClient2({ account, chain: bsc2, transport: http2(rpc) });
|
|
832
|
-
return { account, walletClient };
|
|
833
|
-
}
|
|
834
821
|
function createReadOnlyClient(rpcUrl) {
|
|
835
822
|
const rpc = rpcUrl || process.env.SHLL_RPC || DEFAULT_RPC;
|
|
836
823
|
return createPublicClient2({
|
|
@@ -2417,59 +2404,48 @@ async function getHistory(tokenIdRaw, limit) {
|
|
|
2417
2404
|
recentPolicyRejections: rejections.length
|
|
2418
2405
|
};
|
|
2419
2406
|
}
|
|
2420
|
-
async function
|
|
2421
|
-
if (!options.txLimit && !options.dailyLimit && !options.cooldown) {
|
|
2422
|
-
throw new SkillError("INVALID_INPUT", "Must specify at least one policy config option");
|
|
2423
|
-
}
|
|
2407
|
+
async function getPolicyConfigGuidance(tokenIdRaw, rpcUrl) {
|
|
2424
2408
|
const tokenId = parseTokenId(tokenIdRaw);
|
|
2425
|
-
const { publicClient, policyClient
|
|
2426
|
-
await ensureAccess(tokenId, rpc, publicClient);
|
|
2427
|
-
const { walletClient } = createWallet(rpc);
|
|
2409
|
+
const { publicClient, policyClient } = createClients(rpcUrl);
|
|
2428
2410
|
const policies = await policyClient.getPolicies(tokenId);
|
|
2429
|
-
const
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2411
|
+
const consoleUrl = agentConsoleUrl(tokenId);
|
|
2412
|
+
const currentConfig = {};
|
|
2413
|
+
const spendingPolicy = policies.find((p) => p.policyTypeName === "spending_limit");
|
|
2414
|
+
if (spendingPolicy) {
|
|
2415
|
+
try {
|
|
2416
|
+
const [maxPerTx, maxPerDay, maxSlippageBps] = await publicClient.readContract({
|
|
2417
|
+
address: spendingPolicy.address,
|
|
2418
|
+
abi: SPENDING_LIMIT_ABI,
|
|
2419
|
+
functionName: "instanceLimits",
|
|
2420
|
+
args: [tokenId]
|
|
2421
|
+
});
|
|
2422
|
+
currentConfig.spendingLimit = {
|
|
2423
|
+
maxPerTx: (Number(maxPerTx) / 1e18).toFixed(4) + " BNB",
|
|
2424
|
+
maxPerDay: (Number(maxPerDay) / 1e18).toFixed(4) + " BNB",
|
|
2425
|
+
slippageBps: maxSlippageBps.toString()
|
|
2426
|
+
};
|
|
2427
|
+
} catch {
|
|
2434
2428
|
}
|
|
2435
|
-
const current = await publicClient.readContract({
|
|
2436
|
-
address: spendingPolicy.address,
|
|
2437
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2438
|
-
functionName: "instanceLimits",
|
|
2439
|
-
args: [tokenId]
|
|
2440
|
-
});
|
|
2441
|
-
const [curMaxPerTx, curMaxPerDay, curSlippage] = current;
|
|
2442
|
-
const hash = await walletClient.writeContract({
|
|
2443
|
-
address: spendingPolicy.address,
|
|
2444
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2445
|
-
functionName: "setLimits",
|
|
2446
|
-
args: [
|
|
2447
|
-
tokenId,
|
|
2448
|
-
options.txLimit ? parseAmount(options.txLimit, 18) : curMaxPerTx,
|
|
2449
|
-
options.dailyLimit ? parseAmount(options.dailyLimit, 18) : curMaxPerDay,
|
|
2450
|
-
curSlippage
|
|
2451
|
-
]
|
|
2452
|
-
});
|
|
2453
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2454
|
-
results.push(`SpendingLimit updated: ${hash}`);
|
|
2455
2429
|
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2430
|
+
const cooldownPolicy = policies.find((p) => p.policyTypeName === "cooldown");
|
|
2431
|
+
if (cooldownPolicy) {
|
|
2432
|
+
try {
|
|
2433
|
+
const cooldown = await publicClient.readContract({
|
|
2434
|
+
address: cooldownPolicy.address,
|
|
2435
|
+
abi: COOLDOWN_ABI,
|
|
2436
|
+
functionName: "cooldownSeconds",
|
|
2437
|
+
args: [tokenId]
|
|
2438
|
+
});
|
|
2439
|
+
currentConfig.cooldown = { seconds: Number(cooldown) };
|
|
2440
|
+
} catch {
|
|
2460
2441
|
}
|
|
2461
|
-
const hash = await walletClient.writeContract({
|
|
2462
|
-
address: cooldownPolicy.address,
|
|
2463
|
-
abi: COOLDOWN_ABI,
|
|
2464
|
-
functionName: "setCooldown",
|
|
2465
|
-
args: [tokenId, BigInt(options.cooldown)]
|
|
2466
|
-
});
|
|
2467
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2468
|
-
results.push(`Cooldown updated: ${hash}`);
|
|
2469
2442
|
}
|
|
2470
2443
|
return {
|
|
2471
|
-
status: "
|
|
2472
|
-
|
|
2444
|
+
status: "read_only",
|
|
2445
|
+
tokenId: tokenIdRaw,
|
|
2446
|
+
currentConfig,
|
|
2447
|
+
message: "Policy modification via Skills is disabled. Please use the web console to adjust your security settings.",
|
|
2448
|
+
consoleUrl
|
|
2473
2449
|
};
|
|
2474
2450
|
}
|
|
2475
2451
|
function dedupeStrings(values) {
|
|
@@ -2507,5 +2483,5 @@ export {
|
|
|
2507
2483
|
readTokenRestriction,
|
|
2508
2484
|
getStatusOverview,
|
|
2509
2485
|
getHistory,
|
|
2510
|
-
|
|
2486
|
+
getPolicyConfigGuidance
|
|
2511
2487
|
};
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ var MEV_PROTECTED_RPC = "https://bscrpc.pancakeswap.finance";
|
|
|
12
12
|
var DEFAULT_LISTING_MANAGER = "0x1f9CE85bD0FF75acc3D92eB79f1Eb472f0865071";
|
|
13
13
|
var DEFAULT_LISTING_ID = "0x64083b44e38db02749e6e16bf84ce6c19146cc42a108e53324e11f250b15a0b7";
|
|
14
14
|
var DEFAULT_INDEXER = "https://indexer-mainnet.shll.run";
|
|
15
|
-
var SKILL_VERSION = "6.0.
|
|
15
|
+
var SKILL_VERSION = "6.0.2";
|
|
16
16
|
var BINDINGS_UPDATED_AT = "2026-03-06";
|
|
17
17
|
var PANCAKE_V2_ROUTER = "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
18
18
|
var PANCAKE_V3_SMART_ROUTER = "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4";
|
|
@@ -176,16 +176,11 @@ var LISTING_MANAGER_ABI = [
|
|
|
176
176
|
}
|
|
177
177
|
];
|
|
178
178
|
var SPENDING_LIMIT_ABI = [
|
|
179
|
-
{ type: "function", name: "setLimits", inputs: [{ name: "instanceId", type: "uint256" }, { name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
180
179
|
{ type: "function", name: "instanceLimits", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], stateMutability: "view" },
|
|
181
180
|
{ type: "function", name: "tokenRestrictionEnabled", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "bool" }], stateMutability: "view" },
|
|
182
|
-
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
183
|
-
{ type: "function", name: "addToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
184
|
-
{ type: "function", name: "removeToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
185
|
-
{ type: "function", name: "setTokenRestriction", inputs: [{ name: "instanceId", type: "uint256" }, { name: "enabled", type: "bool" }], outputs: [], stateMutability: "nonpayable" }
|
|
181
|
+
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
186
182
|
];
|
|
187
183
|
var COOLDOWN_ABI = [
|
|
188
|
-
{ type: "function", name: "setCooldown", inputs: [{ name: "instanceId", type: "uint256" }, { name: "seconds_", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
189
184
|
{ type: "function", name: "cooldownSeconds", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "uint256" }], stateMutability: "view" }
|
|
190
185
|
];
|
|
191
186
|
var FOUR_MEME_HELPER_ABI = [
|
|
@@ -825,14 +820,6 @@ function createClients(rpcUrl) {
|
|
|
825
820
|
});
|
|
826
821
|
return { account, publicClient, policyClient, rpc: writeRpc };
|
|
827
822
|
}
|
|
828
|
-
function createWallet(rpcUrl) {
|
|
829
|
-
const privateKey = process.env.RUNNER_PRIVATE_KEY;
|
|
830
|
-
if (!privateKey) throw new Error("RUNNER_PRIVATE_KEY environment variable is required");
|
|
831
|
-
const rpc = rpcUrl || DEFAULT_RPC;
|
|
832
|
-
const account = (0, import_accounts2.privateKeyToAccount)(toHex(privateKey));
|
|
833
|
-
const walletClient = (0, import_viem2.createWalletClient)({ account, chain: import_chains2.bsc, transport: (0, import_viem2.http)(rpc) });
|
|
834
|
-
return { account, walletClient };
|
|
835
|
-
}
|
|
836
823
|
function createReadOnlyClient(rpcUrl) {
|
|
837
824
|
const rpc = rpcUrl || process.env.SHLL_RPC || DEFAULT_RPC;
|
|
838
825
|
return (0, import_viem2.createPublicClient)({
|
|
@@ -2360,59 +2347,48 @@ async function getHistory(tokenIdRaw, limit) {
|
|
|
2360
2347
|
recentPolicyRejections: rejections.length
|
|
2361
2348
|
};
|
|
2362
2349
|
}
|
|
2363
|
-
async function
|
|
2364
|
-
if (!options.txLimit && !options.dailyLimit && !options.cooldown) {
|
|
2365
|
-
throw new SkillError("INVALID_INPUT", "Must specify at least one policy config option");
|
|
2366
|
-
}
|
|
2350
|
+
async function getPolicyConfigGuidance(tokenIdRaw, rpcUrl) {
|
|
2367
2351
|
const tokenId = parseTokenId(tokenIdRaw);
|
|
2368
|
-
const { publicClient, policyClient
|
|
2369
|
-
await ensureAccess(tokenId, rpc, publicClient);
|
|
2370
|
-
const { walletClient } = createWallet(rpc);
|
|
2352
|
+
const { publicClient, policyClient } = createClients(rpcUrl);
|
|
2371
2353
|
const policies = await policyClient.getPolicies(tokenId);
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2354
|
+
const consoleUrl = agentConsoleUrl(tokenId);
|
|
2355
|
+
const currentConfig = {};
|
|
2356
|
+
const spendingPolicy = policies.find((p) => p.policyTypeName === "spending_limit");
|
|
2357
|
+
if (spendingPolicy) {
|
|
2358
|
+
try {
|
|
2359
|
+
const [maxPerTx, maxPerDay, maxSlippageBps] = await publicClient.readContract({
|
|
2360
|
+
address: spendingPolicy.address,
|
|
2361
|
+
abi: SPENDING_LIMIT_ABI,
|
|
2362
|
+
functionName: "instanceLimits",
|
|
2363
|
+
args: [tokenId]
|
|
2364
|
+
});
|
|
2365
|
+
currentConfig.spendingLimit = {
|
|
2366
|
+
maxPerTx: (Number(maxPerTx) / 1e18).toFixed(4) + " BNB",
|
|
2367
|
+
maxPerDay: (Number(maxPerDay) / 1e18).toFixed(4) + " BNB",
|
|
2368
|
+
slippageBps: maxSlippageBps.toString()
|
|
2369
|
+
};
|
|
2370
|
+
} catch {
|
|
2377
2371
|
}
|
|
2378
|
-
const current = await publicClient.readContract({
|
|
2379
|
-
address: spendingPolicy.address,
|
|
2380
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2381
|
-
functionName: "instanceLimits",
|
|
2382
|
-
args: [tokenId]
|
|
2383
|
-
});
|
|
2384
|
-
const [curMaxPerTx, curMaxPerDay, curSlippage] = current;
|
|
2385
|
-
const hash = await walletClient.writeContract({
|
|
2386
|
-
address: spendingPolicy.address,
|
|
2387
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2388
|
-
functionName: "setLimits",
|
|
2389
|
-
args: [
|
|
2390
|
-
tokenId,
|
|
2391
|
-
options.txLimit ? parseAmount(options.txLimit, 18) : curMaxPerTx,
|
|
2392
|
-
options.dailyLimit ? parseAmount(options.dailyLimit, 18) : curMaxPerDay,
|
|
2393
|
-
curSlippage
|
|
2394
|
-
]
|
|
2395
|
-
});
|
|
2396
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2397
|
-
results.push(`SpendingLimit updated: ${hash}`);
|
|
2398
2372
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2373
|
+
const cooldownPolicy = policies.find((p) => p.policyTypeName === "cooldown");
|
|
2374
|
+
if (cooldownPolicy) {
|
|
2375
|
+
try {
|
|
2376
|
+
const cooldown = await publicClient.readContract({
|
|
2377
|
+
address: cooldownPolicy.address,
|
|
2378
|
+
abi: COOLDOWN_ABI,
|
|
2379
|
+
functionName: "cooldownSeconds",
|
|
2380
|
+
args: [tokenId]
|
|
2381
|
+
});
|
|
2382
|
+
currentConfig.cooldown = { seconds: Number(cooldown) };
|
|
2383
|
+
} catch {
|
|
2403
2384
|
}
|
|
2404
|
-
const hash = await walletClient.writeContract({
|
|
2405
|
-
address: cooldownPolicy.address,
|
|
2406
|
-
abi: COOLDOWN_ABI,
|
|
2407
|
-
functionName: "setCooldown",
|
|
2408
|
-
args: [tokenId, BigInt(options.cooldown)]
|
|
2409
|
-
});
|
|
2410
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2411
|
-
results.push(`Cooldown updated: ${hash}`);
|
|
2412
2385
|
}
|
|
2413
2386
|
return {
|
|
2414
|
-
status: "
|
|
2415
|
-
|
|
2387
|
+
status: "read_only",
|
|
2388
|
+
tokenId: tokenIdRaw,
|
|
2389
|
+
currentConfig,
|
|
2390
|
+
message: "Policy modification via Skills is disabled. Please use the web console to adjust your security settings.",
|
|
2391
|
+
consoleUrl
|
|
2416
2392
|
};
|
|
2417
2393
|
}
|
|
2418
2394
|
function dedupeStrings(values) {
|
|
@@ -2582,15 +2558,10 @@ function registerAgentCommands(program2) {
|
|
|
2582
2558
|
process.exit(1);
|
|
2583
2559
|
}
|
|
2584
2560
|
});
|
|
2585
|
-
const configCmd = new import_commander5.Command("config").description("
|
|
2561
|
+
const configCmd = new import_commander5.Command("config").description("View current risk parameters (modify via web console)");
|
|
2586
2562
|
addSharedOptions(configCmd).action(async (opts) => {
|
|
2587
2563
|
try {
|
|
2588
|
-
output(await
|
|
2589
|
-
txLimit: opts.txLimit,
|
|
2590
|
-
dailyLimit: opts.dailyLimit,
|
|
2591
|
-
cooldown: opts.cooldown,
|
|
2592
|
-
rpcUrl: opts.rpc
|
|
2593
|
-
}));
|
|
2564
|
+
output(await getPolicyConfigGuidance(opts.tokenId, opts.rpc));
|
|
2594
2565
|
} catch (error) {
|
|
2595
2566
|
outputError(error);
|
|
2596
2567
|
process.exit(1);
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getBalance,
|
|
12
12
|
getFourMemeInfo,
|
|
13
13
|
getHistory,
|
|
14
|
+
getPolicyConfigGuidance,
|
|
14
15
|
getPolicySummary,
|
|
15
16
|
getPortfolio,
|
|
16
17
|
getPrice,
|
|
@@ -25,9 +26,8 @@ import {
|
|
|
25
26
|
toErrorPayload,
|
|
26
27
|
transferFromVault,
|
|
27
28
|
unwrapWbnb,
|
|
28
|
-
updateRiskConfig,
|
|
29
29
|
wrapBnb
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-MPUPO5EJ.mjs";
|
|
31
31
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
import { Command as Command9 } from "commander";
|
|
@@ -226,15 +226,10 @@ function registerAgentCommands(program2) {
|
|
|
226
226
|
process.exit(1);
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
const configCmd = new Command5("config").description("
|
|
229
|
+
const configCmd = new Command5("config").description("View current risk parameters (modify via web console)");
|
|
230
230
|
addSharedOptions(configCmd).action(async (opts) => {
|
|
231
231
|
try {
|
|
232
|
-
output(await
|
|
233
|
-
txLimit: opts.txLimit,
|
|
234
|
-
dailyLimit: opts.dailyLimit,
|
|
235
|
-
cooldown: opts.cooldown,
|
|
236
|
-
rpcUrl: opts.rpc
|
|
237
|
-
}));
|
|
232
|
+
output(await getPolicyConfigGuidance(opts.tokenId, opts.rpc));
|
|
238
233
|
} catch (error) {
|
|
239
234
|
outputError(error);
|
|
240
235
|
process.exit(1);
|
package/dist/mcp.js
CHANGED
|
@@ -12,7 +12,7 @@ var MEV_PROTECTED_RPC = "https://bscrpc.pancakeswap.finance";
|
|
|
12
12
|
var DEFAULT_LISTING_MANAGER = "0x1f9CE85bD0FF75acc3D92eB79f1Eb472f0865071";
|
|
13
13
|
var DEFAULT_LISTING_ID = "0x64083b44e38db02749e6e16bf84ce6c19146cc42a108e53324e11f250b15a0b7";
|
|
14
14
|
var DEFAULT_INDEXER = "https://indexer-mainnet.shll.run";
|
|
15
|
-
var SKILL_VERSION = "6.0.
|
|
15
|
+
var SKILL_VERSION = "6.0.2";
|
|
16
16
|
var PANCAKE_V2_ROUTER = "0x10ED43C718714eb63d5aA57B78B54704E256024E";
|
|
17
17
|
var PANCAKE_V3_SMART_ROUTER = "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4";
|
|
18
18
|
var V3_QUOTER = "0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997";
|
|
@@ -175,16 +175,11 @@ var LISTING_MANAGER_ABI = [
|
|
|
175
175
|
}
|
|
176
176
|
];
|
|
177
177
|
var SPENDING_LIMIT_ABI = [
|
|
178
|
-
{ type: "function", name: "setLimits", inputs: [{ name: "instanceId", type: "uint256" }, { name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
179
178
|
{ type: "function", name: "instanceLimits", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "maxPerTx", type: "uint256" }, { name: "maxPerDay", type: "uint256" }, { name: "maxSlippageBps", type: "uint256" }], stateMutability: "view" },
|
|
180
179
|
{ type: "function", name: "tokenRestrictionEnabled", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "bool" }], stateMutability: "view" },
|
|
181
|
-
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
182
|
-
{ type: "function", name: "addToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
183
|
-
{ type: "function", name: "removeToken", inputs: [{ name: "instanceId", type: "uint256" }, { name: "token", type: "address" }], outputs: [], stateMutability: "nonpayable" },
|
|
184
|
-
{ type: "function", name: "setTokenRestriction", inputs: [{ name: "instanceId", type: "uint256" }, { name: "enabled", type: "bool" }], outputs: [], stateMutability: "nonpayable" }
|
|
180
|
+
{ type: "function", name: "getTokenList", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "address[]" }], stateMutability: "view" }
|
|
185
181
|
];
|
|
186
182
|
var COOLDOWN_ABI = [
|
|
187
|
-
{ type: "function", name: "setCooldown", inputs: [{ name: "instanceId", type: "uint256" }, { name: "seconds_", type: "uint256" }], outputs: [], stateMutability: "nonpayable" },
|
|
188
183
|
{ type: "function", name: "cooldownSeconds", inputs: [{ name: "instanceId", type: "uint256" }], outputs: [{ name: "", type: "uint256" }], stateMutability: "view" }
|
|
189
184
|
];
|
|
190
185
|
var FOUR_MEME_HELPER_ABI = [
|
|
@@ -824,14 +819,6 @@ function createClients(rpcUrl) {
|
|
|
824
819
|
});
|
|
825
820
|
return { account, publicClient, policyClient, rpc: writeRpc };
|
|
826
821
|
}
|
|
827
|
-
function createWallet(rpcUrl) {
|
|
828
|
-
const privateKey = process.env.RUNNER_PRIVATE_KEY;
|
|
829
|
-
if (!privateKey) throw new Error("RUNNER_PRIVATE_KEY environment variable is required");
|
|
830
|
-
const rpc = rpcUrl || DEFAULT_RPC;
|
|
831
|
-
const account = (0, import_accounts2.privateKeyToAccount)(toHex(privateKey));
|
|
832
|
-
const walletClient = (0, import_viem2.createWalletClient)({ account, chain: import_chains2.bsc, transport: (0, import_viem2.http)(rpc) });
|
|
833
|
-
return { account, walletClient };
|
|
834
|
-
}
|
|
835
822
|
function createReadOnlyClient(rpcUrl) {
|
|
836
823
|
const rpc = rpcUrl || process.env.SHLL_RPC || DEFAULT_RPC;
|
|
837
824
|
return (0, import_viem2.createPublicClient)({
|
|
@@ -2421,59 +2408,48 @@ async function getHistory(tokenIdRaw, limit) {
|
|
|
2421
2408
|
recentPolicyRejections: rejections.length
|
|
2422
2409
|
};
|
|
2423
2410
|
}
|
|
2424
|
-
async function
|
|
2425
|
-
if (!options.txLimit && !options.dailyLimit && !options.cooldown) {
|
|
2426
|
-
throw new SkillError("INVALID_INPUT", "Must specify at least one policy config option");
|
|
2427
|
-
}
|
|
2411
|
+
async function getPolicyConfigGuidance(tokenIdRaw, rpcUrl) {
|
|
2428
2412
|
const tokenId = parseTokenId(tokenIdRaw);
|
|
2429
|
-
const { publicClient, policyClient
|
|
2430
|
-
await ensureAccess(tokenId, rpc, publicClient);
|
|
2431
|
-
const { walletClient } = createWallet(rpc);
|
|
2413
|
+
const { publicClient, policyClient } = createClients(rpcUrl);
|
|
2432
2414
|
const policies = await policyClient.getPolicies(tokenId);
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2415
|
+
const consoleUrl = agentConsoleUrl(tokenId);
|
|
2416
|
+
const currentConfig = {};
|
|
2417
|
+
const spendingPolicy = policies.find((p) => p.policyTypeName === "spending_limit");
|
|
2418
|
+
if (spendingPolicy) {
|
|
2419
|
+
try {
|
|
2420
|
+
const [maxPerTx, maxPerDay, maxSlippageBps] = await publicClient.readContract({
|
|
2421
|
+
address: spendingPolicy.address,
|
|
2422
|
+
abi: SPENDING_LIMIT_ABI,
|
|
2423
|
+
functionName: "instanceLimits",
|
|
2424
|
+
args: [tokenId]
|
|
2425
|
+
});
|
|
2426
|
+
currentConfig.spendingLimit = {
|
|
2427
|
+
maxPerTx: (Number(maxPerTx) / 1e18).toFixed(4) + " BNB",
|
|
2428
|
+
maxPerDay: (Number(maxPerDay) / 1e18).toFixed(4) + " BNB",
|
|
2429
|
+
slippageBps: maxSlippageBps.toString()
|
|
2430
|
+
};
|
|
2431
|
+
} catch {
|
|
2438
2432
|
}
|
|
2439
|
-
const current = await publicClient.readContract({
|
|
2440
|
-
address: spendingPolicy.address,
|
|
2441
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2442
|
-
functionName: "instanceLimits",
|
|
2443
|
-
args: [tokenId]
|
|
2444
|
-
});
|
|
2445
|
-
const [curMaxPerTx, curMaxPerDay, curSlippage] = current;
|
|
2446
|
-
const hash = await walletClient.writeContract({
|
|
2447
|
-
address: spendingPolicy.address,
|
|
2448
|
-
abi: SPENDING_LIMIT_ABI,
|
|
2449
|
-
functionName: "setLimits",
|
|
2450
|
-
args: [
|
|
2451
|
-
tokenId,
|
|
2452
|
-
options.txLimit ? parseAmount(options.txLimit, 18) : curMaxPerTx,
|
|
2453
|
-
options.dailyLimit ? parseAmount(options.dailyLimit, 18) : curMaxPerDay,
|
|
2454
|
-
curSlippage
|
|
2455
|
-
]
|
|
2456
|
-
});
|
|
2457
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2458
|
-
results.push(`SpendingLimit updated: ${hash}`);
|
|
2459
2433
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2434
|
+
const cooldownPolicy = policies.find((p) => p.policyTypeName === "cooldown");
|
|
2435
|
+
if (cooldownPolicy) {
|
|
2436
|
+
try {
|
|
2437
|
+
const cooldown = await publicClient.readContract({
|
|
2438
|
+
address: cooldownPolicy.address,
|
|
2439
|
+
abi: COOLDOWN_ABI,
|
|
2440
|
+
functionName: "cooldownSeconds",
|
|
2441
|
+
args: [tokenId]
|
|
2442
|
+
});
|
|
2443
|
+
currentConfig.cooldown = { seconds: Number(cooldown) };
|
|
2444
|
+
} catch {
|
|
2464
2445
|
}
|
|
2465
|
-
const hash = await walletClient.writeContract({
|
|
2466
|
-
address: cooldownPolicy.address,
|
|
2467
|
-
abi: COOLDOWN_ABI,
|
|
2468
|
-
functionName: "setCooldown",
|
|
2469
|
-
args: [tokenId, BigInt(options.cooldown)]
|
|
2470
|
-
});
|
|
2471
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
2472
|
-
results.push(`Cooldown updated: ${hash}`);
|
|
2473
2446
|
}
|
|
2474
2447
|
return {
|
|
2475
|
-
status: "
|
|
2476
|
-
|
|
2448
|
+
status: "read_only",
|
|
2449
|
+
tokenId: tokenIdRaw,
|
|
2450
|
+
currentConfig,
|
|
2451
|
+
message: "Policy modification via Skills is disabled. Please use the web console to adjust your security settings.",
|
|
2452
|
+
consoleUrl
|
|
2477
2453
|
};
|
|
2478
2454
|
}
|
|
2479
2455
|
function dedupeStrings(values) {
|
|
@@ -2750,20 +2726,13 @@ function registerAgentTools(server2) {
|
|
|
2750
2726
|
);
|
|
2751
2727
|
server2.tool(
|
|
2752
2728
|
"config",
|
|
2753
|
-
"
|
|
2729
|
+
"View current risk parameters and get a link to the web console for modifications",
|
|
2754
2730
|
{
|
|
2755
|
-
token_id: CommonSchemas.tokenId.describe("Agent Token ID")
|
|
2756
|
-
tx_limit: import_zod5.z.string().optional().describe("Max BNB per tx"),
|
|
2757
|
-
daily_limit: import_zod5.z.string().optional().describe("Max BNB per day"),
|
|
2758
|
-
cooldown: import_zod5.z.string().optional().describe("Seconds between tx")
|
|
2731
|
+
token_id: CommonSchemas.tokenId.describe("Agent Token ID")
|
|
2759
2732
|
},
|
|
2760
|
-
async ({ token_id
|
|
2733
|
+
async ({ token_id }) => {
|
|
2761
2734
|
try {
|
|
2762
|
-
return asToolResult5(await
|
|
2763
|
-
txLimit: tx_limit,
|
|
2764
|
-
dailyLimit: daily_limit,
|
|
2765
|
-
cooldown
|
|
2766
|
-
}));
|
|
2735
|
+
return asToolResult5(await getPolicyConfigGuidance(token_id));
|
|
2767
2736
|
} catch (error) {
|
|
2768
2737
|
return formatMcpError(error);
|
|
2769
2738
|
}
|
package/dist/mcp.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
getBalance,
|
|
12
12
|
getFourMemeInfo,
|
|
13
13
|
getHistory,
|
|
14
|
+
getPolicyConfigGuidance,
|
|
14
15
|
getPolicySummary,
|
|
15
16
|
getPortfolio,
|
|
16
17
|
getPrice,
|
|
@@ -24,9 +25,8 @@ import {
|
|
|
24
25
|
sellFourMeme,
|
|
25
26
|
transferFromVault,
|
|
26
27
|
unwrapWbnb,
|
|
27
|
-
updateRiskConfig,
|
|
28
28
|
wrapBnb
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-MPUPO5EJ.mjs";
|
|
30
30
|
|
|
31
31
|
// src/mcp.ts
|
|
32
32
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -303,20 +303,13 @@ function registerAgentTools(server2) {
|
|
|
303
303
|
);
|
|
304
304
|
server2.tool(
|
|
305
305
|
"config",
|
|
306
|
-
"
|
|
306
|
+
"View current risk parameters and get a link to the web console for modifications",
|
|
307
307
|
{
|
|
308
|
-
token_id: CommonSchemas.tokenId.describe("Agent Token ID")
|
|
309
|
-
tx_limit: z4.string().optional().describe("Max BNB per tx"),
|
|
310
|
-
daily_limit: z4.string().optional().describe("Max BNB per day"),
|
|
311
|
-
cooldown: z4.string().optional().describe("Seconds between tx")
|
|
308
|
+
token_id: CommonSchemas.tokenId.describe("Agent Token ID")
|
|
312
309
|
},
|
|
313
|
-
async ({ token_id
|
|
310
|
+
async ({ token_id }) => {
|
|
314
311
|
try {
|
|
315
|
-
return asToolResult5(await
|
|
316
|
-
txLimit: tx_limit,
|
|
317
|
-
dailyLimit: daily_limit,
|
|
318
|
-
cooldown
|
|
319
|
-
}));
|
|
312
|
+
return asToolResult5(await getPolicyConfigGuidance(token_id));
|
|
320
313
|
} catch (error) {
|
|
321
314
|
return formatMcpError(error);
|
|
322
315
|
}
|