httpcat-cli 0.2.12 → 0.2.13-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +355 -22
- package/Screenshot 2025-12-21 at 8.56.02/342/200/257PM.png +0 -0
- package/bun.lock +15 -1305
- package/cat-spin.sh +417 -0
- package/dist/agent/ax-agent.d.ts.map +1 -0
- package/dist/agent/ax-agent.js +459 -0
- package/dist/agent/ax-agent.js.map +1 -0
- package/dist/agent/llm-factory.d.ts.map +1 -0
- package/dist/agent/llm-factory.js +82 -0
- package/dist/agent/llm-factory.js.map +1 -0
- package/dist/agent/setup-wizard.d.ts.map +1 -0
- package/dist/agent/setup-wizard.js +114 -0
- package/dist/agent/setup-wizard.js.map +1 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +394 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +403 -46
- package/dist/client.js.map +1 -1
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +1 -0
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/balances.d.ts.map +1 -1
- package/dist/commands/balances.js +39 -14
- package/dist/commands/balances.js.map +1 -1
- package/dist/commands/buy.d.ts.map +1 -1
- package/dist/commands/buy.js +22 -14
- package/dist/commands/buy.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +60 -62
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +133 -5
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +12 -9
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/positions.d.ts.map +1 -1
- package/dist/commands/positions.js +51 -54
- package/dist/commands/positions.js.map +1 -1
- package/dist/commands/sell.d.ts.map +1 -1
- package/dist/commands/sell.js +14 -10
- package/dist/commands/sell.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +160 -10
- package/dist/config.js.map +1 -1
- package/dist/index.js +558 -45
- package/dist/index.js.map +1 -1
- package/dist/interactive/cat-spin.d.ts.map +1 -0
- package/dist/interactive/cat-spin.js +448 -0
- package/dist/interactive/cat-spin.js.map +1 -0
- package/dist/interactive/shell.d.ts.map +1 -1
- package/dist/interactive/shell.js +1651 -157
- package/dist/interactive/shell.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +109 -7
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +44 -2
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +3 -3
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/loading.d.ts.map +1 -1
- package/dist/utils/loading.js +30 -0
- package/dist/utils/loading.js.map +1 -1
- package/dist/utils/privateKeyPrompt.d.ts.map +1 -1
- package/dist/utils/privateKeyPrompt.js +31 -7
- package/dist/utils/privateKeyPrompt.js.map +1 -1
- package/dist/utils/status.d.ts.map +1 -0
- package/dist/utils/status.js +67 -0
- package/dist/utils/status.js.map +1 -0
- package/dist/utils/token-resolver.d.ts.map +1 -1
- package/dist/utils/token-resolver.js +41 -0
- package/dist/utils/token-resolver.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { config } from "../config.js";
|
|
4
|
+
import { printCat } from "../interactive/art.js";
|
|
5
|
+
/**
|
|
6
|
+
* Setup wizard for AI agent API keys
|
|
7
|
+
* Similar pattern to privateKeyPrompt.ts with cat-themed UX
|
|
8
|
+
*/
|
|
9
|
+
export async function setupAIAgentWizard() {
|
|
10
|
+
console.log();
|
|
11
|
+
// Show wizard cat
|
|
12
|
+
printCat("wizard");
|
|
13
|
+
console.log(chalk.bold.cyan("🐱 Let's set up your cat...\n"));
|
|
14
|
+
// Check if already configured
|
|
15
|
+
const existingConfig = config.getAIAgentConfig();
|
|
16
|
+
if (existingConfig) {
|
|
17
|
+
const providerName = existingConfig.provider === "openai" ? "OpenAI" : "Anthropic";
|
|
18
|
+
console.log(chalk.yellow("📋 Current configuration:"));
|
|
19
|
+
console.log(chalk.dim(` Provider: ${providerName}`));
|
|
20
|
+
console.log(chalk.dim(` Model: ${existingConfig.model || "default"}`));
|
|
21
|
+
console.log();
|
|
22
|
+
console.log(chalk.cyan("You can update your configuration below.\n"));
|
|
23
|
+
}
|
|
24
|
+
// Security messaging
|
|
25
|
+
console.log(chalk.dim("🔒 Security & Privacy:"));
|
|
26
|
+
console.log(chalk.dim(" • Your API keys are stored locally and encrypted"));
|
|
27
|
+
console.log(chalk.dim(" • They are never sent to any server except the LLM provider"));
|
|
28
|
+
console.log(chalk.dim(" • Stored in: "), chalk.cyan(config.getConfigPath()));
|
|
29
|
+
console.log();
|
|
30
|
+
// Ask which provider (default to existing if configured)
|
|
31
|
+
const providerChoice = await inquirer.prompt([
|
|
32
|
+
{
|
|
33
|
+
type: "list",
|
|
34
|
+
name: "provider",
|
|
35
|
+
message: "Which AI provider would you like to use?",
|
|
36
|
+
choices: [
|
|
37
|
+
{
|
|
38
|
+
name: "OpenAI (GPT-4, GPT-3.5) - Recommended",
|
|
39
|
+
value: "openai",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "Anthropic (Claude) - Great for complex tasks",
|
|
43
|
+
value: "anthropic",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: existingConfig?.provider || "openai",
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
// Helper function to validate API key format
|
|
50
|
+
const validateApiKey = (input, provider) => {
|
|
51
|
+
if (!input || input.trim().length === 0) {
|
|
52
|
+
return "API key is required";
|
|
53
|
+
}
|
|
54
|
+
const trimmed = input.trim();
|
|
55
|
+
if (provider === "openai") {
|
|
56
|
+
// OpenAI keys can start with "sk-" (legacy) or "sk-proj-" (newer project keys)
|
|
57
|
+
// Newer project keys are much longer, so we just check prefix and minimum length
|
|
58
|
+
if (!trimmed.startsWith("sk-") && !trimmed.startsWith("sk-proj-")) {
|
|
59
|
+
return "Invalid OpenAI API key format. Keys should start with 'sk-' or 'sk-proj-'";
|
|
60
|
+
}
|
|
61
|
+
if (trimmed.length < 20) {
|
|
62
|
+
return "Invalid OpenAI API key length. Keys should be at least 20 characters long.";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else if (provider === "anthropic") {
|
|
66
|
+
// Anthropic keys should start with "sk-ant-"
|
|
67
|
+
if (!trimmed.startsWith("sk-ant-")) {
|
|
68
|
+
return "Invalid Anthropic API key format. Keys should start with 'sk-ant-'";
|
|
69
|
+
}
|
|
70
|
+
if (trimmed.length < 40) {
|
|
71
|
+
return "Invalid Anthropic API key length. Keys should be at least 40 characters long.";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
// Ask for API key
|
|
77
|
+
const apiKeyAnswer = await inquirer.prompt([
|
|
78
|
+
{
|
|
79
|
+
type: "password",
|
|
80
|
+
name: "apiKey",
|
|
81
|
+
message: `Enter your ${providerChoice.provider === "openai" ? "OpenAI" : "Anthropic"} API key:`,
|
|
82
|
+
mask: "•",
|
|
83
|
+
validate: (input) => {
|
|
84
|
+
return validateApiKey(input, providerChoice.provider);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
]);
|
|
88
|
+
// Ask for model (with defaults)
|
|
89
|
+
const defaultModel = providerChoice.provider === "openai" ? "gpt-4" : "claude-3-5-sonnet-20241022";
|
|
90
|
+
const modelAnswer = await inquirer.prompt([
|
|
91
|
+
{
|
|
92
|
+
type: "input",
|
|
93
|
+
name: "model",
|
|
94
|
+
message: `Model name [${defaultModel}]:`,
|
|
95
|
+
default: defaultModel,
|
|
96
|
+
},
|
|
97
|
+
]);
|
|
98
|
+
// Save to config
|
|
99
|
+
config.setAIAgentConfig({
|
|
100
|
+
provider: providerChoice.provider,
|
|
101
|
+
apiKey: apiKeyAnswer.apiKey.trim(),
|
|
102
|
+
model: modelAnswer.model.trim() || defaultModel,
|
|
103
|
+
});
|
|
104
|
+
console.log();
|
|
105
|
+
console.log(chalk.green("✅ Cat configured successfully!"));
|
|
106
|
+
console.log(chalk.dim(` Provider: ${providerChoice.provider === "openai" ? "OpenAI" : "Anthropic"}`));
|
|
107
|
+
console.log(chalk.dim(` Model: ${modelAnswer.model.trim() || defaultModel}`));
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(chalk.cyan("🐱 You can now use the cat (or 'agent') with:"));
|
|
110
|
+
console.log(chalk.dim(" agent \"your question here\" (or 'cat \"your question here\"')"));
|
|
111
|
+
console.log(chalk.dim(" agent --chat (or 'cat --chat')"));
|
|
112
|
+
console.log();
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=setup-wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-wizard.js","sourceRoot":"","sources":["../../src/agent/setup-wizard.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,kBAAkB;IAClB,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC,CAAC;IAE9D,8BAA8B;IAC9B,MAAM,cAAc,GAAG,MAAM,CAAC,gBAAgB,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AE,GAC5E,OAAO,CAAC,MAAM,CAAC,CAsBjB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,EAAE,GACP,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,EAAE,GACP,OAAO,CAAC,MAAM,CAAC,CAkBjB"}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { HttpcatClient } from "../client.js";
|
|
2
|
+
import { buyToken } from "../commands/buy.js";
|
|
3
|
+
import { sellToken } from "../commands/sell.js";
|
|
4
|
+
import { getTokenInfo } from "../commands/info.js";
|
|
5
|
+
import { listTokens } from "../commands/list.js";
|
|
6
|
+
import { getPositions } from "../commands/positions.js";
|
|
7
|
+
import { checkBalance } from "../commands/balances.js";
|
|
8
|
+
import { config } from "../config.js";
|
|
9
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
10
|
+
// Helper to get private key
|
|
11
|
+
function getPrivateKey() {
|
|
12
|
+
return config.getPrivateKey();
|
|
13
|
+
}
|
|
14
|
+
// Helper to check if test mode
|
|
15
|
+
function isTestMode(client) {
|
|
16
|
+
const network = client.getNetwork();
|
|
17
|
+
return network === "eip155:84532" || network === "eip155:11155111" || network.includes("sepolia");
|
|
18
|
+
}
|
|
19
|
+
// Helper to safely serialize errors to strings
|
|
20
|
+
function serializeError(error) {
|
|
21
|
+
if (!error) {
|
|
22
|
+
return "Unknown error";
|
|
23
|
+
}
|
|
24
|
+
// If it's already a string, return it
|
|
25
|
+
if (typeof error === "string") {
|
|
26
|
+
return error;
|
|
27
|
+
}
|
|
28
|
+
// Try to get error message first (most common case)
|
|
29
|
+
if (error.message && typeof error.message === "string") {
|
|
30
|
+
return error.message;
|
|
31
|
+
}
|
|
32
|
+
// Try to stringify the error object, handling circular references
|
|
33
|
+
try {
|
|
34
|
+
// Use a replacer function to handle circular references
|
|
35
|
+
const seen = new WeakSet();
|
|
36
|
+
const serialized = JSON.stringify(error, (key, value) => {
|
|
37
|
+
if (typeof value === "object" && value !== null) {
|
|
38
|
+
if (seen.has(value)) {
|
|
39
|
+
return "[Circular]";
|
|
40
|
+
}
|
|
41
|
+
seen.add(value);
|
|
42
|
+
}
|
|
43
|
+
return value;
|
|
44
|
+
});
|
|
45
|
+
// If we got something meaningful, return it
|
|
46
|
+
if (serialized && serialized !== "{}" && serialized !== "null") {
|
|
47
|
+
return serialized;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// JSON.stringify failed, fall through to toString
|
|
52
|
+
}
|
|
53
|
+
// Last resort: try toString
|
|
54
|
+
try {
|
|
55
|
+
const str = String(error);
|
|
56
|
+
if (str && str !== "[object Object]") {
|
|
57
|
+
return str;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// toString also failed
|
|
62
|
+
}
|
|
63
|
+
// Final fallback
|
|
64
|
+
return "An error occurred (unable to serialize error details)";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Tool: Buy tokens
|
|
68
|
+
* Args: { tokenIdentifier: string, amount: string, repeat?: number, delay?: number }
|
|
69
|
+
*/
|
|
70
|
+
export async function toolBuyToken(client, args) {
|
|
71
|
+
try {
|
|
72
|
+
// Validate required arguments
|
|
73
|
+
if (!args || typeof args !== "object") {
|
|
74
|
+
return JSON.stringify({
|
|
75
|
+
success: false,
|
|
76
|
+
error: "Invalid arguments: args must be an object",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (!args.tokenIdentifier || typeof args.tokenIdentifier !== "string") {
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
success: false,
|
|
82
|
+
error: "Invalid arguments: tokenIdentifier is required and must be a string",
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (!args.amount || typeof args.amount !== "string") {
|
|
86
|
+
return JSON.stringify({
|
|
87
|
+
success: false,
|
|
88
|
+
error: "Invalid arguments: amount is required and must be a string",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const privateKey = getPrivateKey();
|
|
92
|
+
const isTest = isTestMode(client);
|
|
93
|
+
// Handle repeat mode
|
|
94
|
+
if (args.repeat && args.repeat > 1) {
|
|
95
|
+
const results = [];
|
|
96
|
+
let totalSpent = 0;
|
|
97
|
+
let stoppedEarly = false;
|
|
98
|
+
let stopReason = "";
|
|
99
|
+
for (let i = 1; i <= args.repeat; i++) {
|
|
100
|
+
try {
|
|
101
|
+
// Retry logic: try up to 10 times with exponential backoff on 402 errors
|
|
102
|
+
// Client is recreated on each attempt to ensure fresh signature for new nonce
|
|
103
|
+
let result = null;
|
|
104
|
+
let lastError = null;
|
|
105
|
+
const maxRetries = 10;
|
|
106
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
107
|
+
try {
|
|
108
|
+
// Recreate client inside the operation to ensure fresh signature
|
|
109
|
+
// for each attempt (including retries). This fixes the issue where x402-fetch
|
|
110
|
+
// generates a new nonce but reuses the same signature, causing subsequent buys to fail
|
|
111
|
+
result = await (async () => {
|
|
112
|
+
// Recreate client for each attempt to ensure fresh signature for new nonce
|
|
113
|
+
const client = await HttpcatClient.create(privateKey);
|
|
114
|
+
return buyToken(client, args.tokenIdentifier, args.amount, isTest, true, // silent
|
|
115
|
+
privateKey);
|
|
116
|
+
})();
|
|
117
|
+
// Success! Break out of retry loop
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
lastError = error;
|
|
122
|
+
// Only retry on 402 errors (payment required)
|
|
123
|
+
const is402Error = error?.message?.includes("402") ||
|
|
124
|
+
error?.status === 402 ||
|
|
125
|
+
(typeof error === "string" && error.includes("402"));
|
|
126
|
+
if (is402Error && attempt < maxRetries) {
|
|
127
|
+
// Exponential backoff: 1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s, 256s, 512s (capped at 10s)
|
|
128
|
+
const backoffMs = Math.min(Math.pow(2, attempt - 1) * 1000, 10000);
|
|
129
|
+
await new Promise((resolve) => setTimeout(resolve, backoffMs));
|
|
130
|
+
continue; // Retry
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Not a 402 error, or max retries reached - throw the error
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// If we exhausted retries, throw the last error
|
|
139
|
+
if (!result) {
|
|
140
|
+
if (lastError) {
|
|
141
|
+
throw lastError;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
throw new Error(`Failed to complete buy ${i}/${args.repeat} after ${maxRetries} attempts`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
results.push(result);
|
|
148
|
+
totalSpent += parseFloat(result.amountSpent);
|
|
149
|
+
// Check if token graduated
|
|
150
|
+
if (result.graduationReached) {
|
|
151
|
+
stoppedEarly = true;
|
|
152
|
+
stopReason = "Token graduated";
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
// Wait for transaction confirmations if present
|
|
156
|
+
// This ensures both the buy transaction and payment transaction are confirmed
|
|
157
|
+
// before the next buy, preventing nonce/signature conflicts
|
|
158
|
+
if (i < args.repeat) {
|
|
159
|
+
try {
|
|
160
|
+
const { createPublicClient, http } = await import("viem");
|
|
161
|
+
const { baseSepolia } = await import("viem/chains");
|
|
162
|
+
const publicClient = createPublicClient({
|
|
163
|
+
chain: baseSepolia,
|
|
164
|
+
transport: http(config.getRpcUrl()),
|
|
165
|
+
});
|
|
166
|
+
// Wait for payment transaction first (if present)
|
|
167
|
+
// This is critical to ensure the payment nonce is consumed before next request
|
|
168
|
+
if (result.paymentTxHash) {
|
|
169
|
+
await publicClient.waitForTransactionReceipt({
|
|
170
|
+
hash: result.paymentTxHash,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// Wait for buy transaction (if present)
|
|
174
|
+
if (result.txHash) {
|
|
175
|
+
await publicClient.waitForTransactionReceipt({
|
|
176
|
+
hash: result.txHash,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (txError) {
|
|
181
|
+
// If we can't wait for confirmation, continue with delay
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Apply delay between iterations (except after the last one)
|
|
185
|
+
// For bonding curve buys, we need a minimum delay to allow backend
|
|
186
|
+
// to process the transaction and update balance state
|
|
187
|
+
if (i < args.repeat) {
|
|
188
|
+
const MIN_DELAY_MS = 2000; // 2 seconds minimum for backend processing
|
|
189
|
+
const delay = args.delay || 0;
|
|
190
|
+
const totalDelay = Math.max(delay, MIN_DELAY_MS);
|
|
191
|
+
if (totalDelay > 0) {
|
|
192
|
+
await new Promise((resolve) => setTimeout(resolve, totalDelay));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
// Handle insufficient funds gracefully
|
|
198
|
+
const errorMsg = serializeError(error);
|
|
199
|
+
if (errorMsg.includes("402") || errorMsg.includes("Insufficient")) {
|
|
200
|
+
stoppedEarly = true;
|
|
201
|
+
stopReason = "Insufficient funds";
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const lastResult = results[results.length - 1];
|
|
208
|
+
return JSON.stringify({
|
|
209
|
+
success: true,
|
|
210
|
+
totalBuys: results.length,
|
|
211
|
+
requestedBuys: args.repeat,
|
|
212
|
+
totalSpent: totalSpent.toFixed(2),
|
|
213
|
+
tokensReceived: lastResult.tokensReceived,
|
|
214
|
+
newPrice: lastResult.newPrice,
|
|
215
|
+
graduationProgress: lastResult.graduationProgress,
|
|
216
|
+
graduationReached: lastResult.graduationReached,
|
|
217
|
+
stoppedEarly,
|
|
218
|
+
stopReason: stoppedEarly ? stopReason : undefined,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
// Single buy
|
|
223
|
+
const result = await buyToken(client, args.tokenIdentifier, args.amount, isTest, true, // silent
|
|
224
|
+
privateKey);
|
|
225
|
+
return JSON.stringify({
|
|
226
|
+
success: true,
|
|
227
|
+
tokensReceived: result.tokensReceived,
|
|
228
|
+
amountSpent: result.amountSpent,
|
|
229
|
+
newPrice: result.newPrice,
|
|
230
|
+
graduationProgress: result.graduationProgress,
|
|
231
|
+
graduationReached: result.graduationReached,
|
|
232
|
+
txHash: result.txHash,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
return JSON.stringify({
|
|
238
|
+
success: false,
|
|
239
|
+
error: serializeError(error),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Tool: Sell tokens
|
|
245
|
+
* Args: { tokenIdentifier: string, amount: string | number | "all" }
|
|
246
|
+
*/
|
|
247
|
+
export async function toolSellToken(client, args) {
|
|
248
|
+
try {
|
|
249
|
+
// Validate required arguments
|
|
250
|
+
if (!args || typeof args !== "object") {
|
|
251
|
+
return JSON.stringify({
|
|
252
|
+
success: false,
|
|
253
|
+
error: "Invalid arguments: args must be an object",
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
if (!args.tokenIdentifier || typeof args.tokenIdentifier !== "string") {
|
|
257
|
+
return JSON.stringify({
|
|
258
|
+
success: false,
|
|
259
|
+
error: "Invalid arguments: tokenIdentifier is required and must be a string",
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (!args.amount || typeof args.amount !== "string") {
|
|
263
|
+
return JSON.stringify({
|
|
264
|
+
success: false,
|
|
265
|
+
error: "Invalid arguments: amount is required and must be a string",
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
const privateKey = getPrivateKey();
|
|
269
|
+
const result = await sellToken(client, args.tokenIdentifier, args.amount, true, // silent
|
|
270
|
+
privateKey);
|
|
271
|
+
return JSON.stringify({
|
|
272
|
+
success: true,
|
|
273
|
+
tokensSold: result.tokensSold,
|
|
274
|
+
usdcReceived: result.usdcReceived,
|
|
275
|
+
newPrice: result.newPrice,
|
|
276
|
+
txHash: result.txHash,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
return JSON.stringify({
|
|
281
|
+
success: false,
|
|
282
|
+
error: serializeError(error),
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Tool: Get token info
|
|
288
|
+
* Args: { tokenIdentifier: string }
|
|
289
|
+
*/
|
|
290
|
+
export async function toolGetTokenInfo(client, args) {
|
|
291
|
+
try {
|
|
292
|
+
// Validate required arguments
|
|
293
|
+
if (!args || typeof args !== "object") {
|
|
294
|
+
return JSON.stringify({
|
|
295
|
+
success: false,
|
|
296
|
+
error: "Invalid arguments: args must be an object",
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
if (!args.tokenIdentifier || typeof args.tokenIdentifier !== "string") {
|
|
300
|
+
return JSON.stringify({
|
|
301
|
+
success: false,
|
|
302
|
+
error: "Invalid arguments: tokenIdentifier is required and must be a string",
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
const account = privateKeyToAccount(getPrivateKey());
|
|
306
|
+
const info = await getTokenInfo(client, args.tokenIdentifier, account.address, true);
|
|
307
|
+
return JSON.stringify({
|
|
308
|
+
success: true,
|
|
309
|
+
name: info.name,
|
|
310
|
+
symbol: info.symbol,
|
|
311
|
+
address: info.address,
|
|
312
|
+
status: info.status,
|
|
313
|
+
price: info.price,
|
|
314
|
+
mcap: info.mcap,
|
|
315
|
+
graduationProgress: info.graduationProgress,
|
|
316
|
+
totalSupply: info.totalSupply,
|
|
317
|
+
userPosition: info.userPosition,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
return JSON.stringify({
|
|
322
|
+
success: false,
|
|
323
|
+
error: serializeError(error),
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Tool: List tokens
|
|
329
|
+
* Args: { page?: number, limit?: number, sortBy?: "mcap" | "created" | "name" }
|
|
330
|
+
*/
|
|
331
|
+
export async function toolListTokens(client, args) {
|
|
332
|
+
try {
|
|
333
|
+
const result = await listTokens(client, args.page || 1, args.limit || 20, args.sortBy || "mcap");
|
|
334
|
+
return JSON.stringify({
|
|
335
|
+
success: true,
|
|
336
|
+
tokens: result.tokens,
|
|
337
|
+
total: result.total,
|
|
338
|
+
page: result.page,
|
|
339
|
+
pages: result.pages,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
return JSON.stringify({
|
|
344
|
+
success: false,
|
|
345
|
+
error: serializeError(error),
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Tool: Get positions
|
|
351
|
+
* Args: {}
|
|
352
|
+
*/
|
|
353
|
+
export async function toolGetPositions(client, args) {
|
|
354
|
+
try {
|
|
355
|
+
const account = privateKeyToAccount(getPrivateKey());
|
|
356
|
+
const result = await getPositions(client, account.address);
|
|
357
|
+
return JSON.stringify({
|
|
358
|
+
success: true,
|
|
359
|
+
positions: result.positions,
|
|
360
|
+
total: result.total,
|
|
361
|
+
summary: result.summary,
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
return JSON.stringify({
|
|
366
|
+
success: false,
|
|
367
|
+
error: serializeError(error),
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Tool: Check balance
|
|
373
|
+
* Args: {}
|
|
374
|
+
*/
|
|
375
|
+
export async function toolCheckBalance(client, args) {
|
|
376
|
+
try {
|
|
377
|
+
const balance = await checkBalance(getPrivateKey(), true);
|
|
378
|
+
return JSON.stringify({
|
|
379
|
+
success: true,
|
|
380
|
+
ethBalance: balance.ethBalance,
|
|
381
|
+
usdcBalance: balance.usdcBalance,
|
|
382
|
+
address: balance.address,
|
|
383
|
+
ethFormatted: balance.ethFormatted,
|
|
384
|
+
usdcFormatted: balance.usdcFormatted,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
return JSON.stringify({
|
|
389
|
+
success: false,
|
|
390
|
+
error: serializeError(error),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/agent/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAkB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAmB,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAmB,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAmB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAe,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,4BAA4B;AAC5B,SAAS,aAAa;IACpB,OAAO,MAAM,CAAC,aAAa,EAAmB,CAAC;AACjD,CAAC;AAED,+BAA+B;AAC/B,SAAS,UAAU,CAAC,MAAqB;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,OAAO,OAAO,KAAK,cAAc,IAAI,OAAO,KAAK,iBAAiB,IAAI,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACpG,CAAC;AAED,+CAA+C;AAC/C,SAAS,cAAc,CAAC,KA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C;SAC7B,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAqB,EACrB,IAAQ;IAER,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,aAAa,EAAE,EAAE,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC;SAC7B,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAIhC,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG;IACzC,MAAM,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,gBAAgB,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO;WAcM,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC;IA6D7D;;;OAGG;YACW,iBAAiB;IAmI/B;;OAEG;YACW,sBAAsB;IAsH9B,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EACtC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,WAAW,CAAA;KAAE,CAAC;IAgW9C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IA2FrC,WAAW,IAAI,MAAM;IAIrB,UAAU,IAAI,MAAM;CAGrB;AAED,qBAAa,YAAa,SAAQ,KAAK;IACD,MAAM,EAAE,MAAM;IAAS,OAAO,CAAC,EAAE,GAAG;gBAA5D,OAAO,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,EAAS,OAAO,CAAC,EAAE,GAAG,YAAA;CAIzE"}
|