@useopentab/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/LICENSE +202 -0
- package/README.md +147 -2
- package/dist/bin.js +361 -0
- package/dist/chunks/chunk-4R3NAR3C.js +28 -0
- package/dist/chunks/chunk-D3C7KAMJ.js +2221 -0
- package/dist/chunks/chunk-EKJH2AJS.js +371 -0
- package/dist/chunks/chunk-GOEFQ62Z.js +53 -0
- package/dist/chunks/chunk-HTU7QRDF.js +223 -0
- package/dist/chunks/chunk-HZHOKJIM.js +360 -0
- package/dist/chunks/chunk-IRXOU25X.js +1856 -0
- package/dist/chunks/chunk-MOZ4BFSB.js +13 -0
- package/dist/chunks/chunk-Q776JIO3.js +1821 -0
- package/dist/chunks/chunk-QTI2WM44.js +68 -0
- package/dist/chunks/chunk-S5IAH7CT.js +84 -0
- package/dist/chunks/config-OPZLVTYX.js +73 -0
- package/dist/chunks/gate-53O3YCXE.js +74 -0
- package/dist/chunks/indexer-OLIWEEFT.js +491 -0
- package/dist/chunks/init-JSZX6AF5.js +176 -0
- package/dist/chunks/line-2QBTLAUN.js +95 -0
- package/dist/chunks/liveNode-SLQN4XRB.js +299 -0
- package/dist/chunks/liveOnboard-Z4GRTSHR.js +400 -0
- package/dist/chunks/liveSettle-V5W7D2U5.js +1398 -0
- package/dist/chunks/notary-PQDSEOVV.js +122 -0
- package/dist/chunks/onboardError-RLJPEEFU.js +10 -0
- package/dist/chunks/src-RIOYQO2J.js +556 -0
- package/dist/chunks/tab-QPO2545T.js +59 -0
- package/dist/chunks/verify-Z7BGKZOB.js +719 -0
- package/package.json +66 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,148 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @useopentab/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The OpenTab command line, for Concordium **testnet**.
|
|
4
|
+
|
|
5
|
+
- **The verify kit** (`opentab verify …`) re-checks OpenTab transactions, credit lines, tabs,
|
|
6
|
+
settlements, receipt logs and whole evidence bundles from public chain data and signed bytes,
|
|
7
|
+
decoded with `@opentab/codec`. Nothing is taken on trust: the indexer, when configured, only
|
|
8
|
+
locates transaction hashes. See [docs/verify-kit.md](https://github.com/OoJae/opentab/blob/main/docs/verify-kit.md).
|
|
9
|
+
- `opentab init` onboards an agent wallet-first through `@opentab/onboard`.
|
|
10
|
+
- `opentab line`, `opentab tab`, `opentab notary repair` and `opentab gate up`.
|
|
11
|
+
|
|
12
|
+
Every command prints a report (`PASS`/`FAIL` per check, then facts); `--json` prints it as JSON.
|
|
13
|
+
Exit codes: `0` passed, `1` a check failed or an error, `2` usage, `3` run again (`init` is waiting
|
|
14
|
+
for a signature or for the card to be hosted).
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
`@useopentab/cli` 0.1.0 is packaged for npm but **not published yet**. Its command is `opentab` (for example after `npm i -g @useopentab/cli`). After publication:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx @useopentab/cli verify demo --bundle <path-or-url of an opentab-evidence/v1 bundle>
|
|
22
|
+
npx @useopentab/cli verify tx <hash>
|
|
23
|
+
npx @useopentab/cli --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
It needs Node.js 22.19 or later (the floor of its dependency `undici` 8). The package is one
|
|
27
|
+
JavaScript file, `dist/bin.js`: the OpenTab workspace packages it uses are bundled into it, and npm
|
|
28
|
+
installs the third-party packages (`@concordium/web-sdk` and ten others) at the exact versions the
|
|
29
|
+
repository's tests ran with. Most of the install is `@concordium/web-sdk` and its Rust bindings
|
|
30
|
+
(about 375 MB of `node_modules` in total, LOCAL, 20 Nov 2026). It is a command line only: the
|
|
31
|
+
published package exports no library entry points.
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
| Command | What it does |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `verify tx <hash>` | Decodes any transaction (calls, events, transfers, anchors) and runs the checks of its kind (inferred from the entrypoint; a DRP-1 anchor, `"OTDRP1" ‖ root` from the anchor account, is `anchorDRP`) |
|
|
38
|
+
| `verify settlement <txHash>` | settleTab on this bureau; close signed by the line key; `TabSettled`; attached = total − settled before; exactly one transfer of that amount to the tab's snapshot seller wallet; bureau balance 0 after the block; `acked` matches the CloseAck signature |
|
|
39
|
+
| `verify line <id> [--tx <openLine>]` | `LineOpened` commitment = H(terms_hash ‖ H(attestation)); terms pin the session key; attestation signed by an allow-listed attestor (CI attestor flagged); CCDVRA/CCDVAA anchors are RegisterData from the anchor account, decode, and precede the line (a line attested by the flagged CI attestor that names no anchors, both hashes zero, is reported as "no anchored identity proof" instead); lineOf matches |
|
|
40
|
+
| `verify tab <id> [--tx <openTab>] [--settlement <hash>]…` | `TabOpened`; agreement hash = tab's; buyer and seller signatures; tabOf matches the agreement; then each settlement |
|
|
41
|
+
| `verify receipts <file> [--offline]` | Every voucher (buyer key) and receipt (seller key) signature; receipt answers its voucher; charged ≤ max_price; cumulative arithmetic; per-lane seq 1, 2, 3…, ack and `prev_receipt_hash` chain; request/response hashes; on chain: the keys are the line's and the tab's, settled lanes are covered |
|
|
42
|
+
| `verify demo [--bundle <path-or-url>] [--timeout <s>]` | All of the above for every item of an evidence bundle (default `<PUBLIC_BASE_URL>/evidence/latest.json`), 8 at a time, within `--timeout` (default 60 s) from the command's start, node retries included (below). A bundle can also expect an on-chain rejection (`expect.rejectCode`: failed, rejected by that entrypoint with that code; for a `Flagged` openLine, the owner flagged at the block before), a ladder step or none (`expect.capStepped`) and a DRP-1 anchor's root (`expect.drpRoot`); see [docs/verify-kit.md](https://github.com/OoJae/opentab/blob/main/docs/verify-kit.md) |
|
|
43
|
+
| `init --role buyer\|seller …` | Register, setAgentWallet (raw proof), CIS-8 session key, badge, then registerSeller or the consent URL. Checks the owner's balance and prompts for the faucet before any transaction, then asks for confirmation (`--yes` skips the prompts and fails when unfunded). Key-file mode with `--owner-key`/`--wallet-key`; without `--owner-key` it prints unsigned payloads, and `--step <s> --tx <hash>` (or `--wallet-signature <hex>`) resumes |
|
|
44
|
+
| `line open --token --owner --session-key` | Prints the web consent URL (`<PUBLIC_BASE_URL>/line/<token>#p=<LineProposalV1>`, default terms 100 CCD line, 25 CCD per seller, 1-day cycle, valid 30 days); the owner signs openLine in Browser Wallet there |
|
|
45
|
+
| `line status <id>` | lineOf and the standing of its key |
|
|
46
|
+
| `line close <id> --owner <acct> [--owner-key <export>]` | closeLine from the owner (key file), or the unsigned payload |
|
|
47
|
+
| `tab status <id>` | tabOf: status, totals, cycle, lanes |
|
|
48
|
+
| `tab settle <id> --url <seller> --wallet-key <export> --key <keyd buyer key>` | Resyncs lanes from the seller (`GET /tab/:id`), signs the close through keyd, collects the CloseAck and sends one sponsored settleTab through the facilitator (`@opentab/client`) |
|
|
49
|
+
| `notary repair <badge> [--host-at <url>] [--out <file>]` | Calls Notary's `POST /v1/repair {token, hostAt?}` and re-checks the answer: bytes hash to the stated SHA-256, A2A v1.0, badge valid for the on-chain owner and agent wallet; prints the field diff, what could not be fixed, the hosting steps and the setAgentURI parameter. The repair is an x402 exact payment: a 402 is reported with its price |
|
|
50
|
+
| `gate up --seller-token --upstream [--public-url] [--prices] [--mode]` | Prints the tab-gate env file and `docker run` line (no secrets) |
|
|
51
|
+
|
|
52
|
+
## Configuration (environment)
|
|
53
|
+
|
|
54
|
+
| Variable | Default | Used by |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `OPENTAB_GRPC_HOST` / `OPENTAB_GRPC_PORT` | `grpc.testnet.concordium.com` / `20000` (TLS) | all chain reads |
|
|
57
|
+
| `OPENTAB_BUREAU` | `13064,0` | everything |
|
|
58
|
+
| `OPENTAB_ANCHOR_ACCOUNT` | ANCHOR from docs/provenance.md | `verify line`, CCDVRA/CCDVAA anchors |
|
|
59
|
+
| `OPENTAB_DRP_ANCHOR_ACCOUNTS` | ANCHOR_DRP,ANCHOR (comma-separated) | DRP-1 anchors (`anchorDRP`) |
|
|
60
|
+
| `INDEXER_URL` | none | `verify line`/`tab` without `--tx` (locator only, read with @opentab/indexer-client) |
|
|
61
|
+
| `PUBLIC_BASE_URL` | none | `verify demo` default bundle, `line open`, `init` defaults |
|
|
62
|
+
| `NOTARY_URL` | none | `notary repair` |
|
|
63
|
+
| `FACILITATOR_URL` | none | `tab settle`, `gate up` |
|
|
64
|
+
| `KEYD_SOCKET` | `~/.opentab/run/keyd.sock` | `tab settle`, `gate up` |
|
|
65
|
+
| `KEYD_KEY_DIR` | `~/.opentab/keyd` | `init` (session keys) |
|
|
66
|
+
|
|
67
|
+
URLs must be https (http only for localhost). No domain is built in.
|
|
68
|
+
|
|
69
|
+
## When the node is busy (`verify …`)
|
|
70
|
+
|
|
71
|
+
The public testnet node rate-limits (HTTP 429) and has slow spells (deadline exceeded, "Waiting for
|
|
72
|
+
LB pick"). Every chain read of the verify kit (`src/verify/grpc.ts`, with `retryRead` from
|
|
73
|
+
`@opentab/registry`) asks again after such an error, and only then:
|
|
74
|
+
|
|
75
|
+
- retried: `UNAVAILABLE` (HTTP 429, 502, 503, 504), `DEADLINE_EXCEEDED`, `RESOURCE_EXHAUSTED`, a
|
|
76
|
+
dropped or refused connection; never an answer (`NOT_FOUND` is an absent transaction, a failed
|
|
77
|
+
view or check fails at once);
|
|
78
|
+
- waits of 0.25–0.5 s doubling up to 4–8 s, random within each range; at most 12 attempts and 60 s
|
|
79
|
+
per read;
|
|
80
|
+
- `verify demo` has one deadline, `--timeout` seconds from the command's start: no wait goes past
|
|
81
|
+
it, a read still waiting is abandoned, items not started are "not checked", so the command ends
|
|
82
|
+
by then. The report shows `node reads retried: N` when there were retries;
|
|
83
|
+
- when retries run out: `opentab: node_unavailable: <read>: gave up after 12 attempts in 50.1 s; last
|
|
84
|
+
error: Received HTTP status code 429 (UNAVAILABLE)` (exit 1). The kit only reads; run it again.
|
|
85
|
+
|
|
86
|
+
LOCAL, 20 Nov 2026 (laptop, public node, read-only): 8 consecutive `verify demo --bundle
|
|
87
|
+
e2e/runs/<id>.json` runs over the four recorded bundles all passed in 3.8–26.6 s (as the report
|
|
88
|
+
measures it); three of them retried 36–68 reads. Details: [docs/verify-kit.md](https://github.com/OoJae/opentab/blob/main/docs/verify-kit.md#when-the-node-is-busy).
|
|
89
|
+
|
|
90
|
+
## Run
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
pnpm --dir packages/cli opentab verify tx <hash> # tsx src/bin.ts
|
|
94
|
+
rtk proxy pnpm --dir packages/cli exec vitest run
|
|
95
|
+
LIVE=1 rtk proxy pnpm --dir packages/cli exec vitest run test/live.test.ts # read-only testnet
|
|
96
|
+
pnpm --dir packages/cli typecheck
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Build and publish
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
rtk proxy pnpm --dir packages/cli build # dist/bin.js (tsx build/run.ts); `prepack` runs it too
|
|
103
|
+
pnpm --dir packages/cli publish # prepublishOnly: build, then every test of this package
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`build/build.ts` bundles `src/bin.ts` with esbuild (already in the lockfile through tsx and Vite)
|
|
107
|
+
into `dist/bin.js`, with a `#!/usr/bin/env node` line, no source map and no minification. Each
|
|
108
|
+
`@opentab/*` package is bundled. Every other package stays an import. The build fails unless:
|
|
109
|
+
|
|
110
|
+
- `dependencies` lists exactly the packages the bundle imports;
|
|
111
|
+
- each of them is pinned to the version the workspace resolves;
|
|
112
|
+
- the output holds no absolute path of the machine that built it.
|
|
113
|
+
|
|
114
|
+
`build/build.test.ts` builds the bundle and runs it with plain `node`, so it resolves its imports
|
|
115
|
+
only from this package's own dependencies.
|
|
116
|
+
|
|
117
|
+
In this repository the package's `exports` point at the TypeScript source, for the workspace
|
|
118
|
+
(`e2e/*`, `apps/web`). `publishConfig.exports` replaces them with `./package.json` only, and pnpm
|
|
119
|
+
replaces the `workspace:` ranges of the bundled `@opentab/*` devDependencies. Only `pnpm publish`
|
|
120
|
+
or `pnpm pack` does both, so `prepublishOnly` refuses `npm publish` in this directory. To publish
|
|
121
|
+
with npm, pack with pnpm first: `pnpm pack`, then `npm publish opentab-0.1.0.tgz`. `npm pack` also
|
|
122
|
+
yields a working CLI, but its manifest keeps the development `exports`.
|
|
123
|
+
|
|
124
|
+
A fresh checkout prints `Failed to create bin … packages/cli/dist/bin.js` warnings during
|
|
125
|
+
`pnpm install` for the workspace packages that depend on `opentab`, because `dist/` is built and
|
|
126
|
+
not committed. They are harmless. In development, run the source with
|
|
127
|
+
`pnpm --dir packages/cli opentab …`.
|
|
128
|
+
|
|
129
|
+
## Mocked vs live
|
|
130
|
+
|
|
131
|
+
Unit tests build a fully signed history (seller, line with attestation and anchors, tab, settlement,
|
|
132
|
+
receipts on two lanes, a default report) with the codec and real ed25519 signatures, served by a fake
|
|
133
|
+
chain, and tamper with it to hit every failing check. `test/expectations.test.ts` adds an openLine
|
|
134
|
+
refused with `Flagged`, settlements with and without `CapStepped`, and a DRP-1 anchor, each with the
|
|
135
|
+
ways it can fail. An injected flaky node client (HTTP 429,
|
|
136
|
+
deadline exceeded, NOT_FOUND, a failed view) tests the retries, the final `node_unavailable` error
|
|
137
|
+
and the `verify demo` deadline. `init` runs end to end against the onboarding
|
|
138
|
+
fake node with real key files. The `LIVE=1` test (read-only) checks that the live `<13064,0>` config
|
|
139
|
+
view equals `docs/deployments/testnet.json` and that `verify tx` passes the S1/S2 spike transactions.
|
|
140
|
+
|
|
141
|
+
## Needs testnet accounts, services or the domain
|
|
142
|
+
|
|
143
|
+
- `verify demo` with no `--bundle` needs `PUBLIC_BASE_URL` serving `/evidence/latest.json` (the web
|
|
144
|
+
app serves `apps/web/public/evidence/latest.json` there). The bundle schema is also exported as
|
|
145
|
+
`opentab/bundle` (codec and zod only) inside this repository, which the web app's `/verify` page uses.
|
|
146
|
+
- `verify line`/`tab` without `--tx` need the indexer (`INDEXER_URL`).
|
|
147
|
+
- `tab settle` needs a live tab, keyd serving the line key, the buyer wallet's key export and the
|
|
148
|
+
facilitator; `line close` and `init` need funded owners; `notary repair` needs the Notary API.
|