safehands-pharos 1.2.6 → 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.
Files changed (153) hide show
  1. package/.env.example +64 -26
  2. package/README.md +333 -445
  3. package/dist/cli.d.ts +5 -5
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +124 -98
  6. package/dist/cli.js.map +1 -1
  7. package/dist/demo.d.ts +1 -1
  8. package/dist/demo.js +171 -171
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +138 -87
  11. package/dist/index.js.map +1 -1
  12. package/dist/init.d.ts +1 -1
  13. package/dist/init.js +65 -65
  14. package/dist/lib/auditLog.d.ts +9 -0
  15. package/dist/lib/auditLog.d.ts.map +1 -0
  16. package/dist/lib/auditLog.js +30 -0
  17. package/dist/lib/auditLog.js.map +1 -0
  18. package/dist/lib/constants.d.ts +291 -291
  19. package/dist/lib/constants.js +292 -292
  20. package/dist/lib/dodoApi.d.ts +78 -70
  21. package/dist/lib/dodoApi.d.ts.map +1 -1
  22. package/dist/lib/dodoApi.js +196 -178
  23. package/dist/lib/dodoApi.js.map +1 -1
  24. package/dist/lib/http.d.ts +14 -14
  25. package/dist/lib/http.js +118 -118
  26. package/dist/lib/pharosClient.d.ts +58 -58
  27. package/dist/lib/pharosClient.d.ts.map +1 -1
  28. package/dist/lib/pharosClient.js +63 -53
  29. package/dist/lib/pharosClient.js.map +1 -1
  30. package/dist/lib/policy/actionPolicyEngine.d.ts +53 -53
  31. package/dist/lib/policy/actionPolicyEngine.js +212 -212
  32. package/dist/lib/policy/actionPolicyEngine.js.map +1 -1
  33. package/dist/lib/riskEngine.d.ts +26 -26
  34. package/dist/lib/riskEngine.js +283 -283
  35. package/dist/lib/signer/index.d.ts +24 -24
  36. package/dist/lib/signer/index.d.ts.map +1 -1
  37. package/dist/lib/signer/index.js +88 -89
  38. package/dist/lib/signer/index.js.map +1 -1
  39. package/dist/lib/spendAccumulator.d.ts +10 -0
  40. package/dist/lib/spendAccumulator.d.ts.map +1 -0
  41. package/dist/lib/spendAccumulator.js +54 -0
  42. package/dist/lib/spendAccumulator.js.map +1 -0
  43. package/dist/lib/testDodoLive.d.ts +1 -1
  44. package/dist/lib/testDodoLive.js +104 -104
  45. package/dist/lib/testLiveSafehands.d.ts +1 -1
  46. package/dist/lib/testLiveSafehands.js +92 -92
  47. package/dist/lib/testRpc.d.ts +1 -1
  48. package/dist/lib/testRpc.js +29 -29
  49. package/dist/lib/testRpcLive.d.ts +1 -1
  50. package/dist/lib/testRpcLive.js +88 -88
  51. package/dist/lib/testTools.d.ts +1 -1
  52. package/dist/lib/testTools.js +397 -397
  53. package/dist/lib/testX402Live.d.ts +1 -1
  54. package/dist/lib/testX402Live.js +159 -159
  55. package/dist/lib/toolResponse.d.ts +25 -25
  56. package/dist/lib/toolResponse.js +53 -53
  57. package/dist/lib/wallet/index.d.ts +37 -18
  58. package/dist/lib/wallet/index.d.ts.map +1 -1
  59. package/dist/lib/wallet/index.js +128 -70
  60. package/dist/lib/wallet/index.js.map +1 -1
  61. package/dist/scripts/checkDeploy.d.ts +1 -1
  62. package/dist/scripts/checkDeploy.js +24 -24
  63. package/dist/scripts/deployRegistry.d.ts +1 -1
  64. package/dist/scripts/deployRegistry.js +100 -100
  65. package/dist/scripts/testRegistry.d.ts +1 -1
  66. package/dist/scripts/testRegistry.js +43 -43
  67. package/dist/tools/approveToken.d.ts +45 -46
  68. package/dist/tools/approveToken.d.ts.map +1 -1
  69. package/dist/tools/approveToken.js +85 -83
  70. package/dist/tools/approveToken.js.map +1 -1
  71. package/dist/tools/assessRisk.d.ts +79 -79
  72. package/dist/tools/assessRisk.d.ts.map +1 -1
  73. package/dist/tools/assessRisk.js +104 -93
  74. package/dist/tools/assessRisk.js.map +1 -1
  75. package/dist/tools/checkAllowance.d.ts +43 -36
  76. package/dist/tools/checkAllowance.d.ts.map +1 -1
  77. package/dist/tools/checkAllowance.js +56 -42
  78. package/dist/tools/checkAllowance.js.map +1 -1
  79. package/dist/tools/checkTokenSecurity.d.ts +46 -46
  80. package/dist/tools/checkTokenSecurity.d.ts.map +1 -1
  81. package/dist/tools/checkTokenSecurity.js +95 -88
  82. package/dist/tools/checkTokenSecurity.js.map +1 -1
  83. package/dist/tools/createAgentWallet.d.ts +26 -26
  84. package/dist/tools/createAgentWallet.d.ts.map +1 -1
  85. package/dist/tools/createAgentWallet.js +58 -59
  86. package/dist/tools/createAgentWallet.js.map +1 -1
  87. package/dist/tools/estimateGas.d.ts +79 -79
  88. package/dist/tools/estimateGas.js +124 -124
  89. package/dist/tools/executeSwap.d.ts +61 -59
  90. package/dist/tools/executeSwap.d.ts.map +1 -1
  91. package/dist/tools/executeSwap.js +141 -129
  92. package/dist/tools/executeSwap.js.map +1 -1
  93. package/dist/tools/explainRisk.d.ts +29 -29
  94. package/dist/tools/explainRisk.js +32 -32
  95. package/dist/tools/getAgentWallet.d.ts +21 -21
  96. package/dist/tools/getAgentWallet.js +27 -27
  97. package/dist/tools/getAgentWalletBalance.d.ts +11 -11
  98. package/dist/tools/getAgentWalletBalance.js +70 -70
  99. package/dist/tools/getExecutionHistory.d.ts +49 -51
  100. package/dist/tools/getExecutionHistory.d.ts.map +1 -1
  101. package/dist/tools/getExecutionHistory.js +154 -93
  102. package/dist/tools/getExecutionHistory.js.map +1 -1
  103. package/dist/tools/getGasPrice.d.ts +43 -43
  104. package/dist/tools/getGasPrice.js +59 -59
  105. package/dist/tools/getPoolInfo.d.ts +75 -75
  106. package/dist/tools/getPoolInfo.js +137 -137
  107. package/dist/tools/getTokenPrice.d.ts +113 -113
  108. package/dist/tools/getTokenPrice.js +117 -117
  109. package/dist/tools/getTransactionStatus.d.ts +43 -57
  110. package/dist/tools/getTransactionStatus.d.ts.map +1 -1
  111. package/dist/tools/getTransactionStatus.js +59 -67
  112. package/dist/tools/getTransactionStatus.js.map +1 -1
  113. package/dist/tools/getWalletBalance.d.ts +68 -68
  114. package/dist/tools/getWalletBalance.js +87 -87
  115. package/dist/tools/publishRiskScore.d.ts +63 -63
  116. package/dist/tools/publishRiskScore.d.ts.map +1 -1
  117. package/dist/tools/publishRiskScore.js +88 -85
  118. package/dist/tools/publishRiskScore.js.map +1 -1
  119. package/dist/tools/queryRiskRegistry.d.ts +38 -48
  120. package/dist/tools/queryRiskRegistry.d.ts.map +1 -1
  121. package/dist/tools/queryRiskRegistry.js +55 -60
  122. package/dist/tools/queryRiskRegistry.js.map +1 -1
  123. package/dist/tools/safehandsPreflightCheck.d.ts +77 -77
  124. package/dist/tools/safehandsPreflightCheck.js +47 -47
  125. package/dist/tools/safehandsRiskReport.d.ts +81 -81
  126. package/dist/tools/safehandsRiskReport.js +28 -28
  127. package/dist/tools/safehandsSafeExecute.d.ts +20 -20
  128. package/dist/tools/safehandsSafeExecute.d.ts.map +1 -1
  129. package/dist/tools/safehandsSafeExecute.js +81 -75
  130. package/dist/tools/safehandsSafeExecute.js.map +1 -1
  131. package/dist/tools/safehandsWalletHealth.d.ts +14 -14
  132. package/dist/tools/safehandsWalletHealth.js +103 -103
  133. package/dist/tools/safehandsX402Preflight.d.ts +26 -26
  134. package/dist/tools/safehandsX402Preflight.js +65 -65
  135. package/dist/tools/sendPayment.d.ts +57 -58
  136. package/dist/tools/sendPayment.d.ts.map +1 -1
  137. package/dist/tools/sendPayment.js +117 -108
  138. package/dist/tools/sendPayment.js.map +1 -1
  139. package/dist/tools/simulateTransaction.d.ts +60 -81
  140. package/dist/tools/simulateTransaction.d.ts.map +1 -1
  141. package/dist/tools/simulateTransaction.js +83 -88
  142. package/dist/tools/simulateTransaction.js.map +1 -1
  143. package/dist/tools/tokenRegistryStatus.d.ts +26 -26
  144. package/dist/tools/tokenRegistryStatus.js +96 -96
  145. package/dist/tools/x402PayAndFetch.d.ts +81 -81
  146. package/dist/tools/x402PayAndFetch.d.ts.map +1 -1
  147. package/dist/tools/x402PayAndFetch.js +152 -149
  148. package/dist/tools/x402PayAndFetch.js.map +1 -1
  149. package/dist/x402Server.d.ts +1 -1
  150. package/dist/x402Server.js +252 -252
  151. package/examples/dashboard/index.html +337 -0
  152. package/package.json +83 -82
  153. package/skill/SKILL.md +133 -133
