@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
package/setup.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
|
5
|
+
INSTALLER="${ROOT_DIR}/agent-wallet/scripts/install_agent_wallet.py"
|
|
6
|
+
|
|
7
|
+
require_path() {
|
|
8
|
+
target="$1"
|
|
9
|
+
label="$2"
|
|
10
|
+
if [ ! -e "$target" ]; then
|
|
11
|
+
printf 'Missing %s at %s\n' "$label" "$target" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
require_cmd() {
|
|
17
|
+
name="$1"
|
|
18
|
+
if ! command -v "$name" >/dev/null 2>&1; then
|
|
19
|
+
printf 'Required command not found: %s\n' "$name" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
require_cmd python3
|
|
25
|
+
require_cmd node
|
|
26
|
+
require_cmd npm
|
|
27
|
+
|
|
28
|
+
require_path "$INSTALLER" "Python installer"
|
|
29
|
+
require_path "${ROOT_DIR}/agent-wallet" "agent-wallet package"
|
|
30
|
+
require_path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" "OpenClaw extension"
|
|
31
|
+
require_path "${ROOT_DIR}/wdk-btc-wallet/package.json" "wdk-btc-wallet package"
|
|
32
|
+
require_path "${ROOT_DIR}/wdk-evm-wallet/package.json" "wdk-evm-wallet package"
|
|
33
|
+
|
|
34
|
+
exec python3 "$INSTALLER" \
|
|
35
|
+
--package-root "${ROOT_DIR}/agent-wallet" \
|
|
36
|
+
--extension-path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" \
|
|
37
|
+
--wdk-btc-root "${ROOT_DIR}/wdk-btc-wallet" \
|
|
38
|
+
--wdk-evm-root "${ROOT_DIR}/wdk-evm-wallet" \
|
|
39
|
+
--npm-bin "$(command -v npm)" \
|
|
40
|
+
"$@"
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# WDK BTC Wallet
|
|
2
|
+
|
|
3
|
+
Separate BTC-only wallet service built on top of Tether WDK.
|
|
4
|
+
|
|
5
|
+
This project is intentionally isolated from the existing Python `agent-wallet/`.
|
|
6
|
+
It is the first step toward a second wallet backend for non-Solana assets, starting
|
|
7
|
+
with Bitcoin only.
|
|
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 BTC accounts and addresses
|
|
17
|
+
- fetch BTC balances
|
|
18
|
+
- fetch BTC transfer history
|
|
19
|
+
- fetch BTC fee rates
|
|
20
|
+
- compute max spendable BTC
|
|
21
|
+
- estimate BTC transfer cost
|
|
22
|
+
- send BTC transactions
|
|
23
|
+
|
|
24
|
+
The implementation is based on the official WDK documentation:
|
|
25
|
+
|
|
26
|
+
- Node.js Quickstart: https://docs.wdk.tether.io/start-building/nodejs-bare-quickstart
|
|
27
|
+
- SDK Get Started: https://docs.wdk.tether.io/sdk/get-started
|
|
28
|
+
- BTC wallet configuration: https://docs.wdk.tether.io/sdk/wallet-modules/wallet-btc/configuration
|
|
29
|
+
- WDK concepts: https://docs.wdk.tether.io/resources-and-guides/concepts
|
|
30
|
+
|
|
31
|
+
## Why Separate
|
|
32
|
+
|
|
33
|
+
- keeps the existing Solana wallet untouched
|
|
34
|
+
- avoids mixing Python wallet policy with a Node.js SDK runtime
|
|
35
|
+
- creates a clean path for a future second wallet backend
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
- `GET /health`
|
|
40
|
+
- `GET /v1/btc/network`
|
|
41
|
+
- `POST /v1/btc/network/set`
|
|
42
|
+
- `POST /v1/btc/seed-phrase/generate`
|
|
43
|
+
- `GET /v1/btc/wallets`
|
|
44
|
+
- `POST /v1/btc/wallets/get`
|
|
45
|
+
- `POST /v1/btc/wallets/create`
|
|
46
|
+
- `POST /v1/btc/wallets/import`
|
|
47
|
+
- `POST /v1/btc/wallets/unlock`
|
|
48
|
+
- `POST /v1/btc/wallets/lock`
|
|
49
|
+
- `POST /v1/btc/wallets/reveal-seed`
|
|
50
|
+
- `POST /v1/btc/wallets/change-password`
|
|
51
|
+
- `POST /v1/btc/address/resolve`
|
|
52
|
+
- `POST /v1/btc/balance/get`
|
|
53
|
+
- `POST /v1/btc/transfers/get`
|
|
54
|
+
- `POST /v1/btc/max-spendable/get`
|
|
55
|
+
- `POST /v1/btc/fee-rates/get`
|
|
56
|
+
- `POST /v1/btc/transfer/quote`
|
|
57
|
+
- `POST /v1/btc/transfer/send`
|
|
58
|
+
|
|
59
|
+
All routes except `/health` require:
|
|
60
|
+
|
|
61
|
+
- `Authorization: Bearer <token>`
|
|
62
|
+
|
|
63
|
+
By default the service generates that token automatically at:
|
|
64
|
+
|
|
65
|
+
- `~/.openclaw/wdk-btc-wallet/local-auth-token`
|
|
66
|
+
|
|
67
|
+
or under `OPENCLAW_HOME/wdk-btc-wallet/local-auth-token` when `OPENCLAW_HOME` is set.
|
|
68
|
+
|
|
69
|
+
The preferred flow is now local-vault based:
|
|
70
|
+
|
|
71
|
+
1. create or import a wallet
|
|
72
|
+
2. get a `walletId`
|
|
73
|
+
3. the wallet is auto-unlocked locally
|
|
74
|
+
4. call BTC operations using `walletId`
|
|
75
|
+
|
|
76
|
+
The service also has a persistent active Bitcoin network:
|
|
77
|
+
|
|
78
|
+
- `bitcoin` for mainnet
|
|
79
|
+
- `testnet` for public test BTC
|
|
80
|
+
- `regtest` for local-only development
|
|
81
|
+
|
|
82
|
+
You can switch the active network without changing code.
|
|
83
|
+
|
|
84
|
+
Raw `seedPhrase` input is still accepted as a transitional developer path, but it is
|
|
85
|
+
no longer the intended local-wallet model.
|
|
86
|
+
|
|
87
|
+
`unlock` remains available for two cases only:
|
|
88
|
+
|
|
89
|
+
- after an explicit `lock`
|
|
90
|
+
- after process restart, because unlocked seed phrases live only in memory
|
|
91
|
+
|
|
92
|
+
## Install
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd wdk-btc-wallet
|
|
96
|
+
npm install
|
|
97
|
+
cp .env.example .env
|
|
98
|
+
npm start
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Simplest onboarding:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd wdk-btc-wallet && sh bootstrap.sh
|
|
105
|
+
cd wdk-btc-wallet && npm start
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or in one command:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cd wdk-btc-wallet && sh bootstrap.sh && npm start
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Fastest local start:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cd wdk-btc-wallet && sh run-local.sh
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
`run-local.sh` will:
|
|
121
|
+
- create `.env` if missing
|
|
122
|
+
- install dependencies if `node_modules` is missing
|
|
123
|
+
- start the wallet service
|
|
124
|
+
|
|
125
|
+
## Configuration
|
|
126
|
+
|
|
127
|
+
Environment variables:
|
|
128
|
+
|
|
129
|
+
- `HOST`
|
|
130
|
+
- `PORT`
|
|
131
|
+
- `WDK_BTC_NETWORK`
|
|
132
|
+
- `WDK_BTC_BIP`
|
|
133
|
+
- `WDK_BTC_BITCOIN_ELECTRUM_PROTOCOL`
|
|
134
|
+
- `WDK_BTC_BITCOIN_ELECTRUM_HOST`
|
|
135
|
+
- `WDK_BTC_BITCOIN_ELECTRUM_PORT`
|
|
136
|
+
- `WDK_BTC_TESTNET_ELECTRUM_PROTOCOL`
|
|
137
|
+
- `WDK_BTC_TESTNET_ELECTRUM_HOST`
|
|
138
|
+
- `WDK_BTC_TESTNET_ELECTRUM_PORT`
|
|
139
|
+
- `WDK_BTC_REGTEST_ELECTRUM_PROTOCOL`
|
|
140
|
+
- `WDK_BTC_REGTEST_ELECTRUM_HOST`
|
|
141
|
+
- `WDK_BTC_REGTEST_ELECTRUM_PORT`
|
|
142
|
+
- `WDK_BTC_DATA_DIR`
|
|
143
|
+
- `WDK_BTC_LOCAL_TOKEN`
|
|
144
|
+
- `WDK_BTC_LOCAL_TOKEN_PATH`
|
|
145
|
+
- `WDK_BTC_UNLOCK_TIMEOUT_SECONDS`
|
|
146
|
+
|
|
147
|
+
Production note from WDK docs:
|
|
148
|
+
|
|
149
|
+
- public Electrum servers are convenient, but slower and less reliable
|
|
150
|
+
- production should use your own Electrum/Fulcrum server
|
|
151
|
+
|
|
152
|
+
Local security note:
|
|
153
|
+
|
|
154
|
+
- the service now binds to `127.0.0.1` by default
|
|
155
|
+
- encrypted wallet files are stored locally on disk
|
|
156
|
+
- unlocked seed phrases live only in memory
|
|
157
|
+
- by default the unlocked session does not expire automatically
|
|
158
|
+
- explicit `lock` or process restart clears the in-memory unlocked state
|
|
159
|
+
- seed reveal is password-gated and separate from normal agent operations
|
|
160
|
+
|
|
161
|
+
## Example Requests
|
|
162
|
+
|
|
163
|
+
Generate a seed phrase:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
curl http://localhost:8080/v1/btc/seed-phrase/generate \
|
|
167
|
+
-H "Content-Type: application/json" \
|
|
168
|
+
-d '{"words": 12}'
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
The service intentionally exposes only documented WDK seed generation behavior, so `12`
|
|
172
|
+
is the only supported word count right now.
|
|
173
|
+
|
|
174
|
+
Read the active Bitcoin network:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
curl http://127.0.0.1:8080/v1/btc/network
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Switch to testnet:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
curl http://127.0.0.1:8080/v1/btc/network/set \
|
|
184
|
+
-H "Content-Type: application/json" \
|
|
185
|
+
-d '{"network":"testnet"}'
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
All subsequent wallet operations use that active network unless an explicit `network`
|
|
189
|
+
override is passed in the request body.
|
|
190
|
+
|
|
191
|
+
Create a local encrypted wallet:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
curl http://127.0.0.1:8080/v1/btc/wallets/create \
|
|
195
|
+
-H "Content-Type: application/json" \
|
|
196
|
+
-d '{"label":"My BTC Wallet","password":"strong-local-password","words":12}'
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
This returns a `walletId` and leaves the wallet unlocked locally right away.
|
|
200
|
+
By default it does not return the seed phrase. If a host UI needs first-run backup UX,
|
|
201
|
+
it should request and display it explicitly rather than exposing it to the agent path.
|
|
202
|
+
|
|
203
|
+
Reveal the seed phrase for backup or recovery:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
curl http://127.0.0.1:8080/v1/btc/wallets/reveal-seed \
|
|
207
|
+
-H "Content-Type: application/json" \
|
|
208
|
+
-d '{"walletId":"replace-with-wallet-id","password":"strong-local-password"}'
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This endpoint is intended for the host/UI only. The agent-facing flow should keep
|
|
212
|
+
using `walletId` and should not need to see the password or the seed phrase.
|
|
213
|
+
|
|
214
|
+
List wallets:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
curl http://127.0.0.1:8080/v1/btc/wallets
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Get a single wallet's metadata:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
curl http://127.0.0.1:8080/v1/btc/wallets/get \
|
|
224
|
+
-H "Content-Type: application/json" \
|
|
225
|
+
-d '{"walletId":"replace-with-wallet-id"}'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Unlock a wallet after restart or explicit lock:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
curl http://127.0.0.1:8080/v1/btc/wallets/unlock \
|
|
232
|
+
-H "Content-Type: application/json" \
|
|
233
|
+
-d '{"walletId":"replace-with-wallet-id","password":"strong-local-password"}'
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Rotate the wallet password:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
curl http://127.0.0.1:8080/v1/btc/wallets/change-password \
|
|
240
|
+
-H "Content-Type: application/json" \
|
|
241
|
+
-d '{
|
|
242
|
+
"walletId":"replace-with-wallet-id",
|
|
243
|
+
"currentPassword":"old-password",
|
|
244
|
+
"newPassword":"new-password"
|
|
245
|
+
}'
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
If the wallet is already unlocked locally, password rotation keeps it unlocked.
|
|
249
|
+
|
|
250
|
+
Resolve the first BTC address:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
curl http://127.0.0.1:8080/v1/btc/address/resolve \
|
|
254
|
+
-H "Content-Type: application/json" \
|
|
255
|
+
-d '{"walletId":"replace-with-wallet-id","accountIndex":0}'
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
To force a one-off request to testnet without changing the active network:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
curl http://127.0.0.1:8080/v1/btc/address/resolve \
|
|
262
|
+
-H "Content-Type: application/json" \
|
|
263
|
+
-d '{"walletId":"replace-with-wallet-id","accountIndex":0,"network":"testnet"}'
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Get the BTC balance:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
curl http://127.0.0.1:8080/v1/btc/balance/get \
|
|
270
|
+
-H "Content-Type: application/json" \
|
|
271
|
+
-d '{"walletId":"replace-with-wallet-id","accountIndex":0}'
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Get BTC transfer history:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
curl http://127.0.0.1:8080/v1/btc/transfers/get \
|
|
278
|
+
-H "Content-Type: application/json" \
|
|
279
|
+
-d '{
|
|
280
|
+
"walletId":"replace-with-wallet-id",
|
|
281
|
+
"accountIndex":0,
|
|
282
|
+
"direction":"all",
|
|
283
|
+
"limit":10,
|
|
284
|
+
"skip":0
|
|
285
|
+
}'
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Get BTC fee rates:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
curl http://127.0.0.1:8080/v1/btc/fee-rates/get \
|
|
292
|
+
-H "Content-Type: application/json" \
|
|
293
|
+
-d '{}'
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Get max spendable BTC:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
curl http://127.0.0.1:8080/v1/btc/max-spendable/get \
|
|
300
|
+
-H "Content-Type: application/json" \
|
|
301
|
+
-d '{"walletId":"replace-with-wallet-id","accountIndex":0}'
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Estimate a BTC transfer:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
curl http://127.0.0.1:8080/v1/btc/transfer/quote \
|
|
308
|
+
-H "Content-Type: application/json" \
|
|
309
|
+
-d '{
|
|
310
|
+
"walletId":"replace-with-wallet-id",
|
|
311
|
+
"accountIndex":0,
|
|
312
|
+
"to":"bc1...",
|
|
313
|
+
"value":10000
|
|
314
|
+
}'
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Notes
|
|
318
|
+
|
|
319
|
+
- WDK BTC docs describe BIP-84 as the current default.
|
|
320
|
+
- WDK BTC docs also note a historical derivation-path change from legacy BIP-44.
|
|
321
|
+
- If you need to recreate older wallets, use an explicit derivation path or set `WDK_BTC_BIP=44`.
|
|
322
|
+
- The service currently follows the documented `WalletManagerBtc` and `WalletAccountBtc` API surface only.
|
|
323
|
+
- The local vault is intentionally file-based and cross-platform; it does not depend on Apple Secure Enclave.
|
|
324
|
+
- The intended host-managed mode is: user enters password, agent uses only `walletId`, password never needs to be exposed to the agent.
|
|
325
|
+
- Mainnet/testnet/regtest switching is runtime-configurable; active network state is stored locally under the wallet data directory.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname "$0")" && pwd)"
|
|
5
|
+
cd "$SCRIPT_DIR"
|
|
6
|
+
|
|
7
|
+
if [ ! -f .env ]; then
|
|
8
|
+
cp .env.example .env
|
|
9
|
+
echo "Created .env from .env.example"
|
|
10
|
+
else
|
|
11
|
+
echo "Using existing .env"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if [ -z "${NPM_CONFIG_CACHE:-}" ]; then
|
|
15
|
+
export NPM_CONFIG_CACHE=/tmp/npm-cache
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
npm install
|
|
19
|
+
|
|
20
|
+
echo
|
|
21
|
+
echo "Bootstrap complete."
|
|
22
|
+
echo "Next step: npm start"
|