@elgora/cli 7.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.
Files changed (3) hide show
  1. package/README.md +138 -0
  2. package/dist/cli.js +7183 -0
  3. package/package.json +44 -0
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # elgora-cli
2
+
3
+ `elgora-cli` lets Posters, Solvers, Guardians, and claimants perform their part
4
+ of an Elgora bounty from their own machine. It is a thin client: ElgoraHub owns
5
+ the bounty lifecycle, current Verdicts, settlement, claims, and refunds.
6
+
7
+ The CLI does not tally Guardian Verdicts or settle bounties. Every selected
8
+ Guardian must record a Verdict; ElgoraHub decides when two-thirds of the
9
+ pinned roster match.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install -g @elgora/cli
15
+ elgora-cli --help
16
+ ```
17
+
18
+ Or run one command without installing:
19
+
20
+ ```sh
21
+ npx @elgora/cli --help
22
+ ```
23
+
24
+ ## Commands
25
+
26
+ - `poster:publish-fund` publishes approved `bounty_challenge.md` bytes and
27
+ funds the new bounty.
28
+ - `poster:open-winning-submission` retrieves the finalized winning Submission
29
+ for the funding Poster and decrypts it locally.
30
+ - `spec-commitment` reproduces the challenge's `spec_commitment` offline.
31
+ - `solver:submit` encrypts a Submission for the bounty's pinned Guardian roster
32
+ and prepares or sends the exact ElgoraHub transaction.
33
+ - `guardian:judgeable` lists open bounties ready for Guardian review.
34
+ - `guardian:open` signs the protected content read, then verifies and decrypts
35
+ one exact Solver and Submission pair.
36
+ - `guardian:verdict` publishes a written Verdict and records the same Verdict
37
+ on ElgoraHub.
38
+ - `guardian:deliver-key` repairs delivery for one exact Solver and Submission
39
+ pair when ElgoraHub still permits it.
40
+ - `claim` prepares or sends the winning Solver's reserved award or the
41
+ Poster's queued refund, as selected from finalized ElgoraHub state.
42
+ - `verification-record` is a plain, unauthenticated GET that fetches or lazily
43
+ creates the small advisory `VerificationRecord` for a finalized bounty, which
44
+ `GET /api/bounties/<bounty_id>` inlines.
45
+
46
+ Run `elgora-cli help <command>` for exact arguments and environment variables.
47
+
48
+ ## Wallets and keys
49
+
50
+ Posters use `ELGORA_POSTER_PRIVATE_KEY`. Solvers should normally use
51
+ `--solver-address` and sign the emitted EIP-712 requests and prepared
52
+ transaction with an external wallet; `ELGORA_SOLVER_PRIVATE_KEY` is an optional
53
+ local testing convenience. Claimants can use `--claimant-address`, or
54
+ `ELGORA_CLAIMANT_PRIVATE_KEY` for a local test wallet.
55
+
56
+ Guardian commands use two different kinds of secret:
57
+
58
+ - `ELGORA_GUARDIAN_ACCOUNT_PRIVATE_KEY` is the Guardian's Ethereum account key.
59
+ It signs protected Submission reads, API writes, and `commitVerdict`
60
+ transactions.
61
+ - `ELGORA_GUARDIAN_PRIVATE_KEYS_JSON` contains retained X25519 encryption keys.
62
+ They decrypt Submissions and never sign transactions.
63
+
64
+ A Guardian may retain old and new X25519 keys after rotating the public key for
65
+ the same account. The CLI tries the retained keys locally so an earlier bounty
66
+ can still use the roster and key it pinned.
67
+
68
+ Never put private keys, decrypted artifacts, or raw Submission keys in command
69
+ arguments, logs, or submitted files. Each command reads only the secrets it
70
+ needs.
71
+
72
+ ## Deployment configuration
73
+
74
+ Every command accepts `--network <name|chain id>`, which selects the deployment
75
+ for that invocation without touching the environment. It takes a network name
76
+ (`base`, `base-sepolia`, `local`) or that network's chain id (`8453`, `84532`,
77
+ `31337`), and sets `ELGORA_CHAIN_ID` — the variable the CLI reads when no flag is
78
+ passed — for that run only:
79
+
80
+ ```sh
81
+ elgora-cli guardian:judgeable # the default deployment
82
+ elgora-cli claim --network base-sepolia 7 # one invocation, by name
83
+ elgora-cli claim --network 84532 7 # the same, by chain id
84
+ ```
85
+
86
+ The chain's public RPC, the ElgoraHub address, the escrow token, and the subgraph
87
+ endpoint are all defaulted from that chain id, so targeting Elgora's own
88
+ deployment needs no other configuration. They stay individually settable:
89
+ `ELGORA_HUB_ADDRESS`, `ELGORA_RPC_URL`, and `ELGORA_SUBGRAPH_ENDPOINT` override
90
+ what the chain id resolved — a local anvil stack needs them, since its addresses
91
+ change on every run. `elgora-cli help <command>` lists what that command reads
92
+ and which values it defaults. Supply a complete, coherent configuration when
93
+ targeting a deployment this CLI release does not know about, and do not mix
94
+ addresses or endpoints from different deployments.
95
+
96
+ Commands that use the public API accept `--api-base-url <url>`. That is a
97
+ separate choice from the chain: it names one API deployment, and the flag wins
98
+ over `ELGORA_API_BASE_URL` for that invocation. Point it at an API serving the
99
+ deployment you selected.
100
+
101
+ Protected API reads and writes use one EIP-712 approval per request. The
102
+ signature is bound to the method, path, body, query, API host, and a recent
103
+ chain block. The CLI constructs this approval locally; no session or stored API
104
+ credential is required.
105
+
106
+ `verification-record <bounty_id>` is the one exception: it is a plain,
107
+ unauthenticated GET with no approval to sign. Deriving this advisory record
108
+ grants no Poster, Guardian, coordinator, settlement, claim, or delivery
109
+ authority, so there is nothing to authenticate — any caller, with or without a
110
+ wallet, gets the same result a bounty page visit would — it reads that page's
111
+ own `GET /api/bounties/<bounty_id>`. A bounty with no record yet fails with the
112
+ reason the API gave.
113
+
114
+ ## Solver custody
115
+
116
+ `solver:submit --solver-address <address> <bounty_id> <artifact_dir>` prints an
117
+ approval request whenever the API needs a signed write. Sign its exact
118
+ `typed_data` value and return only the hex signature on stdin. The CLI then
119
+ checks the pinned Guardian roster directly against ElgoraHub, verifies the four
120
+ prepared `submit` values, and locally encodes the transaction for the same
121
+ wallet.
122
+
123
+ Without `--solver-address`, `ELGORA_SOLVER_PRIVATE_KEY` signs and sends the same
124
+ requests locally. It is intended only for controlled testing.
125
+
126
+ ## Development
127
+
128
+ From the repository root:
129
+
130
+ ```sh
131
+ pnpm --filter @elgora/cli typecheck
132
+ pnpm --filter @elgora/cli test
133
+ pnpm --filter @elgora/cli build
134
+ pnpm --filter @elgora/cli build:standalone
135
+ ```
136
+
137
+ The normal build uses workspace packages. The standalone build bundles the
138
+ runtime for release readback.