@agentlayer.tech/wallet 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/.openclaw/AGENTS.md +98 -0
- package/.openclaw/extensions/agent-wallet/README.md +127 -0
- package/.openclaw/extensions/agent-wallet/index.ts +1520 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +184 -0
- package/.openclaw/extensions/agent-wallet/package.json +11 -0
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +20 -0
- package/CHANGELOG.md +42 -0
- package/LICENSE +104 -0
- package/README.md +332 -0
- package/RELEASING.md +204 -0
- package/agent-wallet/.env.example +62 -0
- package/agent-wallet/AGENTS.md +129 -0
- package/agent-wallet/README.md +527 -0
- package/agent-wallet/agent_wallet/__init__.py +11 -0
- package/agent-wallet/agent_wallet/approval.py +161 -0
- package/agent-wallet/agent_wallet/bootstrap.py +178 -0
- package/agent-wallet/agent_wallet/btc_user_wallets.py +217 -0
- package/agent-wallet/agent_wallet/config.py +382 -0
- package/agent-wallet/agent_wallet/encrypted_storage.py +161 -0
- package/agent-wallet/agent_wallet/evm_user_wallets.py +370 -0
- package/agent-wallet/agent_wallet/exceptions.py +9 -0
- package/agent-wallet/agent_wallet/file_ops.py +34 -0
- package/agent-wallet/agent_wallet/http_client.py +25 -0
- package/agent-wallet/agent_wallet/models.py +66 -0
- package/agent-wallet/agent_wallet/nonce_registry.py +59 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +5128 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +626 -0
- package/agent-wallet/agent_wallet/openclaw_runtime.py +272 -0
- package/agent-wallet/agent_wallet/plugin_bundle.py +42 -0
- package/agent-wallet/agent_wallet/providers/__init__.py +1 -0
- package/agent-wallet/agent_wallet/providers/bags.py +259 -0
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +470 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +567 -0
- package/agent-wallet/agent_wallet/providers/kamino.py +215 -0
- package/agent-wallet/agent_wallet/providers/lifi.py +277 -0
- package/agent-wallet/agent_wallet/providers/solana_rpc.py +470 -0
- package/agent-wallet/agent_wallet/providers/wdk_btc_local.py +114 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +205 -0
- package/agent-wallet/agent_wallet/sealed_keys.py +61 -0
- package/agent-wallet/agent_wallet/solana_stake.py +103 -0
- package/agent-wallet/agent_wallet/solana_tx.py +93 -0
- package/agent-wallet/agent_wallet/spending_limits.py +101 -0
- package/agent-wallet/agent_wallet/transaction_policy.py +518 -0
- package/agent-wallet/agent_wallet/user_wallets.py +355 -0
- package/agent-wallet/agent_wallet/validation.py +31 -0
- package/agent-wallet/agent_wallet/wallet_layer/__init__.py +1 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +808 -0
- package/agent-wallet/agent_wallet/wallet_layer/base58.py +44 -0
- package/agent-wallet/agent_wallet/wallet_layer/factory.py +102 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +4252 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_btc.py +272 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +1628 -0
- package/agent-wallet/examples/bootstrap_wallet.py +21 -0
- package/agent-wallet/examples/openclaw_runtime_onboarding.py +28 -0
- package/agent-wallet/examples/openclaw_user_wallet_example.py +31 -0
- package/agent-wallet/examples/openclaw_wallet_adapter_example.py +33 -0
- package/agent-wallet/openclaw.plugin.json +138 -0
- package/agent-wallet/pyproject.toml +31 -0
- package/agent-wallet/scripts/bootstrap_openclaw_btc.py +278 -0
- package/agent-wallet/scripts/build_release_bundle.py +188 -0
- package/agent-wallet/scripts/finalize_openclaw_local_wallet_config.py +121 -0
- package/agent-wallet/scripts/install_agent_wallet.py +505 -0
- package/agent-wallet/scripts/install_openclaw_local_config.py +226 -0
- package/agent-wallet/scripts/install_openclaw_sealed_keys.py +105 -0
- package/agent-wallet/scripts/manage_openclaw_btc_wallet.py +244 -0
- package/agent-wallet/scripts/reveal_btc_seed.sh +130 -0
- package/agent-wallet/scripts/security_utils.py +37 -0
- package/agent-wallet/scripts/setup_btc_wallet.sh +146 -0
- package/agent-wallet/scripts/switch_openclaw_wallet_network.py +106 -0
- package/agent-wallet/skills/wallet-operator/SKILL.md +128 -0
- package/bin/openclaw-agent-wallet.mjs +487 -0
- package/install-from-github.sh +134 -0
- package/package.json +61 -0
- package/setup.sh +40 -0
- package/wdk-btc-wallet/README.md +325 -0
- package/wdk-btc-wallet/bootstrap.sh +22 -0
- package/wdk-btc-wallet/package-lock.json +1839 -0
- package/wdk-btc-wallet/package.json +18 -0
- package/wdk-btc-wallet/run-local.sh +21 -0
- package/wdk-btc-wallet/src/config.js +160 -0
- package/wdk-btc-wallet/src/json.js +35 -0
- package/wdk-btc-wallet/src/local_vault.js +432 -0
- package/wdk-btc-wallet/src/network_state.js +84 -0
- package/wdk-btc-wallet/src/server.js +257 -0
- package/wdk-btc-wallet/src/wdk_btc_wallet.js +332 -0
- package/wdk-evm-wallet/README.md +183 -0
- package/wdk-evm-wallet/bootstrap.sh +8 -0
- package/wdk-evm-wallet/package-lock.json +2340 -0
- package/wdk-evm-wallet/package.json +23 -0
- package/wdk-evm-wallet/run-local.sh +12 -0
- package/wdk-evm-wallet/src/config.js +274 -0
- package/wdk-evm-wallet/src/json.js +35 -0
- package/wdk-evm-wallet/src/local_vault.js +430 -0
- package/wdk-evm-wallet/src/network_state.js +92 -0
- package/wdk-evm-wallet/src/server.js +575 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +4981 -0
|
@@ -0,0 +1,1520 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
const PLUGIN_ID = "agent-wallet";
|
|
8
|
+
const PLUGIN_ROOT = path.dirname(new URL(import.meta.url).pathname);
|
|
9
|
+
let selectedWalletBackend = null;
|
|
10
|
+
let selectedSolanaNetwork = null;
|
|
11
|
+
let selectedEvmNetwork = null;
|
|
12
|
+
let selectedBtcNetwork = null;
|
|
13
|
+
|
|
14
|
+
function resolvePluginConfig(api) {
|
|
15
|
+
const globalConfig = api?.config ?? {};
|
|
16
|
+
const pluginEntry = globalConfig?.plugins?.entries?.[PLUGIN_ID];
|
|
17
|
+
return pluginEntry?.config ?? globalConfig?.config ?? {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function resolveUserId(api, config) {
|
|
21
|
+
return (
|
|
22
|
+
config.userId ||
|
|
23
|
+
process.env.OPENCLAW_AGENT_WALLET_USER_ID ||
|
|
24
|
+
process.env.USER ||
|
|
25
|
+
"openclaw-main"
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function resolveBackend(api) {
|
|
30
|
+
const config = resolvePluginConfig(api);
|
|
31
|
+
return normalizeWalletBackend(config.backend || process.env.AGENT_WALLET_BACKEND || "solana_local");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeWalletBackend(value) {
|
|
35
|
+
const normalized = String(value || "").trim().toLowerCase();
|
|
36
|
+
const aliases = {
|
|
37
|
+
sol: "solana_local",
|
|
38
|
+
solana: "solana_local",
|
|
39
|
+
solana_local: "solana_local",
|
|
40
|
+
"solana-local": "solana_local",
|
|
41
|
+
evm: "wdk_evm_local",
|
|
42
|
+
ethereum: "wdk_evm_local",
|
|
43
|
+
eth: "wdk_evm_local",
|
|
44
|
+
base: "wdk_evm_local",
|
|
45
|
+
wdk_evm_local: "wdk_evm_local",
|
|
46
|
+
"wdk-evm-local": "wdk_evm_local",
|
|
47
|
+
evm_local: "wdk_evm_local",
|
|
48
|
+
"evm-local": "wdk_evm_local",
|
|
49
|
+
btc: "wdk_btc_local",
|
|
50
|
+
bitcoin: "wdk_btc_local",
|
|
51
|
+
wdk_btc_local: "wdk_btc_local",
|
|
52
|
+
"wdk-btc-local": "wdk_btc_local",
|
|
53
|
+
btc_local: "wdk_btc_local",
|
|
54
|
+
"btc-local": "wdk_btc_local",
|
|
55
|
+
};
|
|
56
|
+
const backend = aliases[normalized] || normalized;
|
|
57
|
+
if (!["solana_local", "wdk_evm_local", "wdk_btc_local"].includes(backend)) {
|
|
58
|
+
throw new Error("Wallet backend must be solana, evm, base, ethereum, btc, or bitcoin.");
|
|
59
|
+
}
|
|
60
|
+
return backend;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function backendLabel(backend) {
|
|
64
|
+
if (backend === "wdk_evm_local") return "evm";
|
|
65
|
+
if (backend === "wdk_btc_local") return "bitcoin";
|
|
66
|
+
return "solana";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function normalizeEvmNetwork(value) {
|
|
70
|
+
const normalized = String(value || "").trim().toLowerCase();
|
|
71
|
+
const aliases = {
|
|
72
|
+
mainnet: "ethereum",
|
|
73
|
+
eth: "ethereum",
|
|
74
|
+
"eth-mainnet": "ethereum",
|
|
75
|
+
"base-mainnet": "base",
|
|
76
|
+
base_sepolia: "base-sepolia",
|
|
77
|
+
};
|
|
78
|
+
return aliases[normalized] || normalized;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function normalizeSelectableEvmNetwork(value) {
|
|
82
|
+
const network = normalizeEvmNetwork(value);
|
|
83
|
+
if (!["ethereum", "base"].includes(network)) {
|
|
84
|
+
throw new Error("EVM network must be 'ethereum' or 'base'.");
|
|
85
|
+
}
|
|
86
|
+
return network;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function normalizeSolanaNetwork(value) {
|
|
90
|
+
const network = String(value || "").trim().toLowerCase();
|
|
91
|
+
if (!network) return null;
|
|
92
|
+
const aliases = {
|
|
93
|
+
solana: "mainnet",
|
|
94
|
+
"solana-mainnet": "mainnet",
|
|
95
|
+
mainnet_beta: "mainnet",
|
|
96
|
+
"mainnet-beta": "mainnet",
|
|
97
|
+
};
|
|
98
|
+
const normalized = aliases[network] || network;
|
|
99
|
+
if (!["mainnet", "devnet", "testnet"].includes(normalized)) {
|
|
100
|
+
throw new Error("Solana network must be mainnet, devnet, or testnet.");
|
|
101
|
+
}
|
|
102
|
+
return normalized;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function normalizeBtcNetwork(value) {
|
|
106
|
+
const network = String(value || "").trim().toLowerCase();
|
|
107
|
+
if (!network) return null;
|
|
108
|
+
const aliases = {
|
|
109
|
+
btc: "bitcoin",
|
|
110
|
+
bitcoin_mainnet: "bitcoin",
|
|
111
|
+
"bitcoin-mainnet": "bitcoin",
|
|
112
|
+
mainnet: "bitcoin",
|
|
113
|
+
};
|
|
114
|
+
const normalized = aliases[network] || network;
|
|
115
|
+
if (!["bitcoin", "testnet", "regtest"].includes(normalized)) {
|
|
116
|
+
throw new Error("Bitcoin network must be bitcoin, testnet, or regtest.");
|
|
117
|
+
}
|
|
118
|
+
return normalized;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function defaultSelectableEvmNetwork(api) {
|
|
122
|
+
const config = resolvePluginConfig(api);
|
|
123
|
+
const configured = normalizeEvmNetwork(config.network || process.env.WDK_EVM_NETWORK);
|
|
124
|
+
return ["ethereum", "base"].includes(configured) ? configured : null;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function defaultSolanaNetwork(api) {
|
|
128
|
+
const config = resolvePluginConfig(api);
|
|
129
|
+
try {
|
|
130
|
+
return normalizeSolanaNetwork(config.network || process.env.SOLANA_NETWORK) || "mainnet";
|
|
131
|
+
} catch {
|
|
132
|
+
return "mainnet";
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function defaultBtcNetwork(api) {
|
|
137
|
+
const config = resolvePluginConfig(api);
|
|
138
|
+
try {
|
|
139
|
+
return normalizeBtcNetwork(config.network || process.env.WDK_BTC_NETWORK) || "bitcoin";
|
|
140
|
+
} catch {
|
|
141
|
+
return "bitcoin";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function inferBackendForTool(toolName) {
|
|
146
|
+
if (
|
|
147
|
+
toolName.startsWith("get_evm_") ||
|
|
148
|
+
toolName.startsWith("manage_evm_") ||
|
|
149
|
+
toolName.startsWith("swap_evm_") ||
|
|
150
|
+
toolName.startsWith("transfer_evm_") ||
|
|
151
|
+
toolName === "set_evm_network"
|
|
152
|
+
) {
|
|
153
|
+
return "wdk_evm_local";
|
|
154
|
+
}
|
|
155
|
+
if (toolName.startsWith("get_btc_") || toolName === "transfer_btc") {
|
|
156
|
+
return "wdk_btc_local";
|
|
157
|
+
}
|
|
158
|
+
if (
|
|
159
|
+
toolName.includes("solana") ||
|
|
160
|
+
toolName.includes("jupiter") ||
|
|
161
|
+
toolName.includes("kamino") ||
|
|
162
|
+
toolName.includes("bags") ||
|
|
163
|
+
toolName === "transfer_sol" ||
|
|
164
|
+
toolName === "transfer_spl_token" ||
|
|
165
|
+
toolName === "sign_wallet_message" ||
|
|
166
|
+
toolName === "close_empty_token_accounts" ||
|
|
167
|
+
toolName === "request_devnet_airdrop" ||
|
|
168
|
+
toolName === "get_wallet_portfolio" ||
|
|
169
|
+
toolName === "get_solana_token_prices"
|
|
170
|
+
) {
|
|
171
|
+
return "solana_local";
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function activeBackendForTool(api, toolName) {
|
|
177
|
+
return selectedWalletBackend || inferBackendForTool(toolName) || resolveBackend(api);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function networkForBackend(api, backend) {
|
|
181
|
+
const config = resolvePluginConfig(api);
|
|
182
|
+
if (backend === "wdk_evm_local") {
|
|
183
|
+
return selectedEvmNetwork || defaultSelectableEvmNetwork(api) || "ethereum";
|
|
184
|
+
}
|
|
185
|
+
if (backend === "wdk_btc_local") {
|
|
186
|
+
return selectedBtcNetwork || defaultBtcNetwork(api);
|
|
187
|
+
}
|
|
188
|
+
return selectedSolanaNetwork || normalizeSolanaNetwork(config.network || process.env.SOLANA_NETWORK) || "mainnet";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function effectiveConfigForBackend(api, backend) {
|
|
192
|
+
const config = resolvePluginConfig(api);
|
|
193
|
+
return {
|
|
194
|
+
...config,
|
|
195
|
+
backend,
|
|
196
|
+
network: networkForBackend(api, backend),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function resolvePythonBin(config) {
|
|
201
|
+
return config.pythonBin || process.env.OPENCLAW_AGENT_WALLET_PYTHON || "python3";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function resolvePackageRoot(config) {
|
|
205
|
+
const candidates = [
|
|
206
|
+
config.packageRoot,
|
|
207
|
+
process.env.OPENCLAW_AGENT_WALLET_PACKAGE_ROOT,
|
|
208
|
+
path.resolve(PLUGIN_ROOT, "../../../agent-wallet"),
|
|
209
|
+
path.resolve(process.cwd(), "agent-wallet"),
|
|
210
|
+
].filter(Boolean);
|
|
211
|
+
|
|
212
|
+
for (const candidate of candidates) {
|
|
213
|
+
const resolved = path.resolve(candidate);
|
|
214
|
+
if (fs.existsSync(path.join(resolved, "agent_wallet", "__init__.py"))) {
|
|
215
|
+
return resolved;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
throw new Error(
|
|
219
|
+
"Could not resolve agent-wallet package root. Set plugins.entries.agent-wallet.config.packageRoot."
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function buildCliEnv(packageRoot) {
|
|
224
|
+
const env = { ...process.env };
|
|
225
|
+
env.PYTHONPATH = env.PYTHONPATH
|
|
226
|
+
? `${packageRoot}${path.delimiter}${env.PYTHONPATH}`
|
|
227
|
+
: packageRoot;
|
|
228
|
+
return env;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function callWalletCli(api, command, extraArgs = [], configOverride = null) {
|
|
232
|
+
const config = configOverride || resolvePluginConfig(api);
|
|
233
|
+
const packageRoot = resolvePackageRoot(config);
|
|
234
|
+
const pythonBin = resolvePythonBin(config);
|
|
235
|
+
const userId = resolveUserId(api, config);
|
|
236
|
+
const args = [
|
|
237
|
+
"-m",
|
|
238
|
+
"agent_wallet.openclaw_cli",
|
|
239
|
+
command,
|
|
240
|
+
"--user-id",
|
|
241
|
+
userId,
|
|
242
|
+
"--config-json",
|
|
243
|
+
JSON.stringify(config),
|
|
244
|
+
...extraArgs,
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
const { stdout, stderr } = await execFileAsync(pythonBin, args, {
|
|
248
|
+
cwd: packageRoot,
|
|
249
|
+
env: buildCliEnv(packageRoot),
|
|
250
|
+
maxBuffer: 1024 * 1024 * 8,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
if (stderr && stderr.trim()) {
|
|
254
|
+
api?.logger?.debug?.(`[agent-wallet] stderr: ${stderr.trim()}`);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const payload = JSON.parse(stdout.trim() || "{}");
|
|
258
|
+
if (payload?.ok === false && payload?.error) {
|
|
259
|
+
throw new Error(payload.error);
|
|
260
|
+
}
|
|
261
|
+
return payload;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function asContent(data) {
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: "text",
|
|
269
|
+
text: JSON.stringify(data, null, 2),
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function registerTool(api, definition) {
|
|
276
|
+
api.registerTool({
|
|
277
|
+
name: definition.name,
|
|
278
|
+
description: definition.description,
|
|
279
|
+
parameters: definition.parameters,
|
|
280
|
+
returns: {
|
|
281
|
+
type: "object",
|
|
282
|
+
additionalProperties: true,
|
|
283
|
+
},
|
|
284
|
+
optional: Boolean(definition.optional),
|
|
285
|
+
async execute(_id, params = {}) {
|
|
286
|
+
if (definition.name === "get_active_wallet_backend") {
|
|
287
|
+
const configuredBackend = resolveBackend(api);
|
|
288
|
+
const activeBackend = selectedWalletBackend || configuredBackend;
|
|
289
|
+
const activeNetwork = networkForBackend(api, activeBackend);
|
|
290
|
+
return asContent({
|
|
291
|
+
active_backend: activeBackend,
|
|
292
|
+
active_wallet: backendLabel(activeBackend),
|
|
293
|
+
active_network: activeNetwork,
|
|
294
|
+
configured_backend: configuredBackend,
|
|
295
|
+
configured_network: String(resolvePluginConfig(api).network || "").trim() || null,
|
|
296
|
+
session_override_active: Boolean(selectedWalletBackend),
|
|
297
|
+
available_wallets: ["solana", "evm", "bitcoin"],
|
|
298
|
+
usage:
|
|
299
|
+
"Use set_wallet_backend to switch between Solana, EVM, and Bitcoin for this OpenClaw plugin session. Do not edit plugin config for normal wallet switching.",
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (definition.name === "set_wallet_backend") {
|
|
304
|
+
const requestedWallet = String(params?.backend || params?.wallet || "").trim().toLowerCase();
|
|
305
|
+
const backend = normalizeWalletBackend(requestedWallet);
|
|
306
|
+
const impliedNetwork =
|
|
307
|
+
["base", "base-mainnet"].includes(requestedWallet)
|
|
308
|
+
? "base"
|
|
309
|
+
: ["ethereum", "eth", "mainnet", "eth-mainnet"].includes(requestedWallet)
|
|
310
|
+
? "ethereum"
|
|
311
|
+
: null;
|
|
312
|
+
if (backend === "wdk_evm_local") {
|
|
313
|
+
selectedEvmNetwork = normalizeSelectableEvmNetwork(
|
|
314
|
+
params?.network || impliedNetwork || selectedEvmNetwork || defaultSelectableEvmNetwork(api) || "ethereum"
|
|
315
|
+
);
|
|
316
|
+
} else if (backend === "solana_local") {
|
|
317
|
+
selectedSolanaNetwork = normalizeSolanaNetwork(
|
|
318
|
+
params?.network || selectedSolanaNetwork || defaultSolanaNetwork(api)
|
|
319
|
+
);
|
|
320
|
+
} else if (backend === "wdk_btc_local") {
|
|
321
|
+
selectedBtcNetwork = normalizeBtcNetwork(
|
|
322
|
+
params?.network || selectedBtcNetwork || defaultBtcNetwork(api)
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
const configOverride = effectiveConfigForBackend(api, backend);
|
|
326
|
+
const payload = await callWalletCli(api, "invoke", [
|
|
327
|
+
"--tool",
|
|
328
|
+
backend === "wdk_evm_local" ? "get_evm_network" : "get_wallet_capabilities",
|
|
329
|
+
"--arguments-json",
|
|
330
|
+
JSON.stringify({}),
|
|
331
|
+
], configOverride);
|
|
332
|
+
if (payload?.ok === false) {
|
|
333
|
+
throw new Error(payload?.error || "set_wallet_backend failed");
|
|
334
|
+
}
|
|
335
|
+
selectedWalletBackend = backend;
|
|
336
|
+
return asContent({
|
|
337
|
+
selected_backend: backend,
|
|
338
|
+
selected_wallet: backendLabel(backend),
|
|
339
|
+
selected_network: networkForBackend(api, backend),
|
|
340
|
+
configured_backend: resolveBackend(api),
|
|
341
|
+
session_override_active: true,
|
|
342
|
+
config_file_changed: false,
|
|
343
|
+
usage:
|
|
344
|
+
"Subsequent wallet calls in this OpenClaw plugin session use this wallet backend by default. The startup plugin config remains unchanged.",
|
|
345
|
+
data: payload?.data ?? {},
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (definition.name === "set_evm_network") {
|
|
350
|
+
const network = normalizeSelectableEvmNetwork(params?.network);
|
|
351
|
+
const configOverride = effectiveConfigForBackend(api, "wdk_evm_local");
|
|
352
|
+
configOverride.network = network;
|
|
353
|
+
const payload = await callWalletCli(api, "invoke", [
|
|
354
|
+
"--tool",
|
|
355
|
+
"get_evm_network",
|
|
356
|
+
"--arguments-json",
|
|
357
|
+
JSON.stringify({ network }),
|
|
358
|
+
], configOverride);
|
|
359
|
+
if (payload?.ok === false) {
|
|
360
|
+
throw new Error(payload?.error || "set_evm_network failed");
|
|
361
|
+
}
|
|
362
|
+
selectedWalletBackend = "wdk_evm_local";
|
|
363
|
+
selectedEvmNetwork = network;
|
|
364
|
+
return asContent({
|
|
365
|
+
selected_backend: "wdk_evm_local",
|
|
366
|
+
selected_wallet: "evm",
|
|
367
|
+
selected_network: network,
|
|
368
|
+
session_active_network: network,
|
|
369
|
+
session_override_active: true,
|
|
370
|
+
network_switch_persistent_for_runtime_session: true,
|
|
371
|
+
usage:
|
|
372
|
+
"Subsequent wallet calls in this OpenClaw plugin session use the EVM wallet on this network by default. You can still override a single EVM call with its network parameter.",
|
|
373
|
+
data: payload?.data ?? {},
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const effectiveParams = { ...(params ?? {}) };
|
|
378
|
+
const activeBackend = activeBackendForTool(api, definition.name);
|
|
379
|
+
if (
|
|
380
|
+
activeBackend === "wdk_evm_local" &&
|
|
381
|
+
selectedEvmNetwork &&
|
|
382
|
+
definition.parameters?.properties?.network &&
|
|
383
|
+
effectiveParams.network === undefined
|
|
384
|
+
) {
|
|
385
|
+
effectiveParams.network = selectedEvmNetwork;
|
|
386
|
+
}
|
|
387
|
+
const configOverride = effectiveConfigForBackend(api, activeBackend);
|
|
388
|
+
if (activeBackend === "wdk_evm_local" && effectiveParams.network !== undefined) {
|
|
389
|
+
configOverride.network = normalizeSelectableEvmNetwork(effectiveParams.network);
|
|
390
|
+
}
|
|
391
|
+
const payload = await callWalletCli(api, "invoke", [
|
|
392
|
+
"--tool",
|
|
393
|
+
definition.name,
|
|
394
|
+
"--arguments-json",
|
|
395
|
+
JSON.stringify(effectiveParams),
|
|
396
|
+
], configOverride);
|
|
397
|
+
if (payload?.ok === false) {
|
|
398
|
+
throw new Error(payload?.error || `${definition.name} failed`);
|
|
399
|
+
}
|
|
400
|
+
return asContent(payload?.data ?? {});
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const walletSessionToolDefinitions = [
|
|
406
|
+
{
|
|
407
|
+
name: "get_wallet_capabilities",
|
|
408
|
+
description: "Describe the active wallet backend, chain, network, address, and safety limits. Use set_wallet_backend to switch between Solana, EVM, and Bitcoin instead of editing plugin config.",
|
|
409
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: "get_wallet_address",
|
|
413
|
+
description: "Return the active wallet address for the current session-selected backend.",
|
|
414
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: "get_wallet_balance",
|
|
418
|
+
description: "Get the active wallet overview. Solana and EVM return native assets, discovered token balances, per-asset USD values when available, and total_value_usd. Use set_wallet_backend first when the user asks to switch wallets.",
|
|
419
|
+
parameters: {
|
|
420
|
+
type: "object",
|
|
421
|
+
properties: {
|
|
422
|
+
address: {
|
|
423
|
+
type: "string",
|
|
424
|
+
description: "Optional wallet address override.",
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
additionalProperties: false,
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: "get_active_wallet_backend",
|
|
432
|
+
description: "Show which wallet backend is active in this OpenClaw plugin session and whether it differs from the startup plugin config.",
|
|
433
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
name: "set_wallet_backend",
|
|
437
|
+
description:
|
|
438
|
+
"Switch the active wallet backend for this OpenClaw plugin session. Use this for user requests like 'switch to EVM wallet', 'use Base', 'switch back to Solana', or 'use Bitcoin'. This does not edit code, environment variables, or plugin config.",
|
|
439
|
+
parameters: {
|
|
440
|
+
type: "object",
|
|
441
|
+
properties: {
|
|
442
|
+
backend: {
|
|
443
|
+
type: "string",
|
|
444
|
+
enum: ["solana", "sol", "evm", "ethereum", "base", "bitcoin", "btc"],
|
|
445
|
+
description: "Wallet backend or common alias to make active.",
|
|
446
|
+
},
|
|
447
|
+
network: {
|
|
448
|
+
type: "string",
|
|
449
|
+
description: "Optional network for the selected wallet. Examples: mainnet, devnet, ethereum, base, bitcoin, testnet.",
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
required: ["backend"],
|
|
453
|
+
additionalProperties: false,
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
];
|
|
457
|
+
|
|
458
|
+
const solanaToolDefinitions = [
|
|
459
|
+
{
|
|
460
|
+
name: "get_wallet_capabilities",
|
|
461
|
+
description: "Describe the connected wallet backend, chain, and safety limits.",
|
|
462
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "get_wallet_address",
|
|
466
|
+
description: "Return the configured wallet address for the connected backend.",
|
|
467
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
name: "get_wallet_balance",
|
|
471
|
+
description: "Get the wallet overview: native balance, discovered token balances, per-asset USD values when available, and total_value_usd. Solana token discovery uses RPC; pricing uses Jupiter rather than RPC.",
|
|
472
|
+
parameters: {
|
|
473
|
+
type: "object",
|
|
474
|
+
properties: {
|
|
475
|
+
address: {
|
|
476
|
+
type: "string",
|
|
477
|
+
description: "Optional wallet address override.",
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
additionalProperties: false,
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: "get_lifi_supported_chains",
|
|
485
|
+
description: "List the LI.FI chains currently allowed for OpenClaw cross-chain routing.",
|
|
486
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: "get_lifi_quote",
|
|
490
|
+
description: "Get a read-only LI.FI cross-chain quote for Ethereum/Base/Solana routes. Execution is not enabled by this tool.",
|
|
491
|
+
parameters: {
|
|
492
|
+
type: "object",
|
|
493
|
+
properties: {
|
|
494
|
+
from_chain: { type: "string", description: "Source chain: ethereum, base, solana, or the LI.FI chain id." },
|
|
495
|
+
to_chain: { type: "string", description: "Destination chain: ethereum, base, solana, or the LI.FI chain id." },
|
|
496
|
+
from_token: { type: "string", description: "Source token address. Use native/eth/sol for native tokens." },
|
|
497
|
+
to_token: { type: "string", description: "Destination token address. Use native/eth/sol for native tokens." },
|
|
498
|
+
amount_in_raw: { type: "string", description: "Input amount in token base units as a base-10 integer string." },
|
|
499
|
+
from_address: { type: "string", description: "Optional source wallet address. Defaults to the active wallet when the source chain matches it." },
|
|
500
|
+
to_address: { type: "string", description: "Optional destination wallet address. Defaults to the active wallet when the destination chain matches it." },
|
|
501
|
+
slippage: { type: "number", description: "Optional decimal fraction, for example 0.01 for 1%." },
|
|
502
|
+
allow_bridges: { type: "array", items: { type: "string" } },
|
|
503
|
+
deny_bridges: { type: "array", items: { type: "string" } },
|
|
504
|
+
prefer_bridges: { type: "array", items: { type: "string" } },
|
|
505
|
+
},
|
|
506
|
+
required: ["from_chain", "to_chain", "from_token", "to_token", "amount_in_raw"],
|
|
507
|
+
additionalProperties: false,
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "get_lifi_transfer_status",
|
|
512
|
+
description: "Get LI.FI cross-chain transfer status using a source/destination transaction hash or LI.FI step id.",
|
|
513
|
+
parameters: {
|
|
514
|
+
type: "object",
|
|
515
|
+
properties: {
|
|
516
|
+
tx_hash: { type: "string" },
|
|
517
|
+
bridge: { type: "string" },
|
|
518
|
+
from_chain: { type: "string" },
|
|
519
|
+
to_chain: { type: "string" },
|
|
520
|
+
},
|
|
521
|
+
required: ["tx_hash"],
|
|
522
|
+
additionalProperties: false,
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
name: "get_wallet_portfolio",
|
|
527
|
+
description: "Get the Solana wallet portfolio. This is the detailed equivalent of get_wallet_balance and includes native SOL, non-zero SPL token accounts, USD pricing when available, and total_value_usd.",
|
|
528
|
+
parameters: {
|
|
529
|
+
type: "object",
|
|
530
|
+
properties: {
|
|
531
|
+
address: {
|
|
532
|
+
type: "string",
|
|
533
|
+
description: "Optional wallet address override.",
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
additionalProperties: false,
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "get_solana_token_prices",
|
|
541
|
+
description: "Get current token prices for one or more Solana mint addresses via Jupiter.",
|
|
542
|
+
parameters: {
|
|
543
|
+
type: "object",
|
|
544
|
+
properties: {
|
|
545
|
+
mints: {
|
|
546
|
+
type: "array",
|
|
547
|
+
items: { type: "string" },
|
|
548
|
+
description: "List of Solana token mint addresses.",
|
|
549
|
+
},
|
|
550
|
+
},
|
|
551
|
+
required: ["mints"],
|
|
552
|
+
additionalProperties: false,
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "get_bags_claimable_positions",
|
|
557
|
+
description: "Get claimable Bags fee-share positions for a Solana wallet on mainnet.",
|
|
558
|
+
parameters: {
|
|
559
|
+
type: "object",
|
|
560
|
+
properties: {
|
|
561
|
+
wallet: {
|
|
562
|
+
type: "string",
|
|
563
|
+
description: "Optional wallet address override.",
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
additionalProperties: false,
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: "get_bags_fee_analytics",
|
|
571
|
+
description: "Get Bags fee analytics for a launched token, with optional claim event history.",
|
|
572
|
+
parameters: {
|
|
573
|
+
type: "object",
|
|
574
|
+
properties: {
|
|
575
|
+
token_mint: {
|
|
576
|
+
type: "string",
|
|
577
|
+
description: "Launched token mint address.",
|
|
578
|
+
},
|
|
579
|
+
include_claim_events: {
|
|
580
|
+
type: "boolean",
|
|
581
|
+
description: "If true, also fetch claim event history.",
|
|
582
|
+
},
|
|
583
|
+
mode: {
|
|
584
|
+
type: "string",
|
|
585
|
+
enum: ["offset", "time"],
|
|
586
|
+
},
|
|
587
|
+
limit: { type: "integer" },
|
|
588
|
+
offset: { type: "integer" },
|
|
589
|
+
from_ts: { type: "integer" },
|
|
590
|
+
to_ts: { type: "integer" },
|
|
591
|
+
},
|
|
592
|
+
required: ["token_mint"],
|
|
593
|
+
additionalProperties: false,
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
name: "get_jupiter_earn_tokens",
|
|
598
|
+
description: "List Jupiter Earn vault tokens currently supported on Solana mainnet.",
|
|
599
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: "get_jupiter_earn_positions",
|
|
603
|
+
description: "Get Jupiter Earn positions for one or more Solana wallet addresses on mainnet.",
|
|
604
|
+
parameters: {
|
|
605
|
+
type: "object",
|
|
606
|
+
properties: {
|
|
607
|
+
users: {
|
|
608
|
+
type: "array",
|
|
609
|
+
items: { type: "string" },
|
|
610
|
+
description: "Optional list of Solana wallet addresses. If omitted, use the configured wallet address.",
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
additionalProperties: false,
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: "get_jupiter_earn_earnings",
|
|
618
|
+
description: "Get Jupiter Earn earnings for a wallet and one or more position addresses on mainnet.",
|
|
619
|
+
parameters: {
|
|
620
|
+
type: "object",
|
|
621
|
+
properties: {
|
|
622
|
+
user: {
|
|
623
|
+
type: "string",
|
|
624
|
+
description: "Optional Solana wallet address override.",
|
|
625
|
+
},
|
|
626
|
+
positions: {
|
|
627
|
+
type: "array",
|
|
628
|
+
items: { type: "string" },
|
|
629
|
+
description: "List of Jupiter Earn position addresses.",
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
required: ["positions"],
|
|
633
|
+
additionalProperties: false,
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
name: "get_kamino_lend_markets",
|
|
638
|
+
description: "List Kamino lending markets currently available on Solana mainnet.",
|
|
639
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
name: "get_kamino_lend_market_reserves",
|
|
643
|
+
description: "Get reserve metrics for one Kamino lending market on Solana mainnet.",
|
|
644
|
+
parameters: {
|
|
645
|
+
type: "object",
|
|
646
|
+
properties: {
|
|
647
|
+
market: {
|
|
648
|
+
type: "string",
|
|
649
|
+
description: "Kamino market address.",
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
required: ["market"],
|
|
653
|
+
additionalProperties: false,
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: "get_kamino_lend_user_obligations",
|
|
658
|
+
description: "Get Kamino obligations for a wallet in a specific Kamino market on Solana mainnet.",
|
|
659
|
+
parameters: {
|
|
660
|
+
type: "object",
|
|
661
|
+
properties: {
|
|
662
|
+
market: {
|
|
663
|
+
type: "string",
|
|
664
|
+
description: "Kamino market address.",
|
|
665
|
+
},
|
|
666
|
+
user: {
|
|
667
|
+
type: "string",
|
|
668
|
+
description: "Optional Solana wallet address override.",
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
required: ["market"],
|
|
672
|
+
additionalProperties: false,
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: "get_kamino_lend_user_rewards",
|
|
677
|
+
description: "Get Kamino rewards summary for a Solana wallet on mainnet.",
|
|
678
|
+
parameters: {
|
|
679
|
+
type: "object",
|
|
680
|
+
properties: {
|
|
681
|
+
user: {
|
|
682
|
+
type: "string",
|
|
683
|
+
description: "Optional Solana wallet address override.",
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
additionalProperties: false,
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
name: "sign_wallet_message",
|
|
691
|
+
description: "Sign an arbitrary message with the connected wallet after explicit approval.",
|
|
692
|
+
optional: true,
|
|
693
|
+
parameters: {
|
|
694
|
+
type: "object",
|
|
695
|
+
properties: {
|
|
696
|
+
message: { type: "string" },
|
|
697
|
+
purpose: { type: "string" },
|
|
698
|
+
user_confirmed: { type: "boolean" },
|
|
699
|
+
},
|
|
700
|
+
required: ["message", "purpose", "user_confirmed"],
|
|
701
|
+
additionalProperties: false,
|
|
702
|
+
},
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
name: "transfer_sol",
|
|
706
|
+
description: "Preview, prepare, or execute a native SOL transfer. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
707
|
+
optional: true,
|
|
708
|
+
parameters: {
|
|
709
|
+
type: "object",
|
|
710
|
+
properties: {
|
|
711
|
+
recipient: { type: "string" },
|
|
712
|
+
amount: { type: "number" },
|
|
713
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
714
|
+
purpose: { type: "string" },
|
|
715
|
+
user_intent: { type: "boolean" },
|
|
716
|
+
approval_token: { type: "string" },
|
|
717
|
+
},
|
|
718
|
+
required: ["recipient", "amount", "mode", "purpose"],
|
|
719
|
+
additionalProperties: false,
|
|
720
|
+
},
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
name: "transfer_spl_token",
|
|
724
|
+
description: "Preview, prepare, or execute an SPL token transfer by mint address. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
725
|
+
optional: true,
|
|
726
|
+
parameters: {
|
|
727
|
+
type: "object",
|
|
728
|
+
properties: {
|
|
729
|
+
recipient: { type: "string" },
|
|
730
|
+
mint: { type: "string" },
|
|
731
|
+
amount: { type: "number" },
|
|
732
|
+
decimals: { type: "integer" },
|
|
733
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
734
|
+
purpose: { type: "string" },
|
|
735
|
+
user_intent: { type: "boolean" },
|
|
736
|
+
approval_token: { type: "string" },
|
|
737
|
+
},
|
|
738
|
+
required: ["recipient", "mint", "amount", "mode", "purpose"],
|
|
739
|
+
additionalProperties: false,
|
|
740
|
+
},
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
name: "swap_solana_tokens",
|
|
744
|
+
description: "Preview, prepare, or execute a Solana token swap via Jupiter. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
745
|
+
optional: true,
|
|
746
|
+
parameters: {
|
|
747
|
+
type: "object",
|
|
748
|
+
properties: {
|
|
749
|
+
input_mint: { type: "string" },
|
|
750
|
+
output_mint: { type: "string" },
|
|
751
|
+
amount: { type: "number" },
|
|
752
|
+
slippage_bps: { type: "integer" },
|
|
753
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
754
|
+
purpose: { type: "string" },
|
|
755
|
+
user_intent: { type: "boolean" },
|
|
756
|
+
approval_token: { type: "string" },
|
|
757
|
+
},
|
|
758
|
+
required: ["input_mint", "output_mint", "amount", "mode", "purpose"],
|
|
759
|
+
additionalProperties: false,
|
|
760
|
+
},
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
name: "swap_solana_lifi_cross_chain_tokens",
|
|
764
|
+
description: "Preview, prepare, or execute a Solana-origin cross-chain swap through LI.FI. This currently supports Solana as the source chain and ethereum/base as the destination chain. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
765
|
+
optional: true,
|
|
766
|
+
parameters: {
|
|
767
|
+
type: "object",
|
|
768
|
+
properties: {
|
|
769
|
+
input_token: { type: "string" },
|
|
770
|
+
destination_chain: { type: "string", enum: ["ethereum", "base", "1", "8453"] },
|
|
771
|
+
output_token: { type: "string" },
|
|
772
|
+
destination_address: { type: "string" },
|
|
773
|
+
amount_in_raw: { type: "string" },
|
|
774
|
+
slippage: { type: "number" },
|
|
775
|
+
allow_bridges: { type: "array", items: { type: "string" } },
|
|
776
|
+
deny_bridges: { type: "array", items: { type: "string" } },
|
|
777
|
+
prefer_bridges: { type: "array", items: { type: "string" } },
|
|
778
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
779
|
+
purpose: { type: "string" },
|
|
780
|
+
user_intent: { type: "boolean" },
|
|
781
|
+
approval_token: { type: "string" },
|
|
782
|
+
},
|
|
783
|
+
required: [
|
|
784
|
+
"input_token",
|
|
785
|
+
"destination_chain",
|
|
786
|
+
"output_token",
|
|
787
|
+
"destination_address",
|
|
788
|
+
"amount_in_raw",
|
|
789
|
+
"mode",
|
|
790
|
+
"purpose",
|
|
791
|
+
],
|
|
792
|
+
additionalProperties: false,
|
|
793
|
+
},
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
name: "claim_bags_fees",
|
|
797
|
+
description: "Preview, prepare, or execute a Bags fee-share claim for the connected wallet on mainnet. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
798
|
+
optional: true,
|
|
799
|
+
parameters: {
|
|
800
|
+
type: "object",
|
|
801
|
+
properties: {
|
|
802
|
+
token_mint: { type: "string" },
|
|
803
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
804
|
+
purpose: { type: "string" },
|
|
805
|
+
user_intent: { type: "boolean" },
|
|
806
|
+
approval_token: { type: "string" },
|
|
807
|
+
},
|
|
808
|
+
required: ["token_mint", "mode", "purpose"],
|
|
809
|
+
additionalProperties: false,
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
name: "launch_bags_token",
|
|
814
|
+
description: "Preview, prepare, or execute a Bags token launch with fee-share config on mainnet. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
815
|
+
optional: true,
|
|
816
|
+
parameters: {
|
|
817
|
+
type: "object",
|
|
818
|
+
properties: {
|
|
819
|
+
name: { type: "string" },
|
|
820
|
+
symbol: { type: "string" },
|
|
821
|
+
description: { type: "string" },
|
|
822
|
+
image_url: { type: "string" },
|
|
823
|
+
website: { type: "string" },
|
|
824
|
+
twitter: { type: "string" },
|
|
825
|
+
telegram: { type: "string" },
|
|
826
|
+
discord: { type: "string" },
|
|
827
|
+
base_mint: { type: "string" },
|
|
828
|
+
claimers: {
|
|
829
|
+
type: "array",
|
|
830
|
+
items: { type: "string" },
|
|
831
|
+
},
|
|
832
|
+
basis_points: {
|
|
833
|
+
type: "array",
|
|
834
|
+
items: { type: "integer" },
|
|
835
|
+
},
|
|
836
|
+
initial_buy_sol: { type: "number" },
|
|
837
|
+
bags_config_type: { type: "integer" },
|
|
838
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
839
|
+
purpose: { type: "string" },
|
|
840
|
+
user_intent: { type: "boolean" },
|
|
841
|
+
approval_token: { type: "string" },
|
|
842
|
+
},
|
|
843
|
+
required: [
|
|
844
|
+
"name",
|
|
845
|
+
"symbol",
|
|
846
|
+
"description",
|
|
847
|
+
"base_mint",
|
|
848
|
+
"claimers",
|
|
849
|
+
"basis_points",
|
|
850
|
+
"initial_buy_sol",
|
|
851
|
+
"mode",
|
|
852
|
+
"purpose",
|
|
853
|
+
],
|
|
854
|
+
additionalProperties: false,
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
name: "jupiter_earn_deposit",
|
|
859
|
+
description: "Preview, prepare, or execute a Jupiter Earn deposit using a raw base-unit amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
860
|
+
optional: true,
|
|
861
|
+
parameters: {
|
|
862
|
+
type: "object",
|
|
863
|
+
properties: {
|
|
864
|
+
asset: { type: "string" },
|
|
865
|
+
amount_raw: { type: "string" },
|
|
866
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
867
|
+
purpose: { type: "string" },
|
|
868
|
+
user_intent: { type: "boolean" },
|
|
869
|
+
approval_token: { type: "string" },
|
|
870
|
+
},
|
|
871
|
+
required: ["asset", "amount_raw", "mode", "purpose"],
|
|
872
|
+
additionalProperties: false,
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
name: "jupiter_earn_withdraw",
|
|
877
|
+
description: "Preview, prepare, or execute a Jupiter Earn withdraw using a raw base-unit amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
878
|
+
optional: true,
|
|
879
|
+
parameters: {
|
|
880
|
+
type: "object",
|
|
881
|
+
properties: {
|
|
882
|
+
asset: { type: "string" },
|
|
883
|
+
amount_raw: { type: "string" },
|
|
884
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
885
|
+
purpose: { type: "string" },
|
|
886
|
+
user_intent: { type: "boolean" },
|
|
887
|
+
approval_token: { type: "string" },
|
|
888
|
+
},
|
|
889
|
+
required: ["asset", "amount_raw", "mode", "purpose"],
|
|
890
|
+
additionalProperties: false,
|
|
891
|
+
},
|
|
892
|
+
},
|
|
893
|
+
{
|
|
894
|
+
name: "kamino_lend_deposit",
|
|
895
|
+
description: "Preview, prepare, or execute a Kamino lending deposit using a decimal token amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
896
|
+
optional: true,
|
|
897
|
+
parameters: {
|
|
898
|
+
type: "object",
|
|
899
|
+
properties: {
|
|
900
|
+
market: { type: "string" },
|
|
901
|
+
reserve: { type: "string" },
|
|
902
|
+
amount_ui: { type: "string" },
|
|
903
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
904
|
+
purpose: { type: "string" },
|
|
905
|
+
user_intent: { type: "boolean" },
|
|
906
|
+
approval_token: { type: "string" },
|
|
907
|
+
},
|
|
908
|
+
required: ["market", "reserve", "amount_ui", "mode", "purpose"],
|
|
909
|
+
additionalProperties: false,
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: "kamino_lend_withdraw",
|
|
914
|
+
description: "Preview, prepare, or execute a Kamino lending withdraw using a decimal token amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
915
|
+
optional: true,
|
|
916
|
+
parameters: {
|
|
917
|
+
type: "object",
|
|
918
|
+
properties: {
|
|
919
|
+
market: { type: "string" },
|
|
920
|
+
reserve: { type: "string" },
|
|
921
|
+
amount_ui: { type: "string" },
|
|
922
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
923
|
+
purpose: { type: "string" },
|
|
924
|
+
user_intent: { type: "boolean" },
|
|
925
|
+
approval_token: { type: "string" },
|
|
926
|
+
},
|
|
927
|
+
required: ["market", "reserve", "amount_ui", "mode", "purpose"],
|
|
928
|
+
additionalProperties: false,
|
|
929
|
+
},
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
name: "kamino_lend_borrow",
|
|
933
|
+
description: "Preview, prepare, or execute a Kamino lending borrow using a decimal token amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
934
|
+
optional: true,
|
|
935
|
+
parameters: {
|
|
936
|
+
type: "object",
|
|
937
|
+
properties: {
|
|
938
|
+
market: { type: "string" },
|
|
939
|
+
reserve: { type: "string" },
|
|
940
|
+
amount_ui: { type: "string" },
|
|
941
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
942
|
+
purpose: { type: "string" },
|
|
943
|
+
user_intent: { type: "boolean" },
|
|
944
|
+
approval_token: { type: "string" },
|
|
945
|
+
},
|
|
946
|
+
required: ["market", "reserve", "amount_ui", "mode", "purpose"],
|
|
947
|
+
additionalProperties: false,
|
|
948
|
+
},
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
name: "kamino_lend_repay",
|
|
952
|
+
description: "Preview, prepare, or execute a Kamino lending repay using a decimal token amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
953
|
+
optional: true,
|
|
954
|
+
parameters: {
|
|
955
|
+
type: "object",
|
|
956
|
+
properties: {
|
|
957
|
+
market: { type: "string" },
|
|
958
|
+
reserve: { type: "string" },
|
|
959
|
+
amount_ui: { type: "string" },
|
|
960
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
961
|
+
purpose: { type: "string" },
|
|
962
|
+
user_intent: { type: "boolean" },
|
|
963
|
+
approval_token: { type: "string" },
|
|
964
|
+
},
|
|
965
|
+
required: ["market", "reserve", "amount_ui", "mode", "purpose"],
|
|
966
|
+
additionalProperties: false,
|
|
967
|
+
},
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
name: "close_empty_token_accounts",
|
|
971
|
+
description: "Preview or execute closing zero-balance token accounts. Execute requires a host-issued approval token bound to the previewed operation.",
|
|
972
|
+
optional: true,
|
|
973
|
+
parameters: {
|
|
974
|
+
type: "object",
|
|
975
|
+
properties: {
|
|
976
|
+
limit: { type: "integer" },
|
|
977
|
+
mode: { type: "string", enum: ["preview", "execute"] },
|
|
978
|
+
purpose: { type: "string" },
|
|
979
|
+
approval_token: { type: "string" },
|
|
980
|
+
},
|
|
981
|
+
required: ["limit", "mode", "purpose"],
|
|
982
|
+
additionalProperties: false,
|
|
983
|
+
},
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
name: "request_devnet_airdrop",
|
|
987
|
+
description: "Request devnet or testnet SOL from the faucet.",
|
|
988
|
+
optional: true,
|
|
989
|
+
parameters: {
|
|
990
|
+
type: "object",
|
|
991
|
+
properties: {
|
|
992
|
+
amount: { type: "number" },
|
|
993
|
+
},
|
|
994
|
+
required: ["amount"],
|
|
995
|
+
additionalProperties: false,
|
|
996
|
+
},
|
|
997
|
+
},
|
|
998
|
+
];
|
|
999
|
+
|
|
1000
|
+
const btcToolDefinitions = [
|
|
1001
|
+
{
|
|
1002
|
+
name: "get_wallet_capabilities",
|
|
1003
|
+
description: "Describe the connected wallet backend, chain, and safety limits.",
|
|
1004
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: "get_wallet_address",
|
|
1008
|
+
description: "Return the configured wallet address for the connected backend.",
|
|
1009
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
1010
|
+
},
|
|
1011
|
+
{
|
|
1012
|
+
name: "get_wallet_balance",
|
|
1013
|
+
description: "Get the native BTC balance for the configured wallet address.",
|
|
1014
|
+
parameters: {
|
|
1015
|
+
type: "object",
|
|
1016
|
+
properties: {
|
|
1017
|
+
address: {
|
|
1018
|
+
type: "string",
|
|
1019
|
+
description: "Optional wallet address override.",
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
additionalProperties: false,
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
name: "get_btc_transfer_history",
|
|
1027
|
+
description: "Get BTC transfer history for the configured wallet account.",
|
|
1028
|
+
parameters: {
|
|
1029
|
+
type: "object",
|
|
1030
|
+
properties: {
|
|
1031
|
+
direction: { type: "string", enum: ["incoming", "outgoing", "all"] },
|
|
1032
|
+
limit: { type: "integer" },
|
|
1033
|
+
skip: { type: "integer" },
|
|
1034
|
+
},
|
|
1035
|
+
additionalProperties: false,
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
name: "get_btc_fee_rates",
|
|
1040
|
+
description: "Get current BTC fee-rate suggestions from the local BTC wallet service.",
|
|
1041
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
name: "get_btc_max_spendable",
|
|
1045
|
+
description: "Estimate the maximum BTC spendable amount after fees.",
|
|
1046
|
+
parameters: {
|
|
1047
|
+
type: "object",
|
|
1048
|
+
properties: {
|
|
1049
|
+
fee_rate: { type: "integer" },
|
|
1050
|
+
},
|
|
1051
|
+
additionalProperties: false,
|
|
1052
|
+
},
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
name: "transfer_btc",
|
|
1056
|
+
description: "Preview, prepare, or execute a BTC transfer in satoshis. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1057
|
+
optional: true,
|
|
1058
|
+
parameters: {
|
|
1059
|
+
type: "object",
|
|
1060
|
+
properties: {
|
|
1061
|
+
recipient: { type: "string" },
|
|
1062
|
+
amount_sats: { type: "integer" },
|
|
1063
|
+
fee_rate: { type: "integer" },
|
|
1064
|
+
confirmation_target: { type: "integer" },
|
|
1065
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1066
|
+
purpose: { type: "string" },
|
|
1067
|
+
user_intent: { type: "boolean" },
|
|
1068
|
+
approval_token: { type: "string" },
|
|
1069
|
+
},
|
|
1070
|
+
required: ["recipient", "amount_sats", "mode", "purpose"],
|
|
1071
|
+
additionalProperties: false,
|
|
1072
|
+
},
|
|
1073
|
+
},
|
|
1074
|
+
];
|
|
1075
|
+
|
|
1076
|
+
const evmToolDefinitions = [
|
|
1077
|
+
{
|
|
1078
|
+
name: "get_wallet_capabilities",
|
|
1079
|
+
description: "Describe the connected wallet backend, chain, and safety limits.",
|
|
1080
|
+
parameters: {
|
|
1081
|
+
type: "object",
|
|
1082
|
+
properties: {
|
|
1083
|
+
network: {
|
|
1084
|
+
type: "string",
|
|
1085
|
+
enum: ["ethereum", "base"],
|
|
1086
|
+
description: "Optional EVM network override for this request.",
|
|
1087
|
+
},
|
|
1088
|
+
},
|
|
1089
|
+
additionalProperties: false,
|
|
1090
|
+
},
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
name: "get_wallet_address",
|
|
1094
|
+
description: "Return the configured wallet address for the connected backend.",
|
|
1095
|
+
parameters: {
|
|
1096
|
+
type: "object",
|
|
1097
|
+
properties: {
|
|
1098
|
+
network: {
|
|
1099
|
+
type: "string",
|
|
1100
|
+
enum: ["ethereum", "base"],
|
|
1101
|
+
description: "Optional EVM network override for this request.",
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
additionalProperties: false,
|
|
1105
|
+
},
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
name: "get_wallet_balance",
|
|
1109
|
+
description: "Get the EVM wallet overview: native asset, discovered ERC-20 balances, per-asset USD values, assets, balance_usd, and total_value_usd when available. Pricing uses aggregator APIs rather than RPC.",
|
|
1110
|
+
parameters: {
|
|
1111
|
+
type: "object",
|
|
1112
|
+
properties: {
|
|
1113
|
+
address: {
|
|
1114
|
+
type: "string",
|
|
1115
|
+
description: "Optional wallet address override.",
|
|
1116
|
+
},
|
|
1117
|
+
network: {
|
|
1118
|
+
type: "string",
|
|
1119
|
+
enum: ["ethereum", "base"],
|
|
1120
|
+
description: "Optional EVM network override for this request.",
|
|
1121
|
+
},
|
|
1122
|
+
},
|
|
1123
|
+
additionalProperties: false,
|
|
1124
|
+
},
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
name: "get_lifi_supported_chains",
|
|
1128
|
+
description: "List the LI.FI chains currently allowed for OpenClaw cross-chain routing.",
|
|
1129
|
+
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: "get_lifi_quote",
|
|
1133
|
+
description: "Get a read-only LI.FI cross-chain quote for Ethereum/Base/Solana routes. Execution is not enabled by this tool.",
|
|
1134
|
+
parameters: {
|
|
1135
|
+
type: "object",
|
|
1136
|
+
properties: {
|
|
1137
|
+
from_chain: { type: "string", description: "Source chain: ethereum, base, solana, or the LI.FI chain id." },
|
|
1138
|
+
to_chain: { type: "string", description: "Destination chain: ethereum, base, solana, or the LI.FI chain id." },
|
|
1139
|
+
from_token: { type: "string", description: "Source token address. Use native/eth/sol for native tokens." },
|
|
1140
|
+
to_token: { type: "string", description: "Destination token address. Use native/eth/sol for native tokens." },
|
|
1141
|
+
amount_in_raw: { type: "string", description: "Input amount in token base units as a base-10 integer string." },
|
|
1142
|
+
from_address: { type: "string", description: "Optional source wallet address. Defaults to the active wallet when the source chain matches it." },
|
|
1143
|
+
to_address: { type: "string", description: "Optional destination wallet address. Defaults to the active wallet when the destination chain matches it." },
|
|
1144
|
+
slippage: { type: "number", description: "Optional decimal fraction, for example 0.01 for 1%." },
|
|
1145
|
+
allow_bridges: { type: "array", items: { type: "string" } },
|
|
1146
|
+
deny_bridges: { type: "array", items: { type: "string" } },
|
|
1147
|
+
prefer_bridges: { type: "array", items: { type: "string" } },
|
|
1148
|
+
},
|
|
1149
|
+
required: ["from_chain", "to_chain", "from_token", "to_token", "amount_in_raw"],
|
|
1150
|
+
additionalProperties: false,
|
|
1151
|
+
},
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
name: "get_lifi_transfer_status",
|
|
1155
|
+
description: "Get LI.FI cross-chain transfer status using a source/destination transaction hash or LI.FI step id.",
|
|
1156
|
+
parameters: {
|
|
1157
|
+
type: "object",
|
|
1158
|
+
properties: {
|
|
1159
|
+
tx_hash: { type: "string" },
|
|
1160
|
+
bridge: { type: "string" },
|
|
1161
|
+
from_chain: { type: "string" },
|
|
1162
|
+
to_chain: { type: "string" },
|
|
1163
|
+
},
|
|
1164
|
+
required: ["tx_hash"],
|
|
1165
|
+
additionalProperties: false,
|
|
1166
|
+
},
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
name: "get_evm_network",
|
|
1170
|
+
description: "Show the effective EVM network context, available networks, and swap-supported networks.",
|
|
1171
|
+
parameters: {
|
|
1172
|
+
type: "object",
|
|
1173
|
+
properties: {
|
|
1174
|
+
network: {
|
|
1175
|
+
type: "string",
|
|
1176
|
+
enum: ["ethereum", "base"],
|
|
1177
|
+
},
|
|
1178
|
+
},
|
|
1179
|
+
additionalProperties: false,
|
|
1180
|
+
},
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
name: "set_evm_network",
|
|
1184
|
+
description:
|
|
1185
|
+
"Select the active EVM network for subsequent wallet tool calls in this OpenClaw plugin session. Use this to switch between ethereum and base instead of editing code or plugin configuration.",
|
|
1186
|
+
parameters: {
|
|
1187
|
+
type: "object",
|
|
1188
|
+
properties: {
|
|
1189
|
+
network: {
|
|
1190
|
+
type: "string",
|
|
1191
|
+
enum: ["ethereum", "base"],
|
|
1192
|
+
description: "EVM network to make active for subsequent calls.",
|
|
1193
|
+
},
|
|
1194
|
+
},
|
|
1195
|
+
required: ["network"],
|
|
1196
|
+
additionalProperties: false,
|
|
1197
|
+
},
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
name: "get_evm_token_balance",
|
|
1201
|
+
description: "Get the ERC-20 balance for the configured EVM wallet account.",
|
|
1202
|
+
parameters: {
|
|
1203
|
+
type: "object",
|
|
1204
|
+
properties: {
|
|
1205
|
+
token_address: { type: "string" },
|
|
1206
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1207
|
+
},
|
|
1208
|
+
required: ["token_address"],
|
|
1209
|
+
additionalProperties: false,
|
|
1210
|
+
},
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
name: "get_evm_token_metadata",
|
|
1214
|
+
description: "Get ERC-20 token metadata for a contract address on the active EVM network.",
|
|
1215
|
+
parameters: {
|
|
1216
|
+
type: "object",
|
|
1217
|
+
properties: {
|
|
1218
|
+
token_address: { type: "string" },
|
|
1219
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1220
|
+
},
|
|
1221
|
+
required: ["token_address"],
|
|
1222
|
+
additionalProperties: false,
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: "get_evm_fee_rates",
|
|
1227
|
+
description: "Get current EVM fee-rate suggestions for the active network.",
|
|
1228
|
+
parameters: {
|
|
1229
|
+
type: "object",
|
|
1230
|
+
properties: {
|
|
1231
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1232
|
+
},
|
|
1233
|
+
additionalProperties: false,
|
|
1234
|
+
},
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
name: "get_evm_transaction_receipt",
|
|
1238
|
+
description: "Get the transaction receipt for a broadcast EVM transaction hash.",
|
|
1239
|
+
parameters: {
|
|
1240
|
+
type: "object",
|
|
1241
|
+
properties: {
|
|
1242
|
+
tx_hash: { type: "string" },
|
|
1243
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1244
|
+
},
|
|
1245
|
+
required: ["tx_hash"],
|
|
1246
|
+
additionalProperties: false,
|
|
1247
|
+
},
|
|
1248
|
+
},
|
|
1249
|
+
{
|
|
1250
|
+
name: "get_evm_aave_account",
|
|
1251
|
+
description: "Get read-only Aave V3 account data for the configured EVM wallet on supported mainnet networks.",
|
|
1252
|
+
parameters: {
|
|
1253
|
+
type: "object",
|
|
1254
|
+
properties: {
|
|
1255
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1256
|
+
},
|
|
1257
|
+
additionalProperties: false,
|
|
1258
|
+
},
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
name: "get_evm_aave_reserves",
|
|
1262
|
+
description: "Get the read-only Aave V3 reserve catalog for the configured EVM network, including reserve flags, pricing, and liquidity metadata.",
|
|
1263
|
+
parameters: {
|
|
1264
|
+
type: "object",
|
|
1265
|
+
properties: {
|
|
1266
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1267
|
+
},
|
|
1268
|
+
additionalProperties: false,
|
|
1269
|
+
},
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
name: "get_evm_aave_positions",
|
|
1273
|
+
description: "Get read-only Aave V3 per-reserve positions for the configured EVM wallet, including supplied and borrowed balances on supported mainnet networks.",
|
|
1274
|
+
parameters: {
|
|
1275
|
+
type: "object",
|
|
1276
|
+
properties: {
|
|
1277
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1278
|
+
},
|
|
1279
|
+
additionalProperties: false,
|
|
1280
|
+
},
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
name: "manage_evm_aave_position",
|
|
1284
|
+
description: "Preview, prepare, or execute a narrow Aave V3 lending operation on supported EVM mainnet networks. Supported operations are supply, withdraw, borrow, and repay. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1285
|
+
optional: true,
|
|
1286
|
+
parameters: {
|
|
1287
|
+
type: "object",
|
|
1288
|
+
properties: {
|
|
1289
|
+
operation: { type: "string", enum: ["supply", "withdraw", "borrow", "repay"] },
|
|
1290
|
+
token_address: { type: "string" },
|
|
1291
|
+
amount_raw: { type: "string" },
|
|
1292
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1293
|
+
purpose: { type: "string" },
|
|
1294
|
+
user_intent: { type: "boolean" },
|
|
1295
|
+
approval_token: { type: "string" },
|
|
1296
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1297
|
+
},
|
|
1298
|
+
required: ["operation", "token_address", "amount_raw", "mode", "purpose"],
|
|
1299
|
+
additionalProperties: false,
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
name: "get_evm_lido_overview",
|
|
1304
|
+
description: "Get the read-only Lido staking overview for the configured EVM wallet on supported networks, including contract addresses and sample wrap rates.",
|
|
1305
|
+
parameters: {
|
|
1306
|
+
type: "object",
|
|
1307
|
+
properties: {
|
|
1308
|
+
network: { type: "string", enum: ["ethereum"] },
|
|
1309
|
+
},
|
|
1310
|
+
additionalProperties: false,
|
|
1311
|
+
},
|
|
1312
|
+
},
|
|
1313
|
+
{
|
|
1314
|
+
name: "get_evm_lido_positions",
|
|
1315
|
+
description: "Get read-only Lido positions for the configured EVM wallet, including stETH, wstETH, and stETH-equivalent balances.",
|
|
1316
|
+
parameters: {
|
|
1317
|
+
type: "object",
|
|
1318
|
+
properties: {
|
|
1319
|
+
network: { type: "string", enum: ["ethereum"] },
|
|
1320
|
+
},
|
|
1321
|
+
additionalProperties: false,
|
|
1322
|
+
},
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
name: "manage_evm_lido_position",
|
|
1326
|
+
description: "Preview, prepare, or execute a narrow Lido staking operation on Ethereum mainnet. Supported operations are stake_eth_for_wsteth, wrap_steth, and unwrap_wsteth. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1327
|
+
optional: true,
|
|
1328
|
+
parameters: {
|
|
1329
|
+
type: "object",
|
|
1330
|
+
properties: {
|
|
1331
|
+
operation: { type: "string", enum: ["stake_eth_for_wsteth", "wrap_steth", "unwrap_wsteth"] },
|
|
1332
|
+
amount_raw: { type: "string" },
|
|
1333
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1334
|
+
purpose: { type: "string" },
|
|
1335
|
+
user_intent: { type: "boolean" },
|
|
1336
|
+
approval_token: { type: "string" },
|
|
1337
|
+
network: { type: "string", enum: ["ethereum"] },
|
|
1338
|
+
},
|
|
1339
|
+
required: ["operation", "amount_raw", "mode", "purpose"],
|
|
1340
|
+
additionalProperties: false,
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
name: "get_evm_lido_withdrawal_requests",
|
|
1345
|
+
description: "Get read-only Lido withdrawal queue requests for the configured EVM wallet, including finalized and claimable request statuses.",
|
|
1346
|
+
parameters: {
|
|
1347
|
+
type: "object",
|
|
1348
|
+
properties: {
|
|
1349
|
+
network: { type: "string", enum: ["ethereum"] },
|
|
1350
|
+
},
|
|
1351
|
+
additionalProperties: false,
|
|
1352
|
+
},
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
name: "manage_evm_lido_withdrawal",
|
|
1356
|
+
description: "Preview, prepare, or execute a narrow Lido withdrawal queue operation on Ethereum mainnet. Supported operations are request_withdrawal_steth, request_withdrawal_wsteth, and claim_withdrawal. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1357
|
+
optional: true,
|
|
1358
|
+
parameters: {
|
|
1359
|
+
type: "object",
|
|
1360
|
+
properties: {
|
|
1361
|
+
operation: {
|
|
1362
|
+
type: "string",
|
|
1363
|
+
enum: ["request_withdrawal_steth", "request_withdrawal_wsteth", "claim_withdrawal"],
|
|
1364
|
+
},
|
|
1365
|
+
amount_raw: { type: "string" },
|
|
1366
|
+
request_id: { type: "string" },
|
|
1367
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1368
|
+
purpose: { type: "string" },
|
|
1369
|
+
user_intent: { type: "boolean" },
|
|
1370
|
+
approval_token: { type: "string" },
|
|
1371
|
+
network: { type: "string", enum: ["ethereum"] },
|
|
1372
|
+
},
|
|
1373
|
+
required: ["operation", "mode", "purpose"],
|
|
1374
|
+
additionalProperties: false,
|
|
1375
|
+
},
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
name: "get_evm_swap_quote",
|
|
1379
|
+
description: "Get a read-only Velora quote for an ERC-20 to ERC-20 swap on supported EVM mainnet networks. This does not approve or execute a swap.",
|
|
1380
|
+
parameters: {
|
|
1381
|
+
type: "object",
|
|
1382
|
+
properties: {
|
|
1383
|
+
token_in: { type: "string" },
|
|
1384
|
+
token_out: { type: "string" },
|
|
1385
|
+
amount_in_raw: { type: "string" },
|
|
1386
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1387
|
+
},
|
|
1388
|
+
required: ["token_in", "token_out", "amount_in_raw"],
|
|
1389
|
+
additionalProperties: false,
|
|
1390
|
+
},
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
name: "swap_evm_tokens",
|
|
1394
|
+
description: "Preview, prepare, or execute an ERC-20 to ERC-20 swap through Velora on supported EVM mainnet networks. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1395
|
+
optional: true,
|
|
1396
|
+
parameters: {
|
|
1397
|
+
type: "object",
|
|
1398
|
+
properties: {
|
|
1399
|
+
token_in: { type: "string" },
|
|
1400
|
+
token_out: { type: "string" },
|
|
1401
|
+
amount_in_raw: { type: "string" },
|
|
1402
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1403
|
+
purpose: { type: "string" },
|
|
1404
|
+
user_intent: { type: "boolean" },
|
|
1405
|
+
approval_token: { type: "string" },
|
|
1406
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1407
|
+
},
|
|
1408
|
+
required: ["token_in", "token_out", "amount_in_raw", "mode", "purpose"],
|
|
1409
|
+
additionalProperties: false,
|
|
1410
|
+
},
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
name: "swap_evm_lifi_cross_chain_tokens",
|
|
1414
|
+
description: "Preview, prepare, or execute an EVM-origin cross-chain swap through LI.FI. This currently supports ethereum/base as the source network and ethereum/base/solana as the destination chain. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1415
|
+
optional: true,
|
|
1416
|
+
parameters: {
|
|
1417
|
+
type: "object",
|
|
1418
|
+
properties: {
|
|
1419
|
+
token_in: { type: "string" },
|
|
1420
|
+
destination_chain: { type: "string", enum: ["ethereum", "base", "solana", "1", "8453", "1151111081099710"] },
|
|
1421
|
+
output_token: { type: "string" },
|
|
1422
|
+
destination_address: { type: "string" },
|
|
1423
|
+
amount_in_raw: { type: "string" },
|
|
1424
|
+
slippage: { type: "number" },
|
|
1425
|
+
allow_bridges: { type: "array", items: { type: "string" } },
|
|
1426
|
+
deny_bridges: { type: "array", items: { type: "string" } },
|
|
1427
|
+
prefer_bridges: { type: "array", items: { type: "string" } },
|
|
1428
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1429
|
+
purpose: { type: "string" },
|
|
1430
|
+
user_intent: { type: "boolean" },
|
|
1431
|
+
approval_token: { type: "string" },
|
|
1432
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1433
|
+
},
|
|
1434
|
+
required: [
|
|
1435
|
+
"token_in",
|
|
1436
|
+
"destination_chain",
|
|
1437
|
+
"output_token",
|
|
1438
|
+
"destination_address",
|
|
1439
|
+
"amount_in_raw",
|
|
1440
|
+
"mode",
|
|
1441
|
+
"purpose",
|
|
1442
|
+
],
|
|
1443
|
+
additionalProperties: false,
|
|
1444
|
+
},
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
name: "transfer_evm_native",
|
|
1448
|
+
description: "Preview, prepare, or execute a native EVM transfer using a wei amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1449
|
+
optional: true,
|
|
1450
|
+
parameters: {
|
|
1451
|
+
type: "object",
|
|
1452
|
+
properties: {
|
|
1453
|
+
recipient: { type: "string" },
|
|
1454
|
+
amount_wei: { type: "string" },
|
|
1455
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1456
|
+
purpose: { type: "string" },
|
|
1457
|
+
user_intent: { type: "boolean" },
|
|
1458
|
+
approval_token: { type: "string" },
|
|
1459
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1460
|
+
},
|
|
1461
|
+
required: ["recipient", "amount_wei", "mode", "purpose"],
|
|
1462
|
+
additionalProperties: false,
|
|
1463
|
+
},
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
name: "transfer_evm_token",
|
|
1467
|
+
description: "Preview, prepare, or execute an ERC-20 transfer using a raw base-unit amount. Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation.",
|
|
1468
|
+
optional: true,
|
|
1469
|
+
parameters: {
|
|
1470
|
+
type: "object",
|
|
1471
|
+
properties: {
|
|
1472
|
+
token_address: { type: "string" },
|
|
1473
|
+
recipient: { type: "string" },
|
|
1474
|
+
amount_raw: { type: "string" },
|
|
1475
|
+
mode: { type: "string", enum: ["preview", "prepare", "execute"] },
|
|
1476
|
+
purpose: { type: "string" },
|
|
1477
|
+
user_intent: { type: "boolean" },
|
|
1478
|
+
approval_token: { type: "string" },
|
|
1479
|
+
network: { type: "string", enum: ["ethereum", "base"] },
|
|
1480
|
+
},
|
|
1481
|
+
required: ["token_address", "recipient", "amount_raw", "mode", "purpose"],
|
|
1482
|
+
additionalProperties: false,
|
|
1483
|
+
},
|
|
1484
|
+
},
|
|
1485
|
+
];
|
|
1486
|
+
|
|
1487
|
+
export default function registerAgentWalletPlugin(api) {
|
|
1488
|
+
api?.logger?.info?.("[agent-wallet] registering OpenClaw wallet plugin");
|
|
1489
|
+
|
|
1490
|
+
const backend = resolveBackend(api);
|
|
1491
|
+
selectedWalletBackend = null;
|
|
1492
|
+
selectedSolanaNetwork = defaultSolanaNetwork(api);
|
|
1493
|
+
selectedEvmNetwork = defaultSelectableEvmNetwork(api);
|
|
1494
|
+
selectedBtcNetwork = defaultBtcNetwork(api);
|
|
1495
|
+
const duplicateSessionToolNames = new Set(
|
|
1496
|
+
walletSessionToolDefinitions.map((definition) => definition.name)
|
|
1497
|
+
);
|
|
1498
|
+
const toolDefinitions = [];
|
|
1499
|
+
const seen = new Set();
|
|
1500
|
+
for (const definition of [
|
|
1501
|
+
...walletSessionToolDefinitions,
|
|
1502
|
+
...solanaToolDefinitions.filter((item) => !duplicateSessionToolNames.has(item.name)),
|
|
1503
|
+
...btcToolDefinitions.filter((item) => !duplicateSessionToolNames.has(item.name)),
|
|
1504
|
+
...evmToolDefinitions.filter((item) => !duplicateSessionToolNames.has(item.name)),
|
|
1505
|
+
]) {
|
|
1506
|
+
if (seen.has(definition.name)) {
|
|
1507
|
+
continue;
|
|
1508
|
+
}
|
|
1509
|
+
seen.add(definition.name);
|
|
1510
|
+
toolDefinitions.push(definition);
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
for (const definition of toolDefinitions) {
|
|
1514
|
+
registerTool(api, definition);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
api?.logger?.info?.(
|
|
1518
|
+
`[agent-wallet] default wallet backend ${backend}; registered ${toolDefinitions.length} multi-wallet tools`
|
|
1519
|
+
);
|
|
1520
|
+
}
|