@secondlayer/cli 13.0.1 → 13.0.3

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 CHANGED
@@ -14,12 +14,12 @@ secondlayer --version
14
14
 
15
15
  Default API is `http://127.0.0.1:3800`. Override with `SL_API_URL`.
16
16
 
17
- Writes against a published bind use `INSTANCE_TOKEN` from `secondlayer init` as
18
- `SL_API_KEY`. Loopback reads need no token.
17
+ Writes against a published bind use `INSTANCE_TOKEN` from `secondlayer init`.
18
+ Loopback reads need no token. `SL_API_KEY` is a legacy alias of `INSTANCE_TOKEN`.
19
19
 
20
20
  ```bash
21
21
  export SL_API_URL=http://127.0.0.1:3800
22
- export SL_API_KEY=<INSTANCE_TOKEN>
22
+ export INSTANCE_TOKEN=<from secondlayer init>
23
23
  ```
24
24
 
25
25
  ## Quickstart
@@ -126,7 +126,7 @@ points at.
126
126
  | Command | What it does |
127
127
  |---|---|
128
128
  | `secondlayer index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded Index layer. Anonymous reads OK |
129
- | `secondlayer streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `dumps` | Raw chain event firehose. **Requires `SL_API_KEY`** |
129
+ | `secondlayer streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `dumps` | Raw chain event firehose. **Requires `INSTANCE_TOKEN` past loopback** |
130
130
 
131
131
  Reads emit JSON to stdout (`--json` accepted across all read commands); `-o/--output` is a file path, not a format.
132
132
 
@@ -168,7 +168,8 @@ operates on both kinds.
168
168
 
169
169
  | Var | Purpose |
170
170
  |---|---|
171
- | `SL_API_KEY` | `INSTANCE_TOKEN` from `secondlayer init` for writes. Loopback reads need no token |
171
+ | `INSTANCE_TOKEN` | From `secondlayer init` for writes. Loopback reads need no token |
172
+ | `SL_API_KEY` | Legacy alias of `INSTANCE_TOKEN` |
172
173
  | `SL_API_URL` | Instance API. Default `http://127.0.0.1:3800` |
173
174
  | `SL_PLATFORM_API_URL` | Alias of `SL_API_URL` |
174
175
  | `STACKS_NETWORK` | Default network (also via `--network <local\|testnet\|mainnet>`) |
package/dist/cli.js CHANGED
@@ -16502,7 +16502,7 @@ class StacksApiClient {
16502
16502
  const statusCode = typeof error2 === "object" && error2 !== null && "response" in error2 && typeof error2.response === "object" && error2.response !== null && "statusCode" in error2.response ? error2.response.statusCode : undefined;
16503
16503
  const message = error2 instanceof Error ? error2.message : String(error2);
16504
16504
  if (statusCode === 401) {
16505
- throw new Error("Authentication required. Run: secondlayer auth login");
16505
+ throw new Error(isOssMode() ? "Authentication required. Set INSTANCE_TOKEN from `secondlayer init` (SL_API_KEY is a legacy alias)." : "Authentication required. Run: secondlayer login");
16506
16506
  }
16507
16507
  if (statusCode === 404) {
16508
16508
  throw new Error(`${resourceType} not found: ${resourceId}`);
@@ -30031,8 +30031,7 @@ deployed definition's only copy is the row in the database. Pass
30031
30031
  await closeDb();
30032
30032
  }
30033
30033
  } catch (err) {
30034
- error(`Failed to deploy subgraph: ${err}`);
30035
- process.exit(1);
30034
+ handleApiError(err, "deploy subgraph");
30036
30035
  }
30037
30036
  });
30038
30037
  subgraphs.command("list").alias("ls").description("List all deployed subgraphs").option("--json", "Output as JSON").action(async (options3) => {
@@ -30682,7 +30681,7 @@ function emitOne(doc, label, json) {
30682
30681
  });
30683
30682
  }
