@agentwallex/openclaw 0.0.3 → 0.1.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/dist/index.js CHANGED
@@ -38,10 +38,39 @@ async function listAgents(client, input = {}) {
38
38
  };
39
39
  }
40
40
 
41
+ // src/tools/update-agent.ts
42
+ async function updateAgent(client, input) {
43
+ const agent = await client.agents.update(input.agent_id, {
44
+ agent_name: input.agent_name,
45
+ agent_description: input.agent_description
46
+ });
47
+ return {
48
+ agent_id: agent.agent_id,
49
+ agent_name: agent.agent_name,
50
+ chain: agent.chain,
51
+ status: agent.status
52
+ };
53
+ }
54
+
55
+ // src/tools/delete-agent.ts
56
+ async function deleteAgent(client, input) {
57
+ await client.agents.delete(input.agent_id);
58
+ }
59
+
60
+ // src/tools/agent-status.ts
61
+ async function agentStatus(client, input) {
62
+ const agent = await client.agents.updateStatus(input.agent_id, {
63
+ status: input.status
64
+ });
65
+ return {
66
+ agent_id: agent.agent_id,
67
+ status: agent.status
68
+ };
69
+ }
70
+
41
71
  // src/tools/create-wallet.ts
42
72
  async function createWallet(client, agentId, input = {}) {
43
- const result = await client.wallets.getDepositAddress({
44
- agent_id: agentId,
73
+ const result = await client.agents.getDepositAddress(agentId, {
45
74
  chain: input.chain
46
75
  });
47
76
  return {
@@ -53,41 +82,32 @@ async function createWallet(client, agentId, input = {}) {
53
82
 
54
83
  // src/tools/pay.ts
55
84
  async function pay(client, agentId, input) {
56
- const wallet = await client.wallets.getDepositAddress({
57
- agent_id: agentId,
58
- chain: input.chain
59
- });
60
- const tx = await client.transactions.create({
61
- agent_id: agentId,
62
- direction: "outbound",
63
- type: "payment",
64
- from_address: wallet.address,
65
- to_address: input.to,
85
+ const result = await client.agents.withdraw(agentId, {
66
86
  amount: input.amount,
67
- token: input.token ?? "USDC",
68
- chain: input.chain ?? wallet.chain,
69
- memo: input.memo
87
+ to_address: input.to,
88
+ chain: input.chain
70
89
  });
71
90
  return {
72
- transaction_id: tx.transaction_id,
73
- tx_hash: tx.tx_hash ?? void 0,
74
- status: tx.status
91
+ transaction_id: result.ledger_id,
92
+ tx_hash: result.tx_hash || void 0,
93
+ status: result.status
75
94
  };
76
95
  }
77
96
 
78
97
  // src/tools/check-balance.ts
79
- async function checkBalance(client, agentId, input = {}) {
80
- const balances = await client.wallets.listBalances({
81
- agent_id: agentId,
82
- chain: input.chain
83
- });
84
- const balance = balances[0];
85
- if (!balance) {
86
- return { available: "0", chain: input.chain ?? "base" };
87
- }
98
+ async function checkBalance(client, agentId, _input = {}) {
99
+ const balances = await client.agents.getBalance(agentId);
88
100
  return {
89
- available: balance.available,
90
- chain: balance.chain
101
+ balances: balances.map((b) => ({
102
+ chain: b.chain,
103
+ available: b.available,
104
+ locked: b.locked,
105
+ pending_income: b.pending_income,
106
+ total_deposited: b.total_deposited,
107
+ total_withdrawn: b.total_withdrawn,
108
+ total_paid: b.total_paid,
109
+ total_earned: b.total_earned
110
+ }))
91
111
  };
92
112
  }
93
113
 
@@ -105,6 +125,29 @@ async function txStatus(client, agentId, input) {
105
125
  confirmed_at: tx.confirmed_at ?? void 0
106
126
  };
107
127
  }
128
+
129
+ // src/tools/list-transactions.ts
130
+ async function listTransactions(client, input = {}) {
131
+ const page = await client.transactions.list({
132
+ agent_id: input.agent_id,
133
+ status: input.status,
134
+ direction: input.direction
135
+ });
136
+ return {
137
+ transactions: page.data.map((tx) => ({
138
+ transaction_id: tx.transaction_id,
139
+ agent_id: tx.agent_id,
140
+ direction: tx.direction,
141
+ status: tx.status,
142
+ amount: tx.amount,
143
+ token: tx.token,
144
+ chain: tx.chain,
145
+ tx_hash: tx.tx_hash ?? void 0,
146
+ confirmed_at: tx.confirmed_at ?? void 0
147
+ })),
148
+ total: page.total
149
+ };
150
+ }
108
151
  function getConfigDir() {
109
152
  return join(homedir(), ".openclaw", "agentwallex");
110
153
  }
@@ -244,6 +287,67 @@ var openClawToolSchema = {
244
287
  required: ["agents", "total"]
245
288
  }
246
289
  },
290
+ {
291
+ name: "agentwallex_update_agent",
292
+ description: "Update an agent's name or description",
293
+ inputSchema: {
294
+ type: "object",
295
+ properties: {
296
+ agent_id: { type: "string", description: "Agent ID to update" },
297
+ agent_name: { type: "string", description: "New agent name" },
298
+ agent_description: { type: "string", description: "New description" }
299
+ },
300
+ required: ["agent_id"]
301
+ },
302
+ outputSchema: {
303
+ type: "object",
304
+ properties: {
305
+ agent_id: { type: "string" },
306
+ agent_name: { type: "string" },
307
+ chain: { type: "string" },
308
+ status: { type: "string" }
309
+ },
310
+ required: ["agent_id", "agent_name", "chain", "status"]
311
+ }
312
+ },
313
+ {
314
+ name: "agentwallex_delete_agent",
315
+ description: "Delete an agent",
316
+ inputSchema: {
317
+ type: "object",
318
+ properties: {
319
+ agent_id: { type: "string", description: "Agent ID to delete" }
320
+ },
321
+ required: ["agent_id"]
322
+ },
323
+ outputSchema: {
324
+ type: "object",
325
+ properties: {
326
+ success: { type: "boolean" }
327
+ },
328
+ required: ["success"]
329
+ }
330
+ },
331
+ {
332
+ name: "agentwallex_agent_status",
333
+ description: "Update agent status (active / suspended)",
334
+ inputSchema: {
335
+ type: "object",
336
+ properties: {
337
+ agent_id: { type: "string", description: "Agent ID" },
338
+ status: { type: "string", description: "New status: active, inactive, or suspended" }
339
+ },
340
+ required: ["agent_id", "status"]
341
+ },
342
+ outputSchema: {
343
+ type: "object",
344
+ properties: {
345
+ agent_id: { type: "string" },
346
+ status: { type: "string" }
347
+ },
348
+ required: ["agent_id", "status"]
349
+ }
350
+ },
247
351
  {
248
352
  name: "agentwallex_create_wallet",
249
353
  description: "Get or create a wallet deposit address for an agent",
@@ -301,10 +405,24 @@ var openClawToolSchema = {
301
405
  outputSchema: {
302
406
  type: "object",
303
407
  properties: {
304
- available: { type: "string" },
305
- chain: { type: "string" }
408
+ balances: {
409
+ type: "array",
410
+ items: {
411
+ type: "object",
412
+ properties: {
413
+ chain: { type: "string" },
414
+ available: { type: "string" },
415
+ locked: { type: "string" },
416
+ pending_income: { type: "string" },
417
+ total_deposited: { type: "string" },
418
+ total_withdrawn: { type: "string" },
419
+ total_paid: { type: "string" },
420
+ total_earned: { type: "string" }
421
+ }
422
+ }
423
+ }
306
424
  },
307
- required: ["available", "chain"]
425
+ required: ["balances"]
308
426
  }
309
427
  },
310
428
  {
@@ -326,6 +444,27 @@ var openClawToolSchema = {
326
444
  },
327
445
  required: ["status"]
328
446
  }
447
+ },
448
+ {
449
+ name: "agentwallex_list_transactions",
450
+ description: "List transactions with filtering",
451
+ inputSchema: {
452
+ type: "object",
453
+ properties: {
454
+ agent_id: { type: "string", description: "Filter by agent ID" },
455
+ status: { type: "string", description: "Filter by status (pending, confirmed, failed)" },
456
+ direction: { type: "string", description: "Filter by direction (inbound, outbound)" }
457
+ },
458
+ required: []
459
+ },
460
+ outputSchema: {
461
+ type: "object",
462
+ properties: {
463
+ transactions: { type: "array", items: { type: "object" } },
464
+ total: { type: "number" }
465
+ },
466
+ required: ["transactions", "total"]
467
+ }
329
468
  }
330
469
  ]
331
470
  };
@@ -464,6 +603,59 @@ function register(api) {
464
603
  });
465
604
  })
466
605
  });