@@ -1,125 +1,125 @@
1
- // ─── Tool: estimate_gas ────────────────────────────────────────────────
2
- // Estimates gas cost for a swap or transfer before executing.
3
- // ────────────────────────────────────────────────────────────────────────
4
- import { z } from "zod";
5
- import { publicClient } from "../lib/pharosClient.js";
6
- import { getDodoRoute, isNativeToken } from "../lib/dodoApi.js";
7
- import { formatEther, formatGwei, isAddress, parseEther } from "viem";
8
- import { CHAIN_ID, PHAROS_ENVIRONMENT } from "../lib/constants.js";
9
- import { classifyExternalError, fail, ok } from "../lib/toolResponse.js";
10
- export const estimateGasSchema = z.object({
11
- action: z.enum(["swap", "transfer"]).describe("Type of action to estimate gas for"),
12
- tokenIn: z.string().optional().describe("Token to swap from (for swaps)"),
13
- tokenOut: z.string().optional().describe("Token to swap to (for swaps)"),
14
- amount: z.string().describe("Human-readable amount"),
15
- walletAddress: z.string().describe("Sender wallet address"),
16
- toAddress: z.string().optional().describe("Recipient address (for transfers)"),
17
- });
18
- export const estimateGasTool = {
19
- name: "estimate_gas",
20
- description: "Estimate gas cost for a swap or transfer before executing. Returns gas units, cost in PHRS/USD, and whether the wallet has sufficient gas.",
21
- inputSchema: estimateGasSchema,
22
- };
23
- const QUOTE_WALLET = "0x0000000000000000000000000000000000000001";
24
- export async function handleEstimateGas(raw) {
25
- const input = estimateGasSchema.parse(raw);
26
- if (!isAddress(input.walletAddress)) {
27
- return fail("INVALID_WALLET_ADDRESS", `Invalid wallet address: ${input.walletAddress}`, false, "estimate_gas");
28
- }
29
- const walletAddr = input.walletAddress;
30
- try {
31
- const gasPrice = await publicClient.getGasPrice();
32
- const balance = await publicClient.getBalance({ address: walletAddr });
33
- let gasEstimate;
34
- if (input.action === "transfer") {
35
- if (!input.toAddress) {
36
- return fail("MISSING_TO_ADDRESS", "toAddress is required for transfer gas estimation.", false, "estimate_gas");
37
- }
38
- if (!isAddress(input.toAddress)) {
39
- return fail("INVALID_RECIPIENT_ADDRESS", `Invalid recipient address: ${input.toAddress}`, false, "estimate_gas");
40
- }
41
- try {
42
- gasEstimate = await publicClient.estimateGas({
43
- to: input.toAddress,
44
- value: parseEther(input.amount),
45
- account: walletAddr,
46
- });
47
- }
48
- catch {
49
- gasEstimate = 21000n;
50
- }
51
- }
52
- else {
53
- if (!input.tokenIn || !input.tokenOut) {
54
- return fail("MISSING_SWAP_TOKENS", "tokenIn and tokenOut are required for swap gas estimation.", false, "estimate_gas");
55
- }
56
- try {
57
- const quote = await getDodoRoute({
58
- fromToken: input.tokenIn,
59
- toToken: input.tokenOut,
60
- amountHuman: input.amount,
61
- walletAddress: input.walletAddress,
62
- });
63
- if (!quote.routeAvailable) {
64
- return fail("NO_ROUTE_AVAILABLE", "No swap route available; cannot estimate gas.", true, "dodo_api");
65
- }
66
- gasEstimate = BigInt(quote.gasLimit);
67
- }
68
- catch (err) {
69
- const message = err instanceof Error ? err.message : String(err);
70
- if (message.includes("DODO_API_AUTH_REQUIRED")) {
71
- return fail("DODO_API_AUTH_REQUIRED", "DODO/FaroSwap route API rejected public mode. Configure DODO_API_KEY only if this endpoint requires authenticated access.", false, "dodo_api");
72
- }
73
- if (message.includes("DODO_API_RATE_LIMITED")) {
74
- return fail("DODO_API_RATE_LIMITED", message, true, "dodo_api");
75
- }
76
- return classifyExternalError("dodo_api", err);
77
- }
78
- }
79
- const gasCostWei = gasEstimate * gasPrice;
80
- const gasCostPHRS = formatEther(gasCostWei);
81
- let gasCostUsd = null;
82
- let priceSourceStatus = "unavailable";
83
- try {
84
- const priceQuote = await getDodoRoute({
85
- fromToken: "PHRS",
86
- toToken: "USDC",
87
- amountHuman: "1",
88
- walletAddress: QUOTE_WALLET,
89
- });
90
- if (priceQuote.routeAvailable) {
91
- gasCostUsd = (parseFloat(gasCostPHRS) * parseFloat(priceQuote.amountOut)).toFixed(6);
92
- priceSourceStatus = "ok";
93
- }
94
- else {
95
- priceSourceStatus = "no_route_available";
96
- }
97
- }
98
- catch {
99
- priceSourceStatus = "unavailable";
100
- }
101
- let totalNeeded = gasCostWei;
102
- if (input.action === "transfer" || (input.action === "swap" && isNativeToken(input.tokenIn || ""))) {
103
- totalNeeded += parseEther(input.amount);
104
- }
105
- const isSufficient = balance >= totalNeeded;
106
- return ok({
107
- action: input.action,
108
- gasEstimate: { value: gasEstimate.toString(), unit: "gas" },
109
- gasPrice: { value: formatGwei(gasPrice), unit: "gwei" },
110
- gasCostPHRS: { value: gasCostPHRS, unit: "PHRS" },
111
- gasCostUsd: gasCostUsd ? { value: gasCostUsd, unit: "USD" } : null,
112
- walletBalance: { value: formatEther(balance), unit: "PHRS" },
113
- isSufficient,
114
- priceSourceStatus,
115
- chainId: CHAIN_ID,
116
- environment: PHAROS_ENVIRONMENT,
117
- isMainnet: false,
118
- source: "pharos_rpc",
119
- });
120
- }
121
- catch (err) {
122
- return classifyExternalError("pharos_rpc", err);
123
- }
124
- }
1
+ // ─── Tool: estimate_gas ────────────────────────────────────────────────
2
+ // Estimates gas cost for a swap or transfer before executing.
3
+ // ────────────────────────────────────────────────────────────────────────
4
+ import { z } from "zod";
5
+ import { publicClient } from "../lib/pharosClient.js";
6
+ import { getDodoRoute, isNativeToken } from "../lib/dodoApi.js";
7
+ import { formatEther, formatGwei, isAddress, parseEther } from "viem";
8
+ import { CHAIN_ID, PHAROS_ENVIRONMENT } from "../lib/constants.js";
9
+ import { classifyExternalError, fail, ok } from "../lib/toolResponse.js";
10
+ export const estimateGasSchema = z.object({
11
+ action: z.enum(["swap", "transfer"]).describe("Type of action to estimate gas for"),
12
+ tokenIn: z.string().optional().describe("Token to swap from (for swaps)"),
13
+ tokenOut: z.string().optional().describe("Token to swap to (for swaps)"),
14
+ amount: z.string().describe("Human-readable amount"),
15
+ walletAddress: z.string().describe("Sender wallet address"),
16
+ toAddress: z.string().optional().describe("Recipient address (for transfers)"),
17
+ });
18
+ export const estimateGasTool = {
19
+ name: "estimate_gas",
20
+ description: "Estimate gas cost for a swap or transfer before executing. Returns gas units, cost in PHRS/USD, and whether the wallet has sufficient gas.",
21
+ inputSchema: estimateGasSchema,
22
+ };
23
+ const QUOTE_WALLET = "0x0000000000000000000000000000000000000001";
24
+ export async function handleEstimateGas(raw) {
25
+ const input = estimateGasSchema.parse(raw);
26
+ if (!isAddress(input.walletAddress)) {
27
+ return fail("INVALID_WALLET_ADDRESS", `Invalid wallet address: ${input.walletAddress}`, false, "estimate_gas");
28
+ }
29
+ const walletAddr = input.walletAddress;
30
+ try {
31
+ const gasPrice = await publicClient.getGasPrice();
32
+ const balance = await publicClient.getBalance({ address: walletAddr });
33
+ let gasEstimate;
34
+ if (input.action === "transfer") {
35
+ if (!input.toAddress) {
36
+ return fail("MISSING_TO_ADDRESS", "toAddress is required for transfer gas estimation.", false, "estimate_gas");
37
+ }
38
+ if (!isAddress(input.toAddress)) {
39
+ return fail("INVALID_RECIPIENT_ADDRESS", `Invalid recipient address: ${input.toAddress}`, false, "estimate_gas");
40
+ }
41
+ try {
42
+ gasEstimate = await publicClient.estimateGas({
43
+ to: input.toAddress,
44
+ value: parseEther(input.amount),
45
+ account: walletAddr,
46
+ });
47
+ }
48
+ catch {
49
+ gasEstimate = 21000n;
50
+ }
51
+ }
52
+ else {
53
+ if (!input.tokenIn || !input.tokenOut) {
54
+ return fail("MISSING_SWAP_TOKENS", "tokenIn and tokenOut are required for swap gas estimation.", false, "estimate_gas");
55
+ }
56
+ try {
57
+ const quote = await getDodoRoute({
58
+ fromToken: input.tokenIn,
59
+ toToken: input.tokenOut,
60
+ amountHuman: input.amount,
61
+ walletAddress: input.walletAddress,
62
+ });
63
+ if (!quote.routeAvailable) {
64
+ return fail("NO_ROUTE_AVAILABLE", "No swap route available; cannot estimate gas.", true, "dodo_api");
65
+ }
66
+ gasEstimate = BigInt(quote.gasLimit);
67
+ }
68
+ catch (err) {
69
+ const message = err instanceof Error ? err.message : String(err);
70
+ if (message.includes("DODO_API_AUTH_REQUIRED")) {
71
+ return fail("DODO_API_AUTH_REQUIRED", "DODO/FaroSwap route API rejected public mode. Configure DODO_API_KEY only if this endpoint requires authenticated access.", false, "dodo_api");
72
+ }
73
+ if (message.includes("DODO_API_RATE_LIMITED")) {
74
+ return fail("DODO_API_RATE_LIMITED", message, true, "dodo_api");
75
+ }
76
+ return classifyExternalError("dodo_api", err);
77
+ }
78
+ }
79
+ const gasCostWei = gasEstimate * gasPrice;
80
+ const gasCostPHRS = formatEther(gasCostWei);
81
+ let gasCostUsd = null;
82
+ let priceSourceStatus = "unavailable";
83
+ try {
84
+ const priceQuote = await getDodoRoute({
85
+ fromToken: "PHRS",
86
+ toToken: "USDC",
87
+ amountHuman: "1",
88
+ walletAddress: QUOTE_WALLET,
89
+ });
90
+ if (priceQuote.routeAvailable) {
91
+ gasCostUsd = (parseFloat(gasCostPHRS) * parseFloat(priceQuote.amountOut)).toFixed(6);
92
+ priceSourceStatus = "ok";
93
+ }
94
+ else {
95
+ priceSourceStatus = "no_route_available";
96
+ }
97
+ }
98
+ catch {
99
+ priceSourceStatus = "unavailable";
100
+ }
101
+ let totalNeeded = gasCostWei;
102
+ if (input.action === "transfer" || (input.action === "swap" && isNativeToken(input.tokenIn || ""))) {
103
+ totalNeeded += parseEther(input.amount);
104
+ }
105
+ const isSufficient = balance >= totalNeeded;
106
+ return ok({
107
+ action: input.action,
108
+ gasEstimate: { value: gasEstimate.toString(), unit: "gas" },
109
+ gasPrice: { value: formatGwei(gasPrice), unit: "gwei" },
110
+ gasCostPHRS: { value: gasCostPHRS, unit: "PHRS" },
111
+ gasCostUsd: gasCostUsd ? { value: gasCostUsd, unit: "USD" } : null,
112
+ walletBalance: { value: formatEther(balance), unit: "PHRS" },
113
+ isSufficient,
114
+ priceSourceStatus,
115
+ chainId: CHAIN_ID,
116
+ environment: PHAROS_ENVIRONMENT,
117
+ isMainnet: false,
118
+ source: "pharos_rpc",
119
+ });
120
+ }
121
+ catch (err) {
122
+ return classifyExternalError("pharos_rpc", err);
123
+ }
124
+ }
125
125
  //# sourceMappingURL=estimateGas.js.map
