@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,21 @@
|
|
|
1
|
+
"""Example bootstrap entrypoint for OpenClaw plugin startup."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from agent_wallet.bootstrap import describe_bootstrap, ensure_solana_wallet_ready
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main() -> None:
|
|
11
|
+
print("Bootstrap configuration:")
|
|
12
|
+
print(json.dumps(describe_bootstrap(), indent=2))
|
|
13
|
+
print()
|
|
14
|
+
|
|
15
|
+
result = ensure_solana_wallet_ready()
|
|
16
|
+
print("Bootstrap result:")
|
|
17
|
+
print(json.dumps(result, indent=2))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Example: host-side onboarding flow for attaching agent-wallet to OpenClaw."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from agent_wallet.openclaw_runtime import onboard_openclaw_user_wallet
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main() -> None:
|
|
11
|
+
user_id = "demo-user-123"
|
|
12
|
+
# Set AGENT_WALLET_MASTER_KEY in the environment before first run.
|
|
13
|
+
context = onboard_openclaw_user_wallet(
|
|
14
|
+
user_id,
|
|
15
|
+
sign_only=False,
|
|
16
|
+
network="mainnet",
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
print("Session metadata:")
|
|
20
|
+
print(context.session_metadata().model_dump_json(indent=2))
|
|
21
|
+
print()
|
|
22
|
+
|
|
23
|
+
print("Serializable bundle for OpenClaw runtime:")
|
|
24
|
+
print(json.dumps(context.serializable_bundle(), indent=2))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__":
|
|
28
|
+
main()
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Example: user-scoped wallet integration for an OpenClaw runtime."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import json
|
|
7
|
+
|
|
8
|
+
from agent_wallet.openclaw_adapter import OpenClawWalletAdapter
|
|
9
|
+
from agent_wallet.user_wallets import create_wallet_backend_for_user
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def main() -> None:
|
|
13
|
+
user_id = "demo-user-123"
|
|
14
|
+
# Set AGENT_WALLET_MASTER_KEY in the environment before first run so
|
|
15
|
+
# the per-user wallet is encrypted at rest.
|
|
16
|
+
backend = create_wallet_backend_for_user(
|
|
17
|
+
user_id,
|
|
18
|
+
sign_only=False,
|
|
19
|
+
network="mainnet",
|
|
20
|
+
)
|
|
21
|
+
adapter = OpenClawWalletAdapter(backend)
|
|
22
|
+
|
|
23
|
+
print(f"Loaded backend for user_id={user_id}")
|
|
24
|
+
print(json.dumps([tool.model_dump() for tool in adapter.list_tools()], indent=2))
|
|
25
|
+
|
|
26
|
+
address = await adapter.invoke("get_wallet_address")
|
|
27
|
+
print(address.model_dump_json(indent=2))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Example: exposing agent-wallet tools to an OpenClaw-style runtime."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import json
|
|
7
|
+
|
|
8
|
+
from agent_wallet.openclaw_adapter import OpenClawWalletAdapter
|
|
9
|
+
from agent_wallet.wallet_layer.factory import create_wallet_backend
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def main() -> None:
|
|
13
|
+
backend = create_wallet_backend()
|
|
14
|
+
if backend is None:
|
|
15
|
+
raise RuntimeError("No wallet backend configured. Set AGENT_WALLET_BACKEND first.")
|
|
16
|
+
|
|
17
|
+
adapter = OpenClawWalletAdapter(backend)
|
|
18
|
+
|
|
19
|
+
print("Runtime instructions:")
|
|
20
|
+
print(adapter.get_runtime_instructions())
|
|
21
|
+
print()
|
|
22
|
+
|
|
23
|
+
print("Registered tools:")
|
|
24
|
+
print(json.dumps([tool.model_dump() for tool in adapter.list_tools()], indent=2))
|
|
25
|
+
print()
|
|
26
|
+
|
|
27
|
+
result = await adapter.invoke("get_wallet_capabilities")
|
|
28
|
+
print("Capabilities:")
|
|
29
|
+
print(result.model_dump_json(indent=2))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
if __name__ == "__main__":
|
|
33
|
+
asyncio.run(main())
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "agent-wallet",
|
|
3
|
+
"name": "OneCraft Wallet",
|
|
4
|
+
"description": "Plugin-friendly wallet backend for OpenClaw agents with safe wallet tools and runtime instructions across Solana and local EVM.",
|
|
5
|
+
"version": "0.1.145",
|
|
6
|
+
"skills": ["skills/wallet-operator"],
|
|
7
|
+
"configSchema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"additionalProperties": false,
|
|
10
|
+
"properties": {
|
|
11
|
+
"backend": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Wallet backend identifier. Supported values: solana_local, wdk_evm_local."
|
|
14
|
+
},
|
|
15
|
+
"rpcUrl": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Optional local fallback Solana RPC URL. Deployment env SOLANA_RPC_URL wins if set."
|
|
18
|
+
},
|
|
19
|
+
"rpcUrls": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": { "type": "string" },
|
|
22
|
+
"description": "Optional local fallback ordered list of Solana RPC URLs. Deployment env SOLANA_RPC_URLS wins if set."
|
|
23
|
+
},
|
|
24
|
+
"rpcProviderMode": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "RPC mode: auto, user_direct, or shared_proxy. In auto mode, user RPC keys/URLs win; otherwise the shared provider gateway is used when configured."
|
|
27
|
+
},
|
|
28
|
+
"providerGatewayUrl": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Optional override for the shared provider gateway base URL. If omitted, the hosted OpenClaw gateway default is used for onboarding-friendly mainnet RPC and Bags launch/fees flows."
|
|
31
|
+
},
|
|
32
|
+
"providerGatewayRpcProvider": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Optional shared RPC upstream selection for the provider gateway: auto, shared, helius, or alchemy."
|
|
35
|
+
},
|
|
36
|
+
"swapProvider": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Optional Solana swap routing preference: auto or jupiter. Bags launch and fee flows still use the provider gateway separately, but token swaps stay Jupiter-first."
|
|
39
|
+
},
|
|
40
|
+
"network": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Backend network selector. Solana uses mainnet. EVM uses ethereum/base."
|
|
43
|
+
},
|
|
44
|
+
"wdkEvmServiceUrl": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Base URL for the localhost-only wdk-evm-wallet HTTP service when backend=wdk_evm_local."
|
|
47
|
+
},
|
|
48
|
+
"wdkEvmWalletId": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Optional direct walletId override from the local wdk-evm-wallet vault. If omitted, agent-wallet will look for a user-bound EVM wallet under ~/.openclaw/users/<user>/wallets/."
|
|
51
|
+
},
|
|
52
|
+
"wdkEvmAccountIndex": {
|
|
53
|
+
"type": "integer",
|
|
54
|
+
"description": "Optional EVM account index to expose to the agent. Defaults to 0."
|
|
55
|
+
},
|
|
56
|
+
"publicKey": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Read-only wallet public key."
|
|
59
|
+
},
|
|
60
|
+
"privateKey": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Deprecated insecure config path. Inject signing key material via environment variables instead of plugin config."
|
|
63
|
+
},
|
|
64
|
+
"keypairPath": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "Path to Solana CLI JSON keypair file."
|
|
67
|
+
},
|
|
68
|
+
"autoCreateWallet": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"description": "Create a local wallet file automatically on first start if none exists."
|
|
71
|
+
},
|
|
72
|
+
"signOnly": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"description": "If true, the wallet may sign but should not broadcast transactions automatically."
|
|
75
|
+
},
|
|
76
|
+
"masterKey": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "Deprecated insecure config path. Inject the wallet master secret via environment or a secret manager instead of plugin config."
|
|
79
|
+
},
|
|
80
|
+
"approvalSecret": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Deprecated insecure config path. Inject the approval secret via environment or a secret manager instead of plugin config."
|
|
83
|
+
},
|
|
84
|
+
"encryptUserWallets": {
|
|
85
|
+
"type": "boolean",
|
|
86
|
+
"description": "If true, newly created per-user wallet files are encrypted at rest."
|
|
87
|
+
},
|
|
88
|
+
"refuseMainnetWalletRecreation": {
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"description": "If true, refuse to silently create a new mainnet wallet when a pinned address already exists."
|
|
91
|
+
},
|
|
92
|
+
"jupiterBaseUrl": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"description": "Optional Jupiter Swap API base URL for quote and swap building."
|
|
95
|
+
},
|
|
96
|
+
"jupiterUltraBaseUrl": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"description": "Optional Jupiter Ultra API base URL for managed swap execution."
|
|
99
|
+
},
|
|
100
|
+
"jupiterPriceBaseUrl": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"description": "Optional Jupiter Price API base URL for token price lookup."
|
|
103
|
+
},
|
|
104
|
+
"jupiterApiKey": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"description": "Optional Jupiter API key if your deployment uses a keyed endpoint."
|
|
107
|
+
},
|
|
108
|
+
"kaminoBaseUrl": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"description": "Optional Kamino REST API base URL for lending and Earn reads plus transaction building."
|
|
111
|
+
},
|
|
112
|
+
"kaminoProgramId": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Optional Kamino lending program id for market discovery."
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "openclaw-agent-wallet"
|
|
7
|
+
version = "0.1.145"
|
|
8
|
+
description = "Plugin-friendly wallet backend for OpenClaw agents"
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"fastmcp>=2.0.0",
|
|
12
|
+
"httpcore>=1.0.9,<2.0.0",
|
|
13
|
+
"httpx>=0.28.1,<0.29.0",
|
|
14
|
+
"jsonschema>=4.20.0,<5.0.0",
|
|
15
|
+
"pydantic>=2.0.0,<2.13.0",
|
|
16
|
+
"pydantic-settings>=2.0.0",
|
|
17
|
+
"pynacl>=1.5.0",
|
|
18
|
+
"python-dotenv>=1.0.0",
|
|
19
|
+
"solana>=0.36.0",
|
|
20
|
+
"solders>=0.27.0",
|
|
21
|
+
"x402[httpx,svm,evm,extensions]>=2.10.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"pytest>=8.0.0",
|
|
27
|
+
"pytest-asyncio>=0.23.0",
|
|
28
|
+
"ruff>=0.4.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.wheel]
|
|
32
|
+
packages = ["agent_wallet"]
|
|
33
|
+
|
|
34
|
+
[tool.ruff]
|
|
35
|
+
target-version = "py310"
|
|
36
|
+
line-length = 100
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""One-command host bootstrap for the local OpenClaw EVM wallet flow."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
11
|
+
import time
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from urllib.parse import urlparse
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
16
|
+
|
|
17
|
+
from agent_wallet.file_ops import atomic_write_text, chmod_if_exists
|
|
18
|
+
from agent_wallet.config import normalize_evm_network
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _default_config_path() -> Path:
|
|
22
|
+
return Path(os.path.expanduser("~/.openclaw/openclaw.json"))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _default_service_url() -> str:
|
|
26
|
+
from agent_wallet.config import resolve_wdk_evm_service_url
|
|
27
|
+
|
|
28
|
+
return resolve_wdk_evm_service_url()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _default_user_id() -> str:
|
|
32
|
+
return f"{os.getenv('USER', 'openclaw-user')}-local"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _default_python_bin() -> str:
|
|
36
|
+
return os.getenv("OPENCLAW_AGENT_WALLET_PYTHON", sys.executable)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _package_root() -> Path:
|
|
40
|
+
return Path(__file__).resolve().parents[1]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _repo_root() -> Path:
|
|
44
|
+
return Path(__file__).resolve().parents[2]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _script_path(name: str) -> Path:
|
|
48
|
+
return _package_root() / "scripts" / name
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _normalize_network(value: str) -> str:
|
|
52
|
+
return normalize_evm_network(value)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
56
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
57
|
+
parser.add_argument("--config-path", default=str(_default_config_path()))
|
|
58
|
+
parser.add_argument("--plugin-id", default="agent-wallet")
|
|
59
|
+
parser.add_argument("--user-id", default=_default_user_id())
|
|
60
|
+
parser.add_argument("--network", default="base")
|
|
61
|
+
parser.add_argument("--service-url", default=_default_service_url())
|
|
62
|
+
parser.add_argument("--wdk-wallet-root", default=str(_repo_root() / "wdk-evm-wallet"))
|
|
63
|
+
parser.add_argument("--label", default="Agent EVM Wallet")
|
|
64
|
+
parser.add_argument("--account-index", type=int, default=0)
|
|
65
|
+
parser.add_argument("--python-bin", default=_default_python_bin())
|
|
66
|
+
parser.add_argument("--package-root", default=str(_package_root()))
|
|
67
|
+
parser.add_argument("--password-stdin", action=argparse.BooleanOptionalAction, default=False)
|
|
68
|
+
parser.add_argument("--sign-only", action=argparse.BooleanOptionalAction, default=False)
|
|
69
|
+
parser.add_argument("--auto-start-service", action=argparse.BooleanOptionalAction, default=True)
|
|
70
|
+
parser.add_argument("--bind-network-pair", action=argparse.BooleanOptionalAction, default=True)
|
|
71
|
+
return parser
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _ensure_openclaw_config(config_path: Path) -> bool:
|
|
75
|
+
if config_path.exists():
|
|
76
|
+
return False
|
|
77
|
+
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
78
|
+
atomic_write_text(
|
|
79
|
+
config_path,
|
|
80
|
+
json.dumps({"plugins": {"entries": {}}, "tools": {"alsoAllow": []}}, indent=2) + "\n",
|
|
81
|
+
mode=0o600,
|
|
82
|
+
)
|
|
83
|
+
chmod_if_exists(config_path, 0o600)
|
|
84
|
+
return True
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _run_script(
|
|
88
|
+
python_bin: str,
|
|
89
|
+
script_name: str,
|
|
90
|
+
args: list[str],
|
|
91
|
+
*,
|
|
92
|
+
stdin_text: str | None = None,
|
|
93
|
+
) -> dict:
|
|
94
|
+
completed = subprocess.run(
|
|
95
|
+
[python_bin, str(_script_path(script_name)), *args],
|
|
96
|
+
check=True,
|
|
97
|
+
capture_output=True,
|
|
98
|
+
text=True,
|
|
99
|
+
input=stdin_text,
|
|
100
|
+
env=os.environ.copy(),
|
|
101
|
+
)
|
|
102
|
+
return json.loads(completed.stdout)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _health_url(service_url: str) -> str:
|
|
106
|
+
return f"{service_url.rstrip('/')}/health"
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _service_is_healthy(service_url: str) -> bool:
|
|
110
|
+
# Delegate to the shared probe: it dispatches on scheme, so a unix:// URL
|
|
111
|
+
# (the default since resolve_wdk_evm_service_url moved to a per-home socket)
|
|
112
|
+
# is fetched over AF_UNIX. urlopen alone raises "unknown url type: unix",
|
|
113
|
+
# which would make --no-auto-start-service reject a healthy daemon.
|
|
114
|
+
from agent_wallet.evm_user_wallets import _service_health
|
|
115
|
+
|
|
116
|
+
return _service_health(service_url) is not None
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _is_local_service_url(service_url: str) -> bool:
|
|
120
|
+
parsed = urlparse(service_url)
|
|
121
|
+
if parsed.scheme == "unix":
|
|
122
|
+
return bool(parsed.path)
|
|
123
|
+
return parsed.scheme in {"http", "https"} and parsed.hostname in {"127.0.0.1", "localhost", "::1"}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _require_local_service_url(service_url: str) -> None:
|
|
127
|
+
if not _is_local_service_url(service_url):
|
|
128
|
+
raise SystemExit(
|
|
129
|
+
f"EVM bootstrap only supports a localhost service URL. Refusing non-local endpoint: {service_url}"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _service_log_dir(config_path: Path) -> Path:
|
|
134
|
+
return config_path.expanduser().parent / "logs"
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _service_log_path(config_path: Path) -> Path:
|
|
138
|
+
return _service_log_dir(config_path) / "wdk-evm-wallet.log"
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _auto_start_local_service(
|
|
142
|
+
*,
|
|
143
|
+
service_url: str,
|
|
144
|
+
network: str,
|
|
145
|
+
wdk_wallet_root: Path,
|
|
146
|
+
config_path: Path,
|
|
147
|
+
) -> dict[str, object]:
|
|
148
|
+
# Restart a running-but-stale daemon (old code in memory after a release) by
|
|
149
|
+
# comparing its /health version to the on-disk launcher version. Idempotent:
|
|
150
|
+
# steady state is a no-op. See agent_wallet.evm_user_wallets for the shared
|
|
151
|
+
# health/version/stop helpers.
|
|
152
|
+
from agent_wallet.evm_user_wallets import (
|
|
153
|
+
_expected_local_service_instance_id,
|
|
154
|
+
_service_health,
|
|
155
|
+
_should_restart_local_service,
|
|
156
|
+
_stop_local_service,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
restarted = False
|
|
160
|
+
health = _service_health(service_url)
|
|
161
|
+
if health is not None:
|
|
162
|
+
if not _should_restart_local_service(health, wallet_root=wdk_wallet_root):
|
|
163
|
+
return {"started": False, "already_healthy": True}
|
|
164
|
+
_stop_local_service(service_url, health)
|
|
165
|
+
restarted = True
|
|
166
|
+
|
|
167
|
+
if not _is_local_service_url(service_url):
|
|
168
|
+
raise SystemExit(
|
|
169
|
+
f"EVM service at {service_url} is unreachable and auto-start is only supported for localhost URLs."
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
run_local = wdk_wallet_root / "run-local.sh"
|
|
173
|
+
if not run_local.exists():
|
|
174
|
+
raise SystemExit(f"Could not find wdk-evm-wallet launcher: {run_local}")
|
|
175
|
+
|
|
176
|
+
parsed = urlparse(service_url)
|
|
177
|
+
log_dir = _service_log_dir(config_path)
|
|
178
|
+
log_dir.mkdir(parents=True, exist_ok=True)
|
|
179
|
+
log_path = _service_log_path(config_path)
|
|
180
|
+
|
|
181
|
+
env = os.environ.copy()
|
|
182
|
+
if parsed.scheme == "unix":
|
|
183
|
+
env["WDK_EVM_TRANSPORT"] = "socket"
|
|
184
|
+
env["WDK_EVM_SOCKET_PATH"] = parsed.path
|
|
185
|
+
else:
|
|
186
|
+
env["WDK_EVM_TRANSPORT"] = "tcp"
|
|
187
|
+
env["HOST"] = parsed.hostname or "127.0.0.1"
|
|
188
|
+
env["PORT"] = str(parsed.port or 8081)
|
|
189
|
+
env["WDK_EVM_NETWORK"] = network
|
|
190
|
+
env["WDK_EVM_INSTANCE_ID"] = _expected_local_service_instance_id()
|
|
191
|
+
|
|
192
|
+
with log_path.open("a", encoding="utf-8") as log_file:
|
|
193
|
+
process = subprocess.Popen( # noqa: S603
|
|
194
|
+
["sh", str(run_local)],
|
|
195
|
+
cwd=str(wdk_wallet_root),
|
|
196
|
+
env=env,
|
|
197
|
+
stdin=subprocess.DEVNULL,
|
|
198
|
+
stdout=log_file,
|
|
199
|
+
stderr=log_file,
|
|
200
|
+
start_new_session=True,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
deadline = time.time() + 30.0
|
|
204
|
+
while time.time() < deadline:
|
|
205
|
+
health = _service_health(service_url)
|
|
206
|
+
if health is not None:
|
|
207
|
+
pid = int(health.get("pid") or 0)
|
|
208
|
+
return {
|
|
209
|
+
"started": True,
|
|
210
|
+
"already_healthy": False,
|
|
211
|
+
"restarted": restarted,
|
|
212
|
+
"pid": pid,
|
|
213
|
+
"log_path": str(log_path),
|
|
214
|
+
}
|
|
215
|
+
if process.poll() is not None:
|
|
216
|
+
raise SystemExit(
|
|
217
|
+
f"wdk-evm-wallet exited before becoming healthy. Check log: {log_path}"
|
|
218
|
+
)
|
|
219
|
+
time.sleep(0.5)
|
|
220
|
+
|
|
221
|
+
raise SystemExit(
|
|
222
|
+
f"Timed out waiting for wdk-evm-wallet health at {_health_url(service_url)}. Check log: {log_path}"
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def main() -> int:
|
|
227
|
+
args = build_parser().parse_args()
|
|
228
|
+
effective_network = _normalize_network(args.network)
|
|
229
|
+
_require_local_service_url(args.service_url)
|
|
230
|
+
config_path = Path(args.config_path).expanduser()
|
|
231
|
+
config_created = _ensure_openclaw_config(config_path)
|
|
232
|
+
service_bootstrap: dict[str, object] | None = None
|
|
233
|
+
if args.auto_start_service:
|
|
234
|
+
service_bootstrap = _auto_start_local_service(
|
|
235
|
+
service_url=args.service_url,
|
|
236
|
+
network=effective_network,
|
|
237
|
+
wdk_wallet_root=Path(args.wdk_wallet_root).expanduser(),
|
|
238
|
+
config_path=config_path,
|
|
239
|
+
)
|
|
240
|
+
elif not _service_is_healthy(args.service_url):
|
|
241
|
+
raise SystemExit(
|
|
242
|
+
f"EVM service is not healthy at {_health_url(args.service_url)} and --no-auto-start-service was set."
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
stdin_text = sys.stdin.read() if args.password_stdin else None
|
|
246
|
+
setup_payload = _run_script(
|
|
247
|
+
args.python_bin,
|
|
248
|
+
"manage_openclaw_evm_wallet.py",
|
|
249
|
+
[
|
|
250
|
+
"setup",
|
|
251
|
+
"--user-id",
|
|
252
|
+
args.user_id,
|
|
253
|
+
"--network",
|
|
254
|
+
effective_network,
|
|
255
|
+
"--service-url",
|
|
256
|
+
args.service_url,
|
|
257
|
+
"--label",
|
|
258
|
+
args.label,
|
|
259
|
+
"--account-index",
|
|
260
|
+
str(args.account_index),
|
|
261
|
+
*([] if not args.password_stdin else ["--password-stdin"]),
|
|
262
|
+
*(["--bind-network-pair"] if args.bind_network_pair else ["--no-bind-network-pair"]),
|
|
263
|
+
],
|
|
264
|
+
stdin_text=stdin_text,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
wallet = dict(setup_payload.get("wallet") or {})
|
|
268
|
+
install_args = [
|
|
269
|
+
"--config-path",
|
|
270
|
+
str(config_path),
|
|
271
|
+
"--plugin-id",
|
|
272
|
+
args.plugin_id,
|
|
273
|
+
"--user-id",
|
|
274
|
+
args.user_id,
|
|
275
|
+
"--backend",
|
|
276
|
+
"wdk_evm_local",
|
|
277
|
+
"--network",
|
|
278
|
+
effective_network,
|
|
279
|
+
"--wdk-evm-service-url",
|
|
280
|
+
args.service_url,
|
|
281
|
+
"--wdk-evm-wallet-id",
|
|
282
|
+
str(wallet.get("wallet_id") or ""),
|
|
283
|
+
"--wdk-evm-account-index",
|
|
284
|
+
str(wallet.get("account_index") or args.account_index),
|
|
285
|
+
"--package-root",
|
|
286
|
+
args.package_root,
|
|
287
|
+
"--python-bin",
|
|
288
|
+
args.python_bin,
|
|
289
|
+
"--sign-only" if args.sign_only else "--no-sign-only",
|
|
290
|
+
]
|
|
291
|
+
install_payload = _run_script(
|
|
292
|
+
args.python_bin,
|
|
293
|
+
"install_openclaw_local_config.py",
|
|
294
|
+
install_args,
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
print(
|
|
298
|
+
json.dumps(
|
|
299
|
+
{
|
|
300
|
+
"ok": True,
|
|
301
|
+
"config_created": config_created,
|
|
302
|
+
"service_bootstrap": service_bootstrap,
|
|
303
|
+
"evm_setup": setup_payload,
|
|
304
|
+
"openclaw_install": install_payload,
|
|
305
|
+
}
|
|
306
|
+
)
|
|
307
|
+
)
|
|
308
|
+
return 0
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
if __name__ == "__main__":
|
|
312
|
+
raise SystemExit(main())
|