606
+ api.registerTool({
607
+ name: "agentwallex_update_agent",
608
+ description: "Update an agent's name or description",
609
+ parameters: {
610
+ type: "object",
611
+ properties: {
612
+ agent_id: { type: "string", description: "Agent ID to update" },
613
+ agent_name: { type: "string", description: "New agent name" },
614
+ agent_description: { type: "string", description: "New description" }
615
+ },
616
+ required: ["agent_id"]
617
+ },
618
+ execute: withConfig(async (client, _agentId, params) => {
619
+ return updateAgent(client, {
620
+ agent_id: params.agent_id,
621
+ agent_name: params.agent_name,
622
+ agent_description: params.agent_description
623
+ });
624
+ })
625
+ });
626
+ api.registerTool({
627
+ name: "agentwallex_delete_agent",
628
+ description: "Delete an agent",
629
+ parameters: {
630
+ type: "object",
631
+ properties: {
632
+ agent_id: { type: "string", description: "Agent ID to delete" }
633
+ },
634
+ required: ["agent_id"]
635
+ },
636
+ execute: withConfig(async (client, _agentId, params) => {
637
+ await deleteAgent(client, { agent_id: params.agent_id });
638
+ return { success: true };
639
+ })
640
+ });
641
+ api.registerTool({
642
+ name: "agentwallex_agent_status",
643
+ description: "Update agent status (active / suspended)",
644
+ parameters: {
645
+ type: "object",
646
+ properties: {
647
+ agent_id: { type: "string", description: "Agent ID" },
648
+ status: { type: "string", description: "New status: active, inactive, or suspended" }
649
+ },
650
+ required: ["agent_id", "status"]
651
+ },
652
+ execute: withConfig(async (client, _agentId, params) => {
653
+ return agentStatus(client, {
654
+ agent_id: params.agent_id,
655
+ status: params.status
656
+ });
657
+ })
658
+ });
467
659
  api.registerTool({
468
660
  name: "agentwallex_create_wallet",
469
661
  description: "Get or create a wallet deposit address for an agent",
@@ -534,8 +726,27 @@ function register(api) {
534
726
  });
535
727
  })
536
728
  });
729
+ api.registerTool({
730
+ name: "agentwallex_list_transactions",
731
+ description: "List transactions with filtering",
732
+ parameters: {
733
+ type: "object",
734
+ properties: {
735
+ agent_id: { type: "string", description: "Filter by agent ID" },
736
+ status: { type: "string", description: "Filter by status (pending, confirmed, failed)" },
737
+ direction: { type: "string", description: "Filter by direction (inbound, outbound)" }
738
+ }
739
+ },
740
+ execute: withConfig(async (client, _agentId, params) => {
741
+ return listTransactions(client, {
742
+ agent_id: params.agent_id,
743
+ status: params.status,
744
+ direction: params.direction
745
+ });
746
+ })
747
+ });
537
748
  }
538
749
 
539
- export { checkBalance, createAgent, createWallet, isConfigured, listAgents, loadConfig, openClawToolSchema, pay, register, requireConfig, saveConfig, txStatus };
750
+ export { agentStatus, checkBalance, createAgent, createWallet, deleteAgent, isConfigured, listAgents, listTransactions, loadConfig, openClawToolSchema, pay, register, requireConfig, saveConfig, txStatus, updateAgent };
540
751
  //# sourceMappingURL=index.js.map
