@secondlayer/cli 20.1.1 → 21.0.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 +5 -21
- package/dist/cli.js +143 -1238
- package/dist/cli.js.map +9 -14
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -43,7 +43,6 @@ the merchant host if this machine ran `secondlayer login` at some point — that
|
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
45
|
bun add -g @secondlayer/cli
|
|
46
|
-
secondlayer setup
|
|
47
46
|
|
|
48
47
|
secondlayer subgraphs scaffold SP1234ABCD.my-contract -o subgraphs/my-contract.ts
|
|
49
48
|
git add subgraphs/my-contract.ts # deploy refuses an unstaged file; or pass --allow-uncommitted
|
|
@@ -51,23 +50,9 @@ secondlayer subgraphs deploy subgraphs/my-contract.ts --start-block <recent-bloc
|
|
|
51
50
|
secondlayer subgraphs query my-contract <table> --sort _block_height --order desc
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
in that directory connects with) into a target directory, brings the stack up,
|
|
58
|
-
prints the observer stanza for an external node, and restores + verifies
|
|
59
|
-
history from the archive: the one-command replacement for `init` → hand-copy
|
|
60
|
-
secrets → `docker compose up` → `observer` → `bootstrap` → `verify`. `setup`
|
|
61
|
-
is also the only way to bring the stack up: the old `secondlayer start`, which
|
|
62
|
-
printed a compose line for a monorepo checkout, is gone. Without a TTY (or
|
|
63
|
-
with `--yes`), it skips the interactive prompts and runs from flags instead;
|
|
64
|
-
`--network` and `--node-mode` are then required. `--against` defaults to the
|
|
65
|
-
official archive, so it's needed only to point at a different one:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
secondlayer setup --yes \
|
|
69
|
-
--network mainnet --node-mode external
|
|
70
|
-
```
|
|
53
|
+
To run your own instance, follow [Self-host](https://secondlayer.tools/docs/self-host):
|
|
54
|
+
`docker compose` from `docker/oss`, with `init`, `observer`, `bootstrap` and
|
|
55
|
+
`verify` below for the steps around it.
|
|
71
56
|
|
|
72
57
|
`secondlayer subgraphs scaffold` writes the definition file, creates/updates
|
|
73
58
|
`package.json`, and runs `bun install` (pass `--no-install` to skip).
|
|
@@ -94,7 +79,6 @@ No account. Writes `.env.local`, restores history, prints the Stacks observer st
|
|
|
94
79
|
|
|
95
80
|
| Command | What it does |
|
|
96
81
|
|---|---|
|
|
97
|
-
| `secondlayer setup [--network …] [--node-mode external\|stacks\|full] [--api-port <spec>] [--dir <path>] [--against <manifest>] [--skip-bootstrap] [--skip-verify] [--yes] [--force]` | Guided self-host onboarding — secrets, compose + `.env`, docker up, observer stanza, bootstrap, verify. Prompts when interactive; flags-only (no prompts) with `--yes` or no TTY |
|
|
98
82
|
| `secondlayer init [--network mainnet\|testnet\|devnet] [--api-url <url>] [--force]` | Write `.env.local` (token, secrets key, webhook signing key). `--network` and `--api-url` are the global flags. Idempotent |
|
|
99
83
|
| `secondlayer bootstrap --against <manifest> [--from-block <n>] [--to-block <n>] [--verify all\|blocks] [--public-key <pem>] [-y] [--json]` | Restore chain history from a verified archive into an empty database. A run that died mid-way resumes per dataset on re-run. After the load, digests for blocks, transactions, and events are checked over the restored range (`--verify blocks` skips the child datasets and the minutes they cost). Partition fetches retry three times with backoff on resets, timeouts, 429 (honoring `Retry-After`) and 5xx; a link that stays down exits `1` with a re-run hint, and the re-run resumes. Exit `0` restored, `1` diverged or interrupted, `2` refused |
|
|
100
84
|
| `secondlayer observer [--mode indexer\|signer-shared] [--endpoint host:port] [--network …]` | Print the `[[events_observer]]` stanza. Signer-shared skips retries; a missed block stays a gap until `repair` |
|
|
@@ -210,7 +194,7 @@ or poll the subgraph API: see
|
|
|
210
194
|
| `SECONDLAYER_API_URL` | Instance API. Default `http://127.0.0.1:3800` |
|
|
211
195
|
| `SL_PLATFORM_API_URL` | Alias of `SECONDLAYER_API_URL` |
|
|
212
196
|
| `STACKS_NETWORK` | Default network (also via `--network <mainnet\|testnet\|devnet>`) |
|
|
213
|
-
| `DATABASE_URL` | Postgres that `bootstrap`, `verify`, `repair`, and `backup` connect to.
|
|
197
|
+
| `DATABASE_URL` | Postgres that `bootstrap`, `verify`, `repair`, and `backup` connect to. Point it at the compose Postgres (`postgres://secondlayer:<POSTGRES_PASSWORD>@127.0.0.1:5432/secondlayer`); unset, the shared dev URL `postgres://postgres:postgres@localhost:5432/secondlayer_dev` is used |
|
|
214
198
|
| `HIRO_API_KEY` | Used by `secondlayer codegen contracts` for remote contract fetches |
|
|
215
199
|
|
|
216
200
|
## Code generation (`secondlayer codegen contracts`)
|
|
@@ -276,7 +260,7 @@ const supply = await token.vars.totalSupply.get()
|
|
|
276
260
|
|
|
277
261
|
## Local development
|
|
278
262
|
|
|
279
|
-
|
|
263
|
+
A self-hosted stack runs from `docker/oss` ([Self-host](https://secondlayer.tools/docs/self-host)). For Clarinet, use
|
|
280
264
|
`secondlayer devnet connect` / `status` / `logs` / `down` (and `devnet faucet`).
|
|
281
265
|
|
|
282
266
|
## Docs
|