@agentlayer.tech/wallet 0.1.43 → 0.1.47
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/.claude-plugin/marketplace.json +17 -0
- package/.openclaw/extensions/agent-wallet/index.ts +99 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +6 -1
- package/.openclaw/extensions/agent-wallet/package.json +1 -1
- package/CHANGELOG.md +79 -0
- package/README.md +16 -2
- package/VERSION +1 -1
- package/agent-wallet/agent_wallet/__init__.py +1 -1
- package/agent-wallet/agent_wallet/openclaw_adapter.py +686 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +22 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +5 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +6 -0
- package/agent-wallet/agent_wallet/telemetry.py +306 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +79 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +14 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +404 -0
- package/agent-wallet/openclaw.plugin.json +1 -1
- package/agent-wallet/pyproject.toml +1 -1
- package/agent-wallet/scripts/install_agent_wallet.py +33 -8
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +1 -1
- package/claude-code/plugins/agent-wallet/README.md +30 -1
- package/claude-code/plugins/agent-wallet/commands/wallet-setup.md +24 -0
- package/claude-code/plugins/agent-wallet/hooks/hooks.json +16 -0
- package/claude-code/plugins/agent-wallet/scripts/bootstrap_backend.sh +136 -0
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +6 -1
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +1 -1
- package/codex/plugins/agent-wallet/scripts/run_mcp.sh +5 -0
- package/hermes/plugins/agent_wallet/plugin.yaml +1 -1
- package/hermes/plugins/agent_wallet/tools.py +3 -0
- package/package.json +2 -1
- package/wdk-btc-wallet/package.json +1 -1
- package/wdk-evm-wallet/README.md +31 -0
- package/wdk-evm-wallet/package-lock.json +268 -64
- package/wdk-evm-wallet/package.json +4 -1
- package/wdk-evm-wallet/src/config.js +2 -0
- package/wdk-evm-wallet/src/server.js +66 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +2725 -939
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# bootstrap_backend.sh — the in-CLI bridge to the npm installer.
|
|
5
|
+
#
|
|
6
|
+
# Claude Code's plugin marketplace only copies the plugin files (this MCP bridge
|
|
7
|
+
# and its skill) into the cache. It does NOT lay down the Python backend runtime
|
|
8
|
+
# (venv + agent_wallet package + server.py + sealed-secret handling) that the
|
|
9
|
+
# bridge talks to. This script closes that gap: it detects whether the backend
|
|
10
|
+
# runtime is present and, if not, delegates to the existing npm installer
|
|
11
|
+
# (`npx @agentlayer.tech/wallet install --yes`) so the whole thing can be set up
|
|
12
|
+
# without leaving the Claude Code CLI.
|
|
13
|
+
#
|
|
14
|
+
# Modes:
|
|
15
|
+
# bootstrap_backend.sh check Report readiness only. Exit 0 if ready, 1 if not.
|
|
16
|
+
# Never installs anything.
|
|
17
|
+
# bootstrap_backend.sh install Ensure the backend is installed (default).
|
|
18
|
+
# Idempotent: a no-op when already healthy.
|
|
19
|
+
#
|
|
20
|
+
# Used by:
|
|
21
|
+
# - /wallet-setup slash command -> `install` (explicit, user-initiated).
|
|
22
|
+
# - SessionStart hook -> `install` by default, so the backend sets
|
|
23
|
+
# itself up on first session. Set
|
|
24
|
+
# AGENT_WALLET_AUTO_BOOTSTRAP=0 to opt out and
|
|
25
|
+
# get only a soft hint to run /wallet-setup.
|
|
26
|
+
|
|
27
|
+
MODE=${1:-install}
|
|
28
|
+
|
|
29
|
+
PACKAGE_SPEC=${AGENT_WALLET_BOOTSTRAP_PACKAGE:-"@agentlayer.tech/wallet@latest"}
|
|
30
|
+
OPENCLAW_HOME=${OPENCLAW_HOME:-"$HOME/.openclaw"}
|
|
31
|
+
RUNTIME_CURRENT="$OPENCLAW_HOME/agent-wallet-runtime/current"
|
|
32
|
+
|
|
33
|
+
# Resolve this script's plugin root with physical paths (pwd -P), the same way
|
|
34
|
+
# run_mcp.sh does, so a marketplace symlink does not break the "../../../codex"
|
|
35
|
+
# sibling math below.
|
|
36
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
|
|
37
|
+
PLUGIN_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd -P)
|
|
38
|
+
|
|
39
|
+
log() {
|
|
40
|
+
printf '%s\n' "$*" >&2
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Locate server.py exactly like run_mcp.sh: the plugin's own copy, then the codex
|
|
44
|
+
# sibling in a repo checkout, then the installed runtime package. Keeping this in
|
|
45
|
+
# lock-step with run_mcp.sh is what avoids a false "not installed" verdict in a
|
|
46
|
+
# dev checkout, where run_mcp.sh resolves the codex sibling but this script used
|
|
47
|
+
# to look only at the runtime path.
|
|
48
|
+
resolve_server() {
|
|
49
|
+
if [ -f "$PLUGIN_ROOT/server.py" ]; then
|
|
50
|
+
printf '%s' "$PLUGIN_ROOT/server.py"
|
|
51
|
+
elif [ -f "$PLUGIN_ROOT/../../../codex/plugins/agent-wallet/server.py" ]; then
|
|
52
|
+
printf '%s' "$PLUGIN_ROOT/../../../codex/plugins/agent-wallet/server.py"
|
|
53
|
+
elif [ -f "$RUNTIME_CURRENT/codex/plugins/agent-wallet/server.py" ]; then
|
|
54
|
+
printf '%s' "$RUNTIME_CURRENT/codex/plugins/agent-wallet/server.py"
|
|
55
|
+
else
|
|
56
|
+
printf '%s' ''
|
|
57
|
+
fi
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
resolve_python() {
|
|
61
|
+
if [ -n "${AGENT_WALLET_PYTHON:-}" ]; then
|
|
62
|
+
printf '%s' "$AGENT_WALLET_PYTHON"
|
|
63
|
+
elif [ -x "$RUNTIME_CURRENT/agent-wallet/.venv/bin/python" ]; then
|
|
64
|
+
printf '%s' "$RUNTIME_CURRENT/agent-wallet/.venv/bin/python"
|
|
65
|
+
elif [ -x "$RUNTIME_CURRENT/agent-wallet/.runtime-venv/bin/python" ]; then
|
|
66
|
+
printf '%s' "$RUNTIME_CURRENT/agent-wallet/.runtime-venv/bin/python"
|
|
67
|
+
elif command -v python3 >/dev/null 2>&1; then
|
|
68
|
+
printf '%s' python3
|
|
69
|
+
else
|
|
70
|
+
printf '%s' ''
|
|
71
|
+
fi
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Readiness proxy: the resolved server.py exists and parses (ast.parse, no
|
|
75
|
+
# bytecode written) — the same shallow check run_mcp.sh and `doctor` run before
|
|
76
|
+
# exec. It deliberately does NOT verify that the venv/dependencies are installed:
|
|
77
|
+
# importing or running the server would be too slow and flaky for a SessionStart
|
|
78
|
+
# hook and risks false-negative reinstall loops. run_mcp.sh surfaces any missing
|
|
79
|
+
# dependency with a clear error at first tool use, so this stays in lock-step
|
|
80
|
+
# with what actually runs the server rather than being stricter than it.
|
|
81
|
+
backend_ready() {
|
|
82
|
+
server=$(resolve_server)
|
|
83
|
+
[ -n "$server" ] || return 1
|
|
84
|
+
py=$(resolve_python)
|
|
85
|
+
[ -n "$py" ] || return 1
|
|
86
|
+
"$py" -c 'import sys, ast; ast.parse(open(sys.argv[1], encoding="utf-8").read())' "$server" 2>/dev/null
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if backend_ready; then
|
|
90
|
+
[ "$MODE" = "check" ] || log "AgentLayer wallet backend already installed (server: $(resolve_server))."
|
|
91
|
+
exit 0
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
if [ "$MODE" = "check" ]; then
|
|
95
|
+
log "AgentLayer wallet backend is not installed yet."
|
|
96
|
+
log "Run /wallet-setup inside Claude Code to install it."
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
# --- install path -----------------------------------------------------------
|
|
101
|
+
|
|
102
|
+
if ! command -v npx >/dev/null 2>&1; then
|
|
103
|
+
log "Cannot install the AgentLayer wallet backend: npx (Node.js) was not found on PATH."
|
|
104
|
+
log "Install Node.js 18+ and re-run /wallet-setup, or run manually:"
|
|
105
|
+
log " npx $PACKAGE_SPEC install --yes"
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
if ! command -v python3 >/dev/null 2>&1; then
|
|
110
|
+
log "Warning: python3 was not found on PATH. The installer needs Python >= 3.10 with venv."
|
|
111
|
+
log "Install Python and re-run /wallet-setup if the install below fails."
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
log "Installing the AgentLayer wallet backend runtime via npm (this may take a minute)…"
|
|
115
|
+
log " -> npx $PACKAGE_SPEC install --yes"
|
|
116
|
+
if ! npx -y "$PACKAGE_SPEC" install --yes; then
|
|
117
|
+
log "Backend install failed. Ensure Node.js 18+ and Python >= 3.10 (with venv) are installed, then re-run /wallet-setup."
|
|
118
|
+
exit 1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# Re-pin the Claude Code cache copies so run_mcp.sh resolves OPENCLAW_HOME and the
|
|
122
|
+
# freshly installed runtime correctly (pinClaudeCacheCopies / marketplace wiring).
|
|
123
|
+
# --skip-enable: the plugin is already registered via the marketplace, so we only
|
|
124
|
+
# want the file pinning, not another `claude plugin install`.
|
|
125
|
+
log "Wiring the Claude Code bridge to the installed runtime…"
|
|
126
|
+
npx -y "$PACKAGE_SPEC" claude-code install --yes --skip-enable || \
|
|
127
|
+
log "Note: could not re-pin the Claude Code bridge automatically; it will still resolve the default runtime."
|
|
128
|
+
|
|
129
|
+
if backend_ready; then
|
|
130
|
+
log "Done. The AgentLayer wallet backend is installed."
|
|
131
|
+
log "Restart Claude Code (or reload the agent-wallet plugin) to activate the wallet tools."
|
|
132
|
+
exit 0
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
log "Install completed but the backend did not verify. Run: npx $PACKAGE_SPEC doctor --deep"
|
|
136
|
+
exit 1
|
|
@@ -27,7 +27,7 @@ elif [ -f "$CODEX_SERVER" ]; then
|
|
|
27
27
|
elif [ -f "$RUNTIME_CODEX_DIR/server.py" ]; then
|
|
28
28
|
SERVER_PY=$(CDPATH= cd -- "$RUNTIME_CODEX_DIR" && pwd -P)/server.py
|
|
29
29
|
else
|
|
30
|
-
printf '{"error":"agent-wallet server.py not found in plugin, codex sibling, or runtime package.","fix":"npx @agentlayer.tech/wallet install --yes"}\n' >&2
|
|
30
|
+
printf '{"error":"agent-wallet backend not installed yet (server.py not found in plugin, codex sibling, or runtime package).","fix":"Run /wallet-setup inside Claude Code, or: npx @agentlayer.tech/wallet install --yes"}\n' >&2
|
|
31
31
|
exit 1
|
|
32
32
|
fi
|
|
33
33
|
|
|
@@ -58,4 +58,9 @@ PY
|
|
|
58
58
|
exit 1
|
|
59
59
|
fi
|
|
60
60
|
|
|
61
|
+
# Tag anonymous telemetry with this frontend so adoption can be split per host
|
|
62
|
+
# (claude-code / codex / hermes / openclaw). An explicit override still wins.
|
|
63
|
+
: "${AGENT_WALLET_HOST:=claude-code}"
|
|
64
|
+
export AGENT_WALLET_HOST
|
|
65
|
+
|
|
61
66
|
exec "$PYTHON_BIN" "$SERVER_PY"
|
|
@@ -39,4 +39,9 @@ PY
|
|
|
39
39
|
exit 1
|
|
40
40
|
fi
|
|
41
41
|
|
|
42
|
+
# Tag anonymous telemetry with this frontend so adoption can be split per host
|
|
43
|
+
# (claude-code / codex / hermes / openclaw). An explicit override still wins.
|
|
44
|
+
: "${AGENT_WALLET_HOST:=codex}"
|
|
45
|
+
export AGENT_WALLET_HOST
|
|
46
|
+
|
|
42
47
|
exec "$PYTHON_BIN" "$PLUGIN_ROOT/server.py"
|
|
@@ -319,6 +319,9 @@ def _cli_env(package_root: Path) -> dict[str, str]:
|
|
|
319
319
|
env = dict(os.environ)
|
|
320
320
|
prior = env.get("PYTHONPATH", "")
|
|
321
321
|
env["PYTHONPATH"] = str(package_root) if not prior else f"{package_root}{os.pathsep}{prior}"
|
|
322
|
+
# Tag anonymous telemetry with this frontend so adoption can be split per
|
|
323
|
+
# host (claude-code / codex / hermes / openclaw). An explicit override wins.
|
|
324
|
+
env.setdefault("AGENT_WALLET_HOST", "hermes")
|
|
322
325
|
if not env.get("AGENT_WALLET_BOOT_KEY"):
|
|
323
326
|
key_file = env.get("AGENT_WALLET_BOOT_KEY_FILE", "").strip()
|
|
324
327
|
if key_file:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentlayer.tech/wallet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.47",
|
|
4
4
|
"description": "NPM installer for the OpenClaw Agent Wallet local runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"agent-wallet/pyproject.toml",
|
|
47
47
|
".openclaw/AGENTS.md",
|
|
48
48
|
".openclaw/extensions/agent-wallet/",
|
|
49
|
+
".claude-plugin/marketplace.json",
|
|
49
50
|
"codex/plugins/agent-wallet/",
|
|
50
51
|
"claude-code/plugins/agent-wallet/",
|
|
51
52
|
"hermes/plugins/agent_wallet/",
|
package/wdk-evm-wallet/README.md
CHANGED
|
@@ -26,6 +26,11 @@ Current scope:
|
|
|
26
26
|
- fetch Aave V3 reserve catalog on supported mainnet networks
|
|
27
27
|
- fetch Aave V3 per-reserve user positions on supported mainnet networks
|
|
28
28
|
- quote and send narrow Aave V3 `supply`, `withdraw`, `borrow`, and `repay` operations
|
|
29
|
+
- fetch Morpho vault discovery and detail data on supported mainnet networks
|
|
30
|
+
- fetch Morpho market discovery and detail data on supported mainnet networks
|
|
31
|
+
- fetch Morpho user vault and market positions on supported mainnet networks
|
|
32
|
+
- quote and send narrow Morpho vault `supply` and `withdraw` operations
|
|
33
|
+
- quote and send narrow Morpho market `supply_collateral`, `borrow`, `repay`, and `withdraw_collateral` operations
|
|
29
34
|
- quote and send native transfers
|
|
30
35
|
- quote and send ERC-20 transfers
|
|
31
36
|
- fetch transaction receipts
|
|
@@ -41,6 +46,8 @@ The implementation follows the official WDK documentation:
|
|
|
41
46
|
- Velora swap API reference: https://docs.wdk.tether.io/sdk/swap-modules/swap-velora-evm/api-reference
|
|
42
47
|
- Aave lending overview: https://docs.wdk.tether.io/sdk/lending-modules/lending-aave-evm
|
|
43
48
|
- Aave lending API reference: https://docs.wdk.tether.io/sdk/lending-modules/lending-aave-evm/api-reference
|
|
49
|
+
- Morpho Build overview: https://morpho.org/build
|
|
50
|
+
- Morpho offchain API docs: https://docs.morpho.org/tools/offchain/api/get-started/
|
|
44
51
|
|
|
45
52
|
## Why Separate
|
|
46
53
|
|
|
@@ -101,6 +108,21 @@ The active network is persistent and can be switched without changing code.
|
|
|
101
108
|
- `POST /v1/evm/aave/borrow/send`
|
|
102
109
|
- `POST /v1/evm/aave/repay/quote`
|
|
103
110
|
- `POST /v1/evm/aave/repay/send`
|
|
111
|
+
- `POST /v1/evm/morpho/vaults/get`
|
|
112
|
+
- `POST /v1/evm/morpho/markets/get`
|
|
113
|
+
- `POST /v1/evm/morpho/positions/get`
|
|
114
|
+
- `POST /v1/evm/morpho/vault/supply/quote`
|
|
115
|
+
- `POST /v1/evm/morpho/vault/supply/send`
|
|
116
|
+
- `POST /v1/evm/morpho/vault/withdraw/quote`
|
|
117
|
+
- `POST /v1/evm/morpho/vault/withdraw/send`
|
|
118
|
+
- `POST /v1/evm/morpho/market/supply_collateral/quote`
|
|
119
|
+
- `POST /v1/evm/morpho/market/supply_collateral/send`
|
|
120
|
+
- `POST /v1/evm/morpho/market/borrow/quote`
|
|
121
|
+
- `POST /v1/evm/morpho/market/borrow/send`
|
|
122
|
+
- `POST /v1/evm/morpho/market/repay/quote`
|
|
123
|
+
- `POST /v1/evm/morpho/market/repay/send`
|
|
124
|
+
- `POST /v1/evm/morpho/market/withdraw_collateral/quote`
|
|
125
|
+
- `POST /v1/evm/morpho/market/withdraw_collateral/send`
|
|
104
126
|
- `POST /v1/evm/swap/quote`
|
|
105
127
|
- `POST /v1/evm/swap/send`
|
|
106
128
|
- `POST /v1/evm/uniswap/swap/quote`
|
|
@@ -162,11 +184,20 @@ Environment variables:
|
|
|
162
184
|
- `WDK_EVM_SEPOLIA_RPC_URL`
|
|
163
185
|
- `WDK_EVM_BASE_RPC_URL`
|
|
164
186
|
- `WDK_EVM_BASE_SEPOLIA_RPC_URL`
|
|
187
|
+
- `MORPHO_API_BASE_URL`
|
|
165
188
|
- `UNISWAP_API_KEY`
|
|
166
189
|
- `UNISWAP_TRADING_API_BASE_URL`
|
|
167
190
|
- `UNISWAP_ROUTER_VERSION`
|
|
168
191
|
- `UNISWAP_DEFAULT_SLIPPAGE_BPS`
|
|
169
192
|
|
|
193
|
+
Morpho read-only support:
|
|
194
|
+
|
|
195
|
+
- the runtime exposes Morpho discovery and account-read routes through the public
|
|
196
|
+
Morpho GraphQL API at `https://api.morpho.org/graphql` by default
|
|
197
|
+
- Morpho support is currently limited to `ethereum` and `base` mainnet
|
|
198
|
+
- vault and market discovery use fixed first-party queries rather than caller-provided
|
|
199
|
+
GraphQL strings
|
|
200
|
+
|
|
170
201
|
Swap providers:
|
|
171
202
|
|
|
172
203
|
- the runtime exposes three independent swap surfaces: Velora (`/v1/evm/swap/*`),
|