@tokamak-private-dapps/private-state-cli 2.1.1 → 2.1.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/CHANGELOG.md +35 -0
- package/README.md +63 -22
- package/cli-assistant.html +11 -5
- package/commands/account.mjs +43 -0
- package/commands/channel.mjs +66 -0
- package/commands/index.mjs +62 -0
- package/commands/investigator.mjs +11 -0
- package/commands/notes.mjs +39 -0
- package/commands/system.mjs +49 -0
- package/commands/wallet.mjs +86 -0
- package/investigator/README.md +16 -6
- package/investigator/app.js +612 -17
- package/investigator/index.html +153 -90
- package/investigator/styles.css +277 -28
- package/lib/private-state-cli-command-registry.mjs +62 -23
- package/lib/runtime.mjs +11531 -0
- package/package.json +2 -1
- package/private-state-bridge-cli.mjs +2 -11269
|
@@ -18,8 +18,34 @@ export const PRIVATE_STATE_CLI_FIELD_CATALOG = Object.freeze({
|
|
|
18
18
|
type: "password",
|
|
19
19
|
placeholder: "https://example-rpc",
|
|
20
20
|
valueLabel: "<URL>",
|
|
21
|
-
hint: "
|
|
21
|
+
hint: "Required by set rpc. Saved to ~/tokamak-private-channels/workspace/<network>/rpc-config.env.",
|
|
22
22
|
option: "--rpc-url",
|
|
23
|
+
},
|
|
24
|
+
provider: {
|
|
25
|
+
label: "RPC Provider",
|
|
26
|
+
type: "select",
|
|
27
|
+
options: ["alchemy", "ankr", "chainstack", "chainnodes", "quicknode"],
|
|
28
|
+
valueLabel: "<PROVIDER>",
|
|
29
|
+
hint: "Optional for set rpc. Uses the built-in provider table for eth_getLogs request rate and block range cap.",
|
|
30
|
+
option: "--provider",
|
|
31
|
+
optional: true,
|
|
32
|
+
},
|
|
33
|
+
logRequestsPerSecond: {
|
|
34
|
+
label: "Log Requests Per Second",
|
|
35
|
+
type: "text",
|
|
36
|
+
placeholder: "7.497",
|
|
37
|
+
valueLabel: "<N>",
|
|
38
|
+
hint: "Optional for set rpc. Required with --block-range-cap when --provider is not used.",
|
|
39
|
+
option: "--log-requests-per-second",
|
|
40
|
+
optional: true,
|
|
41
|
+
},
|
|
42
|
+
blockRangeCap: {
|
|
43
|
+
label: "Block Range Cap",
|
|
44
|
+
type: "text",
|
|
45
|
+
placeholder: "10",
|
|
46
|
+
valueLabel: "<N>",
|
|
47
|
+
hint: "Optional for set rpc. Required with --log-requests-per-second when --provider is not used.",
|
|
48
|
+
option: "--block-range-cap",
|
|
23
49
|
optional: true,
|
|
24
50
|
},
|
|
25
51
|
account: {
|
|
@@ -236,6 +262,18 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
236
262
|
fields: [],
|
|
237
263
|
usage: "no options",
|
|
238
264
|
},
|
|
265
|
+
{
|
|
266
|
+
id: "set-rpc",
|
|
267
|
+
display: "set rpc",
|
|
268
|
+
description: "Configure the network RPC URL and fixed eth_getLogs scan limits.",
|
|
269
|
+
fields: ["network", "rpcUrl", "provider", "logRequestsPerSecond", "blockRangeCap"],
|
|
270
|
+
usage: "--network, --rpc-url, and either --provider or both --log-requests-per-second and --block-range-cap",
|
|
271
|
+
help: [
|
|
272
|
+
"Writes ~/tokamak-private-channels/workspace/<network>/rpc-config.env",
|
|
273
|
+
"Built-in provider limits: ankr=27 calls/s and 3000 blocks, chainstack=22.5 calls/s and 100 blocks, chainnodes=22.5 calls/s and 20000 blocks, quicknode=13.5 calls/s and 5 blocks, alchemy=7.497 calls/s and 10 blocks",
|
|
274
|
+
"All bridge-facing and wallet commands read RPC settings from this file and do not accept --rpc-url",
|
|
275
|
+
],
|
|
276
|
+
},
|
|
239
277
|
{
|
|
240
278
|
id: "help-commands",
|
|
241
279
|
display: "help commands",
|
|
@@ -278,8 +316,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
278
316
|
id: "help-transaction-fees",
|
|
279
317
|
display: "help transaction-fees",
|
|
280
318
|
description: "Estimate ETH and USD fees for transaction-sending commands from packaged measured gas data and live network fee data.",
|
|
281
|
-
fields: ["network", "
|
|
282
|
-
usage: "--network
|
|
319
|
+
fields: ["network", "json"],
|
|
320
|
+
usage: "--network and optional --json",
|
|
283
321
|
help: [
|
|
284
322
|
"Uses packages/apps/private-state/cli/assets/tx-fees.json as the measured gas source packaged with the CLI",
|
|
285
323
|
"Reads live fee data from the selected network RPC and live ETH/USD from CoinGecko",
|
|
@@ -314,15 +352,15 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
314
352
|
id: "account-get-bridge-fund",
|
|
315
353
|
display: "account get-bridge-fund",
|
|
316
354
|
description: "Read the local account's current shared bridge vault balance.",
|
|
317
|
-
fields: ["network", "account"
|
|
318
|
-
usage: "--network, --account
|
|
355
|
+
fields: ["network", "account"],
|
|
356
|
+
usage: "--network, --account",
|
|
319
357
|
},
|
|
320
358
|
{
|
|
321
359
|
id: "channel-create",
|
|
322
360
|
display: "channel create",
|
|
323
361
|
description: "Create a bridge channel and initialize its workspace.",
|
|
324
|
-
fields: ["channelName", "joinToll", "network", "account"
|
|
325
|
-
usage: "--channel-name, --join-toll, --network, --account
|
|
362
|
+
fields: ["channelName", "joinToll", "network", "account"],
|
|
363
|
+
usage: "--channel-name, --join-toll, --network, --account",
|
|
326
364
|
help: [
|
|
327
365
|
"Prints the immutable policy snapshot before sending the transaction",
|
|
328
366
|
"Initializes the local channel workspace by replaying channel logs from channel genesis",
|
|
@@ -332,8 +370,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
332
370
|
id: "channel-recover-workspace",
|
|
333
371
|
display: "channel recover-workspace",
|
|
334
372
|
description: "Rebuild the local channel workspace from bridge state.",
|
|
335
|
-
fields: ["channelName", "network", "source", "fromGenesis"
|
|
336
|
-
usage: "--channel-name, --network, optional --source, optional --from-genesis
|
|
373
|
+
fields: ["channelName", "network", "source", "fromGenesis"],
|
|
374
|
+
usage: "--channel-name, --network, optional --source, optional --from-genesis",
|
|
337
375
|
help: [
|
|
338
376
|
"By default, --source rpc resumes RPC log scanning from the workspace recovery index when available",
|
|
339
377
|
"--source mirror validates the channel leader's registered checkpoint manifest, downloads only the needed checkpoint or delta bundle, and then replays RPC logs to latest",
|
|
@@ -349,8 +387,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
349
387
|
id: "channel-set-workspace-mirror",
|
|
350
388
|
display: "channel set-workspace-mirror",
|
|
351
389
|
description: "Register or update the channel leader's workspace mirror base URL.",
|
|
352
|
-
fields: ["channelName", "network", "account", "url"
|
|
353
|
-
usage: "--channel-name, --network, --account, --url
|
|
390
|
+
fields: ["channelName", "network", "account", "url"],
|
|
391
|
+
usage: "--channel-name, --network, --account, --url",
|
|
354
392
|
help: [
|
|
355
393
|
"Only the on-chain channel leader can update the registered mirror URL",
|
|
356
394
|
"The URL points to a server implementing the private-state channel workspace mirror protocol",
|
|
@@ -360,8 +398,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
360
398
|
id: "channel-publish-workspace-mirror",
|
|
361
399
|
display: "channel publish-workspace-mirror",
|
|
362
400
|
description: "Build static workspace mirror files for the registered mirror URL.",
|
|
363
|
-
fields: ["channelName", "network", "account", "output", "force"
|
|
364
|
-
usage: "--channel-name, --network, --account, --output, optional --force
|
|
401
|
+
fields: ["channelName", "network", "account", "output", "force"],
|
|
402
|
+
usage: "--channel-name, --network, --account, --output, optional --force",
|
|
365
403
|
help: [
|
|
366
404
|
"Requires the local channel workspace to be current and ahead of the registered mirror checkpoint",
|
|
367
405
|
"--force ignores an unreadable or invalid existing mirror manifest and publishes a full checkpoint without a delta",
|
|
@@ -373,15 +411,15 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
373
411
|
id: "channel-get-meta",
|
|
374
412
|
display: "channel get-meta",
|
|
375
413
|
description: "Read channel existence, manager, vault, toll, refund schedule, and immutable policy snapshot.",
|
|
376
|
-
fields: ["channelName", "network"
|
|
377
|
-
usage: "--channel-name, --network
|
|
414
|
+
fields: ["channelName", "network"],
|
|
415
|
+
usage: "--channel-name, --network",
|
|
378
416
|
},
|
|
379
417
|
{
|
|
380
418
|
id: "account-deposit-bridge",
|
|
381
419
|
display: "account deposit-bridge",
|
|
382
420
|
description: "Deposit canonical tokens into the shared bridge vault.",
|
|
383
|
-
fields: ["amount", "network", "account", "acknowledgeActionImpact"
|
|
384
|
-
usage: "--amount, --network, --account, --acknowledge-action-impact
|
|
421
|
+
fields: ["amount", "network", "account", "acknowledgeActionImpact"],
|
|
422
|
+
usage: "--amount, --network, --account, --acknowledge-action-impact",
|
|
385
423
|
help: [
|
|
386
424
|
"Action impact: emits public L1 approval and bridge funding events that expose the local L1 account, bridge vault, amount, and transaction hashes.",
|
|
387
425
|
"Private note state is not changed by this command.",
|
|
@@ -394,8 +432,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
394
432
|
id: "account-withdraw-bridge",
|
|
395
433
|
display: "account withdraw-bridge",
|
|
396
434
|
description: "Withdraw tokens from the shared bridge vault back to the wallet.",
|
|
397
|
-
fields: ["amount", "network", "account", "acknowledgeActionImpact"
|
|
398
|
-
usage: "--amount, --network, --account, --acknowledge-action-impact
|
|
435
|
+
fields: ["amount", "network", "account", "acknowledgeActionImpact"],
|
|
436
|
+
usage: "--amount, --network, --account, --acknowledge-action-impact",
|
|
399
437
|
help: [
|
|
400
438
|
"Action impact: emits a public L1 bridge withdrawal event that exposes the local L1 recipient, bridge vault, amount, and transaction hash.",
|
|
401
439
|
"Private note state is not changed by this command; prior note provenance is not public by default.",
|
|
@@ -408,8 +446,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
408
446
|
id: "wallet-recover-workspace",
|
|
409
447
|
display: "wallet recover-workspace",
|
|
410
448
|
description: "Rebuild a recoverable local wallet from on-chain channel state.",
|
|
411
|
-
fields: ["channelName", "network", "account", "fromGenesis"
|
|
412
|
-
usage: "--channel-name, --network, --account, optional --from-genesis
|
|
449
|
+
fields: ["channelName", "network", "account", "fromGenesis"],
|
|
450
|
+
usage: "--channel-name, --network, --account, optional --from-genesis",
|
|
413
451
|
help: [
|
|
414
452
|
"Rebuilds backup metadata from channel state without recreating the spending key",
|
|
415
453
|
"Derives and stores the viewing key when the local account signer can reproduce the registered viewing public key",
|
|
@@ -424,8 +462,8 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
424
462
|
id: "channel-join",
|
|
425
463
|
display: "channel join",
|
|
426
464
|
description: "Pay the channel join toll and bind a wallet to a channel-specific L2 identity.",
|
|
427
|
-
fields: ["channelName", "network", "account", "walletSecretPath", "acknowledgeActionImpact"
|
|
428
|
-
usage: "--channel-name, --network, --account, --wallet-secret-path, --acknowledge-action-impact
|
|
465
|
+
fields: ["channelName", "network", "account", "walletSecretPath", "acknowledgeActionImpact"],
|
|
466
|
+
usage: "--channel-name, --network, --account, --wallet-secret-path, --acknowledge-action-impact",
|
|
429
467
|
help: [
|
|
430
468
|
"Refreshes the local channel workspace through the saved recovery index before joining when the scan fits the 10 second pre-command budget",
|
|
431
469
|
"Fails instead of replaying from genesis; run channel recover-workspace --source rpc --from-genesis when a genesis rebuild is required",
|
|
@@ -568,6 +606,7 @@ export const PRIVATE_STATE_CLI_COMMANDS = Object.freeze([
|
|
|
568
606
|
usage: "--wallet, --network, --amounts, --acknowledge-action-impact, and optional --tx-submitter",
|
|
569
607
|
help: [
|
|
570
608
|
"Refreshes the local channel workspace through the saved recovery index before proving the mint when the scan fits the 10 second pre-command budget",
|
|
609
|
+
"Requires both viewing and spending key capability so the accepted mint can be recovered through the normal note event path",
|
|
571
610
|
"Use --tx-submitter <ACCOUNT> to let a separate local L1 account pay gas for stronger transaction privacy",
|
|
572
611
|
"Action impact: emits public accepted-transition, commitment, encrypted note-delivery, root update, and transaction events.",
|
|
573
612
|
"Private note state changes by creating local note plaintext and public commitments; note owner/value/salt are not public by default.",
|