safehands-pharos 1.2.0 → 1.2.3
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/.env.example +26 -0
- package/README.md +311 -350
- package/contracts/RiskRegistry.json +75 -1
- package/contracts/RiskRegistry.sol +29 -1
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -0
- package/dist/cli.js.map +1 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/demo.js +172 -0
- package/dist/demo.js.map +1 -0
- package/dist/index.js +181 -169
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +2 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +66 -0
- package/dist/init.js.map +1 -0
- package/dist/lib/constants.d.ts +122 -7
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +139 -13
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/dodoApi.d.ts +14 -0
- package/dist/lib/dodoApi.d.ts.map +1 -1
- package/dist/lib/dodoApi.js +78 -22
- package/dist/lib/dodoApi.js.map +1 -1
- package/dist/lib/http.d.ts +15 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +119 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/pharosClient.d.ts +4 -3
- package/dist/lib/pharosClient.d.ts.map +1 -1
- package/dist/lib/pharosClient.js +8 -5
- package/dist/lib/pharosClient.js.map +1 -1
- package/dist/lib/policy/actionPolicyEngine.d.ts +54 -0
- package/dist/lib/policy/actionPolicyEngine.d.ts.map +1 -0
- package/dist/lib/policy/actionPolicyEngine.js +213 -0
- package/dist/lib/policy/actionPolicyEngine.js.map +1 -0
- package/dist/lib/signer/index.d.ts +25 -0
- package/dist/lib/signer/index.d.ts.map +1 -0
- package/dist/lib/signer/index.js +90 -0
- package/dist/lib/signer/index.js.map +1 -0
- package/dist/lib/testDodoLive.d.ts +2 -0
- package/dist/lib/testDodoLive.d.ts.map +1 -0
- package/dist/lib/testDodoLive.js +105 -0
- package/dist/lib/testDodoLive.js.map +1 -0
- package/dist/lib/testLiveSafehands.d.ts +2 -0
- package/dist/lib/testLiveSafehands.d.ts.map +1 -0
- package/dist/lib/testLiveSafehands.js +93 -0
- package/dist/lib/testLiveSafehands.js.map +1 -0
- package/dist/lib/testRpcLive.d.ts +2 -0
- package/dist/lib/testRpcLive.d.ts.map +1 -0
- package/dist/lib/testRpcLive.js +89 -0
- package/dist/lib/testRpcLive.js.map +1 -0
- package/dist/lib/testTools.js +363 -354
- package/dist/lib/testTools.js.map +1 -1
- package/dist/lib/testX402Live.d.ts +2 -0
- package/dist/lib/testX402Live.d.ts.map +1 -0
- package/dist/lib/testX402Live.js +160 -0
- package/dist/lib/testX402Live.js.map +1 -0
- package/dist/lib/toolResponse.d.ts +26 -0
- package/dist/lib/toolResponse.d.ts.map +1 -0
- package/dist/lib/toolResponse.js +54 -0
- package/dist/lib/toolResponse.js.map +1 -0
- package/dist/lib/wallet/index.d.ts +19 -0
- package/dist/lib/wallet/index.d.ts.map +1 -0
- package/dist/lib/wallet/index.js +71 -0
- package/dist/lib/wallet/index.js.map +1 -0
- package/dist/tools/approveToken.d.ts +19 -20
- package/dist/tools/approveToken.d.ts.map +1 -1
- package/dist/tools/approveToken.js +44 -21
- package/dist/tools/approveToken.js.map +1 -1
- package/dist/tools/assessRisk.d.ts +22 -9
- package/dist/tools/assessRisk.d.ts.map +1 -1
- package/dist/tools/assessRisk.js +32 -9
- package/dist/tools/assessRisk.js.map +1 -1
- package/dist/tools/checkAllowance.d.ts +6 -6
- package/dist/tools/checkTokenSecurity.d.ts +9 -16
- package/dist/tools/checkTokenSecurity.d.ts.map +1 -1
- package/dist/tools/checkTokenSecurity.js +17 -22
- package/dist/tools/checkTokenSecurity.js.map +1 -1
- package/dist/tools/createAgentWallet.d.ts +27 -0
- package/dist/tools/createAgentWallet.d.ts.map +1 -0
- package/dist/tools/createAgentWallet.js +60 -0
- package/dist/tools/createAgentWallet.js.map +1 -0
- package/dist/tools/estimateGas.d.ts +31 -21
- package/dist/tools/estimateGas.d.ts.map +1 -1
- package/dist/tools/estimateGas.js +91 -95
- package/dist/tools/estimateGas.js.map +1 -1
- package/dist/tools/executeSwap.d.ts +13 -29
- package/dist/tools/executeSwap.d.ts.map +1 -1
- package/dist/tools/executeSwap.js +68 -46
- package/dist/tools/executeSwap.js.map +1 -1
- package/dist/tools/explainRisk.d.ts +30 -0
- package/dist/tools/explainRisk.d.ts.map +1 -0
- package/dist/tools/explainRisk.js +33 -0
- package/dist/tools/explainRisk.js.map +1 -0
- package/dist/tools/getAgentWallet.d.ts +22 -0
- package/dist/tools/getAgentWallet.d.ts.map +1 -0
- package/dist/tools/getAgentWallet.js +28 -0
- package/dist/tools/getAgentWallet.js.map +1 -0
- package/dist/tools/getAgentWalletBalance.d.ts +12 -0
- package/dist/tools/getAgentWalletBalance.d.ts.map +1 -0
- package/dist/tools/getAgentWalletBalance.js +71 -0
- package/dist/tools/getAgentWalletBalance.js.map +1 -0
- package/dist/tools/getExecutionHistory.d.ts +4 -4
- package/dist/tools/getGasPrice.d.ts +26 -8
- package/dist/tools/getGasPrice.d.ts.map +1 -1
- package/dist/tools/getGasPrice.js +43 -35
- package/dist/tools/getGasPrice.js.map +1 -1
- package/dist/tools/getPoolInfo.d.ts +47 -59
- package/dist/tools/getPoolInfo.d.ts.map +1 -1
- package/dist/tools/getPoolInfo.js +96 -57
- package/dist/tools/getPoolInfo.js.map +1 -1
- package/dist/tools/getTokenPrice.d.ts +95 -9
- package/dist/tools/getTokenPrice.d.ts.map +1 -1
- package/dist/tools/getTokenPrice.js +95 -56
- package/dist/tools/getTokenPrice.js.map +1 -1
- package/dist/tools/getWalletBalance.d.ts +40 -11
- package/dist/tools/getWalletBalance.d.ts.map +1 -1
- package/dist/tools/getWalletBalance.js +64 -47
- package/dist/tools/getWalletBalance.js.map +1 -1
- package/dist/tools/publishRiskScore.d.ts +12 -10
- package/dist/tools/publishRiskScore.d.ts.map +1 -1
- package/dist/tools/publishRiskScore.js +33 -19
- package/dist/tools/publishRiskScore.js.map +1 -1
- package/dist/tools/queryRiskRegistry.d.ts +3 -3
- package/dist/tools/safehandsPreflightCheck.d.ts +78 -0
- package/dist/tools/safehandsPreflightCheck.d.ts.map +1 -0
- package/dist/tools/safehandsPreflightCheck.js +48 -0
- package/dist/tools/safehandsPreflightCheck.js.map +1 -0
- package/dist/tools/safehandsRiskReport.d.ts +82 -0
- package/dist/tools/safehandsRiskReport.d.ts.map +1 -0
- package/dist/tools/safehandsRiskReport.js +29 -0
- package/dist/tools/safehandsRiskReport.js.map +1 -0
- package/dist/tools/safehandsSafeExecute.d.ts +21 -0
- package/dist/tools/safehandsSafeExecute.d.ts.map +1 -0
- package/dist/tools/safehandsSafeExecute.js +76 -0
- package/dist/tools/safehandsSafeExecute.js.map +1 -0
- package/dist/tools/safehandsWalletHealth.d.ts +15 -0
- package/dist/tools/safehandsWalletHealth.d.ts.map +1 -0
- package/dist/tools/safehandsWalletHealth.js +104 -0
- package/dist/tools/safehandsWalletHealth.js.map +1 -0
- package/dist/tools/safehandsX402Preflight.d.ts +27 -0
- package/dist/tools/safehandsX402Preflight.d.ts.map +1 -0
- package/dist/tools/safehandsX402Preflight.js +66 -0
- package/dist/tools/safehandsX402Preflight.js.map +1 -0
- package/dist/tools/sendPayment.d.ts +13 -35
- package/dist/tools/sendPayment.d.ts.map +1 -1
- package/dist/tools/sendPayment.js +53 -47
- package/dist/tools/sendPayment.js.map +1 -1
- package/dist/tools/simulateTransaction.d.ts +4 -4
- package/dist/tools/tokenRegistryStatus.d.ts +27 -0
- package/dist/tools/tokenRegistryStatus.d.ts.map +1 -0
- package/dist/tools/tokenRegistryStatus.js +97 -0
- package/dist/tools/tokenRegistryStatus.js.map +1 -0
- package/dist/tools/x402PayAndFetch.d.ts +40 -16
- package/dist/tools/x402PayAndFetch.d.ts.map +1 -1
- package/dist/tools/x402PayAndFetch.js +115 -47
- package/dist/tools/x402PayAndFetch.js.map +1 -1
- package/dist/x402Server.js +149 -115
- package/dist/x402Server.js.map +1 -1
- package/examples/pharos-skill-engine/SKILL.safehands.md +85 -0
- package/examples/pharos-skill-engine/assets/safehands/example-actions.json +49 -0
- package/examples/pharos-skill-engine/assets/safehands/policy-defaults.json +11 -0
- package/examples/pharos-skill-engine/references/safehands.md +345 -0
- package/examples/scenario-hack.ts +38 -0
- package/package.json +19 -5
- package/skill/SKILL.md +127 -0
- package/skill/assets/safehands/example-actions.json +49 -0
- package/skill/assets/safehands/policy-defaults.json +11 -0
- package/skill/references/safehands.md +345 -0
- package/.agents/skill/safehands/SKILL.md +0 -200
- package/.agents/skill/safehands/assets/networks.json +0 -24
- package/.agents/skill/safehands/assets/tokens.json +0 -60
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { publicClient } from "../lib/pharosClient.js";
|
|
6
6
|
import { getDodoRoute } from "../lib/dodoApi.js";
|
|
7
|
-
import { USDC_ADDRESS, USDT_ADDRESS, ERC20_ABI } from "../lib/constants.js";
|
|
8
|
-
import { formatEther, formatUnits } from "viem";
|
|
7
|
+
import { USDC_ADDRESS, USDT_ADDRESS, ERC20_ABI, CHAIN_ID, PHAROS_ENVIRONMENT } from "../lib/constants.js";
|
|
8
|
+
import { formatEther, formatUnits, isAddress } from "viem";
|
|
9
|
+
import { classifyExternalError, fail, ok } from "../lib/toolResponse.js";
|
|
9
10
|
export const getWalletBalanceSchema = z.object({
|
|
10
11
|
walletAddress: z.string().describe("Wallet address to check balances for"),
|
|
11
12
|
});
|
|
@@ -17,55 +18,71 @@ export const getWalletBalanceTool = {
|
|
|
17
18
|
const QUOTE_WALLET = "0x0000000000000000000000000000000000000001";
|
|
18
19
|
export async function handleGetWalletBalance(raw) {
|
|
19
20
|
const input = getWalletBalanceSchema.parse(raw);
|
|
21
|
+
if (!isAddress(input.walletAddress)) {
|
|
22
|
+
return fail("INVALID_WALLET_ADDRESS", `Invalid wallet address: ${input.walletAddress}`, false, "get_wallet_balance");
|
|
23
|
+
}
|
|
20
24
|
const addr = input.walletAddress;
|
|
21
|
-
// Fetch all three balances in parallel
|
|
22
|
-
const [phrsBalanceWei, usdcBalanceRaw, usdtBalanceRaw] = await Promise.all([
|
|
23
|
-
publicClient.getBalance({ address: addr }),
|
|
24
|
-
publicClient.readContract({
|
|
25
|
-
address: USDC_ADDRESS,
|
|
26
|
-
abi: ERC20_ABI,
|
|
27
|
-
functionName: "balanceOf",
|
|
28
|
-
args: [addr],
|
|
29
|
-
}),
|
|
30
|
-
publicClient.readContract({
|
|
31
|
-
address: USDT_ADDRESS,
|
|
32
|
-
abi: ERC20_ABI,
|
|
33
|
-
functionName: "balanceOf",
|
|
34
|
-
args: [addr],
|
|
35
|
-
}),
|
|
36
|
-
]);
|
|
37
|
-
const phrsBalance = formatEther(phrsBalanceWei);
|
|
38
|
-
const usdcBalance = formatUnits(usdcBalanceRaw, 6);
|
|
39
|
-
const usdtBalance = formatUnits(usdtBalanceRaw, 6);
|
|
40
|
-
// Get PHRS price in USD for total calculation
|
|
41
|
-
let phrsUsd = 0;
|
|
42
25
|
try {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
const [phrsBalanceWei, usdcBalanceRaw, usdtBalanceRaw] = await Promise.all([
|
|
27
|
+
publicClient.getBalance({ address: addr }),
|
|
28
|
+
publicClient.readContract({
|
|
29
|
+
address: USDC_ADDRESS,
|
|
30
|
+
abi: ERC20_ABI,
|
|
31
|
+
functionName: "balanceOf",
|
|
32
|
+
args: [addr],
|
|
33
|
+
}),
|
|
34
|
+
publicClient.readContract({
|
|
35
|
+
address: USDT_ADDRESS,
|
|
36
|
+
abi: ERC20_ABI,
|
|
37
|
+
functionName: "balanceOf",
|
|
38
|
+
args: [addr],
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
41
|
+
const phrsBalance = formatEther(phrsBalanceWei);
|
|
42
|
+
const usdcBalance = formatUnits(usdcBalanceRaw, 6);
|
|
43
|
+
const usdtBalance = formatUnits(usdtBalanceRaw, 6);
|
|
44
|
+
let phrsUsd = 0;
|
|
45
|
+
let priceSourceStatus = "unavailable";
|
|
46
|
+
try {
|
|
47
|
+
const quote = await getDodoRoute({
|
|
48
|
+
fromToken: "PHRS",
|
|
49
|
+
toToken: "USDC",
|
|
50
|
+
amountHuman: "1",
|
|
51
|
+
walletAddress: QUOTE_WALLET,
|
|
52
|
+
});
|
|
53
|
+
if (quote.routeAvailable) {
|
|
54
|
+
phrsUsd = parseFloat(quote.amountOut);
|
|
55
|
+
priceSourceStatus = "ok";
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
priceSourceStatus = "no_route_available";
|
|
59
|
+
}
|
|
51
60
|
}
|
|
61
|
+
catch {
|
|
62
|
+
priceSourceStatus = "unavailable";
|
|
63
|
+
}
|
|
64
|
+
const phrsValueUsd = parseFloat(phrsBalance) * phrsUsd;
|
|
65
|
+
const usdcValueUsd = parseFloat(usdcBalance);
|
|
66
|
+
const usdtValueUsd = parseFloat(usdtBalance);
|
|
67
|
+
const totalUsd = (phrsValueUsd + usdcValueUsd + usdtValueUsd).toFixed(4);
|
|
68
|
+
return ok({
|
|
69
|
+
walletAddress: input.walletAddress,
|
|
70
|
+
balances: {
|
|
71
|
+
PHRS: { balance: { value: phrsBalance, unit: "PHRS" }, valueUsd: { value: phrsValueUsd.toFixed(4), unit: "USD" } },
|
|
72
|
+
USDC: { balance: { value: usdcBalance, unit: "USDC" }, valueUsd: { value: usdcValueUsd.toFixed(4), unit: "USD" } },
|
|
73
|
+
USDT: { balance: { value: usdtBalance, unit: "USDT" }, valueUsd: { value: usdtValueUsd.toFixed(4), unit: "USD" } },
|
|
74
|
+
},
|
|
75
|
+
totalUsd: { value: totalUsd, unit: "USD" },
|
|
76
|
+
phrsPrice: phrsUsd > 0 ? { value: phrsUsd.toFixed(4), unit: "USD" } : null,
|
|
77
|
+
priceSourceStatus,
|
|
78
|
+
chainId: CHAIN_ID,
|
|
79
|
+
environment: PHAROS_ENVIRONMENT,
|
|
80
|
+
isMainnet: false,
|
|
81
|
+
source: "pharos_rpc",
|
|
82
|
+
});
|
|
52
83
|
}
|
|
53
|
-
catch {
|
|
54
|
-
|
|
84
|
+
catch (err) {
|
|
85
|
+
return classifyExternalError("pharos_rpc", err);
|
|
55
86
|
}
|
|
56
|
-
const phrsValueUsd = parseFloat(phrsBalance) * phrsUsd;
|
|
57
|
-
const usdcValueUsd = parseFloat(usdcBalance); // 1:1 stablecoin
|
|
58
|
-
const usdtValueUsd = parseFloat(usdtBalance); // 1:1 stablecoin
|
|
59
|
-
const totalUsd = (phrsValueUsd + usdcValueUsd + usdtValueUsd).toFixed(4);
|
|
60
|
-
return {
|
|
61
|
-
walletAddress: input.walletAddress,
|
|
62
|
-
balances: {
|
|
63
|
-
PHRS: { balance: phrsBalance, valueUsd: phrsValueUsd.toFixed(4) },
|
|
64
|
-
USDC: { balance: usdcBalance, valueUsd: usdcValueUsd.toFixed(4) },
|
|
65
|
-
USDT: { balance: usdtBalance, valueUsd: usdtValueUsd.toFixed(4) },
|
|
66
|
-
},
|
|
67
|
-
totalUsd,
|
|
68
|
-
phrsPrice: phrsUsd > 0 ? phrsUsd.toFixed(4) : "unavailable",
|
|
69
|
-
};
|
|
70
87
|
}
|
|
71
88
|
//# sourceMappingURL=getWalletBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletBalance.js","sourceRoot":"","sources":["../../src/tools/getWalletBalance.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mEAAmE;AACnE,2EAA2E;AAE3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC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E,CAAC,CAAC,CAAC,IAAI;YAC1E,iBAAiB;YACjB,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,kBAAkB;YAC/B,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,YAAY;SACrB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -5,17 +5,20 @@ export declare const publishRiskScoreSchema: z.ZodObject<{
|
|
|
5
5
|
tokenOut: z.ZodOptional<z.ZodString>;
|
|
6
6
|
amount: z.ZodString;
|
|
7
7
|
toAddress: z.ZodOptional<z.ZodString>;
|
|
8
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
8
9
|
}, "strip", z.ZodTypeAny, {
|
|
9
10
|
amount: string;
|
|
10
11
|
action: "transfer" | "swap";
|
|
11
12
|
tokenIn?: string | undefined;
|
|
12
13
|
tokenOut?: string | undefined;
|
|
14
|
+
agentId?: string | undefined;
|
|
13
15
|
toAddress?: string | undefined;
|
|
14
16
|
}, {
|
|
15
17
|
amount: string;
|
|
16
18
|
action: "transfer" | "swap";
|
|
17
19
|
tokenIn?: string | undefined;
|
|
18
20
|
tokenOut?: string | undefined;
|
|
21
|
+
agentId?: string | undefined;
|
|
19
22
|
toAddress?: string | undefined;
|
|
20
23
|
}>;
|
|
21
24
|
export type PublishRiskScoreInput = z.input<typeof publishRiskScoreSchema>;
|
|
@@ -28,35 +31,34 @@ export declare const publishRiskScoreTool: {
|
|
|
28
31
|
tokenOut: z.ZodOptional<z.ZodString>;
|
|
29
32
|
amount: z.ZodString;
|
|
30
33
|
toAddress: z.ZodOptional<z.ZodString>;
|
|
34
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
31
35
|
}, "strip", z.ZodTypeAny, {
|
|
32
36
|
amount: string;
|
|
33
37
|
action: "transfer" | "swap";
|
|
34
38
|
tokenIn?: string | undefined;
|
|
35
39
|
tokenOut?: string | undefined;
|
|
40
|
+
agentId?: string | undefined;
|
|
36
41
|
toAddress?: string | undefined;
|
|
37
42
|
}, {
|
|
38
43
|
amount: string;
|
|
39
44
|
action: "transfer" | "swap";
|
|
40
45
|
tokenIn?: string | undefined;
|
|
41
46
|
tokenOut?: string | undefined;
|
|
47
|
+
agentId?: string | undefined;
|
|
42
48
|
toAddress?: string | undefined;
|
|
43
49
|
}>;
|
|
44
50
|
};
|
|
45
|
-
export declare function handlePublishRiskScore(raw: PublishRiskScoreInput): Promise<{
|
|
46
|
-
success: boolean;
|
|
51
|
+
export declare function handlePublishRiskScore(raw: PublishRiskScoreInput): Promise<import("../lib/toolResponse.js").ToolFailure | import("../lib/toolResponse.js").ToolSuccess<{
|
|
47
52
|
assessment: import("../lib/riskEngine.js").RiskAssessment;
|
|
53
|
+
policy: import("../lib/policy/actionPolicyEngine.js").ActionPolicyResult;
|
|
54
|
+
signerMode: import("../lib/signer/index.js").SignerMode;
|
|
48
55
|
onChain: {
|
|
49
56
|
txHash: `0x${string}`;
|
|
50
57
|
explorerUrl: string;
|
|
51
|
-
contractAddress:
|
|
58
|
+
contractAddress: `0x${string}`;
|
|
52
59
|
gasUsed: string;
|
|
53
60
|
blockNumber: string;
|
|
54
61
|
};
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
success: boolean;
|
|
58
|
-
assessment: import("../lib/riskEngine.js").RiskAssessment;
|
|
59
|
-
onChain: null;
|
|
60
|
-
error: string;
|
|
61
|
-
}>;
|
|
62
|
+
source: string;
|
|
63
|
+
}>>;
|
|
62
64
|
//# sourceMappingURL=publishRiskScore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishRiskScore.d.ts","sourceRoot":"","sources":["../../src/tools/publishRiskScore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"publishRiskScore.d.ts","sourceRoot":"","sources":["../../src/tools/publishRiskScore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE3E,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;CAMhC,CAAC;AAEF,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,qBAAqB;;;;;;;;;;;;IAiEtE"}
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
// Publishes a risk assessment result to the on-chain RiskRegistry.
|
|
3
3
|
// ────────────────────────────────────────────────────────────────────────
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { publicClient,
|
|
6
|
-
import { RISK_REGISTRY_ADDRESS, RISK_REGISTRY_ABI } from "../lib/constants.js";
|
|
5
|
+
import { publicClient, createPharosWalletClientFromAccount, getExplorerUrl } from "../lib/pharosClient.js";
|
|
6
|
+
import { RISK_REGISTRY_ADDRESS, RISK_REGISTRY_ABI, CHAIN_ID, PHAROS_ENVIRONMENT } from "../lib/constants.js";
|
|
7
7
|
import { assessRisk } from "../lib/riskEngine.js";
|
|
8
|
+
import { fail, ok, requireWriteToolsEnabled, classifyExternalError } from "../lib/toolResponse.js";
|
|
9
|
+
import { getSigner, isSignerFailure } from "../lib/signer/index.js";
|
|
10
|
+
import { evaluateActionPolicy } from "../lib/policy/actionPolicyEngine.js";
|
|
8
11
|
export const publishRiskScoreSchema = z.object({
|
|
9
12
|
action: z.enum(["swap", "transfer"]).describe("Type of on-chain action to assess"),
|
|
10
13
|
tokenIn: z.string().optional(),
|
|
11
14
|
tokenOut: z.string().optional(),
|
|
12
15
|
amount: z.string().describe("Human-readable amount"),
|
|
13
16
|
toAddress: z.string().optional().describe("Recipient address (for transfers)"),
|
|
17
|
+
agentId: z.string().optional().describe("Managed testnet wallet agentId when WALLET_MODE=managed-testnet"),
|
|
14
18
|
});
|
|
15
19
|
export const publishRiskScoreTool = {
|
|
16
20
|
name: "publish_risk_score",
|
|
@@ -19,23 +23,36 @@ export const publishRiskScoreTool = {
|
|
|
19
23
|
inputSchema: publishRiskScoreSchema,
|
|
20
24
|
};
|
|
21
25
|
export async function handlePublishRiskScore(raw) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
throw new Error("Missing PRIVATE_KEY or WALLET_ADDRESS in environment variables.");
|
|
26
|
+
const writeGuard = requireWriteToolsEnabled("publish_risk_score");
|
|
27
|
+
if (writeGuard)
|
|
28
|
+
return writeGuard;
|
|
26
29
|
const input = publishRiskScoreSchema.parse(raw);
|
|
27
|
-
|
|
30
|
+
const signer = await getSigner(input.agentId);
|
|
31
|
+
if (isSignerFailure(signer)) {
|
|
32
|
+
return fail(signer.error.code, signer.error.message, false, "publish_risk_score");
|
|
33
|
+
}
|
|
34
|
+
const policy = evaluateActionPolicy({
|
|
35
|
+
actionType: "publish_risk_score",
|
|
36
|
+
chainId: CHAIN_ID,
|
|
37
|
+
environment: PHAROS_ENVIRONMENT,
|
|
38
|
+
isMainnet: false,
|
|
39
|
+
signerAvailable: true,
|
|
40
|
+
requiresSigner: true,
|
|
41
|
+
});
|
|
42
|
+
if (policy.decision === "BLOCK") {
|
|
43
|
+
return fail("POLICY_BLOCKED", policy.reasons.join(" ") || "Publishing blocked by SafeHands policy.", false, "publish_risk_score");
|
|
44
|
+
}
|
|
45
|
+
const walletAddress = signer.address;
|
|
28
46
|
const assessment = await assessRisk({
|
|
29
47
|
action: input.action,
|
|
30
48
|
tokenIn: input.tokenIn,
|
|
31
49
|
tokenOut: input.tokenOut,
|
|
32
50
|
amount: input.amount,
|
|
33
51
|
toAddress: input.toAddress,
|
|
34
|
-
walletAddress
|
|
52
|
+
walletAddress,
|
|
35
53
|
});
|
|
36
|
-
// 2. Publish to on-chain registry
|
|
37
54
|
try {
|
|
38
|
-
const wallet =
|
|
55
|
+
const wallet = createPharosWalletClientFromAccount(signer.account);
|
|
39
56
|
const txHash = await wallet.writeContract({
|
|
40
57
|
address: RISK_REGISTRY_ADDRESS,
|
|
41
58
|
abi: RISK_REGISTRY_ABI,
|
|
@@ -48,9 +65,10 @@ export async function handlePublishRiskScore(raw) {
|
|
|
48
65
|
],
|
|
49
66
|
});
|
|
50
67
|
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
51
|
-
return {
|
|
52
|
-
success: true,
|
|
68
|
+
return ok({
|
|
53
69
|
assessment,
|
|
70
|
+
policy,
|
|
71
|
+
signerMode: signer.mode,
|
|
54
72
|
onChain: {
|
|
55
73
|
txHash,
|
|
56
74
|
explorerUrl: getExplorerUrl(txHash),
|
|
@@ -58,15 +76,11 @@ export async function handlePublishRiskScore(raw) {
|
|
|
58
76
|
gasUsed: receipt.gasUsed.toString(),
|
|
59
77
|
blockNumber: receipt.blockNumber.toString(),
|
|
60
78
|
},
|
|
61
|
-
|
|
79
|
+
source: "publish_risk_score",
|
|
80
|
+
});
|
|
62
81
|
}
|
|
63
82
|
catch (err) {
|
|
64
|
-
return
|
|
65
|
-
success: false,
|
|
66
|
-
assessment,
|
|
67
|
-
onChain: null,
|
|
68
|
-
error: `Failed to publish to registry: ${err.message}`,
|
|
69
|
-
};
|
|
83
|
+
return classifyExternalError("pharos_rpc", err);
|
|
70
84
|
}
|
|
71
85
|
}
|
|
72
86
|
//# sourceMappingURL=publishRiskScore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishRiskScore.js","sourceRoot":"","sources":["../../src/tools/publishRiskScore.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,mEAAmE;AACnE,2EAA2E;AAE3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"publishRiskScore.js","sourceRoot":"","sources":["../../src/tools/publ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,aAAa;KACd,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEnE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;YACxC,OAAO,EAAE,qBAAqB;YAC9B,GAAG,EAAE,iBAAiB;YACtB,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE;gBACJ,aAAa;gBACb,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC;gBAC5B,UAAU,CAAC,SAAS;gBACpB,UAAU,CAAC,cAAc;aAC1B;SACF,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAE/E,OAAO,EAAE,CAAC;YACR,UAAU;YACV,MAAM;YACN,UAAU,EAAE,MAAM,CAAC,IAAI;YACvB,OAAO,EAAE;gBACP,MAAM;gBACN,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC;gBACnC,eAAe,EAAE,qBAAqB;gBACtC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACnC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;aAC5C;YACD,MAAM,EAAE,oBAAoB;SAC7B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -22,7 +22,7 @@ export declare function handleQueryRiskRegistry(raw: QueryRiskRegistryInput): Pr
|
|
|
22
22
|
walletAddress: string;
|
|
23
23
|
found: boolean;
|
|
24
24
|
record: null;
|
|
25
|
-
registryContract:
|
|
25
|
+
registryContract: `0x${string}`;
|
|
26
26
|
message: string;
|
|
27
27
|
error?: undefined;
|
|
28
28
|
} | {
|
|
@@ -35,14 +35,14 @@ export declare function handleQueryRiskRegistry(raw: QueryRiskRegistryInput): Pr
|
|
|
35
35
|
timestamp: string;
|
|
36
36
|
assessedBy: `0x${string}`;
|
|
37
37
|
};
|
|
38
|
-
registryContract:
|
|
38
|
+
registryContract: `0x${string}`;
|
|
39
39
|
message?: undefined;
|
|
40
40
|
error?: undefined;
|
|
41
41
|
} | {
|
|
42
42
|
walletAddress: string;
|
|
43
43
|
found: boolean;
|
|
44
44
|
record: null;
|
|
45
|
-
registryContract:
|
|
45
|
+
registryContract: `0x${string}`;
|
|
46
46
|
error: string;
|
|
47
47
|
message?: undefined;
|
|
48
48
|
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ToolResponse } from "../lib/toolResponse.js";
|
|
3
|
+
export declare const safehandsPreflightCheckSchema: z.ZodObject<{
|
|
4
|
+
actionType: z.ZodEnum<["send_payment", "approve_token", "execute_swap", "x402_pay_and_fetch", "publish_risk_score", "custom_contract_call"]>;
|
|
5
|
+
chainId: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
environment: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
7
|
+
isMainnet: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
9
|
+
amountUnit: z.ZodOptional<z.ZodEnum<["PHRS", "USDC", "USD", "TOKEN"]>>;
|
|
10
|
+
token: z.ZodOptional<z.ZodString>;
|
|
11
|
+
tokenAddress: z.ZodOptional<z.ZodString>;
|
|
12
|
+
tokenIn: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tokenOut: z.ZodOptional<z.ZodString>;
|
|
14
|
+
recipient: z.ZodOptional<z.ZodString>;
|
|
15
|
+
spender: z.ZodOptional<z.ZodString>;
|
|
16
|
+
approvalAmount: z.ZodOptional<z.ZodString>;
|
|
17
|
+
approvalToken: z.ZodOptional<z.ZodString>;
|
|
18
|
+
approvalUnlimited: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
url: z.ZodOptional<z.ZodString>;
|
|
20
|
+
paymentAmountUsdc: z.ZodOptional<z.ZodString>;
|
|
21
|
+
paymentTokenAddress: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
22
|
+
signerAvailable: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
tokenSecurityStatus: z.ZodOptional<z.ZodEnum<["ok", "unavailable", "unknown"]>>;
|
|
24
|
+
recipientVerified: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
spenderVerified: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
requiresSigner: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
environment: string;
|
|
29
|
+
actionType: "send_payment" | "approve_token" | "execute_swap" | "x402_pay_and_fetch" | "publish_risk_score" | "custom_contract_call";
|
|
30
|
+
chainId: number;
|
|
31
|
+
isMainnet: boolean;
|
|
32
|
+
paymentTokenAddress: string;
|
|
33
|
+
spender?: string | undefined;
|
|
34
|
+
amount?: string | undefined;
|
|
35
|
+
token?: string | undefined;
|
|
36
|
+
tokenAddress?: string | undefined;
|
|
37
|
+
amountUnit?: "PHRS" | "USDC" | "USD" | "TOKEN" | undefined;
|
|
38
|
+
tokenIn?: string | undefined;
|
|
39
|
+
tokenOut?: string | undefined;
|
|
40
|
+
recipient?: string | undefined;
|
|
41
|
+
approvalAmount?: string | undefined;
|
|
42
|
+
approvalToken?: string | undefined;
|
|
43
|
+
approvalUnlimited?: boolean | undefined;
|
|
44
|
+
url?: string | undefined;
|
|
45
|
+
paymentAmountUsdc?: string | undefined;
|
|
46
|
+
signerAvailable?: boolean | undefined;
|
|
47
|
+
tokenSecurityStatus?: "unknown" | "ok" | "unavailable" | undefined;
|
|
48
|
+
recipientVerified?: boolean | undefined;
|
|
49
|
+
spenderVerified?: boolean | undefined;
|
|
50
|
+
requiresSigner?: boolean | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
actionType: "send_payment" | "approve_token" | "execute_swap" | "x402_pay_and_fetch" | "publish_risk_score" | "custom_contract_call";
|
|
53
|
+
spender?: string | undefined;
|
|
54
|
+
amount?: string | undefined;
|
|
55
|
+
environment?: string | undefined;
|
|
56
|
+
token?: string | undefined;
|
|
57
|
+
tokenAddress?: string | undefined;
|
|
58
|
+
chainId?: number | undefined;
|
|
59
|
+
isMainnet?: boolean | undefined;
|
|
60
|
+
amountUnit?: "PHRS" | "USDC" | "USD" | "TOKEN" | undefined;
|
|
61
|
+
tokenIn?: string | undefined;
|
|
62
|
+
tokenOut?: string | undefined;
|
|
63
|
+
recipient?: string | undefined;
|
|
64
|
+
approvalAmount?: string | undefined;
|
|
65
|
+
approvalToken?: string | undefined;
|
|
66
|
+
approvalUnlimited?: boolean | undefined;
|
|
67
|
+
url?: string | undefined;
|
|
68
|
+
paymentAmountUsdc?: string | undefined;
|
|
69
|
+
paymentTokenAddress?: string | undefined;
|
|
70
|
+
signerAvailable?: boolean | undefined;
|
|
71
|
+
tokenSecurityStatus?: "unknown" | "ok" | "unavailable" | undefined;
|
|
72
|
+
recipientVerified?: boolean | undefined;
|
|
73
|
+
spenderVerified?: boolean | undefined;
|
|
74
|
+
requiresSigner?: boolean | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
export type SafeHandsPreflightCheckInput = z.input<typeof safehandsPreflightCheckSchema>;
|
|
77
|
+
export declare function handleSafeHandsPreflightCheck(raw: SafeHandsPreflightCheckInput): Promise<ToolResponse<unknown>>;
|
|
78
|
+
//# sourceMappingURL=safehandsPreflightCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safehandsPreflightCheck.d.ts","sourceRoot":"","sources":["../../src/tools/safehandsPreflightCheck.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAK/D,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBxC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEzF,wBAAsB,6BAA6B,CAAC,GAAG,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAerH"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// ─── Tool: safehands_preflight_check ───────────────────────────────────
|
|
2
|
+
// Branded SafeHands transaction safety firewall preflight.
|
|
3
|
+
// ───────────────────────────────────────────────────────────────────────
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { ok } from "../lib/toolResponse.js";
|
|
6
|
+
import { CHAIN_ID, PHAROS_ENVIRONMENT, IS_MAINNET, X402_PAYMENT_TOKEN_ADDRESS } from "../lib/constants.js";
|
|
7
|
+
import { evaluateActionPolicy } from "../lib/policy/actionPolicyEngine.js";
|
|
8
|
+
import { classifyTokenRegistryStatus } from "./tokenRegistryStatus.js";
|
|
9
|
+
export const safehandsPreflightCheckSchema = z.object({
|
|
10
|
+
actionType: z.enum(["send_payment", "approve_token", "execute_swap", "x402_pay_and_fetch", "publish_risk_score", "custom_contract_call"]),
|
|
11
|
+
chainId: z.number().optional().default(CHAIN_ID),
|
|
12
|
+
environment: z.string().optional().default(PHAROS_ENVIRONMENT),
|
|
13
|
+
isMainnet: z.boolean().optional().default(IS_MAINNET),
|
|
14
|
+
amount: z.string().optional(),
|
|
15
|
+
amountUnit: z.enum(["PHRS", "USDC", "USD", "TOKEN"]).optional(),
|
|
16
|
+
token: z.string().optional(),
|
|
17
|
+
tokenAddress: z.string().optional(),
|
|
18
|
+
tokenIn: z.string().optional(),
|
|
19
|
+
tokenOut: z.string().optional(),
|
|
20
|
+
recipient: z.string().optional(),
|
|
21
|
+
spender: z.string().optional(),
|
|
22
|
+
approvalAmount: z.string().optional(),
|
|
23
|
+
approvalToken: z.string().optional(),
|
|
24
|
+
approvalUnlimited: z.boolean().optional(),
|
|
25
|
+
url: z.string().optional(),
|
|
26
|
+
paymentAmountUsdc: z.string().optional(),
|
|
27
|
+
paymentTokenAddress: z.string().optional().default(X402_PAYMENT_TOKEN_ADDRESS),
|
|
28
|
+
signerAvailable: z.boolean().optional(),
|
|
29
|
+
tokenSecurityStatus: z.enum(["ok", "unavailable", "unknown"]).optional(),
|
|
30
|
+
recipientVerified: z.boolean().optional(),
|
|
31
|
+
spenderVerified: z.boolean().optional(),
|
|
32
|
+
requiresSigner: z.boolean().optional(),
|
|
33
|
+
});
|
|
34
|
+
export async function handleSafeHandsPreflightCheck(raw) {
|
|
35
|
+
const input = safehandsPreflightCheckSchema.parse(raw);
|
|
36
|
+
const tokenForRegistry = input.tokenAddress || input.token || input.tokenOut || input.tokenIn;
|
|
37
|
+
const registry = tokenForRegistry ? classifyTokenRegistryStatus(tokenForRegistry) : null;
|
|
38
|
+
const policy = evaluateActionPolicy({
|
|
39
|
+
...input,
|
|
40
|
+
tokenRegistryStatus: registry?.status,
|
|
41
|
+
});
|
|
42
|
+
return ok({
|
|
43
|
+
...policy,
|
|
44
|
+
tokenRegistry: registry,
|
|
45
|
+
source: "safehands_preflight_check",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=safehandsPreflightCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safehandsPreflightCheck.js","sourceRoot":"","sources":["../../src/tools/safehandsPreflightCheck.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2DAA2D;AAC3D,0EAA0E;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAqB,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,q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Aa,EAAE,QAAQ;QACvB,MAAM,EAAE,2BAA2B;KACpC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ToolResponse } from "../lib/toolResponse.js";
|
|
3
|
+
export declare const safehandsRiskReportSchema: z.ZodObject<{
|
|
4
|
+
actionType: z.ZodEnum<["send_payment", "approve_token", "execute_swap", "x402_pay_and_fetch", "publish_risk_score", "custom_contract_call"]>;
|
|
5
|
+
chainId: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
environment: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
7
|
+
isMainnet: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
8
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
9
|
+
amountUnit: z.ZodOptional<z.ZodEnum<["PHRS", "USDC", "USD", "TOKEN"]>>;
|
|
10
|
+
token: z.ZodOptional<z.ZodString>;
|
|
11
|
+
tokenAddress: z.ZodOptional<z.ZodString>;
|
|
12
|
+
tokenIn: z.ZodOptional<z.ZodString>;
|
|
13
|
+
tokenOut: z.ZodOptional<z.ZodString>;
|
|
14
|
+
recipient: z.ZodOptional<z.ZodString>;
|
|
15
|
+
spender: z.ZodOptional<z.ZodString>;
|
|
16
|
+
approvalAmount: z.ZodOptional<z.ZodString>;
|
|
17
|
+
approvalToken: z.ZodOptional<z.ZodString>;
|
|
18
|
+
approvalUnlimited: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
url: z.ZodOptional<z.ZodString>;
|
|
20
|
+
paymentAmountUsdc: z.ZodOptional<z.ZodString>;
|
|
21
|
+
paymentTokenAddress: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
22
|
+
signerAvailable: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
tokenSecurityStatus: z.ZodOptional<z.ZodEnum<["ok", "unavailable", "unknown"]>>;
|
|
24
|
+
recipientVerified: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
spenderVerified: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
requiresSigner: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
} & {
|
|
28
|
+
includeChecks: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
environment: string;
|
|
31
|
+
actionType: "send_payment" | "approve_token" | "execute_swap" | "x402_pay_and_fetch" | "publish_risk_score" | "custom_contract_call";
|
|
32
|
+
chainId: number;
|
|
33
|
+
isMainnet: boolean;
|
|
34
|
+
paymentTokenAddress: string;
|
|
35
|
+
includeChecks: boolean;
|
|
36
|
+
spender?: string | undefined;
|
|
37
|
+
amount?: string | undefined;
|
|
38
|
+
token?: string | undefined;
|
|
39
|
+
tokenAddress?: string | undefined;
|
|
40
|
+
amountUnit?: "PHRS" | "USDC" | "USD" | "TOKEN" | undefined;
|
|
41
|
+
tokenIn?: string | undefined;
|
|
42
|
+
tokenOut?: string | undefined;
|
|
43
|
+
recipient?: string | undefined;
|
|
44
|
+
approvalAmount?: string | undefined;
|
|
45
|
+
approvalToken?: string | undefined;
|
|
46
|
+
approvalUnlimited?: boolean | undefined;
|
|
47
|
+
url?: string | undefined;
|
|
48
|
+
paymentAmountUsdc?: string | undefined;
|
|
49
|
+
signerAvailable?: boolean | undefined;
|
|
50
|
+
tokenSecurityStatus?: "unknown" | "ok" | "unavailable" | undefined;
|
|
51
|
+
recipientVerified?: boolean | undefined;
|
|
52
|
+
spenderVerified?: boolean | undefined;
|
|
53
|
+
requiresSigner?: boolean | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
actionType: "send_payment" | "approve_token" | "execute_swap" | "x402_pay_and_fetch" | "publish_risk_score" | "custom_contract_call";
|
|
56
|
+
spender?: string | undefined;
|
|
57
|
+
amount?: string | undefined;
|
|
58
|
+
environment?: string | undefined;
|
|
59
|
+
token?: string | undefined;
|
|
60
|
+
tokenAddress?: string | undefined;
|
|
61
|
+
chainId?: number | undefined;
|
|
62
|
+
isMainnet?: boolean | undefined;
|
|
63
|
+
amountUnit?: "PHRS" | "USDC" | "USD" | "TOKEN" | undefined;
|
|
64
|
+
tokenIn?: string | undefined;
|
|
65
|
+
tokenOut?: string | undefined;
|
|
66
|
+
recipient?: string | undefined;
|
|
67
|
+
approvalAmount?: string | undefined;
|
|
68
|
+
approvalToken?: string | undefined;
|
|
69
|
+
approvalUnlimited?: boolean | undefined;
|
|
70
|
+
url?: string | undefined;
|
|
71
|
+
paymentAmountUsdc?: string | undefined;
|
|
72
|
+
paymentTokenAddress?: string | undefined;
|
|
73
|
+
signerAvailable?: boolean | undefined;
|
|
74
|
+
tokenSecurityStatus?: "unknown" | "ok" | "unavailable" | undefined;
|
|
75
|
+
recipientVerified?: boolean | undefined;
|
|
76
|
+
spenderVerified?: boolean | undefined;
|
|
77
|
+
requiresSigner?: boolean | undefined;
|
|
78
|
+
includeChecks?: boolean | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export type SafeHandsRiskReportInput = z.input<typeof safehandsRiskReportSchema>;
|
|
81
|
+
export declare function handleSafeHandsRiskReport(raw: SafeHandsRiskReportInput): Promise<ToolResponse<unknown>>;
|
|
82
|
+
//# sourceMappingURL=safehandsRiskReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safehandsRiskReport.d.ts","sourceRoot":"","sources":["../../src/tools/safehandsRiskReport.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI/D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEpC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEjF,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAkB7G"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// ─── Tool: safehands_risk_report ───────────────────────────────────────
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ok } from "../lib/toolResponse.js";
|
|
4
|
+
import { explainPolicyResult } from "../lib/policy/actionPolicyEngine.js";
|
|
5
|
+
import { handleSafeHandsPreflightCheck, safehandsPreflightCheckSchema } from "./safehandsPreflightCheck.js";
|
|
6
|
+
export const safehandsRiskReportSchema = safehandsPreflightCheckSchema.extend({
|
|
7
|
+
includeChecks: z.boolean().optional().default(true),
|
|
8
|
+
});
|
|
9
|
+
export async function handleSafeHandsRiskReport(raw) {
|
|
10
|
+
const input = safehandsRiskReportSchema.parse(raw);
|
|
11
|
+
const preflight = await handleSafeHandsPreflightCheck(input);
|
|
12
|
+
if (!preflight.success)
|
|
13
|
+
return preflight;
|
|
14
|
+
const data = preflight.data;
|
|
15
|
+
return ok({
|
|
16
|
+
decision: data.decision,
|
|
17
|
+
riskLevel: data.riskLevel,
|
|
18
|
+
safeToExecute: data.safeToExecute,
|
|
19
|
+
summary: explainPolicyResult(data),
|
|
20
|
+
reasons: data.reasons,
|
|
21
|
+
requiredActions: data.requiredActions,
|
|
22
|
+
checks: input.includeChecks ? data.checks : undefined,
|
|
23
|
+
environment: data.environment,
|
|
24
|
+
chainId: data.chainId,
|
|
25
|
+
isMainnet: data.isMainnet,
|
|
26
|
+
source: "safehands_risk_report",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=safehandsRiskReport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safehandsRiskReport.js","sourceRoot":"","sources":["../../src/tools/safehandsRiskReport.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,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
import { type ToolResponse } from "../lib/toolResponse.js";
|
|
3
|
+
export declare const safehandsSafeExecuteSchema: z.ZodObject<{
|
|
4
|
+
path: z.ZodEnum<["safe_execute_send_payment", "safe_execute_approve_token", "safe_execute_swap", "safe_x402_pay_and_fetch"]>;
|
|
5
|
+
execute: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
|
+
confirmExecution: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
7
|
+
action: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
path: "safe_execute_send_payment" | "safe_execute_approve_token" | "safe_execute_swap" | "safe_x402_pay_and_fetch";
|
|
10
|
+
execute: boolean;
|
|
11
|
+
confirmExecution: boolean;
|
|
12
|
+
action: Record<string, any>;
|
|
13
|
+
}, {
|
|
14
|
+
path: "safe_execute_send_payment" | "safe_execute_approve_token" | "safe_execute_swap" | "safe_x402_pay_and_fetch";
|
|
15
|
+
action: Record<string, any>;
|
|
16
|
+
execute?: boolean | undefined;
|
|
17
|
+
confirmExecution?: boolean | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type SafeHandsSafeExecuteInput = z.input<typeof safehandsSafeExecuteSchema>;
|
|
20
|
+
export declare function handleSafeHandsSafeExecute(raw: SafeHandsSafeExecuteInput): Promise<ToolResponse<unknown>>;
|
|
21
|
+
//# sourceMappingURL=safehandsSafeExecute.d.ts.map
|