30684
30683
  function registerIndexCommand(program2) {
30685
- const index = program2.command("index").description("Query the decoded Index layer (events + contract calls)");
30684
+ const index = program2.command("index").description("Query decoded Index data (events + contract calls)");
30686
30685
  const rangeFlags = (cmd) => cmd.option("--contract-id <id>", "Filter by contract id").option("--from-height <n>", "Start block height (inclusive)").option("--to-height <n>", "End block height (inclusive)").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--limit <n>", "Rows per page").option("--json", "Print the full envelope as JSON");
30687
30686
  const heightFlags = (cmd) => cmd.option("--from-height <n>", "Start block height (inclusive)").option("--to-height <n>", "End block height (inclusive)").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--limit <n>", "Rows per page").option("--json", "Print the full envelope as JSON");
30688
30687
  rangeFlags(index.command("ft-transfers")).description("List decoded SIP-010 fungible-token transfers").option("--sender <principal>", "Filter by sender").option("--recipient <principal>", "Filter by recipient").action(async (o3) => {
@@ -36099,7 +36098,7 @@ var {
36099
36098
  // package.json
36100
36099
  var package_default = {
36101
36100
  name: "@secondlayer/cli",
36102
- version: "13.0.1",
36101
+ version: "13.0.3",
36103
36102
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
36104
36103
  repository: {
36105
36104
  type: "git",
@@ -36144,7 +36143,7 @@ var package_default = {
36144
36143
  "@opentui/react": "^0.5.3",
36145
36144
  "@secondlayer/bundler": "^0.5.1",
36146
36145
  "@secondlayer/scaffold": "^1.5.4",
36147
- "@secondlayer/sdk": "^9.0.0",
36146
+ "@secondlayer/sdk": "^9.0.1",
36148
36147
  "@secondlayer/shared": "^11.0.0",
36149
36148
  "@secondlayer/stacks": "^4.0.0",
36150
36149
  "@secondlayer/subgraphs": "^4.0.4",
@@ -41658,11 +41657,12 @@ function registerStartCommand(program2) {
41658
41657
  success(`config ok (${parsed.config.NETWORK}, ${parsed.config.NODE_MODE})`);
41659
41658
  console.log(cmd);
41660
41659
  note(" console UI (optional): add --profile console, then `secondlayer console`");
41660
+ note(" /extended view (optional): set EXTENDED_VIEW=1, then curl http://127.0.0.1:3999/extended/v1/status");
41661
41661
  });
41662
41662
  }
41663
41663
  // src/cli.ts
41664
41664
  var { version } = package_default;
41665
- program.name("secondlayer").alias("sl").description("Secondlayer CLI — run a Stacks index on your own hardware").version(version).option("--network <network>", "Override network (local, testnet, mainnet)").option("--api-key <key>", "API credential (overrides INSTANCE_TOKEN)").option("--api-url <url>", "API endpoint (overrides SL_API_URL)").showSuggestionAfterError(true).showHelpAfterError("(run `secondlayer --help` to see available commands)");
41665
+ program.name("secondlayer").alias("sl").description("Secondlayer CLI — run a Stacks index on your own hardware").version(version).option("--network <network>", "Override network (local, testnet, mainnet)").option("--api-key <key>", "Instance or archive credential (overrides INSTANCE_TOKEN)").option("--api-url <url>", "API endpoint (overrides SL_API_URL)").showSuggestionAfterError(true).showHelpAfterError("(run `secondlayer --help` to see available commands)");
41666
41666
  program.hook("preAction", (thisCommand) => {
41667
41667
  const { network, apiKey, apiUrl } = thisCommand.opts();
41668
41668
  if (network)
@@ -41718,5 +41718,5 @@ program.commandsGroup("Archive:");
41718
41718
  registerCreditsCommand(program);
41719
41719
  program.parse();
41720
41720
 
41721
- //# debugId=E4B3B7874FAC14F764756E2164756E21
41721
+ //# debugId=90E04792038F19D064756E2164756E21
41722
41722
  //# sourceMappingURL=cli.js.map