@parallel-protocol/cli 0.2.5 → 0.2.7

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.
Files changed (3) hide show
  1. package/README.md +78 -68
  2. package/dist/index.js +4565 -3772
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install -g @parallel-protocol/cli
14
14
  npx @parallel-protocol/cli <command>
15
15
  ```
16
16
 
17
- **Requirements:** Node.js ≥ 18
17
+ **Requirements:** Node.js ≥ 22
18
18
 
19
19
  ---
20
20
 
@@ -36,7 +36,7 @@ parallel swap mint --collateral USDC --amount 1000 --chain avalanche --dry-run
36
36
 
37
37
  > **Development (from the parallel-mcp repo):**
38
38
  > ```bash
39
- > npm run build:cli # build once
39
+ > bun run build:cli # build once
40
40
  > alias parallel="node packages/cli/dist/index.js"
41
41
  > parallel protocol overview
42
42
  > ```
@@ -55,9 +55,6 @@ default_chain = "base"
55
55
 
56
56
  [wallet]
57
57
  keystore_path = "~/.parallel/keystore.json"
58
-
59
- [display]
60
- default_format = "table" # table | json
61
58
  ```
62
59
 
63
60
  ### `parallel config get / set`
@@ -76,8 +73,10 @@ The CLI uses the [Ethereum V3 keystore](https://github.com/ethereum/wiki/wiki/We
76
73
  **Option A — Foundry `cast` (recommended for developers)**
77
74
 
78
75
  ```bash
79
- cast wallet new ~/.parallel/keystore.json
80
- # generates a fresh address and encrypts it with a password you choose
76
+ mkdir -p ~/.parallel
77
+ cast wallet new ~/.parallel
78
+ # → generates a fresh address, encrypted with a password you choose,
79
+ # as ~/.parallel/<id> (random filename — rename it if you like)
81
80
  ```
82
81
 
83
82
  **Option B — Geth**
@@ -91,27 +90,31 @@ geth account new --keystore ~/.parallel/
91
90
  ```bash
92
91
  # 1. MetaMask → Account details → Export Private Key
93
92
  # 2. Convert to keystore:
94
- cast wallet import ~/.parallel/keystore.json --interactive
95
- # → paste the private key, set a password
93
+ cast wallet import parallel-cli --keystore-dir ~/.parallel --interactive
94
+ # → paste the private key, set a password — writes ~/.parallel/parallel-cli
96
95
  ```
97
96
 
98
97
  Then point the CLI to it:
99
98
 
100
99
  ```bash
101
- parallel config set wallet.keystore_path ~/.parallel/keystore.json
102
- # or pass it directly: --wallet ~/.parallel/keystore.json
100
+ parallel config set wallet.keystore_path ~/.parallel/parallel-cli
101
+ # or pass it directly: --wallet ~/.parallel/parallel-cli
103
102
  ```
104
103
 
105
104
  ### Environment variables
106
105
 
107
- All optional — they override the config file when set.
106
+ All optional.
108
107
 
109
108
  | Variable | Description |
110
109
  |---|---|
111
- | `PARALLEL_PRIVATE_KEY` | Raw private key (hex, `0x` prefix) — alternative to keystore, useful for scripts and CI |
110
+ | `PARALLEL_PRIVATE_KEY` | Raw private key (hex, `0x` prefix) — alternative to keystore, useful for scripts and CI. Used by `--wallet env`, or by `--wallet` alone when no keystore is configured |
112
111
  | `PARALLEL_DEFAULT_CHAIN` | Default chain — overrides `network.default_chain` in config |
113
112
  | `PARALLEL_JSON` | Set to `true` to force JSON output on all commands |
114
113
  | `PARALLEL_API_URL` | Parallel API base URL for `--history` commands (default: `https://api.parallel.best`) |
114
+ | `FACILITATOR_URL` | Facilitator base URL for `pay` commands (default: `https://agents.parallel.best`) |
115
+ | `ALCHEMY_API_KEY` | Optional Alchemy key — upgrades RPC calls from public endpoints to Alchemy |
116
+
117
+ > **Precedence:** flags > environment > config file — except the wallet: `--wallet` used alone tries the config `keystore_path` **first**, then falls back to `PARALLEL_PRIVATE_KEY`.
115
118
 
116
119
 
117
120
  ---
@@ -170,32 +173,38 @@ parallel protocol supply --history usdp # USDp circulating supply over ti
170
173
 
171
174
  ### `parallel swap`
172
175
 
173
- Build Parallelizer transactions (mint / burn / redeem).
176
+ Build Parallelizer transactions (mint / redeem / redeem-all).
174
177
 
175
178
  ```bash
176
179
  # Get a quote first
177
- parallel swap quote --op mint --collateral <symbol> --amount <n> --chain <chain>
178
- parallel swap quote --op burn --collateral <symbol> --amount <n> --chain <chain>
179
- parallel swap quote --op redeem --amount <n> --chain <chain>
180
+ parallel swap quote --op mint --collateral <symbol> --amount <n> --chain <chain>
181
+ parallel swap quote --op redeem --collateral <symbol> --amount <n> --chain <chain>
182
+ parallel swap quote --op redeem-all --amount <n> --chain <chain>
180
183
 
181
184
  # Dry-run (shows raw unsigned tx — no wallet needed)
182
- parallel swap mint --collateral <symbol> --amount <n> --chain <chain> --dry-run
183
- parallel swap burn --collateral <symbol> --amount <n> --chain <chain> --dry-run
184
- parallel swap redeem --amount <n> --chain <chain> --dry-run
185
+ parallel swap mint --collateral <symbol> --amount <n> --chain <chain> --dry-run
186
+ parallel swap redeem --collateral <symbol> --amount <n> --chain <chain> --dry-run
187
+ parallel swap redeem-all --amount <n> --chain <chain> --dry-run
185
188
 
186
189
  # Sign and broadcast
187
- parallel swap mint --collateral <symbol> --amount <n> --chain <chain> --wallet
188
- parallel swap burn --collateral <symbol> --amount <n> --chain <chain> --wallet
189
- parallel swap redeem --amount <n> --chain <chain> --wallet # proportional redeem
190
+ parallel swap mint --collateral <symbol> --amount <n> --chain <chain> --wallet
191
+ parallel swap redeem --collateral <symbol> --amount <n> --chain <chain> --wallet
192
+ parallel swap redeem-all --amount <n> --chain <chain> --wallet # proportional redeem
190
193
  ```
191
194
 
195
+ > Command names match the MCP tools since 0.2.7: `redeem` targets ONE
196
+ > collateral (formerly `burn`), `redeem-all` redeems proportionally across the
197
+ > whole basket (formerly `redeem`). The old `swap burn` keeps working as a
198
+ > hidden legacy command.
199
+
192
200
  **Options:**
193
201
 
194
202
  | Flag | Default | Description |
195
203
  |---|---|---|
196
- | `--op <mint\|burn\|redeem>` | | Operation (quote only) |
204
+ | `--op <mint\|redeem\|redeem-all>` | | Operation (quote only) |
197
205
  | `--collateral <symbol>` | | Collateral symbol (e.g. `USDC`, `USDS`, `sUSDS`) |
198
206
  | `--amount <n>` | | Amount in USDp (or collateral units for mint) |
207
+ | `--slippage <pct>` | `0.5` | Slippage tolerance in % (`mint` / `redeem` / `redeem-all`) |
199
208
  | `--address <0x...>` | | Receiver address for dry-run (no key needed) |
200
209
 
201
210
  ---
@@ -219,29 +228,30 @@ parallel savings deposit --amount <n> --chain <chain> --wallet
219
228
  parallel savings withdraw --amount <n> --chain <chain> --wallet
220
229
  ```
221
230
 
222
- > **Note:** `savings deposit` uses EIP-3009 `transferWithAuthorization` when availablesingle signature, gasless on L2/sidechains.
231
+ > **Note:** in a terminal, `savings deposit` shows an interactive menu with two methods: **EIP-3009** `depositWithAuthorization` (no approval transaction two EIP-712 signatures, one on-chain transaction) or **standard** approve + deposit (two transactions). In JSON / non-TTY mode the standard path is used automatically.
223
232
 
224
233
  ---
225
234
 
226
235
  ### `parallel bridge`
227
236
 
228
- LayerZero cross-chain bridge (USDp / sUSDp).
237
+ LayerZero cross-chain bridge (USDp).
229
238
 
230
239
  ```bash
231
- parallel bridge quote --token <usdp|susdp> --from <chain> --to <chain> --amount <n>
232
- parallel bridge fees --from <chain> --token <usdp|susdp> # fees to all destinations
233
- parallel bridge limits [--chain <chain>] # daily + global limits
240
+ parallel bridge quote --from <chain> --to <chain> --amount <n>
241
+ parallel bridge fees --from <chain> # fees to all destinations
242
+ parallel bridge limits [--chain <chain>] # daily + global limits
234
243
 
235
244
  # Dry-run
236
- parallel bridge send --token <usdp|susdp> --from <chain> --to <chain> --amount <n> --dry-run
245
+ parallel bridge send --from <chain> --to <chain> --amount <n> --dry-run
237
246
 
238
247
  # Sign and broadcast
239
- parallel bridge send --token <usdp|susdp> --from <chain> --to <chain> --amount <n> --wallet [--recipient <address>]
248
+ parallel bridge send --from <chain> --to <chain> --amount <n> --wallet [--recipient <address>]
240
249
 
241
- parallel bridge status <txHash> --from <chain>
250
+ parallel bridge status <txHash> --from <chain>
251
+ parallel bridge history <address> [--limit <n>] [--offset <n>] # past transfers (default: 20)
242
252
  ```
243
253
 
244
- > **Note:** Mantle does not support bridging (no BridgeableToken deployed). All other chains support bridge.
254
+ > **Note:** only `usdp` can be bridged for now (`--token` defaults to it; other values are rejected). Mantle does not support bridging (no BridgeableToken deployed) all other chains do.
245
255
 
246
256
  ---
247
257
 
@@ -258,7 +268,8 @@ parallel staking cooldown <address> # cooldown status + expiry date
258
268
  parallel staking stake --type sprl1 --amount <n> --dry-run
259
269
  parallel staking unstake --type sprl1 --amount <n> --dry-run
260
270
  parallel staking stake --type sprl1 --amount <n> --wallet
261
- parallel staking unstake --type sprl1 --amount <n> --wallet
271
+ parallel staking unstake --type sprl1 --amount <n> --wallet # initiate cooldown
272
+ parallel staking unstake --type sprl1 --wallet # execute ready withdrawals
262
273
 
263
274
  # sPRL2 — Ethereum only (Balancer BPT, multi-step: Balancer → Aura)
264
275
  parallel staking stake --type sprl2 --amount <n> --dry-run # BPT path
@@ -295,12 +306,19 @@ x402 payment layer.
295
306
  parallel pay capabilities [--chain <chain>]
296
307
 
297
308
  # Gas sponsoring quota for an address
298
- parallel pay quota --chain <chain> [--address <address>]
309
+ parallel pay quota <address> [--chain <chain>]
299
310
 
300
311
  # Verify a payment on-chain
301
312
  parallel pay verify <txHash> --chain <chain>
302
313
  ```
303
314
 
315
+ > **Note:** `confirmed: true` means the facilitator actually settled this hash as an x402 payment —
316
+ > not merely that the transaction is mined. The response also carries `x402Payment` and `txMined`
317
+ > separately: a mined transaction that is not an x402 payment returns
318
+ > `{ confirmed: false, x402Payment: false, txMined: true }`; an unknown hash returns all three
319
+ > `false`. Route, amount, token and recipient (`route`, `amount`, `tokenOut`, `paidTo`) are filled
320
+ > only for confirmed payments.
321
+
304
322
  #### `parallel pay prepare`
305
323
 
306
324
  Builds a signed or unsigned x402 payment payload.
@@ -323,7 +341,7 @@ parallel pay prepare \
323
341
  parallel pay prepare --amount <n> --recipient <address> --chain <chain> --pay-with <usdp|usdc|susdp>
324
342
  ```
325
343
 
326
- **`--token`** controls what the **merchant receives** (default: `usdp`). Accepted values: `usdp` · `usdc` · `susdp` · any backing collateral symbol (`susds`, `sfrxusd`, …).
344
+ **`--token`** controls what the **merchant receives** (default: `usdp`). Accepted values: `usdp` · `usdc` · `susdp` · any backing collateral symbol (`susds`, `sfrxusd`, …) · a token contract address.
327
345
 
328
346
  **`--pay-with`** overrides which token the **agent pays with** (default: auto-detected from wallet balance). Accepted values: `usdp` · `usdc` · `susdp`.
329
347
 
@@ -346,20 +364,6 @@ Without `--wallet`, the payload is unsigned and `tokenIn` defaults to `usdp`.
346
364
 
347
365
  ---
348
366
 
349
- ### `parallel cashback`
350
-
351
- Cashback rewards — read-only, via facilitator API.
352
-
353
- ```bash
354
- parallel cashback balance <address> # current month spend + earnings + tier
355
- parallel cashback tier <address> # 4-tier breakdown + rates
356
- parallel cashback history <address> [--limit <n>] # monthly history + distribution status
357
- parallel cashback estimate <address> [--projected-spend <n>] # projected earnings this month
358
- parallel cashback quota <address> [--chain <chain>] # gas sponsoring quota
359
- ```
360
-
361
- ---
362
-
363
367
  ### Utilities
364
368
 
365
369
  ```bash
@@ -389,7 +393,17 @@ JSON envelope:
389
393
 
390
394
  ```json
391
395
  { "success": true, "data": { ... } }
392
- { "success": false, "error": { "code": "CHAIN_SUNSET", "message": "..." } }
396
+ { "success": false, "error": { "code": "CHAIN_SUNSET", "message": "...", "hint": "..." } }
397
+ ```
398
+
399
+ **Streams and exit codes:** success envelopes are written to **stdout**; error envelopes are written
400
+ to **stderr**, and the process exits with code `1` (`0` on success). stdout carries data only — on a
401
+ failure it stays empty, so `parallel … --json | jq` prints nothing when the command errors. Read
402
+ errors from stderr or branch on the exit code (`hint` is optional):
403
+
404
+ ```bash
405
+ parallel protocol tvl --chain nope --json 2>err.json || jq -r '.error.code' err.json
406
+ # → UNKNOWN_CHAIN
393
407
  ```
394
408
 
395
409
  ---
@@ -398,7 +412,7 @@ JSON envelope:
398
412
 
399
413
  `ethereum` · `base` · `arbitrum` · `optimism` · `polygon` · `avalanche` · `bsc` · `scroll` · `gnosis` · `sei` · `berachain` · `hyperevm` · `unichain` · `ink` · `tac` · `mantle` · `linea` · `xlayer` · `fraxtal` · `worldchain` · `hemi` · `plume` · `plasma` · `katana`
400
414
 
401
- > `sonic` is sunset (PIP-64) — read operations work, write operations return `CHAIN_SUNSET`.
415
+ > `sonic` is sunset (PIP-64) — Parallelizer/Savings operations return `CHAIN_SUNSET`; USDp bridging and balance reads stay active.
402
416
 
403
417
  Not all chains support every feature. Use `parallel protocol chains` to see the full feature matrix (Parallelizer, sUSDp, bridge).
404
418
 
@@ -409,26 +423,22 @@ Not all chains support every feature. Use `parallel protocol chains` to see the
409
423
  | Code | Trigger |
410
424
  |---|---|
411
425
  | `CHAIN_SUNSET` | Operation not available on a sunset chain |
412
- | `CHAIN_PAUSED` | Chain temporarily paused (auto-pause by Hypernative or governance) |
413
426
  | `PARALLELIZER_NOT_DEPLOYED` | Feature requires Parallelizer, not deployed on this chain |
414
427
  | `UNKNOWN_CHAIN` | Chain identifier not recognised |
415
428
  | `INSUFFICIENT_BALANCE` | Wallet balance too low for the requested amount |
416
- | `EXCEEDS_CAP` | Amount would exceed a collateral exposure cap |
417
- | `EXCEEDS_BRIDGE_LIMIT` | Amount exceeds daily or global bridge limit |
418
- | `SLIPPAGE_EXCEEDED` | Actual slippage exceeds the configured tolerance |
419
- | `COOLDOWN_ACTIVE` | Unstake impossible cooldown period not yet expired |
420
- | `COLLATERAL_NOT_SUPPORTED` | Collateral not accepted on this chain |
421
- | `WALLET_REQUIRED` | Write command called without `--wallet` or `--dry-run` |
422
- | `INVALID_KEYSTORE` | Keystore file not found or invalid format |
423
- | `WRONG_PASSWORD` | Incorrect keystore decryption password |
424
- | `INVALID_AMOUNT` | Negative, zero, or unparseable amount |
425
- | `MISSING_OPTION` | Required flag not provided |
429
+ | `COLLATERAL_NOT_SUPPORTED` | Collateral (or bridge token) not accepted on this chain |
430
+ | `WALLET_REQUIRED` | Signing requested but no wallet available (`--wallet` unresolvable) |
431
+ | `INVALID_KEYSTORE` | Keystore unreadable, invalid format, or wrong decryption password |
432
+ | `INVALID_AMOUNT` | Negative, zero, malformed, or sub-decimal amount / duration / slippage |
433
+ | `MISSING_OPTION` | Required flag, argument, or subcommand not provided |
434
+ | `INVALID_OPTION` | A provided flag or argument has an invalid value |
435
+ | `UNKNOWN_COMMAND` / `UNKNOWN_OPTION` | Typo in a command or flag name |
426
436
  | `INVALID_ADDRESS` | Argument is not a valid EVM address |
427
- | `PAYMENT_EXPIRED` | x402 payment `validBefore` exceeded, re-sign required |
428
- | `INVALID_SIGNATURE` | x402 payment EIP-712 signature invalid |
429
- | `INVALID_NONCE` | x402 payment nonce already used |
430
- | `ROUTE_UNAVAILABLE` | x402 payment — no route available for this merchant/chain combination |
431
- | `RPC_ERROR` | RPC call failed (network issue or node unreachable) |
437
+ | `CONFIG_KEY_NOT_FOUND` | `config get` on a key absent from the config file |
438
+ | `RPC_ERROR` | An HTTP provider (facilitator, history APIs) is unreachable |
439
+ | `UNKNOWN` | Any other failure |
440
+
441
+ Protocol-layer errors (caps, bridge limits, sunset chains, partial reads…) are surfaced with their own code in the `code` field since 0.2.7 e.g. `EXCEEDS_CAP`, `EXCEEDS_BRIDGE_LIMIT`, `EXCEEDS_GLOBAL_LIMIT`, `CHAIN_SUNSET`, `ROUTE_UNAVAILABLE`, `PARTIAL_READ`, `PARALLELIZER_NOT_DEPLOYED`, `COLLATERAL_NOT_SUPPORTED`, `INSUFFICIENT_BALANCE`. Match on `error.code`; the message carries the human detail (remaining capacity, valid values…) without the code prefix.
432
442
 
433
443
  ---
434
444