@@ -1,60 +1,62 @@
1
- import { z } from "zod";
2
- export declare const executeSwapSchema: z.ZodObject<{
3
- tokenIn: z.ZodString;
4
- tokenOut: z.ZodString;
5
- amountIn: z.ZodString;
6
- slippageTolerance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
- agentId: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- tokenIn: string;
10
- tokenOut: string;
11
- amountIn: string;
12
- slippageTolerance: number;
13
- agentId?: string | undefined;
14
- }, {
15
- tokenIn: string;
16
- tokenOut: string;
17
- amountIn: string;
18
- agentId?: string | undefined;
19
- slippageTolerance?: number | undefined;
20
- }>;
21
- export type ExecuteSwapInput = z.input<typeof executeSwapSchema>;
22
- export declare const executeSwapTool: {
23
- name: string;
24
- description: string;
25
- inputSchema: z.ZodObject<{
26
- tokenIn: z.ZodString;
27
- tokenOut: z.ZodString;
28
- amountIn: z.ZodString;
29
- slippageTolerance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
30
- agentId: z.ZodOptional<z.ZodString>;
31
- }, "strip", z.ZodTypeAny, {
32
- tokenIn: string;
33
- tokenOut: string;
34
- amountIn: string;
35
- slippageTolerance: number;
36
- agentId?: string | undefined;
37
- }, {
38
- tokenIn: string;
39
- tokenOut: string;
40
- amountIn: string;
41
- agentId?: string | undefined;
42
- slippageTolerance?: number | undefined;
43
- }>;
44
- };
45
- export declare function handleExecuteSwap(raw: ExecuteSwapInput): Promise<import("../lib/toolResponse.js").ToolFailure | import("../lib/toolResponse.js").ToolSuccess<{
46
- txSuccess: boolean;
47
- txHash: `0x${string}`;
48
- explorerUrl: string;
49
- amountOut: string;
50
- signerMode: import("../lib/signer/index.js").SignerMode;
51
- walletAddress: `0x${string}`;
52
- gasUsed: string;
53
- policy: import("../lib/policy/actionPolicyEngine.js").ActionPolicyResult;
54
- riskAssessment: {
55
- riskScore: number;
56
- wasBlocked: boolean;
57
- };
58
- source: string;
59
- }>>;
1
+ import { z } from "zod";
2
+ export declare const executeSwapSchema: z.ZodObject<{
3
+ tokenIn: z.ZodString;
4
+ tokenOut: z.ZodString;
5
+ amountIn: z.ZodString;
6
+ slippageTolerance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
+ agentId: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ tokenIn: string;
10
+ tokenOut: string;
11
+ amountIn: string;
12
+ slippageTolerance: number;
13
+ agentId?: string | undefined;
14
+ }, {
15
+ tokenIn: string;
16
+ tokenOut: string;
17
+ amountIn: string;
18
+ agentId?: string | undefined;
19
+ slippageTolerance?: number | undefined;
20
+ }>;
21
+ export type ExecuteSwapInput = z.input<typeof executeSwapSchema>;
22
+ export declare const executeSwapTool: {
23
+ name: string;
24
+ description: string;
25
+ inputSchema: z.ZodObject<{
26
+ tokenIn: z.ZodString;
27
+ tokenOut: z.ZodString;
28
+ amountIn: z.ZodString;
29
+ slippageTolerance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
30
+ agentId: z.ZodOptional<z.ZodString>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ tokenIn: string;
33
+ tokenOut: string;
34
+ amountIn: string;
35
+ slippageTolerance: number;
36
+ agentId?: string | undefined;
37
+ }, {
38
+ tokenIn: string;
39
+ tokenOut: string;
40
+ amountIn: string;
41
+ agentId?: string | undefined;
42
+ slippageTolerance?: number | undefined;
43
+ }>;
44
+ };
45
+ export declare function handleExecuteSwap(raw: ExecuteSwapInput): Promise<import("../lib/toolResponse.js").ToolFailure | import("../lib/toolResponse.js").ToolSuccess<{
46
+ txHash: `0x${string}`;
47
+ explorerUrl: string;
48
+ amountOut: string;
49
+ usedFromToken: string;
50
+ usedToToken: string;
51
+ wasSubstituted: boolean;
52
+ signerMode: import("../lib/signer/index.js").SignerMode;
53
+ walletAddress: `0x${string}`;
54
+ gasUsed: string;
55
+ policy: import("../lib/policy/actionPolicyEngine.js").ActionPolicyResult;
56
+ riskAssessment: {
57
+ riskScore: number;
58
+ wasBlocked: boolean;
59
+ };
60
+ source: string;
61
+ }>>;
60
62
  //# sourceMappingURL=executeSwap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeSwap.d.ts","sourceRoot":"","sources":["../../src/tools/executeSwap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAI3B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB;;;;;;;;;;;;;;IAuH5D"}
1
+ {"version":3,"file":"executeSwap.d.ts","sourceRoot":"","sources":["../../src/tools/executeSwap.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAI3B,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB;;;;;;;;;;;;;;;;IAgJ5D"}