safehands-pharos 1.3.0 → 1.4.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/.env.example +64 -26
- package/README.md +333 -445
- package/dist/cli.d.ts +5 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +124 -98
- package/dist/cli.js.map +1 -1
- package/dist/demo.d.ts +1 -1
- package/dist/demo.js +171 -171
- package/dist/index.d.ts +2 -2
- package/dist/index.js +138 -85
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +65 -65
- package/dist/lib/auditLog.d.ts +9 -0
- package/dist/lib/auditLog.d.ts.map +1 -0
- package/dist/lib/auditLog.js +30 -0
- package/dist/lib/auditLog.js.map +1 -0
- package/dist/lib/constants.d.ts +291 -291
- package/dist/lib/constants.js +292 -292
- package/dist/lib/dodoApi.d.ts +78 -70
- package/dist/lib/dodoApi.d.ts.map +1 -1
- package/dist/lib/dodoApi.js +196 -178
- package/dist/lib/dodoApi.js.map +1 -1
- package/dist/lib/http.d.ts +14 -14
- package/dist/lib/http.js +118 -118
- package/dist/lib/pharosClient.d.ts +58 -58
- package/dist/lib/pharosClient.d.ts.map +1 -1
- package/dist/lib/pharosClient.js +63 -53
- package/dist/lib/pharosClient.js.map +1 -1
- package/dist/lib/policy/actionPolicyEngine.d.ts +53 -53
- package/dist/lib/policy/actionPolicyEngine.js +212 -212
- package/dist/lib/riskEngine.d.ts +26 -26
- package/dist/lib/riskEngine.js +283 -283
- package/dist/lib/signer/index.d.ts +24 -24
- package/dist/lib/signer/index.d.ts.map +1 -1
- package/dist/lib/signer/index.js +88 -89
- package/dist/lib/signer/index.js.map +1 -1
- package/dist/lib/spendAccumulator.d.ts +10 -0
- package/dist/lib/spendAccumulator.d.ts.map +1 -0
- package/dist/lib/spendAccumulator.js +54 -0
- package/dist/lib/spendAccumulator.js.map +1 -0
- package/dist/lib/testDodoLive.d.ts +1 -1
- package/dist/lib/testDodoLive.js +104 -104
- package/dist/lib/testLiveSafehands.d.ts +1 -1
- package/dist/lib/testLiveSafehands.js +92 -92
- package/dist/lib/testRpc.d.ts +1 -1
- package/dist/lib/testRpc.js +29 -29
- package/dist/lib/testRpcLive.d.ts +1 -1
- package/dist/lib/testRpcLive.js +88 -88
- package/dist/lib/testTools.d.ts +1 -1
- package/dist/lib/testTools.js +397 -397
- package/dist/lib/testX402Live.d.ts +1 -1
- package/dist/lib/testX402Live.js +159 -159
- package/dist/lib/toolResponse.d.ts +25 -25
- package/dist/lib/toolResponse.js +53 -53
- package/dist/lib/wallet/index.d.ts +37 -18
- package/dist/lib/wallet/index.d.ts.map +1 -1
- package/dist/lib/wallet/index.js +128 -70
- package/dist/lib/wallet/index.js.map +1 -1
- package/dist/scripts/checkDeploy.d.ts +1 -1
- package/dist/scripts/checkDeploy.js +24 -24
- package/dist/scripts/deployRegistry.d.ts +1 -1
- package/dist/scripts/deployRegistry.js +100 -100
- package/dist/scripts/testRegistry.d.ts +1 -1
- package/dist/scripts/testRegistry.js +43 -43
- package/dist/tools/approveToken.d.ts +45 -46
- package/dist/tools/approveToken.d.ts.map +1 -1
- package/dist/tools/approveToken.js +85 -83
- package/dist/tools/approveToken.js.map +1 -1
- package/dist/tools/assessRisk.d.ts +79 -79
- package/dist/tools/assessRisk.d.ts.map +1 -1
- package/dist/tools/assessRisk.js +104 -93
- package/dist/tools/assessRisk.js.map +1 -1
- package/dist/tools/checkAllowance.d.ts +43 -36
- package/dist/tools/checkAllowance.d.ts.map +1 -1
- package/dist/tools/checkAllowance.js +56 -42
- package/dist/tools/checkAllowance.js.map +1 -1
- package/dist/tools/checkTokenSecurity.d.ts +46 -46
- package/dist/tools/checkTokenSecurity.d.ts.map +1 -1
- package/dist/tools/checkTokenSecurity.js +95 -88
- package/dist/tools/checkTokenSecurity.js.map +1 -1
- package/dist/tools/createAgentWallet.d.ts +26 -26
- package/dist/tools/createAgentWallet.d.ts.map +1 -1
- package/dist/tools/createAgentWallet.js +58 -59
- package/dist/tools/createAgentWallet.js.map +1 -1
- package/dist/tools/estimateGas.d.ts +79 -79
- package/dist/tools/estimateGas.js +124 -124
- package/dist/tools/executeSwap.d.ts +61 -59
- package/dist/tools/executeSwap.d.ts.map +1 -1
- package/dist/tools/executeSwap.js +141 -129
- package/dist/tools/executeSwap.js.map +1 -1
- package/dist/tools/explainRisk.d.ts +29 -29
- package/dist/tools/explainRisk.js +32 -32
- package/dist/tools/getAgentWallet.d.ts +21 -21
- package/dist/tools/getAgentWallet.js +27 -27
- package/dist/tools/getAgentWalletBalance.d.ts +11 -11
- package/dist/tools/getAgentWalletBalance.js +70 -70
- package/dist/tools/getExecutionHistory.d.ts +49 -51
- package/dist/tools/getExecutionHistory.d.ts.map +1 -1
- package/dist/tools/getExecutionHistory.js +154 -93
- package/dist/tools/getExecutionHistory.js.map +1 -1
- package/dist/tools/getGasPrice.d.ts +43 -43
- package/dist/tools/getGasPrice.js +59 -59
- package/dist/tools/getPoolInfo.d.ts +75 -75
- package/dist/tools/getPoolInfo.js +137 -137
- package/dist/tools/getTokenPrice.d.ts +113 -113
- package/dist/tools/getTokenPrice.js +117 -117
- package/dist/tools/getTransactionStatus.d.ts +43 -57
- package/dist/tools/getTransactionStatus.d.ts.map +1 -1
- package/dist/tools/getTransactionStatus.js +59 -67
- package/dist/tools/getTransactionStatus.js.map +1 -1
- package/dist/tools/getWalletBalance.d.ts +68 -68
- package/dist/tools/getWalletBalance.js +87 -87
- package/dist/tools/publishRiskScore.d.ts +63 -63
- package/dist/tools/publishRiskScore.d.ts.map +1 -1
- package/dist/tools/publishRiskScore.js +88 -85
- package/dist/tools/publishRiskScore.js.map +1 -1
- package/dist/tools/queryRiskRegistry.d.ts +38 -48
- package/dist/tools/queryRiskRegistry.d.ts.map +1 -1
- package/dist/tools/queryRiskRegistry.js +55 -60
- package/dist/tools/queryRiskRegistry.js.map +1 -1
- package/dist/tools/safehandsPreflightCheck.d.ts +77 -77
- package/dist/tools/safehandsPreflightCheck.js +47 -47
- package/dist/tools/safehandsRiskReport.d.ts +81 -81
- package/dist/tools/safehandsRiskReport.js +28 -28
- package/dist/tools/safehandsSafeExecute.d.ts +20 -20
- package/dist/tools/safehandsSafeExecute.d.ts.map +1 -1
- package/dist/tools/safehandsSafeExecute.js +81 -75
- package/dist/tools/safehandsSafeExecute.js.map +1 -1
- package/dist/tools/safehandsWalletHealth.d.ts +14 -14
- package/dist/tools/safehandsWalletHealth.js +103 -103
- package/dist/tools/safehandsX402Preflight.d.ts +26 -26
- package/dist/tools/safehandsX402Preflight.js +65 -65
- package/dist/tools/sendPayment.d.ts +57 -58
- package/dist/tools/sendPayment.d.ts.map +1 -1
- package/dist/tools/sendPayment.js +117 -108
- package/dist/tools/sendPayment.js.map +1 -1
- package/dist/tools/simulateTransaction.d.ts +60 -81
- package/dist/tools/simulateTransaction.d.ts.map +1 -1
- package/dist/tools/simulateTransaction.js +83 -88
- package/dist/tools/simulateTransaction.js.map +1 -1
- package/dist/tools/tokenRegistryStatus.d.ts +26 -26
- package/dist/tools/tokenRegistryStatus.js +96 -96
- package/dist/tools/x402PayAndFetch.d.ts +81 -81
- package/dist/tools/x402PayAndFetch.d.ts.map +1 -1
- package/dist/tools/x402PayAndFetch.js +152 -149
- package/dist/tools/x402PayAndFetch.js.map +1 -1
- package/dist/x402Server.d.ts +1 -1
- package/dist/x402Server.js +252 -252
- package/examples/dashboard/index.html +337 -0
- package/package.json +83 -84
- package/.agents/skill/safehands/SKILL.md +0 -212
- package/.agents/skill/safehands/assets/networks.json +0 -24
- package/.agents/skill/safehands/assets/tokens.json +0 -66
- package/.agents/wallets.json +0 -20
- package/docs/reports/OFFICIAL_DOCS_ALIGNMENT_REPORT.md +0 -137
- package/docs/reports/final_audit_report.md +0 -307
- package/docs/reports/live_verification_report.md +0 -147
- package/docs/reports/pharos_skill_engine_alignment_report.md +0 -85
|
@@ -1,86 +1,89 @@
|
|
|
1
|
-
// ─── Tool: publish_risk_score ──────────────────────────────────────────
|
|
2
|
-
// Publishes a risk assessment result to the on-chain RiskRegistry.
|
|
3
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
4
|
-
import { z } from "zod";
|
|
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
|
-
import { assessRisk } from "../lib/riskEngine.js";
|
|
8
|
-
import { fail, ok, classifyExternalError } from "../lib/toolResponse.js";
|
|
9
|
-
import { getSigner, isSignerFailure } from "../lib/signer/index.js";
|
|
10
|
-
import { evaluateActionPolicy } from "../lib/policy/actionPolicyEngine.js";
|
|
11
|
-
export const publishRiskScoreSchema = z.object({
|
|
12
|
-
action: z.enum(["swap", "transfer"]).describe("Type of on-chain action to assess"),
|
|
13
|
-
tokenIn: z.string().optional(),
|
|
14
|
-
tokenOut: z.string().optional(),
|
|
15
|
-
amount: z.string().describe("Human-readable amount"),
|
|
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"),
|
|
18
|
-
});
|
|
19
|
-
export const publishRiskScoreTool = {
|
|
20
|
-
name: "publish_risk_score",
|
|
21
|
-
description: "Run a risk assessment and publish the result to the on-chain RiskRegistry. " +
|
|
22
|
-
"Other agents can then query this wallet's risk score without re-running the assessment.",
|
|
23
|
-
inputSchema: publishRiskScoreSchema,
|
|
24
|
-
};
|
|
25
|
-
export async function handlePublishRiskScore(raw) {
|
|
26
|
-
if (process.env.WRITE_TOOLS_ENABLED !== "true") {
|
|
27
|
-
return fail("WRITE_TOOLS_DISABLED", "publish_risk_score is disabled by default. Set WRITE_TOOLS_ENABLED=true only for trusted testnet execution.", false, "publish_risk_score");
|
|
28
|
-
}
|
|
29
|
-
const input = publishRiskScoreSchema.parse(raw);
|
|
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;
|
|
46
|
-
const assessment = await assessRisk({
|
|
47
|
-
action: input.action,
|
|
48
|
-
tokenIn: input.tokenIn,
|
|
49
|
-
tokenOut: input.tokenOut,
|
|
50
|
-
amount: input.amount,
|
|
51
|
-
toAddress: input.toAddress,
|
|
52
|
-
walletAddress,
|
|
53
|
-
});
|
|
54
|
-
try {
|
|
55
|
-
const wallet = createPharosWalletClientFromAccount(signer.account);
|
|
56
|
-
const txHash = await wallet.writeContract({
|
|
57
|
-
address: RISK_REGISTRY_ADDRESS,
|
|
58
|
-
abi: RISK_REGISTRY_ABI,
|
|
59
|
-
functionName: "publish",
|
|
60
|
-
args: [
|
|
61
|
-
walletAddress,
|
|
62
|
-
BigInt(assessment.riskScore),
|
|
63
|
-
assessment.riskLevel,
|
|
64
|
-
assessment.recommendation,
|
|
65
|
-
],
|
|
66
|
-
});
|
|
67
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
1
|
+
// ─── Tool: publish_risk_score ──────────────────────────────────────────
|
|
2
|
+
// Publishes a risk assessment result to the on-chain RiskRegistry.
|
|
3
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
4
|
+
import { z } from "zod";
|
|
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
|
+
import { assessRisk } from "../lib/riskEngine.js";
|
|
8
|
+
import { fail, ok, classifyExternalError } from "../lib/toolResponse.js";
|
|
9
|
+
import { getSigner, isSignerFailure } from "../lib/signer/index.js";
|
|
10
|
+
import { evaluateActionPolicy } from "../lib/policy/actionPolicyEngine.js";
|
|
11
|
+
export const publishRiskScoreSchema = z.object({
|
|
12
|
+
action: z.enum(["swap", "transfer"]).describe("Type of on-chain action to assess"),
|
|
13
|
+
tokenIn: z.string().optional(),
|
|
14
|
+
tokenOut: z.string().optional(),
|
|
15
|
+
amount: z.string().describe("Human-readable amount"),
|
|
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"),
|
|
18
|
+
});
|
|
19
|
+
export const publishRiskScoreTool = {
|
|
20
|
+
name: "publish_risk_score",
|
|
21
|
+
description: "Run a risk assessment and publish the result to the on-chain RiskRegistry. " +
|
|
22
|
+
"Other agents can then query this wallet's risk score without re-running the assessment.",
|
|
23
|
+
inputSchema: publishRiskScoreSchema,
|
|
24
|
+
};
|
|
25
|
+
export async function handlePublishRiskScore(raw) {
|
|
26
|
+
if (process.env.WRITE_TOOLS_ENABLED !== "true") {
|
|
27
|
+
return fail("WRITE_TOOLS_DISABLED", "publish_risk_score is disabled by default. Set WRITE_TOOLS_ENABLED=true only for trusted testnet execution.", false, "publish_risk_score");
|
|
28
|
+
}
|
|
29
|
+
const input = publishRiskScoreSchema.parse(raw);
|
|
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;
|
|
46
|
+
const assessment = await assessRisk({
|
|
47
|
+
action: input.action,
|
|
48
|
+
tokenIn: input.tokenIn,
|
|
49
|
+
tokenOut: input.tokenOut,
|
|
50
|
+
amount: input.amount,
|
|
51
|
+
toAddress: input.toAddress,
|
|
52
|
+
walletAddress,
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
const wallet = createPharosWalletClientFromAccount(signer.account);
|
|
56
|
+
const txHash = await wallet.writeContract({
|
|
57
|
+
address: RISK_REGISTRY_ADDRESS,
|
|
58
|
+
abi: RISK_REGISTRY_ABI,
|
|
59
|
+
functionName: "publish",
|
|
60
|
+
args: [
|
|
61
|
+
walletAddress,
|
|
62
|
+
BigInt(assessment.riskScore),
|
|
63
|
+
assessment.riskLevel,
|
|
64
|
+
assessment.recommendation,
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
68
|
+
if (receipt.status !== "success") {
|
|
69
|
+
return fail("TX_REVERTED", "publish_risk_score transaction was mined but reverted on-chain. Ensure the calling wallet is authorized via RiskRegistry.setAuthorizedAgent() by the contract owner.", false, "publish_risk_score");
|
|
70
|
+
}
|
|
71
|
+
return ok({
|
|
72
|
+
assessment,
|
|
73
|
+
policy,
|
|
74
|
+
signerMode: signer.mode,
|
|
75
|
+
onChain: {
|
|
76
|
+
txHash,
|
|
77
|
+
explorerUrl: getExplorerUrl(txHash),
|
|
78
|
+
contractAddress: RISK_REGISTRY_ADDRESS,
|
|
79
|
+
gasUsed: receipt.gasUsed.toString(),
|
|
80
|
+
blockNumber: receipt.blockNumber.toString(),
|
|
81
|
+
},
|
|
82
|
+
source: "publish_risk_score",
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return classifyExternalError("pharos_rpc", err);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
86
89
|
//# 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,mCAAmC,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,EAAE,EAA4B,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC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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"}
|
|
@@ -1,49 +1,39 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const queryRiskRegistrySchema: z.ZodObject<{
|
|
3
|
-
walletAddress: z.ZodString;
|
|
4
|
-
}, "strip", z.ZodTypeAny, {
|
|
5
|
-
walletAddress: string;
|
|
6
|
-
}, {
|
|
7
|
-
walletAddress: string;
|
|
8
|
-
}>;
|
|
9
|
-
export type QueryRiskRegistryInput = z.input<typeof queryRiskRegistrySchema>;
|
|
10
|
-
export declare const queryRiskRegistryTool: {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
inputSchema: z.ZodObject<{
|
|
14
|
-
walletAddress: z.ZodString;
|
|
15
|
-
}, "strip", z.ZodTypeAny, {
|
|
16
|
-
walletAddress: string;
|
|
17
|
-
}, {
|
|
18
|
-
walletAddress: string;
|
|
19
|
-
}>;
|
|
20
|
-
};
|
|
21
|
-
export declare function handleQueryRiskRegistry(raw: QueryRiskRegistryInput): Promise<{
|
|
22
|
-
walletAddress: string;
|
|
23
|
-
found: boolean;
|
|
24
|
-
record: null;
|
|
25
|
-
registryContract: `0x${string}`;
|
|
26
|
-
message: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
message?: undefined;
|
|
40
|
-
error?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
walletAddress: string;
|
|
43
|
-
found: boolean;
|
|
44
|
-
record: null;
|
|
45
|
-
registryContract: `0x${string}`;
|
|
46
|
-
error: string;
|
|
47
|
-
message?: undefined;
|
|
48
|
-
}>;
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const queryRiskRegistrySchema: z.ZodObject<{
|
|
3
|
+
walletAddress: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
walletAddress: string;
|
|
6
|
+
}, {
|
|
7
|
+
walletAddress: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type QueryRiskRegistryInput = z.input<typeof queryRiskRegistrySchema>;
|
|
10
|
+
export declare const queryRiskRegistryTool: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: z.ZodObject<{
|
|
14
|
+
walletAddress: z.ZodString;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
walletAddress: string;
|
|
17
|
+
}, {
|
|
18
|
+
walletAddress: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
export declare function handleQueryRiskRegistry(raw: QueryRiskRegistryInput): Promise<import("../lib/toolResponse.js").ToolFailure | import("../lib/toolResponse.js").ToolSuccess<{
|
|
22
|
+
walletAddress: string;
|
|
23
|
+
found: boolean;
|
|
24
|
+
record: null;
|
|
25
|
+
registryContract: `0x${string}`;
|
|
26
|
+
message: string;
|
|
27
|
+
}> | import("../lib/toolResponse.js").ToolSuccess<{
|
|
28
|
+
walletAddress: string;
|
|
29
|
+
found: boolean;
|
|
30
|
+
record: {
|
|
31
|
+
score: number;
|
|
32
|
+
riskLevel: string;
|
|
33
|
+
recommendation: string;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
assessedBy: `0x${string}`;
|
|
36
|
+
};
|
|
37
|
+
registryContract: `0x${string}`;
|
|
38
|
+
}>>;
|
|
49
39
|
//# sourceMappingURL=queryRiskRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryRiskRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/queryRiskRegistry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"queryRiskRegistry.d.ts","sourceRoot":"","sources":["../../src/tools/queryRiskRegistry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE7E,eAAO,MAAM,qBAAqB;;;;;;;;;;CAMjC,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,sBAAsB;;;;;;;;;;;;;;;;;IA8CxE"}
|
|
@@ -1,61 +1,56 @@
|
|
|
1
|
-
// ─── Tool: query_risk_registry ─────────────────────────────────────────
|
|
2
|
-
// Queries the on-chain RiskRegistry for a wallet's published risk score.
|
|
3
|
-
// Read-only — no private key needed.
|
|
4
|
-
// ────────────────────────────────────────────────────────────────────────
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
import { publicClient } from "../lib/pharosClient.js";
|
|
7
|
-
import { RISK_REGISTRY_ADDRESS, RISK_REGISTRY_ABI } from "../lib/constants.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
if (timestamp
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
registryContract: RISK_REGISTRY_ADDRESS,
|
|
57
|
-
error: `Failed to query registry: ${err.message}`,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
1
|
+
// ─── Tool: query_risk_registry ─────────────────────────────────────────
|
|
2
|
+
// Queries the on-chain RiskRegistry for a wallet's published risk score.
|
|
3
|
+
// Read-only — no private key needed.
|
|
4
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { publicClient } from "../lib/pharosClient.js";
|
|
7
|
+
import { RISK_REGISTRY_ADDRESS, RISK_REGISTRY_ABI } from "../lib/constants.js";
|
|
8
|
+
import { ok, fail } from "../lib/toolResponse.js";
|
|
9
|
+
export const queryRiskRegistrySchema = z.object({
|
|
10
|
+
walletAddress: z.string().describe("Wallet address to query risk score for"),
|
|
11
|
+
});
|
|
12
|
+
export const queryRiskRegistryTool = {
|
|
13
|
+
name: "query_risk_registry",
|
|
14
|
+
description: "Query the on-chain RiskRegistry for a wallet's published risk score. " +
|
|
15
|
+
"Read-only, no private key needed. Returns score, level, recommendation, timestamp, and assessor.",
|
|
16
|
+
inputSchema: queryRiskRegistrySchema,
|
|
17
|
+
};
|
|
18
|
+
export async function handleQueryRiskRegistry(raw) {
|
|
19
|
+
const input = queryRiskRegistrySchema.parse(raw);
|
|
20
|
+
try {
|
|
21
|
+
const result = (await publicClient.readContract({
|
|
22
|
+
address: RISK_REGISTRY_ADDRESS,
|
|
23
|
+
abi: RISK_REGISTRY_ABI,
|
|
24
|
+
functionName: "query",
|
|
25
|
+
args: [input.walletAddress],
|
|
26
|
+
}));
|
|
27
|
+
const score = Number(result.score);
|
|
28
|
+
const timestamp = Number(result.timestamp);
|
|
29
|
+
// Check if record exists (timestamp will be 0 if never published)
|
|
30
|
+
if (timestamp === 0) {
|
|
31
|
+
return ok({
|
|
32
|
+
walletAddress: input.walletAddress,
|
|
33
|
+
found: false,
|
|
34
|
+
record: null,
|
|
35
|
+
registryContract: RISK_REGISTRY_ADDRESS,
|
|
36
|
+
message: "No risk score published for this wallet",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return ok({
|
|
40
|
+
walletAddress: input.walletAddress,
|
|
41
|
+
found: true,
|
|
42
|
+
record: {
|
|
43
|
+
score,
|
|
44
|
+
riskLevel: result.riskLevel,
|
|
45
|
+
recommendation: result.recommendation,
|
|
46
|
+
timestamp: new Date(timestamp * 1000).toISOString(),
|
|
47
|
+
assessedBy: result.assessedBy,
|
|
48
|
+
},
|
|
49
|
+
registryContract: RISK_REGISTRY_ADDRESS,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return fail("REGISTRY_QUERY_FAILED", `Failed to query registry: ${err.message}`, true, "query_risk_registry");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
61
56
|
//# sourceMappingURL=queryRiskRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryRiskRegistry.js","sourceRoot":"","sources":["../../src/tools/queryRiskRegistry.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,yEAAyE;AACzE,qCAAqC;AACrC,2EAA2E;AAE3E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAkB,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{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E,CAAC;gBACR,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,IAAI;gBACZ,gBAAgB,EAAE,qBAAqB;gBACvC,OAAO,EAAE,yCAAyC;aACnD,CAAC,CAAC;QACL,CAAC;QAED,OAAO,EAAE,CAAC;YACR,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,KAAK,EAAE,IAAI;YACX,MAAM,EAAE;gBACN,KAAK;gBACL,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,cAAc,EAAE,MAAM,CAAC,cAAc;gBACrC,SAAS,EAAE,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE;gBACnD,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B;YACD,gBAAgB,EAAE,qBAAqB;SACxC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,uBAAuB,EAAE,6BAA8B,GAAa,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,qBAAqB,CAAC,CAAC;IAC3H,CAAC;AACH,CAAC"}
|
|
@@ -1,78 +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>>;
|
|
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
78
|
//# sourceMappingURL=safehandsPreflightCheck.d.ts.map
|