541
752
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/tools/create-agent.ts","../src/tools/list-agents.ts","../src/tools/create-wallet.ts","../src/tools/pay.ts","../src/tools/check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AAA;AAAA,QACf,OAAO,MAAA,CAAO,KAAA;AAAA,QACd,OAAO,MAAA,CAAO,KAAA;AAAA,QACd,MAAM,MAAA,CAAO;AAAA,OACd,CAAA;AAAA,IACH,CAAC;AAAA,GACF,CAAA;AAED,EAAA,GAAA,CAAI,YAAA,CAAa;AAAA,IACf,IAAA,EAAM,2BAAA;AAAA,IACN,WAAA,EAAa,iCAAA;AAAA,IACb,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,KAAA,EAAO,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,oCAAA;AAAqC;AAC7E,KACF;AAAA,IACA,OAAA,EAAS,UAAA,CAAW,OAAO,MAAA,EAAQ,SAAS,MAAA,KAAW;AACrD,MAAA,OAAO,YAAA,CAAa,QAAQ,OAAA,EAAS;AAAA,QACnC,OAAO,MAAA,CAAO;AAAA,OACf,CAAA;AAAA,IACH,CAAC;AAAA,GACF,CAAA;AAED,EAAA,GAAA,CAAI,YAAA,CAAa;AAAA,IACf,IAAA,EAAM,uBAAA;AAAA,IACN,WAAA,EAAa,mCAAA;AAAA,IACb,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,cAAA,EAAgB,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,yBAAA;AAA0B,OAC3E;AAAA,MACA,QAAA,EAAU,CAAC,gBAAgB;AAAA,KAC7B;AAAA,IACA,OAAA,EAAS,UAAA,CAAW,OAAO,MAAA,EAAQ,SAAS,MAAA,KAAW;AACrD,MAAA,OAAO,QAAA,CAAS,QAAQ,OAAA,EAAS;AAAA,QAC/B,gBAAgB,MAAA,CAAO;AAAA,OACxB,CAAA;AAAA,IACH,CAAC;AAAA,GACF,CAAA;AACH","file":"index.js","sourcesContent":["import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CreateAgentInput, CreateAgentOutput } from '../types.js';\n\nexport async function createAgent(\n client: AgentWallex,\n input: CreateAgentInput,\n): Promise<CreateAgentOutput> {\n const agent = await client.agents.create({\n agent_name: input.agent_name,\n chain: input.chain ?? 'base',\n agent_description: input.agent_description,\n });\n return {\n agent_id: agent.agent_id,\n agent_name: agent.agent_name,\n chain: agent.chain,\n status: agent.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { AgentStatus } from '@agentwallex/sdk';\nimport type { ListAgentsInput, ListAgentsOutput } from '../types.js';\n\nexport async function listAgents(\n client: AgentWallex,\n input: ListAgentsInput = {},\n): Promise<ListAgentsOutput> {\n const page = await client.agents.list({\n status: input.status as AgentStatus | undefined,\n chain: input.chain,\n });\n return {\n agents: page.data.map((a) => ({\n agent_id: a.agent_id,\n agent_name: a.agent_name,\n chain: a.chain,\n status: a.status,\n })),\n total: page.total,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CreateWalletInput, CreateWalletOutput } from '../types.js';\n\nexport async function createWallet(\n client: AgentWallex,\n agentId: string,\n input: CreateWalletInput = {},\n): Promise<CreateWalletOutput> {\n const result = await client.wallets.getDepositAddress({\n agent_id: agentId,\n chain: input.chain,\n });\n return {\n agent_id: result.agent_id,\n address: result.address,\n chain: result.chain,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { PayInput, PayOutput } from '../types.js';\n\nexport async function pay(\n client: AgentWallex,\n agentId: string,\n input: PayInput,\n): Promise<PayOutput> {\n // Get the agent's wallet address for from_address\n const wallet = await client.wallets.getDepositAddress({\n agent_id: agentId,\n chain: input.chain,\n });\n\n const tx = await client.transactions.create({\n agent_id: agentId,\n direction: 'outbound',\n type: 'payment',\n from_address: wallet.address,\n to_address: input.to,\n amount: input.amount,\n token: input.token ?? 'USDC',\n chain: input.chain ?? wallet.chain,\n memo: input.memo,\n });\n\n return {\n transaction_id: tx.transaction_id,\n tx_hash: tx.tx_hash ?? undefined,\n status: tx.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CheckBalanceInput, CheckBalanceOutput } from '../types.js';\n\nexport async function checkBalance(\n client: AgentWallex,\n agentId: string,\n input: CheckBalanceInput = {},\n): Promise<CheckBalanceOutput> {\n const balances = await client.wallets.listBalances({\n agent_id: agentId,\n chain: input.chain,\n });\n\n const balance = balances[0];\n if (!balance) {\n return { available: '0', chain: input.chain ?? 'base' };\n }\n\n return {\n available: balance.available,\n chain: balance.chain,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { TxStatusInput, TxStatusOutput } from '../types.js';\n\nexport async function txStatus(\n client: AgentWallex,\n agentId: string,\n input: TxStatusInput,\n): Promise<TxStatusOutput> {\n const tx = await client.transactions.retrieve(input.transaction_id);\n if (tx.agent_id !== agentId) {\n throw new Error(\n `Transaction ${input.transaction_id} does not belong to agent ${agentId}`,\n );\n }\n return {\n status: tx.status,\n tx_hash: tx.tx_hash ?? undefined,\n confirmed_at: tx.confirmed_at ?? undefined,\n };\n}\n","import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\n\nexport interface StoredConfig {\n apiKey: string;\n agentId: string;\n sandbox?: boolean;\n}\n\nfunction getConfigDir(): string {\n return join(homedir(), '.openclaw', 'agentwallex');\n}\n\nfunction getConfigPath(): string {\n return join(getConfigDir(), 'config.json');\n}\n\nexport function loadConfig(): StoredConfig | null {\n const configPath = getConfigPath();\n if (!existsSync(configPath)) return null;\n\n const raw = readFileSync(configPath, 'utf-8');\n const data = JSON.parse(raw) as StoredConfig;\n\n if (!data.apiKey || !data.agentId) {\n throw new Error(\n 'Invalid config: missing apiKey or agentId in ' + configPath,\n );\n }\n\n return data;\n}\n\nexport function requireConfig(): StoredConfig {\n try {\n const config = loadConfig();\n if (!config) {\n throw new Error(\n 'AgentWallex is not configured yet. ' +\n 'Use the agentwallex_setup tool to get started, ' +\n 'then agentwallex_configure to save your credentials.',\n );\n }\n return config;\n } catch (err) {\n if (err instanceof SyntaxError) {\n throw new Error(\n 'AgentWallex config file is corrupted. ' +\n 'Delete ~/.openclaw/agentwallex/config.json and run agentwallex_setup again.',\n );\n }\n throw err;\n }\n}\n\nexport function saveConfig(config: StoredConfig): void {\n const dir = getConfigDir();\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n\n const configPath = getConfigPath();\n writeFileSync(configPath, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n chmodSync(configPath, 0o600);\n}\n\nexport function isConfigured(): boolean {\n try {\n return loadConfig() !== null;\n } catch {\n return false;\n }\n}\n","import { AgentWallex } from '@agentwallex/sdk';\nimport { createAgent } from './tools/create-agent.js';\nimport { listAgents } from './tools/list-agents.js';\nimport { createWallet } from './tools/create-wallet.js';\nimport { pay } from './tools/pay.js';\nimport { checkBalance } from './tools/check-balance.js';\nimport { txStatus } from './tools/tx-status.js';\nimport { requireConfig, saveConfig, isConfigured } from './store.js';\n\n/* ------------------------------------------------------------------ */\n/* Static schema — for library consumers who need raw JSON Schema */\n/* ------------------------------------------------------------------ */\n\nexport const openClawToolSchema = {\n name: 'agentwallex-payment',\n description: 'Send USDC payments, check balances, and query transactions via AgentWallex',\n tools: [\n {\n name: 'agentwallex_setup',\n description: 'Check AgentWallex configuration status and get setup instructions',\n inputSchema: {\n type: 'object' as const,\n properties: {},\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n configured: { type: 'boolean' },\n dashboard_url: { type: 'string' },\n instructions: { type: 'string' },\n },\n required: ['configured', 'dashboard_url'],\n },\n },\n {\n name: 'agentwallex_configure',\n description: 'Save AgentWallex API credentials after validating them',\n inputSchema: {\n type: 'object' as const,\n properties: {\n api_key: { type: 'string', description: 'AgentWallex API key (starts with awx_)' },\n agent_id: { type: 'string', description: 'Agent ID from the Dashboard' },\n sandbox: { type: 'boolean', description: 'Use sandbox environment (default: false)' },\n },\n required: ['api_key', 'agent_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n success: { type: 'boolean' },\n agent_name: { type: 'string' },\n message: { type: 'string' },\n },\n required: ['success', 'message'],\n },\n },\n {\n name: 'agentwallex_create_agent',\n description: 'Create a new AI agent with its own wallet',\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_name: { type: 'string', description: 'Name for the new agent' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n agent_description: { type: 'string', description: 'Optional description' },\n },\n required: ['agent_name'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n agent_name: { type: 'string' },\n chain: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['agent_id', 'agent_name', 'chain', 'status'],\n },\n },\n {\n name: 'agentwallex_list_agents',\n description: 'List all agents and their status',\n inputSchema: {\n type: 'object' as const,\n properties: {\n status: { type: 'string', description: 'Filter by status (active, inactive, suspended)' },\n chain: { type: 'string', description: 'Filter by blockchain network' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agents: { type: 'array', items: { type: 'object' } },\n total: { type: 'number' },\n },\n required: ['agents', 'total'],\n },\n },\n {\n name: 'agentwallex_create_wallet',\n description: 'Get or create a wallet deposit address for an agent',\n inputSchema: {\n type: 'object' as const,\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n address: { type: 'string' },\n chain: { type: 'string' },\n },\n required: ['agent_id', 'address', 'chain'],\n },\n },\n {\n name: 'agentwallex_pay',\n description: 'Send a USDC payment to a recipient address',\n inputSchema: {\n type: 'object' as const,\n properties: {\n to: { type: 'string', description: 'Recipient wallet address' },\n amount: { type: 'string', description: 'Amount to send (e.g. \"1.50\")' },\n token: { type: 'string', description: 'Token symbol (default: USDC)' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n memo: { type: 'string', description: 'Optional payment memo' },\n },\n required: ['to', 'amount'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n transaction_id: { type: 'string' },\n tx_hash: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['transaction_id', 'status'],\n },\n },\n {\n name: 'agentwallex_check_balance',\n description: 'Check USDC balance for an agent',\n inputSchema: {\n type: 'object' as const,\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n available: { type: 'string' },\n chain: { type: 'string' },\n },\n required: ['available', 'chain'],\n },\n },\n {\n name: 'agentwallex_tx_status',\n description: 'Check the status of a transaction',\n inputSchema: {\n type: 'object' as const,\n properties: {\n transaction_id: { type: 'string', description: 'Transaction ID to check' },\n },\n required: ['transaction_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n status: { type: 'string' },\n tx_hash: { type: 'string' },\n confirmed_at: { type: 'string' },\n },\n required: ['status'],\n },\n },\n ],\n};\n\n/* ------------------------------------------------------------------ */\n/* OpenClaw Plugin API types (minimal, avoids hard dependency) */\n/* ------------------------------------------------------------------ */\n\ninterface ToolResult {\n content: Array<{ type: 'text'; text: string }>;\n}\n\ninterface ToolRegistration {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n execute: (id: string, params: Record<string, unknown>) => Promise<ToolResult>;\n}\n\ninterface OpenClawPluginApi {\n registerTool(tool: ToolRegistration): void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nconst DASHBOARD_URL = 'https://app.agentwallex.com';\n\nfunction jsonResult(data: unknown): ToolResult {\n return { content: [{ type: 'text', text: JSON.stringify(data) }] };\n}\n\nfunction withConfig<T>(\n fn: (client: AgentWallex, agentId: string, params: Record<string, unknown>) => Promise<T>,\n): (id: string, params: Record<string, unknown>) => Promise<ToolResult> {\n return async (_id, params) => {\n try {\n const config = requireConfig();\n const client = new AgentWallex({ apiKey: config.apiKey, sandbox: config.sandbox });\n const result = await fn(client, config.agentId, params);\n return jsonResult(result);\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Unknown error';\n return jsonResult({ error: true, message });\n }\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* register() — called by OpenClaw at plugin load time */\n/* ------------------------------------------------------------------ */\n\nexport default function register(api: OpenClawPluginApi): void {\n /* ---- setup: no credentials needed ---- */\n api.registerTool({\n name: 'agentwallex_setup',\n description: 'Check AgentWallex configuration status and get setup instructions',\n parameters: {\n type: 'object',\n properties: {},\n },\n async execute() {\n const configured = isConfigured();\n\n if (configured) {\n return jsonResult({\n configured: true,\n dashboard_url: DASHBOARD_URL,\n instructions:\n 'AgentWallex is already configured and ready to use. ' +\n 'You can send payments, check balances, and more. ' +\n 'To reconfigure, use agentwallex_configure with new credentials.',\n });\n }\n\n return jsonResult({\n configured: false,\n dashboard_url: DASHBOARD_URL,\n instructions:\n 'To set up AgentWallex, follow these steps:\\n' +\n `1. Open the AgentWallex Dashboard: ${DASHBOARD_URL}\\n` +\n '2. Sign in with Google\\n' +\n '3. Go to Settings > API Keys and create a new API key (starts with awx_)\\n' +\n '4. Go to Agents, create or select an agent, and copy the Agent ID\\n' +\n '5. Give me the API key and Agent ID, and I\\'ll save them with agentwallex_configure',\n });\n },\n });\n\n /* ---- configure: validate + save credentials ---- */\n api.registerTool({\n name: 'agentwallex_configure',\n description: 'Save AgentWallex API credentials after validating them',\n parameters: {\n type: 'object',\n properties: {\n api_key: { type: 'string', description: 'AgentWallex API key (starts with awx_)' },\n agent_id: { type: 'string', description: 'Agent ID from the Dashboard' },\n sandbox: { type: 'boolean', description: 'Use sandbox environment (default: false)' },\n },\n required: ['api_key', 'agent_id'],\n },\n async execute(_id, params) {\n const apiKey = params.api_key as string | undefined;\n const agentId = params.agent_id as string | undefined;\n const sandbox = (params.sandbox as boolean) ?? false;\n\n if (!apiKey || typeof apiKey !== 'string') {\n return jsonResult({\n success: false,\n message: 'api_key is required. Get one from ' + DASHBOARD_URL,\n });\n }\n\n if (!agentId || typeof agentId !== 'string') {\n return jsonResult({\n success: false,\n message: 'agent_id is required. Find it in your Dashboard at ' + DASHBOARD_URL,\n });\n }\n\n // Validate api_key format\n if (!apiKey.startsWith('awx_')) {\n return jsonResult({\n success: false,\n message:\n 'Invalid API key format. AgentWallex API keys start with \"awx_\". ' +\n `Please check your key at ${DASHBOARD_URL}`,\n });\n }\n\n // Validate credentials by calling the API\n try {\n const client = new AgentWallex({ apiKey, sandbox });\n const agent = await client.agents.retrieve(agentId);\n\n saveConfig({ apiKey, agentId, sandbox: sandbox === true ? true : undefined });\n\n return jsonResult({\n success: true,\n agent_name: agent.agent_name,\n message:\n `AgentWallex configured successfully! Connected to agent \"${agent.agent_name}\". ` +\n 'You can now send payments, check balances, and manage transactions.',\n });\n } catch (err) {\n const message =\n err instanceof Error ? err.message : 'Unknown error';\n return jsonResult({\n success: false,\n message:\n `Failed to validate credentials: ${message}. ` +\n 'Please check your API key and Agent ID, then try again.',\n });\n }\n },\n });\n\n /* ---- existing tools, wrapped with withConfig ---- */\n api.registerTool({\n name: 'agentwallex_create_agent',\n description: 'Create a new AI agent with its own wallet',\n parameters: {\n type: 'object',\n properties: {\n agent_name: { type: 'string', description: 'Name for the new agent' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n agent_description: { type: 'string', description: 'Optional description' },\n },\n required: ['agent_name'],\n },\n execute: withConfig(async (client, _agentId, params) => {\n return createAgent(client, {\n agent_name: params.agent_name as string,\n chain: params.chain as string | undefined,\n agent_description: params.agent_description as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_list_agents',\n description: 'List all agents and their status',\n parameters: {\n type: 'object',\n properties: {\n status: { type: 'string', description: 'Filter by status (active, inactive, suspended)' },\n chain: { type: 'string', description: 'Filter by blockchain network' },\n },\n },\n execute: withConfig(async (client, _agentId, params) => {\n return listAgents(client, {\n status: params.status as string | undefined,\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_create_wallet',\n description: 'Get or create a wallet deposit address for an agent',\n parameters: {\n type: 'object',\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n },\n execute: withConfig(async (client, agentId, params) => {\n return createWallet(client, agentId, {\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_pay',\n description: 'Send a USDC payment to a recipient address',\n parameters: {\n type: 'object',\n properties: {\n to: { type: 'string', description: 'Recipient wallet address' },\n amount: { type: 'string', description: 'Amount to send (e.g. \"1.50\")' },\n token: { type: 'string', description: 'Token symbol (default: USDC)' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n memo: { type: 'string', description: 'Optional payment memo' },\n },\n required: ['to', 'amount'],\n },\n execute: withConfig(async (client, agentId, params) => {\n return pay(client, agentId, {\n to: params.to as string,\n amount: params.amount as string,\n token: params.token as string | undefined,\n chain: params.chain as string | undefined,\n memo: params.memo as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_check_balance',\n description: 'Check USDC balance for an agent',\n parameters: {\n type: 'object',\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n },\n execute: withConfig(async (client, agentId, params) => {\n return checkBalance(client, agentId, {\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_tx_status',\n description: 'Check the status of a transaction',\n parameters: {\n type: 'object',\n properties: {\n transaction_id: { type: 'string', description: 'Transaction ID to check' },\n },\n required: ['transaction_id'],\n },\n execute: withConfig(async (client, agentId, params) => {\n return txStatus(client, agentId, {\n transaction_id: params.transaction_id as string,\n });\n }),\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/tools/create-agent.ts","../src/tools/list-agents.ts","../src/tools/update-agent.ts","../src/tools/delete-agent.ts","../src/tools/agent-status.ts","../src/tools/create-wallet.ts","../src/tools/pay.ts","../src/tools/check-balance.ts","../src/tools/tx-status.ts","../src/tools/list-transactions.ts","../src/store.ts","../src/plugin.ts"],"names":[],"mappings":";;;;;;;;;AAGA,eAAsB,WAAA,CACpB,QACA,KAAA,EAC4B;AAC5B,EAAA,MAAM,KAAA,GA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,+CAAA,EAAgD;AAAA,QACvF,SAAA,EAAW,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,yCAAA;AAA0C;AACtF,KACF;AAAA,IACA,OAAA,EAAS,UAAA,CAAW,OAAO,MAAA,EAAQ,UAAU,MAAA,KAAW;AACtD,MAAA,OAAO,iBAAiB,MAAA,EAAQ;AAAA,QAC9B,UAAU,MAAA,CAAO,QAAA;AAAA,QACjB,QAAQ,MAAA,CAAO,MAAA;AAAA,QACf,WAAW,MAAA,CAAO;AAAA,OACnB,CAAA;AAAA,IACH,CAAC;AAAA,GACF,CAAA;AAEH","file":"index.js","sourcesContent":["import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CreateAgentInput, CreateAgentOutput } from '../types.js';\n\nexport async function createAgent(\n client: AgentWallex,\n input: CreateAgentInput,\n): Promise<CreateAgentOutput> {\n const agent = await client.agents.create({\n agent_name: input.agent_name,\n chain: input.chain ?? 'base',\n agent_description: input.agent_description,\n });\n return {\n agent_id: agent.agent_id,\n agent_name: agent.agent_name,\n chain: agent.chain,\n status: agent.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { AgentStatus } from '@agentwallex/sdk';\nimport type { ListAgentsInput, ListAgentsOutput } from '../types.js';\n\nexport async function listAgents(\n client: AgentWallex,\n input: ListAgentsInput = {},\n): Promise<ListAgentsOutput> {\n const page = await client.agents.list({\n status: input.status as AgentStatus | undefined,\n chain: input.chain,\n });\n return {\n agents: page.data.map((a) => ({\n agent_id: a.agent_id,\n agent_name: a.agent_name,\n chain: a.chain,\n status: a.status,\n })),\n total: page.total,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { UpdateAgentInput, UpdateAgentOutput } from '../types.js';\n\nexport async function updateAgent(\n client: AgentWallex,\n input: UpdateAgentInput,\n): Promise<UpdateAgentOutput> {\n const agent = await client.agents.update(input.agent_id, {\n agent_name: input.agent_name,\n agent_description: input.agent_description,\n });\n return {\n agent_id: agent.agent_id,\n agent_name: agent.agent_name,\n chain: agent.chain,\n status: agent.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { DeleteAgentInput } from '../types.js';\n\nexport async function deleteAgent(\n client: AgentWallex,\n input: DeleteAgentInput,\n): Promise<void> {\n await client.agents.delete(input.agent_id);\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { AgentStatus } from '@agentwallex/sdk';\nimport type { AgentStatusInput, AgentStatusOutput } from '../types.js';\n\nexport async function agentStatus(\n client: AgentWallex,\n input: AgentStatusInput,\n): Promise<AgentStatusOutput> {\n const agent = await client.agents.updateStatus(input.agent_id, {\n status: input.status as AgentStatus,\n });\n return {\n agent_id: agent.agent_id,\n status: agent.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CreateWalletInput, CreateWalletOutput } from '../types.js';\n\nexport async function createWallet(\n client: AgentWallex,\n agentId: string,\n input: CreateWalletInput = {},\n): Promise<CreateWalletOutput> {\n const result = await client.agents.getDepositAddress(agentId, {\n chain: input.chain,\n });\n return {\n agent_id: result.agent_id,\n address: result.address,\n chain: result.chain,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { PayInput, PayOutput } from '../types.js';\n\nexport async function pay(\n client: AgentWallex,\n agentId: string,\n input: PayInput,\n): Promise<PayOutput> {\n const result = await client.agents.withdraw(agentId, {\n amount: input.amount,\n to_address: input.to,\n chain: input.chain,\n });\n\n return {\n transaction_id: result.ledger_id,\n tx_hash: result.tx_hash || undefined,\n status: result.status,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { CheckBalanceInput, CheckBalanceOutput } from '../types.js';\n\nexport async function checkBalance(\n client: AgentWallex,\n agentId: string,\n _input: CheckBalanceInput = {},\n): Promise<CheckBalanceOutput> {\n const balances = await client.agents.getBalance(agentId);\n\n return {\n balances: balances.map((b) => ({\n chain: b.chain,\n available: b.available,\n locked: b.locked,\n pending_income: b.pending_income,\n total_deposited: b.total_deposited,\n total_withdrawn: b.total_withdrawn,\n total_paid: b.total_paid,\n total_earned: b.total_earned,\n })),\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { TxStatusInput, TxStatusOutput } from '../types.js';\n\nexport async function txStatus(\n client: AgentWallex,\n agentId: string,\n input: TxStatusInput,\n): Promise<TxStatusOutput> {\n const tx = await client.transactions.retrieve(input.transaction_id);\n if (tx.agent_id !== agentId) {\n throw new Error(\n `Transaction ${input.transaction_id} does not belong to agent ${agentId}`,\n );\n }\n return {\n status: tx.status,\n tx_hash: tx.tx_hash ?? undefined,\n confirmed_at: tx.confirmed_at ?? undefined,\n };\n}\n","import type { AgentWallex } from '@agentwallex/sdk';\nimport type { TransactionDirection, TransactionStatus } from '@agentwallex/sdk';\nimport type { ListTransactionsInput, ListTransactionsOutput } from '../types.js';\n\nexport async function listTransactions(\n client: AgentWallex,\n input: ListTransactionsInput = {},\n): Promise<ListTransactionsOutput> {\n const page = await client.transactions.list({\n agent_id: input.agent_id,\n status: input.status as TransactionStatus | undefined,\n direction: input.direction as TransactionDirection | undefined,\n });\n return {\n transactions: page.data.map((tx) => ({\n transaction_id: tx.transaction_id,\n agent_id: tx.agent_id,\n direction: tx.direction,\n status: tx.status,\n amount: tx.amount,\n token: tx.token,\n chain: tx.chain,\n tx_hash: tx.tx_hash ?? undefined,\n confirmed_at: tx.confirmed_at ?? undefined,\n })),\n total: page.total,\n };\n}\n","import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { homedir } from 'node:os';\n\nexport interface StoredConfig {\n apiKey: string;\n agentId: string;\n sandbox?: boolean;\n}\n\nfunction getConfigDir(): string {\n return join(homedir(), '.openclaw', 'agentwallex');\n}\n\nfunction getConfigPath(): string {\n return join(getConfigDir(), 'config.json');\n}\n\nexport function loadConfig(): StoredConfig | null {\n const configPath = getConfigPath();\n if (!existsSync(configPath)) return null;\n\n const raw = readFileSync(configPath, 'utf-8');\n const data = JSON.parse(raw) as StoredConfig;\n\n if (!data.apiKey || !data.agentId) {\n throw new Error(\n 'Invalid config: missing apiKey or agentId in ' + configPath,\n );\n }\n\n return data;\n}\n\nexport function requireConfig(): StoredConfig {\n try {\n const config = loadConfig();\n if (!config) {\n throw new Error(\n 'AgentWallex is not configured yet. ' +\n 'Use the agentwallex_setup tool to get started, ' +\n 'then agentwallex_configure to save your credentials.',\n );\n }\n return config;\n } catch (err) {\n if (err instanceof SyntaxError) {\n throw new Error(\n 'AgentWallex config file is corrupted. ' +\n 'Delete ~/.openclaw/agentwallex/config.json and run agentwallex_setup again.',\n );\n }\n throw err;\n }\n}\n\nexport function saveConfig(config: StoredConfig): void {\n const dir = getConfigDir();\n mkdirSync(dir, { recursive: true, mode: 0o700 });\n\n const configPath = getConfigPath();\n writeFileSync(configPath, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n chmodSync(configPath, 0o600);\n}\n\nexport function isConfigured(): boolean {\n try {\n return loadConfig() !== null;\n } catch {\n return false;\n }\n}\n","import { AgentWallex } from '@agentwallex/sdk';\nimport { createAgent } from './tools/create-agent.js';\nimport { listAgents } from './tools/list-agents.js';\nimport { updateAgent } from './tools/update-agent.js';\nimport { deleteAgent } from './tools/delete-agent.js';\nimport { agentStatus } from './tools/agent-status.js';\nimport { createWallet } from './tools/create-wallet.js';\nimport { pay } from './tools/pay.js';\nimport { checkBalance } from './tools/check-balance.js';\nimport { txStatus } from './tools/tx-status.js';\nimport { listTransactions } from './tools/list-transactions.js';\nimport { requireConfig, saveConfig, isConfigured } from './store.js';\n\n/* ------------------------------------------------------------------ */\n/* Static schema — for library consumers who need raw JSON Schema */\n/* ------------------------------------------------------------------ */\n\nexport const openClawToolSchema = {\n name: 'agentwallex-payment',\n description: 'Send USDC payments, check balances, and query transactions via AgentWallex',\n tools: [\n {\n name: 'agentwallex_setup',\n description: 'Check AgentWallex configuration status and get setup instructions',\n inputSchema: {\n type: 'object' as const,\n properties: {},\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n configured: { type: 'boolean' },\n dashboard_url: { type: 'string' },\n instructions: { type: 'string' },\n },\n required: ['configured', 'dashboard_url'],\n },\n },\n {\n name: 'agentwallex_configure',\n description: 'Save AgentWallex API credentials after validating them',\n inputSchema: {\n type: 'object' as const,\n properties: {\n api_key: { type: 'string', description: 'AgentWallex API key (starts with awx_)' },\n agent_id: { type: 'string', description: 'Agent ID from the Dashboard' },\n sandbox: { type: 'boolean', description: 'Use sandbox environment (default: false)' },\n },\n required: ['api_key', 'agent_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n success: { type: 'boolean' },\n agent_name: { type: 'string' },\n message: { type: 'string' },\n },\n required: ['success', 'message'],\n },\n },\n {\n name: 'agentwallex_create_agent',\n description: 'Create a new AI agent with its own wallet',\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_name: { type: 'string', description: 'Name for the new agent' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n agent_description: { type: 'string', description: 'Optional description' },\n },\n required: ['agent_name'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n agent_name: { type: 'string' },\n chain: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['agent_id', 'agent_name', 'chain', 'status'],\n },\n },\n {\n name: 'agentwallex_list_agents',\n description: 'List all agents and their status',\n inputSchema: {\n type: 'object' as const,\n properties: {\n status: { type: 'string', description: 'Filter by status (active, inactive, suspended)' },\n chain: { type: 'string', description: 'Filter by blockchain network' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agents: { type: 'array', items: { type: 'object' } },\n total: { type: 'number' },\n },\n required: ['agents', 'total'],\n },\n },\n {\n name: 'agentwallex_update_agent',\n description: \"Update an agent's name or description\",\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string', description: 'Agent ID to update' },\n agent_name: { type: 'string', description: 'New agent name' },\n agent_description: { type: 'string', description: 'New description' },\n },\n required: ['agent_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n agent_name: { type: 'string' },\n chain: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['agent_id', 'agent_name', 'chain', 'status'],\n },\n },\n {\n name: 'agentwallex_delete_agent',\n description: 'Delete an agent',\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string', description: 'Agent ID to delete' },\n },\n required: ['agent_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n success: { type: 'boolean' },\n },\n required: ['success'],\n },\n },\n {\n name: 'agentwallex_agent_status',\n description: 'Update agent status (active / suspended)',\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string', description: 'Agent ID' },\n status: { type: 'string', description: 'New status: active, inactive, or suspended' },\n },\n required: ['agent_id', 'status'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['agent_id', 'status'],\n },\n },\n {\n name: 'agentwallex_create_wallet',\n description: 'Get or create a wallet deposit address for an agent',\n inputSchema: {\n type: 'object' as const,\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string' },\n address: { type: 'string' },\n chain: { type: 'string' },\n },\n required: ['agent_id', 'address', 'chain'],\n },\n },\n {\n name: 'agentwallex_pay',\n description: 'Send a USDC payment to a recipient address',\n inputSchema: {\n type: 'object' as const,\n properties: {\n to: { type: 'string', description: 'Recipient wallet address' },\n amount: { type: 'string', description: 'Amount to send (e.g. \"1.50\")' },\n token: { type: 'string', description: 'Token symbol (default: USDC)' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n memo: { type: 'string', description: 'Optional payment memo' },\n },\n required: ['to', 'amount'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n transaction_id: { type: 'string' },\n tx_hash: { type: 'string' },\n status: { type: 'string' },\n },\n required: ['transaction_id', 'status'],\n },\n },\n {\n name: 'agentwallex_check_balance',\n description: 'Check USDC balance for an agent',\n inputSchema: {\n type: 'object' as const,\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n balances: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n chain: { type: 'string' },\n available: { type: 'string' },\n locked: { type: 'string' },\n pending_income: { type: 'string' },\n total_deposited: { type: 'string' },\n total_withdrawn: { type: 'string' },\n total_paid: { type: 'string' },\n total_earned: { type: 'string' },\n },\n },\n },\n },\n required: ['balances'],\n },\n },\n {\n name: 'agentwallex_tx_status',\n description: 'Check the status of a transaction',\n inputSchema: {\n type: 'object' as const,\n properties: {\n transaction_id: { type: 'string', description: 'Transaction ID to check' },\n },\n required: ['transaction_id'],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n status: { type: 'string' },\n tx_hash: { type: 'string' },\n confirmed_at: { type: 'string' },\n },\n required: ['status'],\n },\n },\n {\n name: 'agentwallex_list_transactions',\n description: 'List transactions with filtering',\n inputSchema: {\n type: 'object' as const,\n properties: {\n agent_id: { type: 'string', description: 'Filter by agent ID' },\n status: { type: 'string', description: 'Filter by status (pending, confirmed, failed)' },\n direction: { type: 'string', description: 'Filter by direction (inbound, outbound)' },\n },\n required: [],\n },\n outputSchema: {\n type: 'object' as const,\n properties: {\n transactions: { type: 'array', items: { type: 'object' } },\n total: { type: 'number' },\n },\n required: ['transactions', 'total'],\n },\n },\n ],\n};\n\n/* ------------------------------------------------------------------ */\n/* OpenClaw Plugin API types (minimal, avoids hard dependency) */\n/* ------------------------------------------------------------------ */\n\ninterface ToolResult {\n content: Array<{ type: 'text'; text: string }>;\n}\n\ninterface ToolRegistration {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n execute: (id: string, params: Record<string, unknown>) => Promise<ToolResult>;\n}\n\ninterface OpenClawPluginApi {\n registerTool(tool: ToolRegistration): void;\n}\n\n/* ------------------------------------------------------------------ */\n/* Helpers */\n/* ------------------------------------------------------------------ */\n\nconst DASHBOARD_URL = 'https://app.agentwallex.com';\n\nfunction jsonResult(data: unknown): ToolResult {\n return { content: [{ type: 'text', text: JSON.stringify(data) }] };\n}\n\nfunction withConfig<T>(\n fn: (client: AgentWallex, agentId: string, params: Record<string, unknown>) => Promise<T>,\n): (id: string, params: Record<string, unknown>) => Promise<ToolResult> {\n return async (_id, params) => {\n try {\n const config = requireConfig();\n const client = new AgentWallex({ apiKey: config.apiKey, sandbox: config.sandbox });\n const result = await fn(client, config.agentId, params);\n return jsonResult(result);\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Unknown error';\n return jsonResult({ error: true, message });\n }\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* register() — called by OpenClaw at plugin load time */\n/* ------------------------------------------------------------------ */\n\nexport default function register(api: OpenClawPluginApi): void {\n /* ---- setup: no credentials needed ---- */\n api.registerTool({\n name: 'agentwallex_setup',\n description: 'Check AgentWallex configuration status and get setup instructions',\n parameters: {\n type: 'object',\n properties: {},\n },\n async execute() {\n const configured = isConfigured();\n\n if (configured) {\n return jsonResult({\n configured: true,\n dashboard_url: DASHBOARD_URL,\n instructions:\n 'AgentWallex is already configured and ready to use. ' +\n 'You can send payments, check balances, and more. ' +\n 'To reconfigure, use agentwallex_configure with new credentials.',\n });\n }\n\n return jsonResult({\n configured: false,\n dashboard_url: DASHBOARD_URL,\n instructions:\n 'To set up AgentWallex, follow these steps:\\n' +\n `1. Open the AgentWallex Dashboard: ${DASHBOARD_URL}\\n` +\n '2. Sign in with Google\\n' +\n '3. Go to Settings > API Keys and create a new API key (starts with awx_)\\n' +\n '4. Go to Agents, create or select an agent, and copy the Agent ID\\n' +\n '5. Give me the API key and Agent ID, and I\\'ll save them with agentwallex_configure',\n });\n },\n });\n\n /* ---- configure: validate + save credentials ---- */\n api.registerTool({\n name: 'agentwallex_configure',\n description: 'Save AgentWallex API credentials after validating them',\n parameters: {\n type: 'object',\n properties: {\n api_key: { type: 'string', description: 'AgentWallex API key (starts with awx_)' },\n agent_id: { type: 'string', description: 'Agent ID from the Dashboard' },\n sandbox: { type: 'boolean', description: 'Use sandbox environment (default: false)' },\n },\n required: ['api_key', 'agent_id'],\n },\n async execute(_id, params) {\n const apiKey = params.api_key as string | undefined;\n const agentId = params.agent_id as string | undefined;\n const sandbox = (params.sandbox as boolean) ?? false;\n\n if (!apiKey || typeof apiKey !== 'string') {\n return jsonResult({\n success: false,\n message: 'api_key is required. Get one from ' + DASHBOARD_URL,\n });\n }\n\n if (!agentId || typeof agentId !== 'string') {\n return jsonResult({\n success: false,\n message: 'agent_id is required. Find it in your Dashboard at ' + DASHBOARD_URL,\n });\n }\n\n // Validate api_key format\n if (!apiKey.startsWith('awx_')) {\n return jsonResult({\n success: false,\n message:\n 'Invalid API key format. AgentWallex API keys start with \"awx_\". ' +\n `Please check your key at ${DASHBOARD_URL}`,\n });\n }\n\n // Validate credentials by calling the API\n try {\n const client = new AgentWallex({ apiKey, sandbox });\n const agent = await client.agents.retrieve(agentId);\n\n saveConfig({ apiKey, agentId, sandbox: sandbox === true ? true : undefined });\n\n return jsonResult({\n success: true,\n agent_name: agent.agent_name,\n message:\n `AgentWallex configured successfully! Connected to agent \"${agent.agent_name}\". ` +\n 'You can now send payments, check balances, and manage transactions.',\n });\n } catch (err) {\n const message =\n err instanceof Error ? err.message : 'Unknown error';\n return jsonResult({\n success: false,\n message:\n `Failed to validate credentials: ${message}. ` +\n 'Please check your API key and Agent ID, then try again.',\n });\n }\n },\n });\n\n /* ---- existing tools, wrapped with withConfig ---- */\n api.registerTool({\n name: 'agentwallex_create_agent',\n description: 'Create a new AI agent with its own wallet',\n parameters: {\n type: 'object',\n properties: {\n agent_name: { type: 'string', description: 'Name for the new agent' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n agent_description: { type: 'string', description: 'Optional description' },\n },\n required: ['agent_name'],\n },\n execute: withConfig(async (client, _agentId, params) => {\n return createAgent(client, {\n agent_name: params.agent_name as string,\n chain: params.chain as string | undefined,\n agent_description: params.agent_description as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_list_agents',\n description: 'List all agents and their status',\n parameters: {\n type: 'object',\n properties: {\n status: { type: 'string', description: 'Filter by status (active, inactive, suspended)' },\n chain: { type: 'string', description: 'Filter by blockchain network' },\n },\n },\n execute: withConfig(async (client, _agentId, params) => {\n return listAgents(client, {\n status: params.status as string | undefined,\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_update_agent',\n description: \"Update an agent's name or description\",\n parameters: {\n type: 'object',\n properties: {\n agent_id: { type: 'string', description: 'Agent ID to update' },\n agent_name: { type: 'string', description: 'New agent name' },\n agent_description: { type: 'string', description: 'New description' },\n },\n required: ['agent_id'],\n },\n execute: withConfig(async (client, _agentId, params) => {\n return updateAgent(client, {\n agent_id: params.agent_id as string,\n agent_name: params.agent_name as string | undefined,\n agent_description: params.agent_description as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_delete_agent',\n description: 'Delete an agent',\n parameters: {\n type: 'object',\n properties: {\n agent_id: { type: 'string', description: 'Agent ID to delete' },\n },\n required: ['agent_id'],\n },\n execute: withConfig(async (client, _agentId, params) => {\n await deleteAgent(client, { agent_id: params.agent_id as string });\n return { success: true };\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_agent_status',\n description: 'Update agent status (active / suspended)',\n parameters: {\n type: 'object',\n properties: {\n agent_id: { type: 'string', description: 'Agent ID' },\n status: { type: 'string', description: 'New status: active, inactive, or suspended' },\n },\n required: ['agent_id', 'status'],\n },\n execute: withConfig(async (client, _agentId, params) => {\n return agentStatus(client, {\n agent_id: params.agent_id as string,\n status: params.status as string,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_create_wallet',\n description: 'Get or create a wallet deposit address for an agent',\n parameters: {\n type: 'object',\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n },\n execute: withConfig(async (client, agentId, params) => {\n return createWallet(client, agentId, {\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_pay',\n description: 'Send a USDC payment to a recipient address',\n parameters: {\n type: 'object',\n properties: {\n to: { type: 'string', description: 'Recipient wallet address' },\n amount: { type: 'string', description: 'Amount to send (e.g. \"1.50\")' },\n token: { type: 'string', description: 'Token symbol (default: USDC)' },\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n memo: { type: 'string', description: 'Optional payment memo' },\n },\n required: ['to', 'amount'],\n },\n execute: withConfig(async (client, agentId, params) => {\n return pay(client, agentId, {\n to: params.to as string,\n amount: params.amount as string,\n token: params.token as string | undefined,\n chain: params.chain as string | undefined,\n memo: params.memo as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_check_balance',\n description: 'Check USDC balance for an agent',\n parameters: {\n type: 'object',\n properties: {\n chain: { type: 'string', description: 'Blockchain network (default: base)' },\n },\n },\n execute: withConfig(async (client, agentId, params) => {\n return checkBalance(client, agentId, {\n chain: params.chain as string | undefined,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_tx_status',\n description: 'Check the status of a transaction',\n parameters: {\n type: 'object',\n properties: {\n transaction_id: { type: 'string', description: 'Transaction ID to check' },\n },\n required: ['transaction_id'],\n },\n execute: withConfig(async (client, agentId, params) => {\n return txStatus(client, agentId, {\n transaction_id: params.transaction_id as string,\n });\n }),\n });\n\n api.registerTool({\n name: 'agentwallex_list_transactions',\n description: 'List transactions with filtering',\n parameters: {\n type: 'object',\n properties: {\n agent_id: { type: 'string', description: 'Filter by agent ID' },\n status: { type: 'string', description: 'Filter by status (pending, confirmed, failed)' },\n direction: { type: 'string', description: 'Filter by direction (inbound, outbound)' },\n },\n },\n execute: withConfig(async (client, _agentId, params) => {\n return listTransactions(client, {\n agent_id: params.agent_id as string | undefined,\n status: params.status as string | undefined,\n direction: params.direction as string | undefined,\n });\n }),\n });\n\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwallex/openclaw",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "OpenClaw plugin for AgentWallex",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -30,20 +30,20 @@
30
30
  "engines": {
31
31
  "node": ">=18"
32
32
  },
33
- "scripts": {
34
- "build": "tsup",
35
- "test": "vitest run",
36
- "test:watch": "vitest",
37
- "typecheck": "tsc --noEmit",
38
- "clean": "rm -rf dist .turbo"
39
- },
40
33
  "license": "MIT",
41
34
  "dependencies": {
42
- "@agentwallex/sdk": "^0.2.0"
35
+ "@agentwallex/sdk": "0.3.0"
43
36
  },
44
37
  "devDependencies": {
45
38
  "@types/node": "^25.3.5",
46
39
  "tsup": "^8.4.0",
47
40
  "vitest": "^3.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "typecheck": "tsc --noEmit",
47
+ "clean": "rm -rf dist .turbo"
48
48
  }
49
- }
49
+ }