@agentwallex/openclaw 0.0.2 → 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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @agentwallex/openclaw
2
2
 
3
- OpenClaw plugin for [AgentWallex](https://agentwallex.com) — gives AI agents the ability to send USDC payments, check balances, and query transactions.
3
+ OpenClaw plugin for [AgentWallex](https://agentwallex.com) — gives AI agents the ability to manage agents, send USDC payments, check balances, and query transactions.
4
4
 
5
5
  ## Quick Start
6
6
 
@@ -38,6 +38,38 @@ Your agent now has payment tools available. Just ask naturally:
38
38
  "What's the status of transaction tx-abc123?"
39
39
  ```
40
40
 
41
+ ## Upgrade
42
+
43
+ Update to the latest version:
44
+
45
+ ```bash
46
+ openclaw plugins update agentwallex-payment
47
+ ```
48
+
49
+ Or update all plugins at once:
50
+
51
+ ```bash
52
+ openclaw plugins update --all
53
+ ```
54
+
55
+ ## Uninstall
56
+
57
+ ```bash
58
+ openclaw plugins uninstall agentwallex-payment
59
+ ```
60
+
61
+ To keep plugin files on disk:
62
+
63
+ ```bash
64
+ openclaw plugins uninstall agentwallex-payment --keep-files
65
+ ```
66
+
67
+ To also remove locally stored credentials:
68
+
69
+ ```bash
70
+ rm -rf ~/.openclaw/agentwallex
71
+ ```
72
+
41
73
  ## Available Tools
42
74
 
43
75
  | Tool | Description |
@@ -46,10 +78,14 @@ Your agent now has payment tools available. Just ask naturally:
46
78
  | `agentwallex_configure` | Validate and save API credentials |
47
79
  | `agentwallex_create_agent` | Create a new AI agent with its own wallet |
48
80
  | `agentwallex_list_agents` | List all agents and their status |
81
+ | `agentwallex_update_agent` | Update an agent's name or description |
82
+ | `agentwallex_delete_agent` | Delete an agent |
83
+ | `agentwallex_agent_status` | Update agent status (active / suspended) |
49
84
  | `agentwallex_create_wallet` | Get or create a deposit address for the agent |
85
+ | `agentwallex_check_balance` | Check the agent's USDC balances (per chain) |
50
86
  | `agentwallex_pay` | Send a USDC payment to a recipient address |
51
- | `agentwallex_check_balance` | Check the agent's USDC balance |
52
87
  | `agentwallex_tx_status` | Query the status of a transaction |
88
+ | `agentwallex_list_transactions` | List transactions with filtering |
53
89
 
54
90
  ## Usage Examples
55
91
 
@@ -103,6 +139,32 @@ Agent: Transaction tx-a1b2c3d4:
103
139
  Confirmed at: 2025-03-06T12:34:56Z
104
140
  ```
105
141
 
142
+ ### Update an Agent
143
+
144
+ ```
145
+ You: Rename agent agent-a1b2c3d4 to "upgraded-bot"
146
+ Agent: Agent updated successfully.
147
+ Agent ID: agent-a1b2c3d4
148
+ Name: upgraded-bot
149
+ Status: active
150
+ ```
151
+
152
+ ### Suspend / Activate an Agent
153
+
154
+ ```
155
+ You: Suspend agent agent-a1b2c3d4
156
+ Agent: Agent status updated.
157
+ Agent ID: agent-a1b2c3d4
158
+ Status: suspended
159
+ ```
160
+
161
+ ### Delete an Agent
162
+
163
+ ```
164
+ You: Delete agent agent-e5f6
165
+ Agent: Agent agent-e5f6 has been deleted.
166
+ ```
167
+
106
168
  ### Create a Wallet
107
169
 
108
170
  ```
@@ -112,6 +174,15 @@ Agent: Wallet created on base-sepolia.
112
174
  You can deposit testnet USDC to this address.
113
175
  ```
114
176
 
177
+ ### List Transactions
178
+
179
+ ```
180
+ You: Show me my recent confirmed transactions
181
+ Agent: You have 2 confirmed transactions:
182
+ 1. tx-a1b2 — outbound — 10.00 USDC — confirmed
183
+ 2. tx-c3d4 — inbound — 25.00 USDC — confirmed
184
+ ```
185
+
115
186
  ### Multi-step Workflow
116
187
 
117
188
  ```
@@ -139,14 +210,37 @@ Agent: I checked your balance first — you only have 150.00 USDC available,
139
210
  If you want to use the tool functions directly in code (without OpenClaw):
140
211
 
141
212
  ```typescript
142
- import { AgentWallex, checkBalance, pay } from '@agentwallex/openclaw';
213
+ import {
214
+ AgentWallex,
215
+ createAgent, listAgents, updateAgent, deleteAgent, agentStatus,
216
+ createWallet, checkBalance, pay, txStatus, listTransactions,
217
+ } from '@agentwallex/openclaw';
143
218
 
144
219
  const client = new AgentWallex({ apiKey: 'awx_...' });
145
220
  const agentId = 'your-agent-id';
146
221
 
147
- // Check balance
148
- const balance = await checkBalance(client, agentId, { chain: 'base' });
149
- console.log(balance.available); // "100.50"
222
+ // Create an agent
223
+ const agent = await createAgent(client, { agent_name: 'bot', chain: 'base' });
224
+
225
+ // List agents
226
+ const agents = await listAgents(client, { status: 'active' });
227
+
228
+ // Update an agent
229
+ const updated = await updateAgent(client, { agent_id: agentId, agent_name: 'new-name' });
230
+
231
+ // Change agent status
232
+ await agentStatus(client, { agent_id: agentId, status: 'suspended' });
233
+
234
+ // Delete an agent
235
+ await deleteAgent(client, { agent_id: 'agent-to-delete' });
236
+
237
+ // Get deposit address
238
+ const wallet = await createWallet(client, agentId, { chain: 'base' });
239
+ console.log(wallet.address);
240
+
241
+ // Check balance (returns one entry per chain)
242
+ const result = await checkBalance(client, agentId, { chain: 'base' });
243
+ console.log(result.balances[0].available); // "100.50"
150
244
 
151
245
  // Send payment
152
246
  const tx = await pay(client, agentId, {
@@ -154,6 +248,12 @@ const tx = await pay(client, agentId, {
154
248
  amount: '10.00',
155
249
  });
156
250
  console.log(tx.transaction_id); // "tx-abc123"
251
+
252
+ // Check transaction status
253
+ const status = await txStatus(client, agentId, { transaction_id: tx.transaction_id });
254
+
255
+ // List transactions
256
+ const txns = await listTransactions(client, { agent_id: agentId, status: 'confirmed' });
157
257
  ```
158
258
 
159
259
  ### Install as npm dependency
@@ -171,7 +271,10 @@ pnpm add @agentwallex/openclaw
171
271
  import register from '@agentwallex/openclaw';
172
272
 
173
273
  // Tool functions (for direct use)
174
- import { createAgent, listAgents, createWallet, pay, checkBalance, txStatus } from '@agentwallex/openclaw';
274
+ import {
275
+ createAgent, listAgents, updateAgent, deleteAgent, agentStatus,
276
+ createWallet, pay, checkBalance, txStatus, listTransactions,
277
+ } from '@agentwallex/openclaw';
175
278
 
176
279
  // Static tool schema (for custom integrations)
177
280
  import { openClawToolSchema } from '@agentwallex/openclaw';
package/dist/index.cjs CHANGED
@@ -39,10 +39,39 @@ async function listAgents(client, input = {}) {
39
39
  };
40
40
  }
41
41
 
42
+ // src/tools/update-agent.ts
43
+ async function updateAgent(client, input) {
44
+ const agent = await client.agents.update(input.agent_id, {
45
+ agent_name: input.agent_name,
46
+ agent_description: input.agent_description
47
+ });
48
+ return {
49
+ agent_id: agent.agent_id,
50
+ agent_name: agent.agent_name,
51
+ chain: agent.chain,
52
+ status: agent.status
53
+ };
54
+ }
55
+
56
+ // src/tools/delete-agent.ts
57
+ async function deleteAgent(client, input) {
58
+ await client.agents.delete(input.agent_id);
59
+ }
60
+
61
+ // src/tools/agent-status.ts
62
+ async function agentStatus(client, input) {
63
+ const agent = await client.agents.updateStatus(input.agent_id, {
64
+ status: input.status
65
+ });
66
+ return {
67
+ agent_id: agent.agent_id,
68
+ status: agent.status
69
+ };
70
+ }
71
+
42
72
  // src/tools/create-wallet.ts
43
73
  async function createWallet(client, agentId, input = {}) {
44
- const result = await client.wallets.getDepositAddress({
45
- agent_id: agentId,
74
+ const result = await client.agents.getDepositAddress(agentId, {
46
75
  chain: input.chain
47
76
  });
48
77
  return {
@@ -54,41 +83,32 @@ async function createWallet(client, agentId, input = {}) {
54
83
 
55
84
  // src/tools/pay.ts
56
85
  async function pay(client, agentId, input) {
57
- const wallet = await client.wallets.getDepositAddress({
58
- agent_id: agentId,
59
- chain: input.chain
60
- });
61
- const tx = await client.transactions.create({
62
- agent_id: agentId,
63
- direction: "outbound",
64
- type: "payment",
65
- from_address: wallet.address,
66
- to_address: input.to,
86
+ const result = await client.agents.withdraw(agentId, {
67
87
  amount: input.amount,
68
- token: input.token ?? "USDC",
69
- chain: input.chain ?? wallet.chain,
70
- memo: input.memo
88
+ to_address: input.to,
89
+ chain: input.chain
71
90
  });
72
91
  return {
73
- transaction_id: tx.transaction_id,
74
- tx_hash: tx.tx_hash ?? void 0,
75
- status: tx.status
92
+ transaction_id: result.ledger_id,
93
+ tx_hash: result.tx_hash || void 0,
94
+ status: result.status
76
95
  };
77
96
  }
78
97
 
79
98
  // src/tools/check-balance.ts
80
- async function checkBalance(client, agentId, input = {}) {
81
- const balances = await client.wallets.listBalances({
82
- agent_id: agentId,
83
- chain: input.chain
84
- });
85
- const balance = balances[0];
86
- if (!balance) {
87
- return { available: "0", chain: input.chain ?? "base" };
88
- }
99
+ async function checkBalance(client, agentId, _input = {}) {
100
+ const balances = await client.agents.getBalance(agentId);
89
101
  return {
90
- available: balance.available,
91
- chain: balance.chain
102
+ balances: balances.map((b) => ({
103
+ chain: b.chain,
104
+ available: b.available,
105
+ locked: b.locked,
106
+ pending_income: b.pending_income,
107
+ total_deposited: b.total_deposited,
108
+ total_withdrawn: b.total_withdrawn,
109
+ total_paid: b.total_paid,
110
+ total_earned: b.total_earned
111
+ }))
92
112
  };
93
113
  }
94
114
 
@@ -106,6 +126,29 @@ async function txStatus(client, agentId, input) {
106
126
  confirmed_at: tx.confirmed_at ?? void 0
107
127
  };
108
128
  }
129
+
130
+ // src/tools/list-transactions.ts
131
+ async function listTransactions(client, input = {}) {
132
+ const page = await client.transactions.list({
133
+ agent_id: input.agent_id,
134
+ status: input.status,
135
+ direction: input.direction
136
+ });
137
+ return {
138
+ transactions: page.data.map((tx) => ({
139
+ transaction_id: tx.transaction_id,
140
+ agent_id: tx.agent_id,
141
+ direction: tx.direction,
142
+ status: tx.status,
143
+ amount: tx.amount,
144
+ token: tx.token,
145
+ chain: tx.chain,
146
+ tx_hash: tx.tx_hash ?? void 0,
147
+ confirmed_at: tx.confirmed_at ?? void 0
148
+ })),
149
+ total: page.total
150
+ };
151
+ }
109
152
  function getConfigDir() {
110
153
  return path.join(os.homedir(), ".openclaw", "agentwallex");
111
154
  }
@@ -245,6 +288,67 @@ var openClawToolSchema = {
245
288
  required: ["agents", "total"]
246
289
  }
247
290
  },
291
+ {
292
+ name: "agentwallex_update_agent",
293
+ description: "Update an agent's name or description",
294
+ inputSchema: {
295
+ type: "object",
296
+ properties: {
297
+ agent_id: { type: "string", description: "Agent ID to update" },
298
+ agent_name: { type: "string", description: "New agent name" },
299
+ agent_description: { type: "string", description: "New description" }
300
+ },
301
+ required: ["agent_id"]
302
+ },
303
+ outputSchema: {
304
+ type: "object",
305
+ properties: {
306
+ agent_id: { type: "string" },
307
+ agent_name: { type: "string" },
308
+ chain: { type: "string" },
309
+ status: { type: "string" }
310
+ },
311
+ required: ["agent_id", "agent_name", "chain", "status"]
312
+ }
313
+ },
314
+ {
315
+ name: "agentwallex_delete_agent",
316
+ description: "Delete an agent",
317
+ inputSchema: {
318
+ type: "object",
319
+ properties: {
320
+ agent_id: { type: "string", description: "Agent ID to delete" }
321
+ },
322
+ required: ["agent_id"]
323
+ },
324
+ outputSchema: {
325
+ type: "object",
326
+ properties: {
327
+ success: { type: "boolean" }
328
+ },
329
+ required: ["success"]
330
+ }
331
+ },
332
+ {
333
+ name: "agentwallex_agent_status",
334
+ description: "Update agent status (active / suspended)",
335
+ inputSchema: {
336
+ type: "object",
337
+ properties: {
338
+ agent_id: { type: "string", description: "Agent ID" },
339
+ status: { type: "string", description: "New status: active, inactive, or suspended" }
340
+ },
341
+ required: ["agent_id", "status"]
342
+ },
343
+ outputSchema: {
344
+ type: "object",
345
+ properties: {
346
+ agent_id: { type: "string" },
347
+ status: { type: "string" }
348
+ },
349
+ required: ["agent_id", "status"]
350
+ }
351
+ },
248
352
  {
249
353
  name: "agentwallex_create_wallet",
250
354
  description: "Get or create a wallet deposit address for an agent",
@@ -302,10 +406,24 @@ var openClawToolSchema = {
302
406
  outputSchema: {
303
407
  type: "object",
304
408
  properties: {
305
- available: { type: "string" },
306
- chain: { type: "string" }
409
+ balances: {
410
+ type: "array",
411
+ items: {
412
+ type: "object",
413
+ properties: {
414
+ chain: { type: "string" },
415
+ available: { type: "string" },
416
+ locked: { type: "string" },
417
+ pending_income: { type: "string" },
418
+ total_deposited: { type: "string" },
419
+ total_withdrawn: { type: "string" },
420
+ total_paid: { type: "string" },
421
+ total_earned: { type: "string" }
422
+ }
423
+ }
424
+ }
307
425
  },
308
- required: ["available", "chain"]
426
+ required: ["balances"]
309
427
  }
310
428
  },
311
429
  {
@@ -327,6 +445,27 @@ var openClawToolSchema = {
327
445
  },
328
446
  required: ["status"]
329
447
  }
448
+ },
449
+ {
450
+ name: "agentwallex_list_transactions",
451
+ description: "List transactions with filtering",
452
+ inputSchema: {
453
+ type: "object",
454
+ properties: {
455
+ agent_id: { type: "string", description: "Filter by agent ID" },
456
+ status: { type: "string", description: "Filter by status (pending, confirmed, failed)" },
457
+ direction: { type: "string", description: "Filter by direction (inbound, outbound)" }
458
+ },
459
+ required: []
460
+ },
461
+ outputSchema: {
462
+ type: "object",
463
+ properties: {
464
+ transactions: { type: "array", items: { type: "object" } },
465
+ total: { type: "number" }
466
+ },
467
+ required: ["transactions", "total"]
468
+ }
330
469
  }
331
470
  ]
332
471
  };
@@ -465,6 +604,59 @@ function register(api) {
465
604
  });
466
605
  })
467
606
  });
607
+ api.registerTool({
608
+ name: "agentwallex_update_agent",
609
+ description: "Update an agent's name or description",
610
+ parameters: {
611
+ type: "object",
612
+ properties: {
613
+ agent_id: { type: "string", description: "Agent ID to update" },
614
+ agent_name: { type: "string", description: "New agent name" },
615
+ agent_description: { type: "string", description: "New description" }
616
+ },
617
+ required: ["agent_id"]
618
+ },
619
+ execute: withConfig(async (client, _agentId, params) => {
620
+ return updateAgent(client, {
621
+ agent_id: params.agent_id,
622
+ agent_name: params.agent_name,
623
+ agent_description: params.agent_description
624
+ });
625
+ })
626
+ });
627
+ api.registerTool({
628
+ name: "agentwallex_delete_agent",
629
+ description: "Delete an agent",
630
+ parameters: {
631
+ type: "object",
632
+ properties: {
633
+ agent_id: { type: "string", description: "Agent ID to delete" }
634
+ },
635
+ required: ["agent_id"]
636
+ },
637
+ execute: withConfig(async (client, _agentId, params) => {
638
+ await deleteAgent(client, { agent_id: params.agent_id });
639
+ return { success: true };
640
+ })
641
+ });
642
+ api.registerTool({
643
+ name: "agentwallex_agent_status",
644
+ description: "Update agent status (active / suspended)",
645
+ parameters: {
646
+ type: "object",
647
+ properties: {
648
+ agent_id: { type: "string", description: "Agent ID" },
649
+ status: { type: "string", description: "New status: active, inactive, or suspended" }
650
+ },
651
+ required: ["agent_id", "status"]
652
+ },
653
+ execute: withConfig(async (client, _agentId, params) => {
654
+ return agentStatus(client, {
655
+ agent_id: params.agent_id,
656
+ status: params.status
657
+ });
658
+ })
659
+ });
468
660
  api.registerTool({
469
661
  name: "agentwallex_create_wallet",
470
662
  description: "Get or create a wallet deposit address for an agent",
@@ -535,17 +727,39 @@ function register(api) {
535
727
  });
536
728
  })
537
729
  });
730
+ api.registerTool({
731
+ name: "agentwallex_list_transactions",
732
+ description: "List transactions with filtering",
733
+ parameters: {
734
+ type: "object",
735
+ properties: {
736
+ agent_id: { type: "string", description: "Filter by agent ID" },
737
+ status: { type: "string", description: "Filter by status (pending, confirmed, failed)" },
738
+ direction: { type: "string", description: "Filter by direction (inbound, outbound)" }
739
+ }
740
+ },
741
+ execute: withConfig(async (client, _agentId, params) => {
742
+ return listTransactions(client, {
743
+ agent_id: params.agent_id,
744
+ status: params.status,
745
+ direction: params.direction
746
+ });
747
+ })
748
+ });
538
749
  }
539
750
 
540
751
  Object.defineProperty(exports, "AgentWallex", {
541
752
  enumerable: true,
542
753
  get: function () { return sdk.AgentWallex; }
543
754
  });
755
+ exports.agentStatus = agentStatus;
544
756
  exports.checkBalance = checkBalance;
545
757
  exports.createAgent = createAgent;
546
758
  exports.createWallet = createWallet;
759
+ exports.deleteAgent = deleteAgent;
547
760
  exports.isConfigured = isConfigured;
548
761
  exports.listAgents = listAgents;
762
+ exports.listTransactions = listTransactions;
549
763
  exports.loadConfig = loadConfig;
550
764
  exports.openClawToolSchema = openClawToolSchema;
551
765
  exports.pay = pay;
@@ -553,5 +767,6 @@ exports.register = register;
553
767
  exports.requireConfig = requireConfig;
554
768
  exports.saveConfig = saveConfig;
555
769
  exports.txStatus = txStatus;
770
+ exports.updateAgent = updateAgent;
556
771
  //# sourceMappingURL=index.cjs.map
557
772
  //# sourceMappingURL=index.cjs.map