@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,139 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
OPENCLAW_INSTALL_REPO_DEFAULT="lopushok9/Agent-Layer"
|
|
5
|
+
OPENCLAW_INSTALL_REPO="${OPENCLAW_INSTALL_REPO:-$OPENCLAW_INSTALL_REPO_DEFAULT}"
|
|
6
|
+
OPENCLAW_INSTALL_ROOT="${OPENCLAW_INSTALL_ROOT:-$HOME/.openclaw/agent-wallet-runtime}"
|
|
7
|
+
OPENCLAW_INSTALL_TARGET="${OPENCLAW_INSTALL_TARGET:-$OPENCLAW_INSTALL_ROOT/current}"
|
|
8
|
+
OPENCLAW_INSTALL_RELEASE_TAG="${OPENCLAW_INSTALL_RELEASE_TAG:-}"
|
|
9
|
+
OPENCLAW_INSTALL_RELEASE_METADATA_URL="${OPENCLAW_INSTALL_RELEASE_METADATA_URL:-}"
|
|
10
|
+
OPENCLAW_INSTALL_ASSET_NAME="${OPENCLAW_INSTALL_ASSET_NAME:-}"
|
|
11
|
+
OPENCLAW_INSTALL_ASSET_PREFIX="${OPENCLAW_INSTALL_ASSET_PREFIX:-openclaw-agent-wallet-bundle-}"
|
|
12
|
+
OPENCLAW_INSTALL_ASSET_URL="${OPENCLAW_INSTALL_ASSET_URL:-${OPENCLAW_INSTALL_ARCHIVE_URL:-}}"
|
|
13
|
+
|
|
14
|
+
require_cmd() {
|
|
15
|
+
name="$1"
|
|
16
|
+
if ! command -v "$name" >/dev/null 2>&1; then
|
|
17
|
+
printf 'Required command not found: %s\n' "$name" >&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
require_path() {
|
|
23
|
+
target="$1"
|
|
24
|
+
label="$2"
|
|
25
|
+
if [ ! -e "$target" ]; then
|
|
26
|
+
printf 'Missing %s at %s\n' "$label" "$target" >&2
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
resolve_release_metadata_url() {
|
|
32
|
+
if [ -n "$OPENCLAW_INSTALL_RELEASE_METADATA_URL" ]; then
|
|
33
|
+
printf '%s\n' "$OPENCLAW_INSTALL_RELEASE_METADATA_URL"
|
|
34
|
+
return
|
|
35
|
+
fi
|
|
36
|
+
if [ -z "$OPENCLAW_INSTALL_REPO" ]; then
|
|
37
|
+
printf 'OPENCLAW_INSTALL_REPO is required unless OPENCLAW_INSTALL_ASSET_URL or OPENCLAW_INSTALL_RELEASE_METADATA_URL is set.\n' >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
if [ -n "$OPENCLAW_INSTALL_RELEASE_TAG" ]; then
|
|
41
|
+
printf 'https://api.github.com/repos/%s/releases/tags/%s\n' "$OPENCLAW_INSTALL_REPO" "$OPENCLAW_INSTALL_RELEASE_TAG"
|
|
42
|
+
return
|
|
43
|
+
fi
|
|
44
|
+
printf 'https://api.github.com/repos/%s/releases/latest\n' "$OPENCLAW_INSTALL_REPO"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
resolve_asset_url() {
|
|
48
|
+
metadata_path="$1"
|
|
49
|
+
python3 - "$metadata_path" "$OPENCLAW_INSTALL_ASSET_NAME" "$OPENCLAW_INSTALL_ASSET_PREFIX" <<'PY'
|
|
50
|
+
import json
|
|
51
|
+
import sys
|
|
52
|
+
from pathlib import Path
|
|
53
|
+
|
|
54
|
+
metadata_path = Path(sys.argv[1])
|
|
55
|
+
asset_name = sys.argv[2].strip()
|
|
56
|
+
asset_prefix = sys.argv[3].strip()
|
|
57
|
+
payload = json.loads(metadata_path.read_text(encoding="utf-8"))
|
|
58
|
+
assets = payload.get("assets") or []
|
|
59
|
+
|
|
60
|
+
selected = None
|
|
61
|
+
if asset_name:
|
|
62
|
+
for asset in assets:
|
|
63
|
+
if str(asset.get("name") or "").strip() == asset_name:
|
|
64
|
+
selected = asset
|
|
65
|
+
break
|
|
66
|
+
else:
|
|
67
|
+
for asset in assets:
|
|
68
|
+
name = str(asset.get("name") or "").strip()
|
|
69
|
+
if name.startswith(asset_prefix) and name.endswith(".tar.gz"):
|
|
70
|
+
selected = asset
|
|
71
|
+
break
|
|
72
|
+
|
|
73
|
+
if not isinstance(selected, dict):
|
|
74
|
+
raise SystemExit("Could not find a matching release bundle asset.")
|
|
75
|
+
|
|
76
|
+
download_url = str(selected.get("browser_download_url") or "").strip()
|
|
77
|
+
if not download_url:
|
|
78
|
+
raise SystemExit("Matching release asset is missing browser_download_url.")
|
|
79
|
+
|
|
80
|
+
print(download_url)
|
|
81
|
+
PY
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
require_cmd curl
|
|
85
|
+
require_cmd tar
|
|
86
|
+
require_cmd mktemp
|
|
87
|
+
require_cmd rm
|
|
88
|
+
require_cmd mkdir
|
|
89
|
+
require_cmd mv
|
|
90
|
+
require_cmd find
|
|
91
|
+
require_cmd sh
|
|
92
|
+
require_cmd python3
|
|
93
|
+
|
|
94
|
+
TEMP_DIR="$(mktemp -d)"
|
|
95
|
+
ARCHIVE_PATH="${TEMP_DIR}/bundle.tar.gz"
|
|
96
|
+
METADATA_PATH="${TEMP_DIR}/release.json"
|
|
97
|
+
EXTRACT_DIR="${TEMP_DIR}/extract"
|
|
98
|
+
|
|
99
|
+
cleanup() {
|
|
100
|
+
rm -rf "$TEMP_DIR"
|
|
101
|
+
}
|
|
102
|
+
trap cleanup EXIT INT TERM
|
|
103
|
+
|
|
104
|
+
if [ -z "$OPENCLAW_INSTALL_ASSET_URL" ]; then
|
|
105
|
+
RELEASE_METADATA_URL="$(resolve_release_metadata_url)"
|
|
106
|
+
printf 'Resolving release metadata %s\n' "$RELEASE_METADATA_URL" >&2
|
|
107
|
+
curl -fsSL "$RELEASE_METADATA_URL" -o "$METADATA_PATH"
|
|
108
|
+
OPENCLAW_INSTALL_ASSET_URL="$(resolve_asset_url "$METADATA_PATH")"
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
printf 'Downloading %s\n' "$OPENCLAW_INSTALL_ASSET_URL" >&2
|
|
112
|
+
curl -fsSL "$OPENCLAW_INSTALL_ASSET_URL" -o "$ARCHIVE_PATH"
|
|
113
|
+
|
|
114
|
+
mkdir -p "$EXTRACT_DIR"
|
|
115
|
+
tar -xzf "$ARCHIVE_PATH" -C "$EXTRACT_DIR"
|
|
116
|
+
|
|
117
|
+
SOURCE_ROOT="$(find "$EXTRACT_DIR" -mindepth 1 -maxdepth 1 -type d | head -n 1)"
|
|
118
|
+
if [ -z "$SOURCE_ROOT" ] || [ ! -d "$SOURCE_ROOT" ]; then
|
|
119
|
+
printf 'Could not determine extracted bundle root.\n' >&2
|
|
120
|
+
exit 1
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Pre-flight must be a superset of setup.sh's require_path list: everything is
|
|
124
|
+
# checked on the EXTRACTED temp tree, before the destructive swap below. A
|
|
125
|
+
# bundle that would fail setup.sh must never replace the user's runtime.
|
|
126
|
+
require_path "$SOURCE_ROOT/setup.sh" "local setup entrypoint"
|
|
127
|
+
require_path "$SOURCE_ROOT/agent-wallet" "agent-wallet package"
|
|
128
|
+
require_path "$SOURCE_ROOT/agent-wallet/scripts/install_agent_wallet.py" "Python installer"
|
|
129
|
+
require_path "$SOURCE_ROOT/.openclaw/extensions/agent-wallet" "OpenClaw extension"
|
|
130
|
+
require_path "$SOURCE_ROOT/codex/plugins/agent-wallet/.codex-plugin/plugin.json" "Codex plugin"
|
|
131
|
+
require_path "$SOURCE_ROOT/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json" "Claude Code plugin"
|
|
132
|
+
require_path "$SOURCE_ROOT/wdk-evm-wallet/package.json" "wdk-evm-wallet runtime"
|
|
133
|
+
|
|
134
|
+
mkdir -p "$OPENCLAW_INSTALL_ROOT"
|
|
135
|
+
rm -rf "$OPENCLAW_INSTALL_TARGET"
|
|
136
|
+
mv "$SOURCE_ROOT" "$OPENCLAW_INSTALL_TARGET"
|
|
137
|
+
|
|
138
|
+
printf 'Installed runtime bundle into %s\n' "$OPENCLAW_INSTALL_TARGET" >&2
|
|
139
|
+
exec sh "$OPENCLAW_INSTALL_TARGET/setup.sh" "$@"
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# OneCraft Treasury Guard
|
|
2
|
+
|
|
3
|
+
Treasury Guard is an opt-in Hedera testnet integration for OneCraft Wallet.
|
|
4
|
+
It checks an account's HBAR reserve and prepares a policy-limited
|
|
5
|
+
SAUCE-to-HBAR swap through SaucerSwap V1 when the reserve falls below target.
|
|
6
|
+
The policy caps each trade, so a swap may cover only part of the reserve shortfall.
|
|
7
|
+
|
|
8
|
+
## Try a live quote
|
|
9
|
+
|
|
10
|
+
Run from the OneCraft checkout with Node.js 24.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
node bin/openclaw-agent-wallet.mjs hedera-treasury quote --spend-units 1000000
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This quotes one whole testnet SAUCE. The command needs internet access to the
|
|
17
|
+
Hedera testnet mirror node. It requires no account, private key, or SDK install.
|
|
18
|
+
|
|
19
|
+
## Set up a testnet treasury
|
|
20
|
+
|
|
21
|
+
Use a dedicated Hedera testnet account with HBAR for fees and testnet SAUCE
|
|
22
|
+
(token `0.0.1183558`). Create a testnet allowance limited to your intended
|
|
23
|
+
SAUCE spend for the SaucerSwap V1 router `0.0.19264`. Treasury Guard checks
|
|
24
|
+
the allowance and the SAUCE balance before preparing a swap. It uses the
|
|
25
|
+
account's canonical EVM address as the HBAR recipient.
|
|
26
|
+
|
|
27
|
+
Copy the [example policy](examples/treasury-policy.example.json) to a file you control, set
|
|
28
|
+
`account_id`, and adjust the reserve, minimum output, and fee cap for your demo.
|
|
29
|
+
Set the reserve above your current HBAR balance to exercise the top-up branch.
|
|
30
|
+
One HBAR is 100,000,000 tinybars and one SAUCE is 1,000,000 units. Use integer
|
|
31
|
+
strings for amounts. Slippage is configurable from 0 to 100 basis points.
|
|
32
|
+
The default policy location is `~/.openclaw/hedera-treasury/policy.json`, or
|
|
33
|
+
`hedera-treasury/policy.json` under your `OPENCLAW_HOME`.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
node bin/openclaw-agent-wallet.mjs hedera-treasury preview --policy /path/to/policy.json --spend-units 100000000
|
|
37
|
+
node bin/openclaw-agent-wallet.mjs hedera-treasury prepare --policy /path/to/policy.json --spend-units 100000000
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`hold` means the HBAR balance already meets the configured reserve. When a
|
|
41
|
+
top-up is allowed, `prepare` writes a local plan and returns a plan ID. Plans
|
|
42
|
+
expire three minutes after the quote starts. Omitting `--spend-units` uses the
|
|
43
|
+
policy's maximum per-swap spend.
|
|
44
|
+
|
|
45
|
+
## Approve and execute
|
|
46
|
+
|
|
47
|
+
Install the opt-in signing SDK from the repository root. Run the execution command
|
|
48
|
+
in your own interactive terminal while the plan is valid.
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
(cd integrations/hedera/treasury-guard && npm ci --ignore-scripts)
|
|
52
|
+
node bin/openclaw-agent-wallet.mjs hedera-treasury execute PLAN_ID --policy /path/to/policy.json
|
|
53
|
+
node bin/openclaw-agent-wallet.mjs hedera-treasury status PLAN_ID
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Review the printed terms, type the full approval phrase, and enter the dedicated
|
|
57
|
+
testnet account's private key at the hidden terminal prompt. Single-key Ed25519
|
|
58
|
+
and ECDSA accounts are supported. The key stays in memory for this command and
|
|
59
|
+
is never passed through CLI arguments or written to a plan. The command
|
|
60
|
+
rechecks the policy, balances, allowance, and quote before submitting. The
|
|
61
|
+
router enforces the approved minimum HBAR output and deadline.
|
|
62
|
+
|
|
63
|
+
A submitted plan always has a local attempt record and testnet HashScan URL.
|
|
64
|
+
If submission is unconfirmed, use that URL to reconcile the transaction
|
|
65
|
+
before preparing another swap for the same account. OneCraft will not resubmit
|
|
66
|
+
the same plan. If a process crashes and leaves an account lock, remove the
|
|
67
|
+
`<account_id>.lock` directory under the Treasury Guard state directory only
|
|
68
|
+
after checking the saved attempt and confirming no process is still active.
|
|
69
|
+
|
|
70
|
+
To add an HCS audit entry after a confirmed swap, add `audit_topic_id` to the
|
|
71
|
+
policy. Use a testnet topic with no custom fees that the signing account can submit to. Preview
|
|
72
|
+
includes the separate 0.1 HBAR audit fee cap. The swap and audit have separate
|
|
73
|
+
results, so an unsuccessful audit leaves the swap result available.
|
|
74
|
+
|
|
75
|
+
## Use from an agent
|
|
76
|
+
|
|
77
|
+
Give an agent with shell access the [Treasury Guard skill](skills/onecraft-hedera-treasury/SKILL.md)
|
|
78
|
+
and the policy path. The agent can review the quote, decide to hold or prepare a
|
|
79
|
+
top-up, and check local status. The operator runs the signing step directly
|
|
80
|
+
in an interactive terminal. This workflow uses dedicated testnet state under
|
|
81
|
+
`OPENCLAW_HOME/hedera-treasury`.
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
The [source](src/) contains the CLI, policy, mirror client, and signer.
|
|
86
|
+
The root `npm run check` includes the policy and CLI tests. To run both
|
|
87
|
+
Treasury Guard test suites, install the signing SDK and run the following
|
|
88
|
+
from the repository root.
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
node --test integrations/hedera/treasury-guard/tests/*.test.mjs
|
|
92
|
+
```
|