@agentlayer.tech/wallet 0.1.0 → 0.1.3
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/agent-wallet/pyproject.toml +2 -2
- package/bin/openclaw-agent-wallet.mjs +79 -1
- package/package.json +1 -1
- package/setup.sh +48 -2
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
name = "openclaw-agent-wallet"
|
|
7
7
|
version = "0.1.0"
|
|
8
8
|
description = "Plugin-friendly wallet backend for OpenClaw agents"
|
|
9
|
-
requires-python = ">=3.
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"httpx>=0.27.0",
|
|
12
12
|
"pydantic>=2.0.0",
|
|
@@ -27,5 +27,5 @@ dev = [
|
|
|
27
27
|
packages = ["agent_wallet"]
|
|
28
28
|
|
|
29
29
|
[tool.ruff]
|
|
30
|
-
target-version = "
|
|
30
|
+
target-version = "py310"
|
|
31
31
|
line-length = 100
|
|
@@ -85,6 +85,75 @@ function hasCommand(name) {
|
|
|
85
85
|
return result.status === 0;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
function commandPath(name) {
|
|
89
|
+
const result = spawnSync("command", ["-v", name], {
|
|
90
|
+
shell: true,
|
|
91
|
+
encoding: "utf8",
|
|
92
|
+
});
|
|
93
|
+
if (result.status !== 0) return "";
|
|
94
|
+
return result.stdout.trim();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function pythonVersion(pythonBin) {
|
|
98
|
+
if (!pythonBin) return null;
|
|
99
|
+
const result = spawnSync(
|
|
100
|
+
pythonBin,
|
|
101
|
+
["-c", "import sys,json; print(json.dumps({'version': sys.version.split()[0], 'major': sys.version_info[0], 'minor': sys.version_info[1]}))"],
|
|
102
|
+
{ encoding: "utf8" },
|
|
103
|
+
);
|
|
104
|
+
if (result.status !== 0) return null;
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(result.stdout);
|
|
107
|
+
} catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function pythonOk(version) {
|
|
113
|
+
return Boolean(version && (version.major > 3 || (version.major === 3 && version.minor >= 10)));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function pythonVenvOk(pythonBin) {
|
|
117
|
+
if (!pythonBin) return false;
|
|
118
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-python-check-"));
|
|
119
|
+
try {
|
|
120
|
+
const result = spawnSync(pythonBin, ["-m", "venv", path.join(tempRoot, "venv")], {
|
|
121
|
+
stdio: "ignore",
|
|
122
|
+
});
|
|
123
|
+
return result.status === 0;
|
|
124
|
+
} finally {
|
|
125
|
+
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function pythonProbe(pythonBin) {
|
|
130
|
+
const version = pythonVersion(pythonBin);
|
|
131
|
+
const version_ok = pythonOk(version);
|
|
132
|
+
const venv_ok = version_ok ? pythonVenvOk(pythonBin) : false;
|
|
133
|
+
return {
|
|
134
|
+
path: pythonBin || "",
|
|
135
|
+
version: version?.version || null,
|
|
136
|
+
version_ok,
|
|
137
|
+
venv_ok,
|
|
138
|
+
ok: version_ok && venv_ok,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function selectedPythonProbe() {
|
|
143
|
+
const candidates = [];
|
|
144
|
+
if (process.env.OPENCLAW_AGENT_WALLET_PYTHON) {
|
|
145
|
+
candidates.push(process.env.OPENCLAW_AGENT_WALLET_PYTHON);
|
|
146
|
+
} else {
|
|
147
|
+
for (const name of ["python3.14", "python3.13", "python3.12", "python3.11", "python3.10", "python3"]) {
|
|
148
|
+
const found = commandPath(name);
|
|
149
|
+
if (found && !candidates.includes(found)) candidates.push(found);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const probes = candidates.map((candidate) => pythonProbe(candidate));
|
|
154
|
+
return probes.find((probe) => probe.ok) || probes[0] || pythonProbe("");
|
|
155
|
+
}
|
|
156
|
+
|
|
88
157
|
function readLinkOrNull(target) {
|
|
89
158
|
try {
|
|
90
159
|
const stat = fs.lstatSync(target);
|
|
@@ -243,12 +312,20 @@ function runDoctor() {
|
|
|
243
312
|
["wdk-btc-wallet", path.join(packageRoot, "wdk-btc-wallet", "package.json")],
|
|
244
313
|
["wdk-evm-wallet", path.join(packageRoot, "wdk-evm-wallet", "package.json")],
|
|
245
314
|
];
|
|
246
|
-
const commands = ["
|
|
315
|
+
const commands = ["node", "npm"];
|
|
247
316
|
const missing = [];
|
|
317
|
+
const python = selectedPythonProbe();
|
|
248
318
|
|
|
249
319
|
for (const command of commands) {
|
|
250
320
|
if (!hasCommand(command)) missing.push(`command:${command}`);
|
|
251
321
|
}
|
|
322
|
+
if (!python.path) {
|
|
323
|
+
missing.push("command:python3.10-or-python3");
|
|
324
|
+
} else if (!python.version_ok) {
|
|
325
|
+
missing.push(`python>=3.10:selected:${python.version || "unknown"}`);
|
|
326
|
+
} else if (!python.venv_ok) {
|
|
327
|
+
missing.push(`python-venv-ensurepip:selected:${python.version || "unknown"}`);
|
|
328
|
+
}
|
|
252
329
|
for (const [label, target] of requiredPaths) {
|
|
253
330
|
if (!fs.existsSync(target)) missing.push(`${label}:${target}`);
|
|
254
331
|
}
|
|
@@ -266,6 +343,7 @@ function runDoctor() {
|
|
|
266
343
|
current_runtime: currentRuntimePath(),
|
|
267
344
|
active_version: activeVersion(),
|
|
268
345
|
releases: listReleases(),
|
|
346
|
+
python,
|
|
269
347
|
commands: Object.fromEntries(commands.map((command) => [command, hasCommand(command)])),
|
|
270
348
|
missing,
|
|
271
349
|
},
|
package/package.json
CHANGED
package/setup.sh
CHANGED
|
@@ -21,7 +21,53 @@ require_cmd() {
|
|
|
21
21
|
fi
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
find_python() {
|
|
25
|
+
if [ -n "${OPENCLAW_AGENT_WALLET_PYTHON:-}" ]; then
|
|
26
|
+
if is_usable_python "$OPENCLAW_AGENT_WALLET_PYTHON"; then
|
|
27
|
+
printf '%s\n' "$OPENCLAW_AGENT_WALLET_PYTHON"
|
|
28
|
+
return
|
|
29
|
+
fi
|
|
30
|
+
printf 'OPENCLAW_AGENT_WALLET_PYTHON is not usable for this installer: %s\n' "$OPENCLAW_AGENT_WALLET_PYTHON" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
for candidate in python3.14 python3.13 python3.12 python3.11 python3.10 python3; do
|
|
34
|
+
if command -v "$candidate" >/dev/null 2>&1; then
|
|
35
|
+
candidate_path="$(command -v "$candidate")"
|
|
36
|
+
if is_usable_python "$candidate_path"; then
|
|
37
|
+
printf '%s\n' "$candidate_path"
|
|
38
|
+
return
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
done
|
|
42
|
+
printf 'Required Python not found: need Python >= 3.10 with working venv/ensurepip.\n' >&2
|
|
43
|
+
printf 'Install Python 3.10+ or set OPENCLAW_AGENT_WALLET_PYTHON=/path/to/working/python3.\n' >&2
|
|
44
|
+
exit 1
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
is_usable_python() {
|
|
48
|
+
python_bin="$1"
|
|
49
|
+
"$python_bin" - <<'PY' >/dev/null 2>&1
|
|
50
|
+
import sys
|
|
51
|
+
|
|
52
|
+
if sys.version_info < (3, 10):
|
|
53
|
+
raise SystemExit(
|
|
54
|
+
"OpenClaw Agent Wallet requires Python >= 3.10. "
|
|
55
|
+
f"Selected interpreter is {sys.version.split()[0]}. "
|
|
56
|
+
"Install Python 3.10+ or set OPENCLAW_AGENT_WALLET_PYTHON=/path/to/python3."
|
|
57
|
+
)
|
|
58
|
+
PY
|
|
59
|
+
if [ "$?" -ne 0 ]; then
|
|
60
|
+
return 1
|
|
61
|
+
fi
|
|
62
|
+
tmp_dir="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-python-check.XXXXXX")"
|
|
63
|
+
"$python_bin" -m venv "$tmp_dir/venv" >/dev/null 2>&1
|
|
64
|
+
status="$?"
|
|
65
|
+
rm -rf "$tmp_dir"
|
|
66
|
+
return "$status"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
PYTHON_BIN="$(find_python)"
|
|
70
|
+
|
|
25
71
|
require_cmd node
|
|
26
72
|
require_cmd npm
|
|
27
73
|
|
|
@@ -31,7 +77,7 @@ require_path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" "OpenClaw extension
|
|
|
31
77
|
require_path "${ROOT_DIR}/wdk-btc-wallet/package.json" "wdk-btc-wallet package"
|
|
32
78
|
require_path "${ROOT_DIR}/wdk-evm-wallet/package.json" "wdk-evm-wallet package"
|
|
33
79
|
|
|
34
|
-
exec
|
|
80
|
+
exec "$PYTHON_BIN" "$INSTALLER" \
|
|
35
81
|
--package-root "${ROOT_DIR}/agent-wallet" \
|
|
36
82
|
--extension-path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" \
|
|
37
83
|
--wdk-btc-root "${ROOT_DIR}/wdk-btc-wallet" \
|