@ai.ntellect/core 0.5.0 → 0.6.1

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 (131) hide show
  1. package/.mocharc.json +1 -1
  2. package/README.md +311 -272
  3. package/create-llm-to-select-multiple-graph copy.ts +243 -0
  4. package/create-llm-to-select-multiple-graph.ts +148 -0
  5. package/dist/graph/controller.js +63 -0
  6. package/dist/graph/engine.js +563 -0
  7. package/dist/index.js +6 -6
  8. package/dist/memory/adapters/meilisearch/index.js +249 -0
  9. package/dist/memory/adapters/redis/index.js +96 -0
  10. package/dist/memory/index.js +9 -0
  11. package/dist/services/agenda.js +115 -0
  12. package/dist/services/embedding.js +40 -0
  13. package/dist/services/queue.js +99 -103
  14. package/dist/test/graph/controller.test.js +170 -0
  15. package/dist/test/graph/engine.test.js +465 -0
  16. package/dist/test/memory/adapters/meilisearch.test.js +250 -0
  17. package/dist/test/memory/adapters/redis.test.js +143 -0
  18. package/dist/test/memory/base.test.js +209 -0
  19. package/dist/test/services/agenda.test.js +230 -0
  20. package/dist/test/services/queue.test.js +258 -0
  21. package/dist/types/index.js +2 -0
  22. package/dist/utils/generate-object.js +32 -11
  23. package/dist/utils/inject-actions.js +2 -2
  24. package/dist/utils/queue-item-transformer.js +2 -2
  25. package/dist/utils/state-manager.js +20 -0
  26. package/graph/controller.ts +64 -0
  27. package/graph/engine.ts +790 -0
  28. package/index copy.ts +81 -0
  29. package/index.ts +7 -7
  30. package/interfaces/index.ts +119 -0
  31. package/memory/adapters/meilisearch/index.ts +286 -0
  32. package/memory/adapters/redis/index.ts +103 -0
  33. package/memory/index.ts +22 -0
  34. package/package.json +7 -2
  35. package/services/agenda.ts +48 -43
  36. package/services/embedding.ts +26 -0
  37. package/services/queue.ts +2 -29
  38. package/test/.env.test +4 -0
  39. package/test/graph/controller.test.ts +186 -0
  40. package/test/graph/engine.test.ts +546 -0
  41. package/test/memory/adapters/meilisearch.test.ts +297 -0
  42. package/test/memory/adapters/redis.test.ts +160 -0
  43. package/test/memory/base.test.ts +229 -0
  44. package/test/services/agenda.test.ts +280 -0
  45. package/test/services/queue.test.ts +286 -44
  46. package/tsconfig.json +10 -10
  47. package/types/index.ts +278 -0
  48. package/utils/queue-item-transformer.ts +8 -11
  49. package/utils/setup-graphs.ts +45 -0
  50. package/utils/stringifiy-zod-schema.ts +45 -0
  51. package/.nvmrc +0 -1
  52. package/README.FR.md +0 -916
  53. package/agent/index.ts +0 -151
  54. package/agent/workflow/conditions.ts +0 -16
  55. package/agent/workflow/handlers/interpreter.handler.ts +0 -48
  56. package/agent/workflow/handlers/memory.handler.ts +0 -106
  57. package/agent/workflow/handlers/orchestrator.handler.ts +0 -23
  58. package/agent/workflow/handlers/queue.handler.ts +0 -34
  59. package/agent/workflow/handlers/scheduler.handler.ts +0 -61
  60. package/agent/workflow/index.ts +0 -62
  61. package/dist/agent/index.d.ts +0 -38
  62. package/dist/agent/index.js +0 -143
  63. package/dist/agent/tools/get-rss.d.ts +0 -16
  64. package/dist/agent/tools/get-rss.js +0 -62
  65. package/dist/bull.d.ts +0 -1
  66. package/dist/bull.js +0 -9
  67. package/dist/examples/index.d.ts +0 -2
  68. package/dist/examples/index.js +0 -89
  69. package/dist/index.d.ts +0 -7
  70. package/dist/llm/interpreter/context.d.ts +0 -15
  71. package/dist/llm/interpreter/context.js +0 -89
  72. package/dist/llm/interpreter/index.d.ts +0 -21
  73. package/dist/llm/interpreter/index.js +0 -87
  74. package/dist/llm/memory-manager/context.d.ts +0 -2
  75. package/dist/llm/memory-manager/context.js +0 -22
  76. package/dist/llm/memory-manager/index.d.ts +0 -17
  77. package/dist/llm/memory-manager/index.js +0 -107
  78. package/dist/llm/orchestrator/context.d.ts +0 -2
  79. package/dist/llm/orchestrator/context.js +0 -23
  80. package/dist/llm/orchestrator/index.d.ts +0 -44
  81. package/dist/llm/orchestrator/index.js +0 -139
  82. package/dist/llm/orchestrator/types.d.ts +0 -12
  83. package/dist/memory/cache.d.ts +0 -22
  84. package/dist/memory/cache.js +0 -165
  85. package/dist/memory/persistent.d.ts +0 -57
  86. package/dist/memory/persistent.js +0 -189
  87. package/dist/services/queue.d.ts +0 -13
  88. package/dist/services/redis-cache.d.ts +0 -37
  89. package/dist/services/redis-cache.js +0 -93
  90. package/dist/services/scheduler.d.ts +0 -40
  91. package/dist/services/scheduler.js +0 -99
  92. package/dist/services/telegram-monitor.d.ts +0 -0
  93. package/dist/services/telegram-monitor.js +0 -118
  94. package/dist/t.d.ts +0 -46
  95. package/dist/t.js +0 -102
  96. package/dist/test.d.ts +0 -0
  97. package/dist/test.js +0 -438
  98. package/dist/types.d.ts +0 -258
  99. package/dist/types.js +0 -22
  100. package/dist/utils/generate-object.d.ts +0 -12
  101. package/dist/utils/header-builder.d.ts +0 -11
  102. package/dist/utils/inject-actions.d.ts +0 -2
  103. package/dist/utils/queue-item-transformer.d.ts +0 -7
  104. package/dist/utils/sanitize-results.d.ts +0 -17
  105. package/dist/utils/schema-generator.d.ts +0 -16
  106. package/examples/actions/get-rss.ts +0 -71
  107. package/examples/index.ts +0 -98
  108. package/index.html +0 -42
  109. package/llm/dynamic-condition/example.ts +0 -36
  110. package/llm/dynamic-condition/index.ts +0 -108
  111. package/llm/interpreter/context.ts +0 -94
  112. package/llm/interpreter/index.ts +0 -140
  113. package/llm/memory-manager/context.ts +0 -19
  114. package/llm/memory-manager/index.ts +0 -115
  115. package/llm/orchestrator/context.ts +0 -19
  116. package/llm/orchestrator/index.ts +0 -192
  117. package/llm/orchestrator/types.ts +0 -14
  118. package/memory/cache.ts +0 -221
  119. package/memory/persistent.ts +0 -265
  120. package/script.js +0 -167
  121. package/services/cache.ts +0 -298
  122. package/services/telegram-monitor.ts +0 -138
  123. package/services/workflow.ts +0 -491
  124. package/t.py +0 -79
  125. package/t.ts +0 -25
  126. package/test/llm/orchestrator.test.ts +0 -47
  127. package/test/llm/synthesizer.test.ts +0 -31
  128. package/types.ts +0 -367
  129. package/utils/schema-generator.ts +0 -73
  130. package/utils/state-manager.ts +0 -25
  131. /package/dist/{llm/orchestrator/types.js → interfaces/index.js} +0 -0
