@agentlayer.tech/wallet 0.1.0
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/.openclaw/AGENTS.md +98 -0
- package/.openclaw/extensions/agent-wallet/README.md +127 -0
- package/.openclaw/extensions/agent-wallet/index.ts +1520 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +184 -0
- package/.openclaw/extensions/agent-wallet/package.json +11 -0
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +20 -0
- package/CHANGELOG.md +42 -0
- package/LICENSE +104 -0
- package/README.md +332 -0
- package/RELEASING.md +204 -0
- package/agent-wallet/.env.example +62 -0
- package/agent-wallet/AGENTS.md +129 -0
- package/agent-wallet/README.md +527 -0
- package/agent-wallet/agent_wallet/__init__.py +11 -0
- package/agent-wallet/agent_wallet/approval.py +161 -0
- package/agent-wallet/agent_wallet/bootstrap.py +178 -0
- package/agent-wallet/agent_wallet/btc_user_wallets.py +217 -0
- package/agent-wallet/agent_wallet/config.py +382 -0
- package/agent-wallet/agent_wallet/encrypted_storage.py +161 -0
- package/agent-wallet/agent_wallet/evm_user_wallets.py +370 -0
- package/agent-wallet/agent_wallet/exceptions.py +9 -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/models.py +66 -0
- package/agent-wallet/agent_wallet/nonce_registry.py +59 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +5128 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +626 -0
- package/agent-wallet/agent_wallet/openclaw_runtime.py +272 -0
- package/agent-wallet/agent_wallet/plugin_bundle.py +42 -0
- package/agent-wallet/agent_wallet/providers/__init__.py +1 -0
- package/agent-wallet/agent_wallet/providers/bags.py +259 -0
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +470 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +567 -0
- package/agent-wallet/agent_wallet/providers/kamino.py +215 -0
- package/agent-wallet/agent_wallet/providers/lifi.py +277 -0
- package/agent-wallet/agent_wallet/providers/solana_rpc.py +470 -0
- package/agent-wallet/agent_wallet/providers/wdk_btc_local.py +114 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +205 -0
- package/agent-wallet/agent_wallet/sealed_keys.py +61 -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 +101 -0
- package/agent-wallet/agent_wallet/transaction_policy.py +518 -0
- package/agent-wallet/agent_wallet/user_wallets.py +355 -0
- package/agent-wallet/agent_wallet/validation.py +31 -0
- package/agent-wallet/agent_wallet/wallet_layer/__init__.py +1 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +808 -0
- package/agent-wallet/agent_wallet/wallet_layer/base58.py +44 -0
- package/agent-wallet/agent_wallet/wallet_layer/factory.py +102 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +4252 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_btc.py +272 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +1628 -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 +138 -0
- package/agent-wallet/pyproject.toml +31 -0
- package/agent-wallet/scripts/bootstrap_openclaw_btc.py +278 -0
- package/agent-wallet/scripts/build_release_bundle.py +188 -0
- package/agent-wallet/scripts/finalize_openclaw_local_wallet_config.py +121 -0
- package/agent-wallet/scripts/install_agent_wallet.py +505 -0
- package/agent-wallet/scripts/install_openclaw_local_config.py +226 -0
- package/agent-wallet/scripts/install_openclaw_sealed_keys.py +105 -0
- package/agent-wallet/scripts/manage_openclaw_btc_wallet.py +244 -0
- package/agent-wallet/scripts/reveal_btc_seed.sh +130 -0
- package/agent-wallet/scripts/security_utils.py +37 -0
- package/agent-wallet/scripts/setup_btc_wallet.sh +146 -0
- package/agent-wallet/scripts/switch_openclaw_wallet_network.py +106 -0
- package/agent-wallet/skills/wallet-operator/SKILL.md +128 -0
- package/bin/openclaw-agent-wallet.mjs +487 -0
- package/install-from-github.sh +134 -0
- package/package.json +61 -0
- package/setup.sh +40 -0
- package/wdk-btc-wallet/README.md +325 -0
- package/wdk-btc-wallet/bootstrap.sh +22 -0
- package/wdk-btc-wallet/package-lock.json +1839 -0
- package/wdk-btc-wallet/package.json +18 -0
- package/wdk-btc-wallet/run-local.sh +21 -0
- package/wdk-btc-wallet/src/config.js +160 -0
- package/wdk-btc-wallet/src/json.js +35 -0
- package/wdk-btc-wallet/src/local_vault.js +432 -0
- package/wdk-btc-wallet/src/network_state.js +84 -0
- package/wdk-btc-wallet/src/server.js +257 -0
- package/wdk-btc-wallet/src/wdk_btc_wallet.js +332 -0
- package/wdk-evm-wallet/README.md +183 -0
- package/wdk-evm-wallet/bootstrap.sh +8 -0
- package/wdk-evm-wallet/package-lock.json +2340 -0
- package/wdk-evm-wallet/package.json +23 -0
- package/wdk-evm-wallet/run-local.sh +12 -0
- package/wdk-evm-wallet/src/config.js +274 -0
- package/wdk-evm-wallet/src/json.js +35 -0
- package/wdk-evm-wallet/src/local_vault.js +430 -0
- package/wdk-evm-wallet/src/network_state.js +92 -0
- package/wdk-evm-wallet/src/server.js +575 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +4981 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# WDK EVM Wallet
|
|
2
|
+
|
|
3
|
+
Separate EVM wallet service built on top of Tether WDK.
|
|
4
|
+
|
|
5
|
+
This project is intentionally isolated from the existing Python `agent-wallet/`,
|
|
6
|
+
the Solana backend, and the separate BTC runtime. It is the dedicated local EVM
|
|
7
|
+
wallet path for ordinary EVM accounts based on `@tetherto/wdk-wallet-evm`.
|
|
8
|
+
|
|
9
|
+
Current scope:
|
|
10
|
+
|
|
11
|
+
- local encrypted wallet vault
|
|
12
|
+
- localhost-only HTTP surface
|
|
13
|
+
- local bearer-token auth between the wallet service and trusted local callers
|
|
14
|
+
- wallet registry with `walletId`
|
|
15
|
+
- explicit `unlock` / `lock` semantics
|
|
16
|
+
- derive EVM accounts and addresses
|
|
17
|
+
- fetch native balances
|
|
18
|
+
- fetch ERC-20 balances
|
|
19
|
+
- fetch ERC-20 token metadata (`name`, `symbol`, `decimals`)
|
|
20
|
+
- fetch fee-rate suggestions
|
|
21
|
+
- fetch read-only Velora swap quotes for supported mainnet ERC-20 pairs
|
|
22
|
+
- execute Velora ERC-20 swaps on supported mainnet networks through the local wallet account
|
|
23
|
+
- fetch Aave V3 account data on supported mainnet networks
|
|
24
|
+
- fetch Aave V3 reserve catalog on supported mainnet networks
|
|
25
|
+
- fetch Aave V3 per-reserve user positions on supported mainnet networks
|
|
26
|
+
- quote and send narrow Aave V3 `supply`, `withdraw`, `borrow`, and `repay` operations
|
|
27
|
+
- quote and send native transfers
|
|
28
|
+
- quote and send ERC-20 transfers
|
|
29
|
+
- fetch transaction receipts
|
|
30
|
+
|
|
31
|
+
The implementation follows the official WDK documentation:
|
|
32
|
+
|
|
33
|
+
- Node.js Quickstart: https://docs.wdk.tether.io/start-building/nodejs-bare-quickstart
|
|
34
|
+
- SDK Get Started: https://docs.wdk.tether.io/sdk/get-started
|
|
35
|
+
- EVM wallet overview: https://docs.wdk.tether.io/sdk/wallet-modules/wallet-evm
|
|
36
|
+
- EVM wallet configuration: https://docs.wdk.tether.io/sdk/wallet-modules/wallet-evm/configuration
|
|
37
|
+
- EVM wallet API reference: https://docs.wdk.tether.io/sdk/wallet-modules/wallet-evm/api-reference
|
|
38
|
+
- Velora swap overview: https://docs.wdk.tether.io/sdk/swap-modules/swap-velora-evm
|
|
39
|
+
- Velora swap API reference: https://docs.wdk.tether.io/sdk/swap-modules/swap-velora-evm/api-reference
|
|
40
|
+
- Aave lending overview: https://docs.wdk.tether.io/sdk/lending-modules/lending-aave-evm
|
|
41
|
+
- Aave lending API reference: https://docs.wdk.tether.io/sdk/lending-modules/lending-aave-evm/api-reference
|
|
42
|
+
|
|
43
|
+
## Why Separate
|
|
44
|
+
|
|
45
|
+
- keeps the existing Solana wallet backend untouched
|
|
46
|
+
- keeps BTC and EVM custody paths operationally separate
|
|
47
|
+
- avoids mixing Python wallet policy with the Node.js WDK runtime
|
|
48
|
+
- creates a clean path for future EVM-specific protocol layers without exposing raw contract calls to the agent
|
|
49
|
+
|
|
50
|
+
## Initial Safety Boundaries
|
|
51
|
+
|
|
52
|
+
This service intentionally supports a narrow surface:
|
|
53
|
+
|
|
54
|
+
- normal EVM account model only
|
|
55
|
+
- no ERC-4337 in this runtime
|
|
56
|
+
- no arbitrary calldata on `sendTransaction`
|
|
57
|
+
- no generic token approval endpoint
|
|
58
|
+
- protocol-scoped approvals only where required by an explicit supported module
|
|
59
|
+
- no generic contract execution endpoints
|
|
60
|
+
- no seed phrase exposure in the agent-facing path
|
|
61
|
+
|
|
62
|
+
## Networks
|
|
63
|
+
|
|
64
|
+
- `ethereum`
|
|
65
|
+
- `sepolia`
|
|
66
|
+
- `base`
|
|
67
|
+
- `base-sepolia`
|
|
68
|
+
|
|
69
|
+
The active network is persistent and can be switched without changing code.
|
|
70
|
+
|
|
71
|
+
## API
|
|
72
|
+
|
|
73
|
+
- `GET /health`
|
|
74
|
+
- `GET /v1/evm/network`
|
|
75
|
+
- `POST /v1/evm/network/set`
|
|
76
|
+
- `POST /v1/evm/seed-phrase/generate`
|
|
77
|
+
- `GET /v1/evm/wallets`
|
|
78
|
+
- `POST /v1/evm/wallets/get`
|
|
79
|
+
- `POST /v1/evm/wallets/create`
|
|
80
|
+
- `POST /v1/evm/wallets/import`
|
|
81
|
+
- `POST /v1/evm/wallets/unlock`
|
|
82
|
+
- `POST /v1/evm/wallets/lock`
|
|
83
|
+
- `POST /v1/evm/wallets/reveal-seed`
|
|
84
|
+
- `POST /v1/evm/wallets/change-password`
|
|
85
|
+
- `POST /v1/evm/address/resolve`
|
|
86
|
+
- `POST /v1/evm/balance/get`
|
|
87
|
+
- `POST /v1/evm/token-balance/get`
|
|
88
|
+
- `POST /v1/evm/token-metadata/get`
|
|
89
|
+
- `POST /v1/evm/fee-rates/get`
|
|
90
|
+
- `POST /v1/evm/transaction/receipt/get`
|
|
91
|
+
- `POST /v1/evm/aave/account/get`
|
|
92
|
+
- `POST /v1/evm/aave/reserves/get`
|
|
93
|
+
- `POST /v1/evm/aave/positions/get`
|
|
94
|
+
- `POST /v1/evm/aave/supply/quote`
|
|
95
|
+
- `POST /v1/evm/aave/supply/send`
|
|
96
|
+
- `POST /v1/evm/aave/withdraw/quote`
|
|
97
|
+
- `POST /v1/evm/aave/withdraw/send`
|
|
98
|
+
- `POST /v1/evm/aave/borrow/quote`
|
|
99
|
+
- `POST /v1/evm/aave/borrow/send`
|
|
100
|
+
- `POST /v1/evm/aave/repay/quote`
|
|
101
|
+
- `POST /v1/evm/aave/repay/send`
|
|
102
|
+
- `POST /v1/evm/swap/quote`
|
|
103
|
+
- `POST /v1/evm/swap/send`
|
|
104
|
+
- `POST /v1/evm/transfer/quote`
|
|
105
|
+
- `POST /v1/evm/transfer/send`
|
|
106
|
+
- `POST /v1/evm/token-transfer/quote`
|
|
107
|
+
- `POST /v1/evm/token-transfer/send`
|
|
108
|
+
|
|
109
|
+
All routes except `/health` require:
|
|
110
|
+
|
|
111
|
+
- `Authorization: Bearer <token>`
|
|
112
|
+
|
|
113
|
+
By default the service generates that token automatically at:
|
|
114
|
+
|
|
115
|
+
- `~/.openclaw/wdk-evm-wallet/local-auth-token`
|
|
116
|
+
|
|
117
|
+
or under `OPENCLAW_HOME/wdk-evm-wallet/local-auth-token` when `OPENCLAW_HOME` is set.
|
|
118
|
+
|
|
119
|
+
## Install
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
cd wdk-evm-wallet
|
|
123
|
+
npm install
|
|
124
|
+
cp .env.example .env
|
|
125
|
+
npm start
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Simplest onboarding:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cd wdk-evm-wallet && sh bootstrap.sh
|
|
132
|
+
cd wdk-evm-wallet && npm start
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Fastest local start:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cd wdk-evm-wallet && sh run-local.sh
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration
|
|
142
|
+
|
|
143
|
+
Environment variables:
|
|
144
|
+
|
|
145
|
+
- `HOST`
|
|
146
|
+
- `PORT`
|
|
147
|
+
- `WDK_EVM_NETWORK`
|
|
148
|
+
- `WDK_EVM_DATA_DIR`
|
|
149
|
+
- `WDK_EVM_LOCAL_TOKEN`
|
|
150
|
+
- `WDK_EVM_LOCAL_TOKEN_PATH`
|
|
151
|
+
- `WDK_EVM_UNLOCK_TIMEOUT_SECONDS`
|
|
152
|
+
- `WDK_EVM_TRANSFER_MAX_FEE_WEI`
|
|
153
|
+
- `WDK_EVM_RPC_PROVIDER_MODE`
|
|
154
|
+
- `WDK_EVM_RPC_GATEWAY_PROVIDER`
|
|
155
|
+
- `PROVIDER_GATEWAY_URL`
|
|
156
|
+
- `PROVIDER_GATEWAY_BEARER_TOKEN`
|
|
157
|
+
- `WDK_EVM_ETHEREUM_RPC_URL`
|
|
158
|
+
- `WDK_EVM_SEPOLIA_RPC_URL`
|
|
159
|
+
- `WDK_EVM_BASE_RPC_URL`
|
|
160
|
+
- `WDK_EVM_BASE_SEPOLIA_RPC_URL`
|
|
161
|
+
|
|
162
|
+
Gateway mode:
|
|
163
|
+
|
|
164
|
+
- set `WDK_EVM_RPC_PROVIDER_MODE=gateway`
|
|
165
|
+
- `PROVIDER_GATEWAY_URL` defaults to `https://agent-layer-production.up.railway.app`
|
|
166
|
+
- set `PROVIDER_GATEWAY_URL=https://...` only when overriding the hosted default
|
|
167
|
+
- `PROVIDER_GATEWAY_BEARER_TOKEN` is optional and only needed when the gateway is protected
|
|
168
|
+
- optionally set `WDK_EVM_RPC_GATEWAY_PROVIDER=alchemy|shared|auto`
|
|
169
|
+
- in gateway mode, `ethereum` and `base` use the provider gateway raw EVM RPC route
|
|
170
|
+
- explicit `WDK_EVM_<NETWORK>_RPC_URL` values still override gateway mode per network
|
|
171
|
+
|
|
172
|
+
Local security note:
|
|
173
|
+
|
|
174
|
+
- the service binds to `127.0.0.1` by default
|
|
175
|
+
- encrypted wallet files are stored locally on disk
|
|
176
|
+
- unlocked seed phrases live only in memory
|
|
177
|
+
- explicit `lock` or process restart clears the in-memory unlocked state
|
|
178
|
+
- seed reveal is password-gated and separate from normal agent operations
|
|
179
|
+
- Velora swap support is currently limited to `ethereum` and `base` ERC-20 pairs
|
|
180
|
+
- the underlying WDK Velora package is still beta; test swap execution carefully before relying on it
|
|
181
|
+
- Aave V3 support is currently limited to `ethereum` and `base`
|
|
182
|
+
- Aave `supply` and `repay` may perform pool-scoped ERC-20 approvals; if a send fails after approval, the service attempts to restore the original allowance
|
|
183
|
+
- Aave delegated `onBehalfOf` operations and third-party withdraw destinations are intentionally not exposed in this runtime
|