@blackpool/cli 0.0.0-stage → 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/README.md +128 -2
- package/bin/blackpool.js +1386 -0
- package/package.json +47 -4
package/README.md
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @blackpool/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Private payments for onchain agents. One env var or one hidden prompt, then shield / send / swap / bridge with zero-knowledge privacy on **Base**, **Robinhood Chain**, **Arbitrum**, and **BNB Smart Chain**. Wraps the same API `docs.blackpool.cash/agents` uses - no ZK client needed on your side.
|
|
4
|
+
|
|
5
|
+
Every command takes an optional `--chain base|robinhood|arbitrum|bsc` flag (default `base`). On Base and Arbitrum the stablecoin is USDC; on Robinhood it's USDG; on BSC the stablecoins are USDC and USDT (Binance-Peg, 18 decimals) and the native asset is BNB.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g @blackpool/cli
|
|
11
|
+
# or
|
|
12
|
+
npx @blackpool/cli help
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Two ways to provide your key, depending on who's running it.
|
|
18
|
+
|
|
19
|
+
### Interactive (humans / local demo) - key never shown
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
blackpool login
|
|
23
|
+
# private key: ●●●●●●●●●● <- hidden input, like sudo password
|
|
24
|
+
# ✓ wallet stored at ~/.blackpool/wallet.json (chmod 600)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The key is prompted with **hidden input** (no echo, never enters shell history), then stored locally at `~/.blackpool/wallet.json` with `chmod 600` (owner-only). It is never transmitted - only the derived signature is sent to the relayer.
|
|
28
|
+
|
|
29
|
+
### Env var (agents / CI) - no prompt
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
export BLACKPOOL_KEY=0xyour_agent_private_key
|
|
33
|
+
blackpool login # detects env var, skips the prompt, stores nothing to disk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Agents pull the key from their own secret manager / vault into `BLACKPOOL_KEY`. The CLI reads it directly and does not write it to disk.
|
|
37
|
+
|
|
38
|
+
### Logout
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
blackpool logout # removes ~/.blackpool/wallet.json + config.json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Key resolution order:** `BLACKPOOL_KEY` env var → `~/.blackpool/wallet.json` → error.
|
|
45
|
+
|
|
46
|
+
## Commands
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
blackpool balance # private + public balances (both pools), Base
|
|
50
|
+
blackpool balance --chain robinhood # balances on Robinhood (ETH + USDG)
|
|
51
|
+
blackpool balance --chain arbitrum # balances on Arbitrum (ETH + USDC)
|
|
52
|
+
blackpool balance --chain bsc # balances on BSC (BNB + USDC + USDT)
|
|
53
|
+
blackpool balance --pool eth # just private ETH
|
|
54
|
+
blackpool deposit 25 --pool usdc # shield 25 USDC from public to private (Base)
|
|
55
|
+
blackpool deposit 15 --pool usdg --chain robinhood # shield 15 USDG on Robinhood
|
|
56
|
+
blackpool deposit 0.05 --pool bnb --chain bsc # shield BNB (BSC native pool is 'bnb', not 'eth')
|
|
57
|
+
blackpool send 0xRECIPIENT 2.5 # send 2.5 USDC privately (no gas from you)
|
|
58
|
+
blackpool send 0xRECIPIENT 0.01 --pool eth # send private ETH
|
|
59
|
+
blackpool send 0xRECIPIENT 2.5 --chain robinhood # send 2.5 USDG privately on Robinhood
|
|
60
|
+
blackpool swap 0.001 --from eth # private same-chain swap ETH -> USDC (Uniswap V3)
|
|
61
|
+
blackpool swap 3 --from usdc # private same-chain swap USDC -> ETH
|
|
62
|
+
blackpool bridge arb_usdc 0xRECIPIENT 2.5 # bridge cross-chain privately to Arbitrum (1Click)
|
|
63
|
+
blackpool bridge bsc_usdt 0xRECIPIENT 5 --from bsc_usdc # 1Click origin can be any shielded pool
|
|
64
|
+
blackpool bridge rarb_eth 0xRECIPIENT 0.01 --chain robinhood # router: Robinhood -> Arbitrum
|
|
65
|
+
blackpool bridge rbsc_bnb 0xRECIPIENT 0.01 --chain robinhood # router: Robinhood -> BSC
|
|
66
|
+
blackpool assets # list all supported bridge destinations
|
|
67
|
+
blackpool recover # sweep any stranded funds from burner slots
|
|
68
|
+
blackpool recover --to 0xADDR # sweep to a different destination
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## How it works
|
|
72
|
+
|
|
73
|
+
Each command follows the pattern `docs.blackpool.cash/agents` documents.
|
|
74
|
+
|
|
75
|
+
**Login / balance / send / bridge** - you sign once, the relayer builds the Groth16 proof server-side, and broadcasts. You pay no gas. The relayer is compensated via the protocol fee (flat + 0.35% per withdraw / swap / bridge).
|
|
76
|
+
|
|
77
|
+
**Deposit** - your public wallet signs and broadcasts the shield tx (this is the only step where you pay gas, because the pool must see funds coming from a public address). For ERC-20 pools (USDC), an `approve` runs first; the CLI polls the on-chain allowance before broadcasting the deposit (same fix as the frontend for load-balanced RPC lag).
|
|
78
|
+
|
|
79
|
+
**Swap same-chain** - mirrors the frontend burner flow exactly:
|
|
80
|
+
|
|
81
|
+
1. Create a fresh random burner wallet and register its key, encrypted with your signature, in the recovery registry before any funds move.
|
|
82
|
+
2. Private withdraw from your pool → burner via `/api/swap-private`.
|
|
83
|
+
3. For USDC origin: relayer tops up burner gas via `/api/burner-gas`.
|
|
84
|
+
4. Burner approves + swaps on Uniswap V3 (SwapRouter02, 0.01% fee tier).
|
|
85
|
+
5. WETH is unwrapped to ETH if ETH is the destination.
|
|
86
|
+
6. Pre-flight `eth_call` simulation of the reshield (catches reverts cheap).
|
|
87
|
+
7. Burner reshields the swapped output back to **your** private balance via `/api/deposit/prepare`.
|
|
88
|
+
|
|
89
|
+
If any step fails between (2) and (7), funds remain on the burner; its key is in the registry, encrypted so only your signature can read it. Run `blackpool recover` to sweep them home from any device.
|
|
90
|
+
|
|
91
|
+
**Bridge cross-chain** - private withdraw to a NEAR Intents 1Click solver via `/api/swap`, then poll `/api/intent-status` until `SUCCESS` (or `REFUNDED`, in which case the solver returns your funds automatically). No burner involved for bridges.
|
|
92
|
+
|
|
93
|
+
**Recover** - fetches every burner registered for your wallet, decrypts the keys locally, and sweeps stranded funds back to your public wallet (or `--to <addr>`). Handles the wallets `swap` may have left behind if a later step reverted. Uses Base-realistic gas params (0.05 gwei) so the burner's tiny ETH top-up is enough for the sweep tx.
|
|
94
|
+
|
|
95
|
+
## Environment
|
|
96
|
+
|
|
97
|
+
- `BLACKPOOL_KEY` - agent private key (0x-hex). Optional if you've run `blackpool login`.
|
|
98
|
+
- `BLACKPOOL_API` - API base URL (default `https://api.blackpool.cash`).
|
|
99
|
+
- `BLACKPOOL_RPC` / `BLACKPOOL_BASE_RPC` - Base RPC endpoint (default `https://mainnet.base.org`). Set to your own Alchemy / QuickNode URL for faster + more reliable gas estimation on the burner-heavy swap flow.
|
|
100
|
+
- `BLACKPOOL_ROBINHOOD_RPC` - Robinhood Chain RPC endpoint (default `https://rpc.mainnet.chain.robinhood.com`), used when `--chain robinhood`.
|
|
101
|
+
|
|
102
|
+
## Config files
|
|
103
|
+
|
|
104
|
+
- `~/.blackpool/wallet.json` - stored private key (chmod 600, only if you used `blackpool login` interactively).
|
|
105
|
+
- `~/.blackpool/config.json` - cached BLACKPOOL signatures per wallet (chmod 600).
|
|
106
|
+
|
|
107
|
+
## Verified live on Base mainnet
|
|
108
|
+
|
|
109
|
+
Every command in this CLI has been exercised end-to-end against `api.blackpool.cash` with real on-chain transactions:
|
|
110
|
+
|
|
111
|
+
- `deposit` → `0x7ae2dde7…` (3 USDC shielded)
|
|
112
|
+
- `send` → `0x2108ae58…` (1.49125 USDC delivered privately, fee 1.00875)
|
|
113
|
+
- `swap` → `0x1bd8d68d…` (0.001 ETH → 1.170797 USDC private, full reshield)
|
|
114
|
+
- `bridge` → `0xdfc495fa…` (2.5 USDC Base → 1.484306 USDC delivered to Arbitrum)
|
|
115
|
+
- `recover` → 1.9895 USDC swept back from a stranded burner
|
|
116
|
+
|
|
117
|
+
## Cross-chain destinations
|
|
118
|
+
|
|
119
|
+
Run `blackpool assets` for the full live list. Currently: **Base, Ethereum, BSC, Arbitrum** - ETH / WETH / USDC / USDT / cbBTC / ARB / BNB depending on the chain.
|
|
120
|
+
|
|
121
|
+
## Roadmap
|
|
122
|
+
|
|
123
|
+
- `@blackpool/sdk` - TypeScript SDK for programmatic use inside an agent.
|
|
124
|
+
- Mandate limits - human-signed spend cap per window (aligns with the "supervised agent" pattern).
|
|
125
|
+
- Optional wallet encryption at rest - passphrase-protected `wallet.json`.
|
|
126
|
+
|
|
127
|
+
## Support
|
|
128
|
+
|
|
129
|
+
Docs: [docs.blackpool.cash/agents](https://docs.blackpool.cash/agents) · Site: [blackpool.cash](https://blackpool.cash)
|