@@ -1,93 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.RedisCache = void 0;
7
- const ioredis_1 = __importDefault(require("ioredis"));
8
- const node_cron_1 = __importDefault(require("node-cron"));
9
- class RedisCache {
10
- constructor(config) {
11
- this.redis = new ioredis_1.default({
12
- host: config.host,
13
- port: config.port,
14
- password: config.password,
15
- });
16
- this.defaultTTL = config.ttl || 1800; // 30 minutes in seconds
17
- // Setup cleanup job (default: every 30 minutes)
18
- this.cleanupJob = node_cron_1.default.schedule(config.cleanupInterval || "*/30 * * * *", () => this.cleanup());
19
- }
20
- /**
21
- * Store previous actions for a specific request
22
- */
23
- async storePreviousActions(requestId, actions) {
24
- const key = `previous_actions:${requestId}`;
25
- await this.redis.setex(key, this.defaultTTL, JSON.stringify({
26
- timestamp: new Date().toISOString(),
27
- actions,
28
- }));
29
- }
30
- /**
31
- * Get previous actions for a specific request
32
- */
33
- async getPreviousActions(requestId) {
34
- const key = `previous_actions:${requestId}`;
35
- const data = await this.redis.get(key);
36
- if (!data)
37
- return [];
38
- const parsed = JSON.parse(data);
39
- return parsed.actions;
40
- }
41
- /**
42
- * Store a recent message
43
- */
44
- async storeRecentMessage(message, metadata) {
45
- const id = crypto.randomUUID();
46
- const key = `recent_messages:${id}`;
47
- await this.redis.setex(key, this.defaultTTL, JSON.stringify({
48
- timestamp: new Date().toISOString(),
49
- message,
50
- metadata,
51
- }));
52
- }
53
- /**
54
- * Get recent messages
55
- */
56
- async getRecentMessages(limit = 10) {
57
- const keys = await this.redis.keys("recent_messages:*");
58
- if (!keys.length)
59
- return [];
60
- const messages = await Promise.all(keys.map(async (key) => {
61
- const data = await this.redis.get(key);
62
- return data ? JSON.parse(data) : null;
63
- }));
64
- return messages
65
- .filter(Boolean)
66
- .sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime())
67
- .slice(0, limit);
68
- }
69
- /**
70
- * Cleanup expired keys
71
- */
72
- async cleanup() {
73
- console.log("🧹 Starting cache cleanup...");
74
- try {
75
- // Redis automatically removes expired keys
76
- // This is just for logging purposes
77
- const actionKeys = await this.redis.keys("previous_actions:*");
78
- const messageKeys = await this.redis.keys("recent_messages:*");
79
- console.log(`Cache status: ${actionKeys.length} actions, ${messageKeys.length} messages`);
80
- }
81
- catch (error) {
82
- console.error("❌ Cache cleanup error:", error);
83
- }
84
- }
85
- /**
86
- * Stop the cleanup job and close Redis connection
87
- */
88
- async close() {
89
- this.cleanupJob.stop();
90
- await this.redis.quit();
91
- }
92
- }
93
- exports.RedisCache = RedisCache;
@@ -1,40 +0,0 @@
1
- import { AgentRuntime } from "../llm/orchestrator";
2
- import { RedisCache } from "./redis-cache";
3
- interface ScheduledRequest {
4
- id: string;
5
- originalRequest: string;
6
- cronExpression: string;
7
- isRecurring: boolean;
8
- createdAt: Date;
9
- }
10
- export declare class TaskScheduler {
11
- private scheduledRequests;
12
- private cronJobs;
13
- private readonly agentRuntime;
14
- private readonly cache;
15
- constructor(agentRuntime: AgentRuntime, cache: RedisCache);
16
- /**
17
- * Schedule a new request to be processed later
18
- */
19
- scheduleRequest(request: {
20
- originalRequest: string;
21
- cronExpression: string;
22
- }): Promise<string>;
23
- /**
24
- * Execute a scheduled request by launching a new process
25
- */
26
- private executeScheduledRequest;
27
- /**
28
- * Cancel a scheduled request
29
- */
30
- cancelScheduledRequest(requestId: string): boolean;
31
- /**
32
- * Get all scheduled requests
33
- */
34
- getScheduledRequests(): ScheduledRequest[];
35
- /**
36
- * Stop all cron jobs
37
- */
38
- stopAll(): void;
39
- }
40
- export {};
@@ -1,99 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.TaskScheduler = void 0;
7
- const node_cron_1 = __importDefault(require("node-cron"));
8
- class TaskScheduler {
9
- constructor(agentRuntime, cache) {
10
- this.scheduledRequests = new Map();
11
- this.cronJobs = new Map();
12
- this.agentRuntime = agentRuntime;
13
- this.cache = cache;
14
- }
15
- /**
16
- * Schedule a new request to be processed later
17
- */
18
- async scheduleRequest(request) {
19
- const id = crypto.randomUUID();
20
- const scheduledRequest = {
21
- id,
22
- originalRequest: request.originalRequest,
23
- cronExpression: request.cronExpression,
24
- isRecurring: false,
25
- createdAt: new Date(),
26
- };
27
- // Create cron job
28
- const cronJob = node_cron_1.default.schedule(request.cronExpression, async () => {
29
- await this.executeScheduledRequest(scheduledRequest);
30
- if (!scheduledRequest.isRecurring) {
31
- this.cancelScheduledRequest(id);
32
- }
33
- });
34
- // Store request and job
35
- this.scheduledRequests.set(id, scheduledRequest);
36
- this.cronJobs.set(id, cronJob);
37
- console.log(`✅ Request scheduled with cron expression: ${request.cronExpression}`);
38
- return id;
39
- }
40
- /**
41
- * Execute a scheduled request by launching a new process
42
- */
43
- async executeScheduledRequest(request) {
44
- try {
45
- console.log(`🔄 Executing scheduled request from ${request.createdAt}`);
46
- // Récupérer les actions précédentes du cache
47
- const previousActions = await this.cache.getPreviousActions(request.id);
48
- // Add context about when this request was scheduled
49
- const contextualRequest = `You are a scheduler.
50
- You were asked to execute this request: ${request.originalRequest}\n
51
- Date of the request: ${request.createdAt.toISOString()}\n
52
- Act like if you know the request was scheduled.
53
- Don't reschedule the same action.
54
- Just execute it.`;
55
- // Process the request as if it was just received
56
- const result = await this.agentRuntime.process({
57
- currentContext: contextualRequest,
58
- previousActions,
59
- });
60
- // Store the new actions in cache
61
- if (result.actions.length > 0) {
62
- await this.cache.storePreviousActions(request.id, result.actions);
63
- }
64
- console.log(`✅ Scheduled request executed successfully`);
65
- }
66
- catch (error) {
67
- console.error(`❌ Failed to execute scheduled request:`, error);
68
- }
69
- }
70
- /**
71
- * Cancel a scheduled request
72
- */
73
- cancelScheduledRequest(requestId) {
74
- const cronJob = this.cronJobs.get(requestId);
75
- if (cronJob) {
76
- cronJob.stop();
77
- this.cronJobs.delete(requestId);
78
- }
79
- return this.scheduledRequests.delete(requestId);
80
- }
81
- /**
82
- * Get all scheduled requests
83
- */
84
- getScheduledRequests() {
85
- return Array.from(this.scheduledRequests.values());
86
- }
87
- /**
88
- * Stop all cron jobs
89
- */
90
- stopAll() {
91
- for (const [id, cronJob] of this.cronJobs) {
92
- cronJob.stop();
93
- this.cronJobs.delete(id);
94
- this.scheduledRequests.delete(id);
95
- }
96
- console.log("All scheduled requests stopped");
97
- }
98
- }
99
- exports.TaskScheduler = TaskScheduler;
File without changes
@@ -1,118 +0,0 @@
1
- "use strict";
2
- // import dotenv from "dotenv";
3
- // import promptSync from "prompt-sync";
4
- // import { TelegramClient } from "telegram";
5
- // import { NewMessage } from "telegram/events";
6
- // import { StringSession } from "telegram/sessions";
7
- // dotenv.config();
8
- // const prompt = promptSync({ sigint: true });
9
- // export interface TokenLaunch {
10
- // tokenAddress: string;
11
- // messageUrl: string;
12
- // timestamp: string;
13
- // }
14
- // export class TelegramMonitor {
15
- // private client: TelegramClient;
16
- // private botStartTime: Date;
17
- // constructor() {
18
- // if (!process.env.TELEGRAM_API_ID || !process.env.TELEGRAM_API_HASH) {
19
- // throw new Error("TELEGRAM_API_ID and TELEGRAM_API_HASH must be set");
20
- // }
21
- // this.botStartTime = new Date();
22
- // const apiId = parseInt(process.env.TELEGRAM_API_ID);
23
- // const apiHash = process.env.TELEGRAM_API_HASH;
24
- // // Utiliser une session stockée si disponible
25
- // const sessionString = process.env.TELEGRAM_SESSION;
26
- // this.client = new TelegramClient(
27
- // new StringSession(sessionString),
28
- // apiId,
29
- // apiHash,
30
- // {
31
- // connectionRetries: 5,
32
- // }
33
- // );
34
- // }
35
- // async connect() {
36
- // // Se connecter en tant qu'utilisateur
37
- // await this.client.start({
38
- // phoneNumber: async () => prompt("Numéro de téléphone ? "),
39
- // password: async () => prompt("Mot de passe ? "),
40
- // phoneCode: async () => prompt("Code reçu ? "),
41
- // onError: (err) => console.log(err),
42
- // });
43
- // // Sauvegarder la session pour une utilisation ultérieure
44
- // console.log("Session string à sauvegarder:", this.client.session.save());
45
- // }
46
- // async startMonitoring(
47
- // channelUsername: string,
48
- // callback: {
49
- // onNewLaunch: (message: string) => void;
50
- // }
51
- // ) {
52
- // console.log(`Démarrage du monitoring pour ${channelUsername}`);
53
- // try {
54
- // // S'assurer que le client est connecté
55
- // if (!this.client.connected) {
56
- // console.log("Client non connecté, tentative de connexion...");
57
- // await this.client.connect();
58
- // console.log("Client connecté avec succès");
59
- // }
60
- // console.log("État de la connexion:", this.client.connected);
61
- // // Vérifier si le canal existe et est accessible
62
- // try {
63
- // const channel = await this.client.getEntity(channelUsername);
64
- // console.log("Canal trouvé:", channel.id);
65
- // } catch (e) {
66
- // console.error("Erreur lors de l'accès au canal:", e);
67
- // }
68
- // this.client.addEventHandler(async (event: any) => {
69
- // const message = event.message;
70
- // if (!message) {
71
- // console.log("Pas de message dans l'événement");
72
- // return;
73
- // }
74
- // if (!message.text) {
75
- // console.log("Message sans texte:", message);
76
- // return;
77
- // }
78
- // try {
79
- // callback.onNewLaunch(message.text);
80
- // } catch (error) {
81
- // console.error("Erreur lors du traitement du message:", error);
82
- // }
83
- // }, new NewMessage({ chats: [channelUsername] }));
84
- // console.log("Handler d'événements ajouté avec succès");
85
- // } catch (error) {
86
- // console.error("Erreur lors du démarrage du monitoring:", error);
87
- // }
88
- // }
89
- // static async generateNewSession() {
90
- // // Supprimer la session existante
91
- // const client = new TelegramClient(
92
- // new StringSession(""),
93
- // parseInt(process.env.TELEGRAM_API_ID || ""),
94
- // process.env.TELEGRAM_API_HASH || "",
95
- // {
96
- // connectionRetries: 5,
97
- // }
98
- // );
99
- // // Se connecter en tant qu'utilisateur
100
- // await client.start({
101
- // phoneNumber: async () => prompt("Numéro de téléphone ? "),
102
- // password: async () => prompt("Mot de passe ? "),
103
- // phoneCode: async () => prompt("Code reçu ? "),
104
- // onError: (err) => console.log(err),
105
- // });
106
- // // Sauvegarder la nouvelle session pour une utilisation ultérieure
107
- // console.log(
108
- // "Nouvelle session string à sauvegarder:",
109
- // client.session.save()
110
- // );
111
- // }
112
- // }
113
- // const telegramMonitor = new TelegramMonitor();
114
- // telegramMonitor.startMonitoring("testcalldegen", {
115
- // onNewLaunch: (message: string) => {
116
- // console.log("Nouveau message:", message);
117
- // },
118
- // });
package/dist/t.d.ts DELETED
@@ -1,46 +0,0 @@
1
- export interface NetworkConfig {
2
- name: string;
3
- id?: number;
4
- rpc: string;
5
- explorerUrl: string;
6
- nativeToken: string;
7
- }
8
- export declare const networkConfigs: Record<string, NetworkConfig>;
9
- export declare const getNetworkProvider: (networkName: string) => {
10
- config: NetworkConfig;
11
- };
12
- import { z } from "zod";
13
- export type TransactionPrepared = {
14
- to: string;
15
- value: string;
16
- data?: string;
17
- chain: {
18
- id: number;
19
- rpc: string;
20
- };
21
- type: "transfer" | "approve" | "swap";
22
- method?: string;
23
- params?: any[];
24
- };
25
- export declare const prepareEvmTransaction: {
26
- name: string;
27
- description: string;
28
- parameters: z.ZodObject<{
29
- walletAddress: z.ZodString;
30
- amount: z.ZodString;
31
- network: z.ZodString;
32
- }, "strip", z.ZodTypeAny, {
33
- walletAddress: string;
34
- amount: string;
35
- network: string;
36
- }, {
37
- walletAddress: string;
38
- amount: string;
39
- network: string;
40
- }>;
41
- execute: ({ walletAddress, amount, network, }: {
42
- walletAddress: string;
43
- amount: string;
44
- network: string;
45
- }) => Promise<TransactionPrepared>;
46
- };
package/dist/t.js DELETED
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareEvmTransaction = exports.getNetworkProvider = exports.networkConfigs = void 0;
4
- exports.networkConfigs = {
5
- ethereum: {
6
- name: "Ethereum Mainnet",
7
- id: 1,
8
- rpc: "https://eth.llamarpc.com",
9
- explorerUrl: "https://etherscan.io",
10
- nativeToken: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
11
- },
12
- polygon: {
13
- name: "Polygon Mainnet",
14
- id: 137,
15
- rpc: "https://polygon.llamarpc.com",
16
- explorerUrl: "https://polygonscan.com",
17
- nativeToken: "0x0000000000000000000000000000000000001010",
18
- },
19
- arbitrum: {
20
- name: "Arbitrum Mainnet",
21
- id: 42161,
22
- rpc: "https://arbitrum.llamarpc.com",
23
- explorerUrl: "https://arbiscan.io",
24
- nativeToken: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
25
- },
26
- base: {
27
- name: "Base Mainnet",
28
- id: 8453,
29
- rpc: "https://base.llamarpc.com",
30
- explorerUrl: "https://basescan.org",
31
- nativeToken: "0x4200000000000000000000000000000000000006",
32
- },
33
- solana: {
34
- name: "Solana Mainnet",
35
- rpc: "https://api.mainnet-beta.solana.com",
36
- explorerUrl: "https://solscan.io",
37
- nativeToken: "So11111111111111111111111111111111111111112",
38
- },
39
- sepolia: {
40
- name: "Sepolia Testnet",
41
- id: 11155111,
42
- rpc: "https://sepolia.llamarpc.com",
43
- explorerUrl: "https://sepolia.etherscan.io",
44
- nativeToken: "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14",
45
- },
46
- baseSepolia: {
47
- name: "Base Sepolia Testnet",
48
- id: 84532,
49
- rpc: "https://base-sepolia-rpc.publicnode.com",
50
- explorerUrl: "https://sepolia.basescan.org",
51
- nativeToken: "0x4200000000000000000000000000000000000006",
52
- },
53
- };
54
- const getNetworkProvider = (networkName) => {
55
- const config = exports.networkConfigs[networkName.toLowerCase()];
56
- if (!config) {
57
- throw new Error(`Network ${networkName} not supported`);
58
- }
59
- return { config };
60
- };
61
- exports.getNetworkProvider = getNetworkProvider;
62
- const ethers_1 = require("ethers");
63
- const zod_1 = require("zod");
64
- exports.prepareEvmTransaction = {
65
- name: "prepare-evm-transaction",
66
- description: "Prepare a transaction for the user to sign.",
67
- parameters: zod_1.z.object({
68
- walletAddress: zod_1.z.string(),
69
- amount: zod_1.z
70
- .string()
71
- .describe("Ask the user for the amount to send, if not specified"),
72
- network: zod_1.z
73
- .string()
74
- .describe("Examples networks: ethereum, arbitrum, base. IMPORTANT: You must respect the network name."),
75
- }),
76
- execute: async ({ walletAddress, amount, network, }) => {
77
- try {
78
- console.log("💰 Preparing transaction", {
79
- to: walletAddress,
80
- amount,
81
- network,
82
- });
83
- const networkConfig = exports.networkConfigs[network.toLowerCase()];
84
- if (!networkConfig) {
85
- throw new Error(`Network ${network} not found`);
86
- }
87
- return {
88
- to: walletAddress,
89
- value: (0, ethers_1.parseEther)(amount).toString(),
90
- chain: {
91
- id: networkConfig.id || 0,
92
- rpc: networkConfig.rpc,
93
- },
94
- type: "transfer",
95
- };
96
- }
97
- catch (error) {
98
- console.error("💰 Error sending transaction:", error);
99
- throw new Error("An error occurred while sending the transaction");
100
- }
101
- },
102
- };
package/dist/test.d.ts DELETED
File without changes