@onecraft/wallet 0.0.0-stage → 0.1.145
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 +20 -0
- package/.openclaw/AGENTS.md +100 -0
- package/.openclaw/extensions/agent-wallet/README.md +195 -0
- package/.openclaw/extensions/agent-wallet/dist/index.js +2198 -0
- package/.openclaw/extensions/agent-wallet/index.ts +2198 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +251 -0
- package/.openclaw/extensions/agent-wallet/package.json +49 -0
- package/.openclaw/extensions/agent-wallet/skills/cards/SKILL.md +211 -0
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +30 -0
- package/CHANGELOG.md +1232 -0
- package/LICENSE +104 -0
- package/README.md +193 -2
- package/VERSION +1 -0
- package/agent-wallet/.env.example +63 -0
- package/agent-wallet/AGENTS.md +130 -0
- package/agent-wallet/CARD_VAULT.md +640 -0
- package/agent-wallet/README.md +615 -0
- package/agent-wallet/UPGRADE_COMPATIBILITY.md +66 -0
- package/agent-wallet/agent_wallet/__init__.py +16 -0
- package/agent-wallet/agent_wallet/approval.py +165 -0
- package/agent-wallet/agent_wallet/autonomous_permissions.py +281 -0
- package/agent-wallet/agent_wallet/autonomous_policy.py +305 -0
- package/agent-wallet/agent_wallet/autonomous_session.py +236 -0
- package/agent-wallet/agent_wallet/boot_key_migration.py +155 -0
- package/agent-wallet/agent_wallet/boot_key_recovery.py +57 -0
- package/agent-wallet/agent_wallet/bootstrap.py +194 -0
- package/agent-wallet/agent_wallet/card_catalog.py +243 -0
- package/agent-wallet/agent_wallet/card_runtime_secrets.py +108 -0
- package/agent-wallet/agent_wallet/card_vault.py +331 -0
- package/agent-wallet/agent_wallet/card_vault_cli.py +174 -0
- package/agent-wallet/agent_wallet/card_vault_import.py +65 -0
- package/agent-wallet/agent_wallet/card_vault_keychain.py +239 -0
- package/agent-wallet/agent_wallet/config.py +719 -0
- package/agent-wallet/agent_wallet/connector_cli.py +198 -0
- package/agent-wallet/agent_wallet/connectors/__init__.py +28 -0
- package/agent-wallet/agent_wallet/connectors/catalog.py +68 -0
- package/agent-wallet/agent_wallet/connectors/client.py +308 -0
- package/agent-wallet/agent_wallet/connectors/intent_policy.py +243 -0
- package/agent-wallet/agent_wallet/connectors/manifest.py +192 -0
- package/agent-wallet/agent_wallet/connectors/registry.py +341 -0
- package/agent-wallet/agent_wallet/encrypted_storage.py +314 -0
- package/agent-wallet/agent_wallet/evm_user_wallets.py +910 -0
- package/agent-wallet/agent_wallet/exceptions.py +10 -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/kernel_browser.py +479 -0
- package/agent-wallet/agent_wallet/kernel_cli.py +57 -0
- package/agent-wallet/agent_wallet/kernel_gateway.py +95 -0
- package/agent-wallet/agent_wallet/keystore.py +503 -0
- package/agent-wallet/agent_wallet/laso_card_vault.py +246 -0
- package/agent-wallet/agent_wallet/models.py +66 -0
- package/agent-wallet/agent_wallet/morpho_monitor.py +298 -0
- package/agent-wallet/agent_wallet/nonce_registry.py +59 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +9129 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +658 -0
- package/agent-wallet/agent_wallet/openclaw_runtime.py +194 -0
- package/agent-wallet/agent_wallet/plugin_bundle.py +44 -0
- package/agent-wallet/agent_wallet/providers/__init__.py +1 -0
- package/agent-wallet/agent_wallet/providers/bags.py +202 -0
- package/agent-wallet/agent_wallet/providers/dexscreener.py +147 -0
- package/agent-wallet/agent_wallet/providers/evm_activity.py +257 -0
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +459 -0
- package/agent-wallet/agent_wallet/providers/imd.py +720 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +519 -0
- package/agent-wallet/agent_wallet/providers/kamino.py +404 -0
- package/agent-wallet/agent_wallet/providers/lifi.py +302 -0
- package/agent-wallet/agent_wallet/providers/solana_rpc.py +447 -0
- package/agent-wallet/agent_wallet/providers/tokenized_stocks.py +189 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +346 -0
- package/agent-wallet/agent_wallet/providers/x402.py +1972 -0
- package/agent-wallet/agent_wallet/sealed_keys.py +118 -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 +119 -0
- package/agent-wallet/agent_wallet/telemetry.py +481 -0
- package/agent-wallet/agent_wallet/transaction_policy.py +573 -0
- package/agent-wallet/agent_wallet/update_check.py +190 -0
- package/agent-wallet/agent_wallet/user_wallets.py +573 -0
- package/agent-wallet/agent_wallet/validation.py +31 -0
- package/agent-wallet/agent_wallet/vault_executor.py +456 -0
- package/agent-wallet/agent_wallet/wallet_layer/__init__.py +1 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +1204 -0
- package/agent-wallet/agent_wallet/wallet_layer/base58.py +44 -0
- package/agent-wallet/agent_wallet/wallet_layer/factory.py +117 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +5246 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +2705 -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 +118 -0
- package/agent-wallet/pyproject.toml +36 -0
- package/agent-wallet/scripts/bootstrap_openclaw_evm.py +312 -0
- package/agent-wallet/scripts/build_release_bundle.py +210 -0
- package/agent-wallet/scripts/finalize_openclaw_local_wallet_config.py +121 -0
- package/agent-wallet/scripts/install_agent_wallet.py +1357 -0
- package/agent-wallet/scripts/install_openclaw_local_config.py +421 -0
- package/agent-wallet/scripts/install_openclaw_sealed_keys.py +117 -0
- package/agent-wallet/scripts/manage_openclaw_evm_wallet.py +333 -0
- package/agent-wallet/scripts/security_utils.py +37 -0
- package/agent-wallet/scripts/setup_evm_wallet.sh +140 -0
- package/agent-wallet/scripts/switch_openclaw_wallet_network.py +109 -0
- package/agent-wallet/skills/wallet-operator/SKILL.md +157 -0
- package/bin/lib/boot-key.mjs +184 -0
- package/bin/lib/evm-daemon.mjs +389 -0
- package/bin/lib/host-detection.mjs +259 -0
- package/bin/lib/integrations.mjs +578 -0
- package/bin/lib/release-python.mjs +9 -0
- package/bin/lib/update-transaction.mjs +235 -0
- package/bin/openclaw-agent-wallet.mjs +3354 -0
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +19 -0
- package/claude-code/plugins/agent-wallet/.mcp.json +14 -0
- package/claude-code/plugins/agent-wallet/AGENTLAYER_AGENT_GUIDE.md +282 -0
- package/claude-code/plugins/agent-wallet/README.md +134 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-approve.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-revoke.md +17 -0
- package/claude-code/plugins/agent-wallet/commands/cards.md +129 -0
- package/claude-code/plugins/agent-wallet/commands/guide.md +40 -0
- package/claude-code/plugins/agent-wallet/commands/imd.md +125 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-base.md +60 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-ethereum.md +37 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-evm.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-setup.md +25 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-sol.md +51 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-statusline.md +34 -0
- package/claude-code/plugins/agent-wallet/commands/x402.md +121 -0
- package/claude-code/plugins/agent-wallet/commands/yield.md +62 -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/enable_statusline.py +52 -0
- package/claude-code/plugins/agent-wallet/scripts/resolve_wallet_addresses.py +69 -0
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +66 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline.py +130 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline_setup.sh +40 -0
- package/claude-code/plugins/agent-wallet/skills/wallet-operator/SKILL.md +21 -0
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +37 -0
- package/codex/plugins/agent-wallet/.mcp.json +15 -0
- package/codex/plugins/agent-wallet/README.md +158 -0
- package/codex/plugins/agent-wallet/scripts/run_mcp.sh +47 -0
- package/codex/plugins/agent-wallet/server.py +1797 -0
- package/codex/plugins/agent-wallet/skills/cards/SKILL.md +225 -0
- package/codex/plugins/agent-wallet/skills/imd/SKILL.md +145 -0
- package/codex/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/codex/plugins/agent-wallet/skills/wallet-operator/SKILL.md +85 -0
- package/codex/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/codex/plugins/agent-wallet/skills/x402/SKILL.md +159 -0
- package/codex/plugins/agent-wallet/skills/yield/SKILL.md +65 -0
- package/connectors/AGENTS.md +37 -0
- package/connectors/DEVELOPER_GUIDE.md +131 -0
- package/connectors/README.md +139 -0
- package/connectors/READ_ONLY_BETA.md +54 -0
- package/connectors/RELEASING.md +48 -0
- package/connectors/conformance/README.md +31 -0
- package/connectors/conformance/package.json +54 -0
- package/connectors/conformance/scripts/sync-license.mjs +3 -0
- package/connectors/conformance/scripts/sync-spec.mjs +16 -0
- package/connectors/conformance/src/cli.ts +43 -0
- package/connectors/conformance/src/index.ts +7 -0
- package/connectors/conformance/src/runner.ts +314 -0
- package/connectors/conformance/src/types.ts +27 -0
- package/connectors/conformance/test/fixtures/invalid-response-identity.json +14 -0
- package/connectors/conformance/test/fixtures/missing-tool-fixture.json +4 -0
- package/connectors/conformance/test/runner.test.mjs +151 -0
- package/connectors/conformance/tsconfig.json +17 -0
- package/connectors/examples/reference-crypto-data/Dockerfile +21 -0
- package/connectors/examples/reference-crypto-data/README.md +51 -0
- package/connectors/examples/reference-crypto-data/conformance.json +11 -0
- package/connectors/examples/reference-crypto-data/connector.json +95 -0
- package/connectors/examples/reference-crypto-data/package.json +21 -0
- package/connectors/examples/reference-crypto-data/railway.toml +9 -0
- package/connectors/examples/reference-crypto-data/src/connector.ts +137 -0
- package/connectors/examples/reference-crypto-data/src/server.ts +13 -0
- package/connectors/examples/reference-crypto-data/test/connector.test.mjs +97 -0
- package/connectors/examples/reference-crypto-data/tsconfig.json +17 -0
- package/connectors/package-lock.json +561 -0
- package/connectors/package.json +19 -0
- package/connectors/scripts/smoke-packed-packages.mjs +121 -0
- package/connectors/sdk-typescript/README.md +47 -0
- package/connectors/sdk-typescript/package.json +49 -0
- package/connectors/sdk-typescript/scripts/sync-license.mjs +3 -0
- package/connectors/sdk-typescript/src/connector.ts +204 -0
- package/connectors/sdk-typescript/src/errors.ts +11 -0
- package/connectors/sdk-typescript/src/http.ts +116 -0
- package/connectors/sdk-typescript/src/index.ts +26 -0
- package/connectors/sdk-typescript/src/types.ts +101 -0
- package/connectors/sdk-typescript/test/sdk.test.mjs +181 -0
- package/connectors/sdk-typescript/tsconfig.json +21 -0
- package/connectors/spec/connector-manifest.schema.json +340 -0
- package/connectors/spec/connector-protocol.md +159 -0
- package/connectors/spec/transaction-intent.schema.json +281 -0
- package/connectors/templates/read-only/.env.example +1 -0
- package/connectors/templates/read-only/Dockerfile +11 -0
- package/connectors/templates/read-only/README.md +33 -0
- package/connectors/templates/read-only/conformance.json +11 -0
- package/connectors/templates/read-only/connector.json +64 -0
- package/connectors/templates/read-only/package.json +21 -0
- package/connectors/templates/read-only/railway.toml +9 -0
- package/connectors/templates/read-only/src/connector.ts +61 -0
- package/connectors/templates/read-only/src/server.ts +14 -0
- package/connectors/templates/read-only/test/connector.test.mjs +62 -0
- package/connectors/templates/read-only/tsconfig.json +17 -0
- package/cursor/plugins/agent-wallet/.cursor-plugin/plugin.json +14 -0
- package/cursor/plugins/agent-wallet/README.md +62 -0
- package/cursor/plugins/agent-wallet/mcp.json +16 -0
- package/cursor/plugins/agent-wallet/scripts/run_mcp.sh +33 -0
- package/cursor/plugins/agent-wallet/server.py +33 -0
- package/cursor/plugins/agent-wallet/skills/cards/SKILL.md +210 -0
- package/cursor/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/cursor/plugins/agent-wallet/skills/wallet-operator/SKILL.md +23 -0
- package/cursor/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/cursor/plugins/agent-wallet/skills/x402/SKILL.md +130 -0
- package/hermes/plugins/agent_wallet/README.md +54 -0
- package/hermes/plugins/agent_wallet/__init__.py +55 -0
- package/hermes/plugins/agent_wallet/plugin.yaml +9 -0
- package/hermes/plugins/agent_wallet/schemas.py +211 -0
- package/hermes/plugins/agent_wallet/tools.py +622 -0
- package/install-from-github.sh +139 -0
- package/integrations/hedera/treasury-guard/README.md +92 -0
- package/integrations/hedera/treasury-guard/examples/treasury-policy.example.json +9 -0
- package/integrations/hedera/treasury-guard/package-lock.json +880 -0
- package/integrations/hedera/treasury-guard/package.json +8 -0
- package/integrations/hedera/treasury-guard/skills/onecraft-hedera-treasury/SKILL.md +22 -0
- package/integrations/hedera/treasury-guard/src/hedera-mirror-client.mjs +106 -0
- package/integrations/hedera/treasury-guard/src/hedera-signer.mjs +120 -0
- package/integrations/hedera/treasury-guard/src/treasury-cli.mjs +177 -0
- package/integrations/hedera/treasury-guard/src/treasury-policy.mjs +155 -0
- package/mcp/README.md +39 -0
- package/mcp/scripts/run_mcp.sh +37 -0
- package/mcp/server.py +33 -0
- package/package.json +106 -4
- package/scripts/check_release_version.mjs +72 -0
- package/scripts/version_targets.mjs +60 -0
- package/setup.sh +87 -0
- package/wdk-evm-wallet/.env.example +38 -0
- package/wdk-evm-wallet/README.md +254 -0
- package/wdk-evm-wallet/bootstrap.sh +8 -0
- package/wdk-evm-wallet/package-lock.json +2359 -0
- package/wdk-evm-wallet/package.json +43 -0
- package/wdk-evm-wallet/run-local.sh +12 -0
- package/wdk-evm-wallet/src/config.js +461 -0
- package/wdk-evm-wallet/src/imd.js +231 -0
- package/wdk-evm-wallet/src/json.js +35 -0
- package/wdk-evm-wallet/src/local_vault.js +407 -0
- package/wdk-evm-wallet/src/network_state.js +96 -0
- package/wdk-evm-wallet/src/pending_transactions.js +148 -0
- package/wdk-evm-wallet/src/server.js +849 -0
- package/wdk-evm-wallet/src/shutdown.js +63 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +10036 -0
|
@@ -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 @onecraft/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:-"@onecraft/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 "OneCraft wallet backend already installed (server: $(resolve_server))."
|
|
91
|
+
exit 0
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
if [ "$MODE" = "check" ]; then
|
|
95
|
+
log "OneCraft 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 OneCraft 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 OneCraft wallet backend runtime via npm (this may take a minute)…"
|
|
115
|
+
log " -> npx $PACKAGE_SPEC install --yes"
|
|
116
|
+
if ! AGENT_WALLET_INSTALL_SOURCE=claude_marketplace_bootstrap 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
|
+
AGENT_WALLET_INSTALL_SOURCE=claude_marketplace_bootstrap 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 OneCraft 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
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Add the wallet-balance statusLine to the user's Claude Code settings.json.
|
|
3
|
+
|
|
4
|
+
Stdlib-only (runs under the system python3, not the wallet backend's venv).
|
|
5
|
+
Refuses to overwrite a statusLine the user configured for something else —
|
|
6
|
+
this only ever runs when the user explicitly invokes /wallet-statusline, but
|
|
7
|
+
it still shouldn't clobber an unrelated existing config.
|
|
8
|
+
"""
|
|
9
|
+
import json
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
SETTINGS_PATH = Path.home() / ".claude" / "settings.json"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main() -> int:
|
|
17
|
+
if len(sys.argv) != 2:
|
|
18
|
+
print("usage: enable_statusline.py <path-to-wallet_statusline.py>", file=sys.stderr)
|
|
19
|
+
return 2
|
|
20
|
+
script_path = sys.argv[1]
|
|
21
|
+
command = f"python3 {script_path}"
|
|
22
|
+
|
|
23
|
+
settings = {}
|
|
24
|
+
if SETTINGS_PATH.exists():
|
|
25
|
+
settings = json.loads(SETTINGS_PATH.read_text())
|
|
26
|
+
|
|
27
|
+
existing = settings.get("statusLine")
|
|
28
|
+
if existing and existing.get("command") != command:
|
|
29
|
+
print(
|
|
30
|
+
f"A different statusLine is already configured in {SETTINGS_PATH}: "
|
|
31
|
+
f"{existing!r}. Not overwriting it — run /statusline delete first "
|
|
32
|
+
"if you want to replace it, then re-run /wallet-statusline.",
|
|
33
|
+
file=sys.stderr,
|
|
34
|
+
)
|
|
35
|
+
return 1
|
|
36
|
+
|
|
37
|
+
settings["statusLine"] = {
|
|
38
|
+
"type": "command",
|
|
39
|
+
"command": command,
|
|
40
|
+
"refreshInterval": 30,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
SETTINGS_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
44
|
+
tmp = SETTINGS_PATH.with_suffix(".json.tmp")
|
|
45
|
+
tmp.write_text(json.dumps(settings, indent=2) + "\n")
|
|
46
|
+
tmp.replace(SETTINGS_PATH)
|
|
47
|
+
print(f"statusLine configured in {SETTINGS_PATH}")
|
|
48
|
+
return 0
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""One-time wallet address resolver for the statusline feature.
|
|
3
|
+
|
|
4
|
+
Launches this plugin's own MCP server (run_mcp.sh) over stdio using the
|
|
5
|
+
real MCP protocol — the same interface Claude Code itself talks to — asks
|
|
6
|
+
it for the configured Base and Solana addresses, and caches them to disk.
|
|
7
|
+
|
|
8
|
+
The wallet backend's cold start (unsealing local secret material) can take
|
|
9
|
+
several seconds, so this is meant to run once via /wallet-statusline, not
|
|
10
|
+
on every statusline tick. wallet_statusline.py only ever reads the cache
|
|
11
|
+
this script writes; it never imports the wallet backend itself.
|
|
12
|
+
"""
|
|
13
|
+
import asyncio
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
from mcp import ClientSession, StdioServerParameters
|
|
20
|
+
from mcp.client.stdio import stdio_client
|
|
21
|
+
|
|
22
|
+
STATE_DIR = Path(os.path.expanduser("~/.openclaw/wallet-statusline"))
|
|
23
|
+
ADDRESS_FILE = STATE_DIR / "addresses.json"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _tool_json(result):
|
|
27
|
+
return json.loads(result.content[0].text)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
async def resolve(run_mcp_path: str) -> dict:
|
|
31
|
+
params = StdioServerParameters(command="sh", args=[run_mcp_path])
|
|
32
|
+
async with stdio_client(params) as (read, write):
|
|
33
|
+
async with ClientSession(read, write) as session:
|
|
34
|
+
await session.initialize()
|
|
35
|
+
base = _tool_json(await session.call_tool("get_wallet_address", {}))
|
|
36
|
+
sol = _tool_json(await session.call_tool("get_wallet_overview", {"backend": "solana"}))
|
|
37
|
+
return {
|
|
38
|
+
"base_address": base.get("address"),
|
|
39
|
+
"sol_address": sol.get("address"),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def main() -> int:
|
|
44
|
+
if len(sys.argv) != 2:
|
|
45
|
+
print("usage: resolve_wallet_addresses.py <path-to-run_mcp.sh>", file=sys.stderr)
|
|
46
|
+
return 2
|
|
47
|
+
|
|
48
|
+
try:
|
|
49
|
+
addresses = asyncio.run(resolve(sys.argv[1]))
|
|
50
|
+
except Exception as exc:
|
|
51
|
+
print(f"Failed to resolve wallet addresses: {exc}", file=sys.stderr)
|
|
52
|
+
return 1
|
|
53
|
+
|
|
54
|
+
if not addresses.get("base_address") or not addresses.get("sol_address"):
|
|
55
|
+
print(f"Wallet backend returned incomplete data: {addresses}", file=sys.stderr)
|
|
56
|
+
return 1
|
|
57
|
+
|
|
58
|
+
STATE_DIR.mkdir(parents=True, exist_ok=True)
|
|
59
|
+
tmp = ADDRESS_FILE.with_suffix(".tmp")
|
|
60
|
+
tmp.write_text(json.dumps(addresses))
|
|
61
|
+
tmp.replace(ADDRESS_FILE)
|
|
62
|
+
|
|
63
|
+
print(f"Base: {addresses['base_address']}")
|
|
64
|
+
print(f"Solana: {addresses['sol_address']}")
|
|
65
|
+
return 0
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# Resolve to PHYSICAL paths (pwd -P). Claude Code runs this plugin through a
|
|
5
|
+
# marketplace symlink (~/.claude/agentlayer-local/plugins/agent-wallet -> the real
|
|
6
|
+
# plugin dir). With a logical pwd, the symlink stays in PLUGIN_ROOT and the
|
|
7
|
+
# "../../../codex" sibling math below collapses lexically into a non-existent path
|
|
8
|
+
# (e.g. ~/.claude/codex), so `cd` fails and the server dies with -32000. Resolving
|
|
9
|
+
# the symlink up front keeps the `..` arithmetic consistent with the real layout.
|
|
10
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
|
|
11
|
+
PLUGIN_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd -P)
|
|
12
|
+
OPENCLAW_HOME=${OPENCLAW_HOME:-"$HOME/.openclaw"}
|
|
13
|
+
PACKAGE_ROOT=${AGENT_WALLET_PACKAGE_ROOT:-${OPENCLAW_AGENT_WALLET_PACKAGE_ROOT:-"$OPENCLAW_HOME/agent-wallet-runtime/current/agent-wallet"}}
|
|
14
|
+
|
|
15
|
+
# Resolve server.py. The claude-code plugin ships no server.py of its own; it
|
|
16
|
+
# reuses the sibling codex copy (real repo / installed runtime, where claude-code
|
|
17
|
+
# and codex sit side by side), falling back to the codex copy inside the runtime
|
|
18
|
+
# package, which is always present.
|
|
19
|
+
LOCAL_SERVER="$PLUGIN_ROOT/server.py"
|
|
20
|
+
CODEX_SERVER="$PLUGIN_ROOT/../../../codex/plugins/agent-wallet/server.py"
|
|
21
|
+
RUNTIME_CODEX_DIR="$OPENCLAW_HOME/agent-wallet-runtime/current/codex/plugins/agent-wallet"
|
|
22
|
+
|
|
23
|
+
if [ -f "$LOCAL_SERVER" ]; then
|
|
24
|
+
SERVER_PY="$LOCAL_SERVER"
|
|
25
|
+
elif [ -f "$CODEX_SERVER" ]; then
|
|
26
|
+
SERVER_PY=$(CDPATH= cd -- "$PLUGIN_ROOT/../../../codex/plugins/agent-wallet" && pwd -P)/server.py
|
|
27
|
+
elif [ -f "$RUNTIME_CODEX_DIR/server.py" ]; then
|
|
28
|
+
SERVER_PY=$(CDPATH= cd -- "$RUNTIME_CODEX_DIR" && pwd -P)/server.py
|
|
29
|
+
else
|
|
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 @onecraft/wallet install --yes"}\n' >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
if [ -n "${AGENT_WALLET_PYTHON:-}" ]; then
|
|
35
|
+
PYTHON_BIN=$AGENT_WALLET_PYTHON
|
|
36
|
+
elif [ -n "${OPENCLAW_AGENT_WALLET_PYTHON:-}" ]; then
|
|
37
|
+
PYTHON_BIN=$OPENCLAW_AGENT_WALLET_PYTHON
|
|
38
|
+
elif [ -x "$PACKAGE_ROOT/.venv/bin/python" ]; then
|
|
39
|
+
PYTHON_BIN=$PACKAGE_ROOT/.venv/bin/python
|
|
40
|
+
elif [ -x "$PACKAGE_ROOT/.runtime-venv/bin/python" ]; then
|
|
41
|
+
PYTHON_BIN=$PACKAGE_ROOT/.runtime-venv/bin/python
|
|
42
|
+
else
|
|
43
|
+
PYTHON_BIN=python3
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Fail loudly (not -32000) if the resolved server cannot even be parsed.
|
|
47
|
+
# Use ast.parse (no bytecode written) so a read-only install dir cannot trigger
|
|
48
|
+
# a false "runtime broken" error from py_compile failing to write __pycache__.
|
|
49
|
+
if ! "$PYTHON_BIN" -c 'import sys, ast; ast.parse(open(sys.argv[1], encoding="utf-8").read())' "$SERVER_PY" 2>/dev/null; then
|
|
50
|
+
"$PYTHON_BIN" - "$SERVER_PY" >&2 <<'PY'
|
|
51
|
+
import json, sys
|
|
52
|
+
print(json.dumps({
|
|
53
|
+
"error": "agent-wallet server.py failed to parse — runtime likely broken.",
|
|
54
|
+
"server_py": sys.argv[1],
|
|
55
|
+
"fix": "npx @onecraft/wallet install --yes (or: npx @onecraft/wallet rollback)",
|
|
56
|
+
}))
|
|
57
|
+
PY
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
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
|
+
|
|
66
|
+
exec "$PYTHON_BIN" "$SERVER_PY"
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Fast, read-only statusLine renderer: SOL + Base USDC balances.
|
|
3
|
+
|
|
4
|
+
Reads the cached wallet addresses written by wallet_statusline_setup.sh /
|
|
5
|
+
resolve_wallet_addresses.py (never touches the wallet backend or any secret
|
|
6
|
+
material itself) and polls public RPCs directly, with its own short TTL
|
|
7
|
+
cache so a rapid string of statusLine invocations doesn't hammer the RPCs
|
|
8
|
+
or add latency to the UI.
|
|
9
|
+
"""
|
|
10
|
+
import json
|
|
11
|
+
import os
|
|
12
|
+
import time
|
|
13
|
+
import urllib.request
|
|
14
|
+
|
|
15
|
+
STATE_DIR = os.path.expanduser("~/.openclaw/wallet-statusline")
|
|
16
|
+
ADDRESS_FILE = os.path.join(STATE_DIR, "addresses.json")
|
|
17
|
+
BALANCE_CACHE_FILE = os.path.join(STATE_DIR, "balance_cache.json")
|
|
18
|
+
|
|
19
|
+
SOL_USDC_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
|
20
|
+
BASE_USDC_CONTRACT = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
|
|
21
|
+
|
|
22
|
+
SOL_RPC = "https://api.mainnet-beta.solana.com"
|
|
23
|
+
BASE_RPC = "https://base-rpc.publicnode.com"
|
|
24
|
+
|
|
25
|
+
TTL_SECONDS = 30
|
|
26
|
+
TIMEOUT = 2.5
|
|
27
|
+
|
|
28
|
+
RESET = "\x1b[0m"
|
|
29
|
+
BOLD = "\x1b[1m"
|
|
30
|
+
LABEL_COLOR = "\x1b[38;2;56;189;248m"
|
|
31
|
+
GRAY = "\x1b[38;2;156;163;175m"
|
|
32
|
+
DIM = "\x1b[2m"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def rpc_call(url, method, params):
|
|
36
|
+
payload = json.dumps({"jsonrpc": "2.0", "id": 1, "method": method, "params": params}).encode()
|
|
37
|
+
headers = {"Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (wallet-statusline)"}
|
|
38
|
+
req = urllib.request.Request(url, data=payload, headers=headers)
|
|
39
|
+
with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:
|
|
40
|
+
return json.loads(resp.read())
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def load_addresses():
|
|
44
|
+
try:
|
|
45
|
+
with open(ADDRESS_FILE) as f:
|
|
46
|
+
return json.load(f)
|
|
47
|
+
except (OSError, ValueError):
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def fetch_sol_usdc(sol_address):
|
|
52
|
+
result = rpc_call(
|
|
53
|
+
SOL_RPC,
|
|
54
|
+
"getTokenAccountsByOwner",
|
|
55
|
+
[sol_address, {"mint": SOL_USDC_MINT}, {"encoding": "jsonParsed"}],
|
|
56
|
+
)["result"]["value"]
|
|
57
|
+
if not result:
|
|
58
|
+
return 0.0
|
|
59
|
+
return result[0]["account"]["data"]["parsed"]["info"]["tokenAmount"]["uiAmount"]
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def fetch_base_usdc(base_address):
|
|
63
|
+
selector = "70a08231"
|
|
64
|
+
padded_address = base_address[2:].rjust(64, "0")
|
|
65
|
+
data = f"0x{selector}{padded_address}"
|
|
66
|
+
raw = rpc_call(BASE_RPC, "eth_call", [{"to": BASE_USDC_CONTRACT, "data": data}, "latest"])["result"]
|
|
67
|
+
return int(raw, 16) / 1_000_000
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def fetch_balances(addresses):
|
|
71
|
+
return {
|
|
72
|
+
"sol": fetch_sol_usdc(addresses["sol_address"]),
|
|
73
|
+
"base": fetch_base_usdc(addresses["base_address"]),
|
|
74
|
+
"fetched_at": time.time(),
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_cache():
|
|
79
|
+
try:
|
|
80
|
+
with open(BALANCE_CACHE_FILE) as f:
|
|
81
|
+
return json.load(f)
|
|
82
|
+
except (OSError, ValueError):
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def save_cache(data):
|
|
87
|
+
os.makedirs(os.path.dirname(BALANCE_CACHE_FILE), exist_ok=True)
|
|
88
|
+
tmp = BALANCE_CACHE_FILE + ".tmp"
|
|
89
|
+
with open(tmp, "w") as f:
|
|
90
|
+
json.dump(data, f)
|
|
91
|
+
os.replace(tmp, BALANCE_CACHE_FILE)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def format_line(data, stale):
|
|
95
|
+
marker = f"{DIM}~ {RESET}" if stale else ""
|
|
96
|
+
total = data["sol"] + data["base"]
|
|
97
|
+
label = f"{BOLD}{LABEL_COLOR}AGENTLAYER{RESET}"
|
|
98
|
+
total_str = f"{BOLD}{LABEL_COLOR}${total:.2f}{RESET}"
|
|
99
|
+
base = f"{GRAY}base ${data['base']:.2f}{RESET}"
|
|
100
|
+
sol = f"{GRAY}sol ${data['sol']:.2f}{RESET}"
|
|
101
|
+
breakdown = f"{DIM}({RESET}{base}{DIM} · {RESET}{sol}{DIM}){RESET}"
|
|
102
|
+
return f"{marker}{label} {total_str} {breakdown}"
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def main():
|
|
106
|
+
addresses = load_addresses()
|
|
107
|
+
if not addresses:
|
|
108
|
+
print(f"{DIM}wallet: run /wallet-statusline to enable{RESET}")
|
|
109
|
+
return
|
|
110
|
+
|
|
111
|
+
cache = load_cache()
|
|
112
|
+
now = time.time()
|
|
113
|
+
|
|
114
|
+
if cache and now - cache["fetched_at"] < TTL_SECONDS:
|
|
115
|
+
print(format_line(cache, stale=False))
|
|
116
|
+
return
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
fresh = fetch_balances(addresses)
|
|
120
|
+
save_cache(fresh)
|
|
121
|
+
print(format_line(fresh, stale=False))
|
|
122
|
+
except Exception:
|
|
123
|
+
if cache:
|
|
124
|
+
print(format_line(cache, stale=True))
|
|
125
|
+
else:
|
|
126
|
+
print(f"{DIM}wallet: unavailable{RESET}")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if __name__ == "__main__":
|
|
130
|
+
main()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# Orchestrates enabling the wallet-balance statusLine:
|
|
5
|
+
# 1. Resolve the Base + Solana addresses once via the real MCP server
|
|
6
|
+
# (resolve_wallet_addresses.py), using the same interpreter/venv
|
|
7
|
+
# resolution as run_mcp.sh so it can actually import the `mcp` client.
|
|
8
|
+
# 2. Copy the lightweight polling script to a stable location outside the
|
|
9
|
+
# plugin cache (so a plugin update/reinstall doesn't move the path a
|
|
10
|
+
# user's settings.json already points at).
|
|
11
|
+
# 3. Register it in ~/.claude/settings.json (enable_statusline.py), which
|
|
12
|
+
# refuses to clobber a different statusLine the user already has.
|
|
13
|
+
|
|
14
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
|
|
15
|
+
PLUGIN_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd -P)
|
|
16
|
+
OPENCLAW_HOME=${OPENCLAW_HOME:-"$HOME/.openclaw"}
|
|
17
|
+
PACKAGE_ROOT=${AGENT_WALLET_PACKAGE_ROOT:-${OPENCLAW_AGENT_WALLET_PACKAGE_ROOT:-"$OPENCLAW_HOME/agent-wallet-runtime/current/agent-wallet"}}
|
|
18
|
+
|
|
19
|
+
if [ -n "${AGENT_WALLET_PYTHON:-}" ]; then
|
|
20
|
+
PYTHON_BIN=$AGENT_WALLET_PYTHON
|
|
21
|
+
elif [ -n "${OPENCLAW_AGENT_WALLET_PYTHON:-}" ]; then
|
|
22
|
+
PYTHON_BIN=$OPENCLAW_AGENT_WALLET_PYTHON
|
|
23
|
+
elif [ -x "$PACKAGE_ROOT/.venv/bin/python" ]; then
|
|
24
|
+
PYTHON_BIN=$PACKAGE_ROOT/.venv/bin/python
|
|
25
|
+
elif [ -x "$PACKAGE_ROOT/.runtime-venv/bin/python" ]; then
|
|
26
|
+
PYTHON_BIN=$PACKAGE_ROOT/.runtime-venv/bin/python
|
|
27
|
+
else
|
|
28
|
+
PYTHON_BIN=python3
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
RUN_MCP="$SCRIPT_DIR/run_mcp.sh"
|
|
32
|
+
|
|
33
|
+
echo "Resolving wallet addresses (can take several seconds on a cold wallet backend)..." >&2
|
|
34
|
+
"$PYTHON_BIN" "$SCRIPT_DIR/resolve_wallet_addresses.py" "$RUN_MCP"
|
|
35
|
+
|
|
36
|
+
STABLE_DIR="$OPENCLAW_HOME/wallet-statusline"
|
|
37
|
+
mkdir -p "$STABLE_DIR"
|
|
38
|
+
cp "$SCRIPT_DIR/wallet_statusline.py" "$STABLE_DIR/wallet_statusline.py"
|
|
39
|
+
|
|
40
|
+
python3 "$SCRIPT_DIR/enable_statusline.py" "$STABLE_DIR/wallet_statusline.py"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Use whenever the user's own funds or wallet are involved — balances, portfolio, transfers, swaps, bridging, staking, lending, or x402 payments — even if the user never says \"wallet\". Trigger phrases include \"my balance\", \"how much SOL/ETH/BTC/USDC do I have\", \"send/transfer X to\", \"swap\", \"bridge\", \"stake\", \"my portfolio\", \"pay for this API\", \"x402\". Prefer agent-wallet MCP tools over shell commands, raw RPC, or crypto data servers. Preview writes first and execute only after explicit user confirmation."
|
|
3
|
+
user-invocable: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Wallet Operator
|
|
7
|
+
|
|
8
|
+
Use this skill when the user wants Claude Code to work with the existing local OneCraft wallet.
|
|
9
|
+
|
|
10
|
+
Rules:
|
|
11
|
+
|
|
12
|
+
- Do not create a new wallet unless the user explicitly requests wallet provisioning.
|
|
13
|
+
- Prefer wallet tools over shelling out to chain CLIs, curl, or ad hoc scripts.
|
|
14
|
+
- For writes, start with `preview` or `intent_preview` when the tool supports it.
|
|
15
|
+
- Execute only after the user explicitly confirms the shown summary.
|
|
16
|
+
- On mainnet, restate the network, asset, amount, and destination before execute.
|
|
17
|
+
- Do not ask the user for `approval_token`. The bridge manages approval binding internally.
|
|
18
|
+
- If approval context is missing or stale, repeat preview instead of improvising.
|
|
19
|
+
- Use `set_wallet_backend` to switch between Solana and EVM wallets within a session.
|
|
20
|
+
- Buying/selling a stock onchain ("buy TSLA on base"): call `get_evm_tokenized_stock` first — on Base it resolves the ticker to the canonical Coinbase Tokenized Stock (symbol = ticker + `c`, e.g. `TSLAc`, 8 decimals) by address. Never pick a stock token by ticker from `search_uniswap_pairs`. Ask for the amount and funding asset (default USDC on Base) if missing, quote with `get_evm_swap_quote` (token_out = the returned address), show the quote plus the returned notices (not for U.S. persons; exposure certificate, not a share), and swap with `swap_evm_tokens` only after confirmation.
|
|
21
|
+
- Balance and position answers, on every network (Solana, Ethereum, Base, Robinhood, Arc) and for DeFi positions (Kamino, Morpho, Aave, Lido, Uniswap, staking): show a Markdown table `Asset | Amount | USD` with one row per asset or position, using human amounts (`amount_ui`/`balance_ui`, never raw base units) and `value_usd`, then the network and the total (`total_value_usd`, or the sum of the rows). An asset that has a symbol but no price stays in the table with `—` as its USD value. Hide assets that have neither a symbol nor a USD price (usually spam airdrops) and say how many were hidden. Slash commands that define their own format take precedence.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-wallet",
|
|
3
|
+
"version": "0.1.145",
|
|
4
|
+
"description": "Codex plugin bridge for the OneCraft wallet runtime.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "OneCraft"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/lopushok9/Agent-Layer",
|
|
9
|
+
"repository": "https://github.com/lopushok9/Agent-Layer",
|
|
10
|
+
"license": "SEE LICENSE IN ../../../LICENSE",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"codex",
|
|
13
|
+
"wallet",
|
|
14
|
+
"solana",
|
|
15
|
+
"evm",
|
|
16
|
+
"agentlayer"
|
|
17
|
+
],
|
|
18
|
+
"skills": "./skills/",
|
|
19
|
+
"mcpServers": "./.mcp.json",
|
|
20
|
+
"interface": {
|
|
21
|
+
"displayName": "OneCraft Wallet",
|
|
22
|
+
"shortDescription": "Use the local OneCraft wallet runtime directly in Codex",
|
|
23
|
+
"longDescription": "Connect your existing local OneCraft wallet to Codex. The plugin reuses the current OpenClaw runtime, keeps secrets local, and exposes the same Solana, EVM, x402, Jupiter, Kamino, LI.FI, and Bags tools through a Codex-native MCP bridge.",
|
|
24
|
+
"developerName": "OneCraft",
|
|
25
|
+
"category": "Coding",
|
|
26
|
+
"capabilities": [
|
|
27
|
+
"Interactive",
|
|
28
|
+
"Read",
|
|
29
|
+
"Write"
|
|
30
|
+
],
|
|
31
|
+
"websiteURL": "https://github.com/lopushok9/Agent-Layer",
|
|
32
|
+
"privacyPolicyURL": "https://openai.com/policies/privacy-policy/",
|
|
33
|
+
"termsOfServiceURL": "https://openai.com/policies/terms-of-use/",
|
|
34
|
+
"defaultPrompt": "Use my existing OneCraft wallet here in Codex, preview wallet writes first, and execute only after explicit confirmation.",
|
|
35
|
+
"brandColor": "#0F766E"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"agent-wallet": {
|
|
4
|
+
"command": "sh",
|
|
5
|
+
"args": [
|
|
6
|
+
"-lc",
|
|
7
|
+
"OPENCLAW_HOME=${OPENCLAW_HOME:-$HOME/.openclaw}; launcher=\"$OPENCLAW_HOME/agent-wallet-runtime/current/codex/plugins/agent-wallet/scripts/run_mcp.sh\"; if [ ! -f \"$launcher\" ]; then if ! command -v npx >/dev/null 2>&1; then echo 'OneCraft requires Node.js and npx for first-time wallet runtime setup.' >&2; exit 1; fi; AGENT_WALLET_INSTALL_SOURCE=codex_marketplace_bootstrap npx --yes @onecraft/wallet@latest install --yes --runtime-only >&2 || exit 1; fi; exec sh \"$launcher\""
|
|
8
|
+
],
|
|
9
|
+
"env": {
|
|
10
|
+
"FASTMCP_SHOW_SERVER_BANNER": "false",
|
|
11
|
+
"FASTMCP_LOG_LEVEL": "ERROR"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|