@agentwallex/openclaw 0.0.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.
package/README.md ADDED
@@ -0,0 +1,201 @@
1
+ # @agentwallex/openclaw
2
+
3
+ OpenClaw plugin for [AgentWallex](https://agentwallex.com) — gives AI agents the ability to send USDC payments, check balances, and query transactions.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Install the plugin
8
+
9
+ ```bash
10
+ openclaw plugins install @agentwallex/openclaw
11
+ ```
12
+
13
+ ### 2. Set up via conversation
14
+
15
+ Tell your AI agent:
16
+
17
+ ```
18
+ "Set up AgentWallex"
19
+ ```
20
+
21
+ The agent will guide you through:
22
+
23
+ 1. Opening the [AgentWallex Dashboard](https://app.agentwallex.com)
24
+ 2. Signing in with Google
25
+ 3. Creating an API key (starts with `awx_`)
26
+ 4. Copying your Agent ID
27
+ 5. Pasting the credentials back — they're validated and saved locally
28
+
29
+ That's it — zero config files needed. Credentials are stored at `~/.openclaw/agentwallex/config.json` with owner-only permissions.
30
+
31
+ ### 3. Use it
32
+
33
+ Your agent now has payment tools available. Just ask naturally:
34
+
35
+ ```
36
+ "Check my USDC balance"
37
+ "Send 5 USDC to 0xAbC...123"
38
+ "What's the status of transaction tx-abc123?"
39
+ ```
40
+
41
+ ## Available Tools
42
+
43
+ | Tool | Description |
44
+ |------|-------------|
45
+ | `agentwallex_setup` | Check configuration status and get setup instructions |
46
+ | `agentwallex_configure` | Validate and save API credentials |
47
+ | `agentwallex_create_agent` | Create a new AI agent with its own wallet |
48
+ | `agentwallex_list_agents` | List all agents and their status |
49
+ | `agentwallex_create_wallet` | Get or create a deposit address for the agent |
50
+ | `agentwallex_pay` | Send a USDC payment to a recipient address |
51
+ | `agentwallex_check_balance` | Check the agent's USDC balance |
52
+ | `agentwallex_tx_status` | Query the status of a transaction |
53
+
54
+ ## Usage Examples
55
+
56
+ Once the plugin is set up, you can interact with your agent using natural language. Here are some common scenarios:
57
+
58
+ ### Create an Agent
59
+
60
+ ```
61
+ You: Create a new agent called "payment-bot" on base chain
62
+ Agent: Agent created successfully.
63
+ Agent ID: agent-a1b2c3d4
64
+ Name: payment-bot
65
+ Chain: base
66
+ Status: active
67
+ ```
68
+
69
+ ### List Agents
70
+
71
+ ```
72
+ You: How many agents do I have?
73
+ Agent: You have 3 agents:
74
+ 1. payment-bot (agent-a1b2) — base — active
75
+ 2. data-fetcher (agent-c3d4) — base-sepolia — active
76
+ 3. old-bot (agent-e5f6) — base — inactive
77
+ ```
78
+
79
+ ### Check Balance
80
+
81
+ ```
82
+ You: What's my current USDC balance?
83
+ Agent: Your available USDC balance on base is 150.00 USDC.
84
+ ```
85
+
86
+ ### Send a Payment
87
+
88
+ ```
89
+ You: Send 25 USDC to 0xAbCdEf1234567890AbCdEf1234567890AbCdEf12
90
+ Agent: I'll send 25 USDC to that address.
91
+ Transaction created: tx-a1b2c3d4
92
+ Status: pending
93
+ I'll check back on the status shortly.
94
+ ```
95
+
96
+ ### Check Transaction Status
97
+
98
+ ```
99
+ You: What's the status of my last payment?
100
+ Agent: Transaction tx-a1b2c3d4:
101
+ Status: confirmed
102
+ Tx Hash: 0x7f8e...3a2b
103
+ Confirmed at: 2025-03-06T12:34:56Z
104
+ ```
105
+
106
+ ### Create a Wallet
107
+
108
+ ```
109
+ You: Set up a wallet on base-sepolia for testing
110
+ Agent: Wallet created on base-sepolia.
111
+ Address: 0x1234...5678
112
+ You can deposit testnet USDC to this address.
113
+ ```
114
+
115
+ ### Multi-step Workflow
116
+
117
+ ```
118
+ You: Check if I have enough balance, then send 10 USDC to 0xRecipient as payment for the API service
119
+
120
+ Agent: Let me check your balance first.
121
+ Available: 150.00 USDC on base — sufficient.
122
+ Sending 10 USDC to 0xRecipient...
123
+ Transaction created: tx-e5f6g7h8
124
+ Status: pending
125
+ I'll monitor this and let you know when it confirms.
126
+ ```
127
+
128
+ ### Error Handling
129
+
130
+ ```
131
+ You: Send 99999 USDC to 0xRecipient
132
+ Agent: I checked your balance first — you only have 150.00 USDC available,
133
+ which is insufficient for a 99999 USDC transfer.
134
+ Would you like to send a smaller amount?
135
+ ```
136
+
137
+ ## For Developers
138
+
139
+ If you want to use the tool functions directly in code (without OpenClaw):
140
+
141
+ ```typescript
142
+ import { AgentWallex, checkBalance, pay } from '@agentwallex/openclaw';
143
+
144
+ const client = new AgentWallex({ apiKey: 'awx_...' });
145
+ const agentId = 'your-agent-id';
146
+
147
+ // Check balance
148
+ const balance = await checkBalance(client, agentId, { chain: 'base' });
149
+ console.log(balance.available); // "100.50"
150
+
151
+ // Send payment
152
+ const tx = await pay(client, agentId, {
153
+ to: '0xRecipientAddress',
154
+ amount: '10.00',
155
+ });
156
+ console.log(tx.transaction_id); // "tx-abc123"
157
+ ```
158
+
159
+ ### Install as npm dependency
160
+
161
+ ```bash
162
+ npm install @agentwallex/openclaw
163
+ # or
164
+ pnpm add @agentwallex/openclaw
165
+ ```
166
+
167
+ ### Exports
168
+
169
+ ```typescript
170
+ // OpenClaw plugin entry
171
+ import register from '@agentwallex/openclaw';
172
+
173
+ // Tool functions (for direct use)
174
+ import { createAgent, listAgents, createWallet, pay, checkBalance, txStatus } from '@agentwallex/openclaw';
175
+
176
+ // Static tool schema (for custom integrations)
177
+ import { openClawToolSchema } from '@agentwallex/openclaw';
178
+
179
+ // Local credential store
180
+ import { loadConfig, saveConfig, isConfigured } from '@agentwallex/openclaw';
181
+
182
+ // SDK client (re-exported from @agentwallex/sdk)
183
+ import { AgentWallex } from '@agentwallex/openclaw';
184
+ ```
185
+
186
+ ## Sandbox Testing
187
+
188
+ To test against the sandbox environment, pass `sandbox: true` when configuring:
189
+
190
+ ```
191
+ "Configure AgentWallex with my sandbox API key awx_sandbox_xxx and agent ID agent-123, using sandbox mode"
192
+ ```
193
+
194
+ Sandbox transactions use testnet tokens and don't cost real money.
195
+
196
+ ## Links
197
+
198
+ - [AgentWallex Dashboard](https://app.agentwallex.com)
199
+ - [AgentWallex Documentation](https://docs.agentwallex.com)
200
+ - [SDK Package (`@agentwallex/sdk`)](https://www.npmjs.com/package/@agentwallex/sdk)
201
+ - [OpenClaw Documentation](https://docs.openclaw.ai)