clanker-wallet 0.4.1 → 0.4.2
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/README.md +6 -2
- package/SKILL.md +15 -3
- package/bin/cli.js +2 -1
- package/dist/client.js +12 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ npx clanker-wallet
|
|
|
14
14
|
bunx clanker-wallet
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
Running in a sandbox (e.g. Claude Code)? Allow a WebSocket to the relay, `wss://relay.clanker-wallet.xyz/ws` (the `relay` URL in the pairing JSON), or `tx` fails with exit code 3. If the sandbox only lets traffic out through `HTTPS_PROXY`, run the CLI as `NODE_USE_ENV_PROXY=1 clanker-wallet ...` (Node 24+); Node ignores the proxy otherwise. `pair` writes `~/.clanker-wallet/` and the other commands write there too, so allow writes (see [State](#state)).
|
|
18
|
+
|
|
17
19
|
## Quick Start
|
|
18
20
|
|
|
19
21
|
```bash
|
|
@@ -34,7 +36,9 @@ clanker-wallet status
|
|
|
34
36
|
|
|
35
37
|
### `pair`
|
|
36
38
|
|
|
37
|
-
Pair with a human's web app. Run once — identity and pairing
|
|
39
|
+
Pair with a human's web app. Run once — `pair` writes identity and pairing to `~/.clanker-wallet/`.
|
|
40
|
+
|
|
41
|
+
If the pairing JSON contains `"mode":"managed"`, the relay simulates each transaction for the human's review screen, so `tx` also sends the plain transaction fields to it. Otherwise the relay only sees ciphertext. Pair with the JSON as given.
|
|
38
42
|
|
|
39
43
|
```bash
|
|
40
44
|
clanker-wallet pair '<pairing JSON from web app>'
|
|
@@ -43,7 +47,7 @@ clanker-wallet pair '<pairing JSON from web app>'
|
|
|
43
47
|
|
|
44
48
|
### `tx`
|
|
45
49
|
|
|
46
|
-
Send a transaction request. Blocks until the human approves or rejects, for up to 1 hour by default; `--timeout <ms>` changes that.
|
|
50
|
+
Send a transaction request. Blocks until the human approves or rejects, for up to 1 hour by default; `--timeout <ms>` changes that. If your shell tool kills long commands, run `tx` in the background and read its output when it exits.
|
|
47
51
|
|
|
48
52
|
```bash
|
|
49
53
|
clanker-wallet tx \
|
package/SKILL.md
CHANGED
|
@@ -16,6 +16,16 @@ npm install -g clanker-wallet
|
|
|
16
16
|
|
|
17
17
|
Or use without installing: `npx clanker-wallet` / `bunx clanker-wallet`
|
|
18
18
|
|
|
19
|
+
### Running in a sandbox
|
|
20
|
+
|
|
21
|
+
If your commands run in a sandbox (e.g. Claude Code), the CLI needs:
|
|
22
|
+
|
|
23
|
+
- **network:** a WebSocket to the relay, `wss://relay.clanker-wallet.xyz/ws` (the `relay` URL in the pairing JSON). Without it `tx` fails with exit code 3.
|
|
24
|
+
- **the sandbox proxy:** if the sandbox only lets traffic out through `HTTPS_PROXY` (Claude Code does), Node ignores it unless you run the CLI as `NODE_USE_ENV_PROXY=1 clanker-wallet ...` (Node 24+). The exit-3 error says so when this applies.
|
|
25
|
+
- **files:** `pair` writes your identity and the pairing to `~/.clanker-wallet/`, and the other commands write there too (they fix file permissions and create the identity if it is missing). Allow writes, not just reads.
|
|
26
|
+
|
|
27
|
+
Ask the human to allow the host and the directory before you pair.
|
|
28
|
+
|
|
19
29
|
## Pairing (one-time)
|
|
20
30
|
|
|
21
31
|
Before you can send transactions, check if you're already paired:
|
|
@@ -41,7 +51,9 @@ clanker-wallet pair '{"version":1,"pubkey":"ab12...","relay":"wss://...","wallet
|
|
|
41
51
|
|
|
42
52
|
If the human only pastes raw JSON (no prompt prose), pair with it directly. If they only paste the URL, ask them to click "copy prompt for agent" on the pairing screen.
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
`pair` writes your identity and the pairing to `~/.clanker-wallet/`. You only need to do this once.
|
|
55
|
+
|
|
56
|
+
If the JSON contains `"mode":"managed"`, the human chose managed mode: the relay simulates each transaction for the review screen, so `tx` also sends the plain transaction fields (from, to, value, data, chainId) to the relay, which shares them with its simulation provider. Without it (or with `"mode":"encrypted"`) the relay only sees ciphertext. Pair with the JSON exactly as given either way.
|
|
45
57
|
|
|
46
58
|
### Trust (first request)
|
|
47
59
|
|
|
@@ -79,7 +91,7 @@ clanker-wallet tx \
|
|
|
79
91
|
|
|
80
92
|
This sends 0.001 ETH (`1000000000000000` wei) on Base Sepolia (chain `84532`) to the burn address `0x000000000000000000000000000000000000dEaD`.
|
|
81
93
|
|
|
82
|
-
The command **blocks until the human approves or rejects**, for up to 1 hour by default. Pass `--timeout <ms>` to wait a different time (`600000` = 10 minutes). Output is JSON:
|
|
94
|
+
The command **blocks until the human approves or rejects**, for up to 1 hour by default. Pass `--timeout <ms>` to wait a different time (`600000` = 10 minutes). If your shell tool kills commands after a few minutes, run `tx` in the background and read its output when it exits. Output is JSON:
|
|
83
95
|
- Approved: `{"tx_hash":"0x...","status":"approved"}` (exit code 0)
|
|
84
96
|
- Rejected: `{"status":"rejected","error":"..."}` (exit code 1)
|
|
85
97
|
- Timeout: `{"status":"timeout","error":"..."}` (exit code 2)
|
|
@@ -166,4 +178,4 @@ clanker-wallet whoami
|
|
|
166
178
|
- **exit code 4 / "not paired"** — run `clanker-wallet pair '<JSON>'` first
|
|
167
179
|
- **exit code 2 / timeout** — human didn't respond in time, increase `--timeout` or ask them to check the web app
|
|
168
180
|
- **exit code 1 / "rejected"** — human clicked reject. Explain why the tx is needed and try again if appropriate.
|
|
169
|
-
- **exit code 3 / connection error** — relay may be down, try again in a few seconds
|
|
181
|
+
- **exit code 3 / "relay connection error: could not reach wss://..."** — if you run in a sandbox or behind a firewall, allow that host (`relay.clanker-wallet.xyz` by default) and, if the error mentions it, rerun with `NODE_USE_ENV_PROXY=1` (see "Running in a sandbox"); otherwise the relay may be down or rate limiting, try again in a few seconds
|
package/bin/cli.js
CHANGED
|
@@ -241,7 +241,8 @@ exit codes:
|
|
|
241
241
|
0 success
|
|
242
242
|
1 rejected by human
|
|
243
243
|
2 timeout
|
|
244
|
-
3 connection error
|
|
244
|
+
3 connection error (in a sandbox or behind a firewall, allow the relay host, wss://relay.clanker-wallet.xyz/ws by default;
|
|
245
|
+
behind HTTPS_PROXY run with NODE_USE_ENV_PROXY=1)
|
|
245
246
|
4 not paired
|
|
246
247
|
5 invalid arguments
|
|
247
248
|
|
package/dist/client.js
CHANGED
|
@@ -2,6 +2,16 @@ import { decryptMessage, encryptMessage, fromHex, generateKeypair, keypairFromSe
|
|
|
2
2
|
import { TypedEmitter } from './events.js';
|
|
3
3
|
import { validateTx } from './validate.js';
|
|
4
4
|
const DEFAULT_TIMEOUT_MS = 3_600_000; // 1 hour
|
|
5
|
+
const UNREACHABLE_HINT = 'if you run in a sandbox or behind a firewall, allow this host; otherwise the relay may be down or rate limiting, retry in a few seconds';
|
|
6
|
+
/** node's WebSocket ignores HTTPS_PROXY unless NODE_USE_ENV_PROXY is set at startup, and sandboxes (claude code) only let traffic out through that proxy */
|
|
7
|
+
function proxyHint() {
|
|
8
|
+
const env = globalThis.process?.env;
|
|
9
|
+
if (!env || env.NODE_USE_ENV_PROXY)
|
|
10
|
+
return '';
|
|
11
|
+
return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy
|
|
12
|
+
? '; HTTPS_PROXY is set but node ignores it, rerun with NODE_USE_ENV_PROXY=1 (node 24+)'
|
|
13
|
+
: '';
|
|
14
|
+
}
|
|
5
15
|
export class ClankerWallet extends TypedEmitter {
|
|
6
16
|
publicKey;
|
|
7
17
|
secretKey;
|
|
@@ -103,8 +113,9 @@ export class ClankerWallet extends TypedEmitter {
|
|
|
103
113
|
return;
|
|
104
114
|
}
|
|
105
115
|
ws.addEventListener('error', () => {
|
|
116
|
+
// node's WebSocket error event carries no cause, so name the url: a sandbox or firewall blocking it looks the same as an outage
|
|
106
117
|
if (!settled)
|
|
107
|
-
fail(
|
|
118
|
+
fail(`relay connection error: could not reach ${relayUrl} (${UNREACHABLE_HINT}${proxyHint()})`);
|
|
108
119
|
});
|
|
109
120
|
ws.addEventListener('close', () => {
|
|
110
121
|
this.emit('disconnected', {});
|