@secondlayer/cli 8.7.0 → 8.8.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 CHANGED
@@ -104,7 +104,6 @@ scoped reads and cannot mint (403). Minted keys inherit your plan's tier.
104
104
 
105
105
  | Command | What it does |
106
106
  |---|---|
107
- | `sl datasets list` / `query <dataset> [--filter k=v] [--cursor] [--limit] [--json]` | Foundation Datasets (sBTC, BNS, PoX-4, STX transfers). Public — no key |
108
107
  | `sl index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded L2 layer. Anonymous reads OK; free-tier keys rejected (Build+ for keyed) |
109
108
  | `sl streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `pull` | Raw L1 event firehose. **Requires `SL_API_KEY`** |
110
109
 
@@ -136,16 +135,6 @@ trait — via the SDK, REST, or MCP with a `triggers` array. Every other
136
135
  `sl subscriptions` command (list/get/update/pause/resume/delete/doctor/test/
137
136
  deliveries/...) operates on both kinds.
138
137
 
139
- ### Local dev & OSS
140
-
141
- | Command | What it does |
142
- |---|---|
143
- | `sl local up [--devnet]` / `sl local down [--devnet]` | Start/stop the full local stack (Stacks node + dev services), or a Clarinet devnet |
144
- | `sl local start/stop/restart/status/logs` | Manage just the local dev services |
145
- | `sl local node setup/start/stop/...` | Manage the local Stacks node |
146
- | `sl local db blocks/txs/events/gaps/truncate/resync` | Inspect the local source DB |
147
- | `sl devnet connect/down/status/logs` | Clarinet devnet integration |
148
-
149
138
  ### Other
150
139
 
151
140
  | Command | What it does |
@@ -220,6 +209,17 @@ await token.write.transfer({ amount: 100n, recipient: "SP..." })
220
209
  const supply = await token.vars.totalSupply.get()
221
210
  ```
222
211
 
212
+ ## Frozen commands
213
+
214
+ Local-dev periphery: still functional, hidden from `sl --help`, no further
215
+ investment — may be removed in a future major. The hosted dev loop
216
+ (`sl subgraphs create/deploy`) is the supported path.
217
+
218
+ - `sl local up/down/start/stop/restart/status/logs` — local stack + dev services
219
+ - `sl local node ...` — local Stacks node management
220
+ - `sl local db ...` — local source DB inspection
221
+ - `sl devnet connect/down/status/logs` — Clarinet devnet integration
222
+
223
223
  ## Docs
224
224
 
225
225
  Full reference: https://secondlayer.tools/docs
package/dist/cli.js CHANGED
@@ -31811,7 +31811,7 @@ var {
31811
31811
  // package.json
31812
31812
  var package_default = {
31813
31813
  name: "@secondlayer/cli",
31814
- version: "8.7.0",
31814
+ version: "8.8.0",
31815
31815
  repository: {
31816
31816
  type: "git",
31817
31817
  url: "git+https://github.com/ryanwaits/secondlayer.git",
@@ -31861,10 +31861,10 @@ var package_default = {
31861
31861
  "@inquirer/prompts": "^8.2.0",
31862
31862
  "@secondlayer/bundler": "^0.3.7",
31863
31863
  "@secondlayer/scaffold": "^1.2.0",
31864
- "@secondlayer/sdk": "^6.20.0",
31865
- "@secondlayer/shared": "^6.29.0",
31866
- "@secondlayer/stacks": "^2.5.0",
31867
- "@secondlayer/subgraphs": "^3.10.0",
31864
+ "@secondlayer/sdk": "^6.21.1",
31865
+ "@secondlayer/shared": "^6.30.0",
31866
+ "@secondlayer/stacks": "^2.5.1",
31867
+ "@secondlayer/subgraphs": "^3.11.0",
31868
31868
  "@biomejs/js-api": "^0.7.0",
31869
31869
  "@biomejs/wasm-nodejs": "^1.9.0",
31870
31870
  esbuild: "^0.19.0",
@@ -33847,6 +33847,24 @@ stacks_node_events_observers = [${entry}]
33847
33847
  return { status: exists ? "added" : "created" };
33848
33848
  }
33849
33849
 
33850
+ // src/lib/frozen.ts
33851
+ function markFrozen(cmd) {
33852
+ let warned = false;
33853
+ const warn2 = () => {
33854
+ if (warned)
33855
+ return;
33856
+ warned = true;
33857
+ process.stderr.write(`⚠ \`sl ${cmd.name()}\` is frozen — no further investment; it may be removed in a future major. The hosted dev loop (sl subgraphs create/deploy) is the supported path.
33858
+ `);
33859
+ };
33860
+ cmd.hook("preAction", warn2);
33861
+ cmd.addHelpText("beforeAll", () => {
33862
+ warn2();
33863
+ return "";
33864
+ });
33865
+ return cmd;
33866
+ }
33867
+
33850
33868
  // src/commands/devnet.ts
33851
33869
  init_output();
33852
33870
  var COMPOSE_REL = join6(".secondlayer", "docker-compose.yml");
@@ -33877,7 +33895,7 @@ var SERVICES = [
33877
33895
  "migrate"
33878
33896
  ];
33879
33897
  function registerDevnetCommand(program2) {
33880
- const devnet = program2.command("devnet").description("Run Secondlayer services against a local Clarinet devnet");
33898
+ const devnet = markFrozen(program2.command("devnet", { hidden: true }).description("Run Secondlayer services against a local Clarinet devnet"));
33881
33899
  devnet.command("connect").description("Point your clarinet project's devnet at a local Secondlayer stack and start it").option("--project <dir>", "Clarinet project directory (defaults to the nearest Clarinet.toml)").option("--image-tag <tag>", "Published image tag to run", DEFAULT_IMAGE_TAG).option("--owner <owner>", "ghcr image owner (namespace) to pull from").option("--no-up", "Patch config + write compose without starting docker").action(async (options) => {
33882
33900
  await connect(options);
33883
33901
  });
@@ -34595,7 +34613,7 @@ function sip010Balances(name) {
34595
34613
 
34596
34614
  /**
34597
34615
  * Track SIP-010 token balances per (asset_identifier, holder).
34598
- * Mirrors the shape of the Foundation Datasets sBTC token-events
34616
+ * Mirrors the shape of the curated sBTC token-events view
34599
34617
  * surface — but works for ANY SIP-010 token. Constrain to a single
34600
34618
  * token by adding \`assetIdentifier: "SP...token::token-name"\` to each
34601
34619
  * source filter.
@@ -34672,8 +34690,7 @@ function sbtcFlows(name) {
34672
34690
 
34673
34691
  /**
34674
34692
  * Track sBTC protocol flows: deposits, withdrawals, signer rotations,
34675
- * governance updates. Mirrors the shape of the Foundation Datasets
34676
- * \`/v1/datasets/sbtc/events\` surface but in your own subgraph.
34693
+ * governance updates — your own indexed view of the sbtc-registry contract.
34677
34694
  *
34678
34695
  * Source contract: sbtc-registry (mainnet).
34679
34696
  *
@@ -34740,13 +34757,10 @@ function poxStacking(name) {
34740
34757
 
34741
34758
  /**
34742
34759
  * Track Stacking lifecycle calls on PoX-4 — solo stacking, delegation,
34743
- * extension, increase, aggregation, signer-key authorizations. Mirrors
34744
- * the shape of the Foundation Datasets \`/v1/datasets/pox-4/calls\`
34745
- * surface as your own subgraph.
34760
+ * extension, increase, aggregation, signer-key authorizations.
34746
34761
  *
34747
34762
  * Note: PoX-4 emits zero print events; this subgraph captures contract
34748
- * calls. Decoding function args + raw_result is left to your handler —
34749
- * the dataset shows one possible shape.
34763
+ * calls. Decoding function args + raw_result is left to your handler.
34750
34764
  *
34751
34765
  * Query examples once deployed:
34752
34766
  * GET /v1/subgraphs/${name}/calls?function_name=stack-stx
@@ -34794,8 +34808,7 @@ function bnsNames(name) {
34794
34808
 
34795
34809
  /**
34796
34810
  * Track BNS-V2 name lifecycle events — registrations, transfers,
34797
- * renewals, burns, airdrops. Mirrors the Foundation Datasets
34798
- * \`/v1/datasets/bns/name-events\` surface as your own subgraph.
34811
+ * renewals, burns, airdrops.
34799
34812
  *
34800
34813
  * Source: BNS-V2 print events (topic-discriminated payloads).
34801
34814
  *
@@ -35347,6 +35360,9 @@ Stopped watching.`);
35347
35360
  ...options2.databaseUrl ? { databaseUrl: options2.databaseUrl } : {},
35348
35361
  ...visibility ? { visibility } : {}
35349
35362
  });
35363
+ if (result.start_block_clamped) {
35364
+ info(` Free tier indexes forward from deploy (start block ${result.start_block}) — upgrade for genesis backfill.`);
35365
+ }
35350
35366
  const printDeployFooter = async () => {
35351
35367
  try {
35352
35368
  const { apiUrl } = await resolveAuth();
@@ -35362,6 +35378,9 @@ Stopped watching.`);
35362
35378
  info(` Publish: sl subgraphs publish ${effectiveDef.name} (open anon /v1 reads)`);
35363
35379
  }
35364
35380
  info(` Watch: sl subgraphs status ${effectiveDef.name}`);
35381
+ if (firstTable) {
35382
+ info(` Webhook: sl subscriptions create ${effectiveDef.name}-hook --subgraph ${effectiveDef.name} --table ${firstTable} --url <your-endpoint>`);
35383
+ }
35365
35384
  } catch {}
35366
35385
  };
35367
35386
  if (result.action === "unchanged") {
@@ -36154,72 +36173,16 @@ Examples:
36154
36173
  }
36155
36174
  });
36156
36175
  }
36157
- // src/commands/datasets.ts
36158
- init_output();
36159
- import { CURSOR_SLUGS, Datasets } from "@secondlayer/sdk";
36160
- var DEFAULT_BASE_URL3 = "https://api.secondlayer.tools";
36161
- function client2() {
36162
- return new Datasets({ baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL3 });
36163
- }
36164
- function parseFilters(pairs) {
36165
- const out = {};
36166
- for (const pair of pairs ?? []) {
36167
- const eq = pair.indexOf("=");
36168
- if (eq <= 0) {
36169
- throw new Error(`invalid --filter "${pair}" (expected key=value)`);
36170
- }
36171
- out[pair.slice(0, eq)] = pair.slice(eq + 1);
36172
- }
36173
- return out;
36174
- }
36175
- function registerDatasetsCommand(program2) {
36176
- const datasets = program2.command("datasets").description("Query Foundation Datasets (sBTC, BNS, PoX-4, STX transfers)");
36177
- datasets.command("list").description("List the dataset catalog + freshness").action(async () => {
36178
- try {
36179
- const catalog = await client2().listDatasets();
36180
- writeData(JSON.stringify(catalog, null, 2));
36181
- } catch (err) {
36182
- error(`Failed to list datasets: ${err}`);
36183
- process.exit(1);
36184
- }
36185
- });
36186
- datasets.command("query <dataset>").description(`Query a cursor-paginated dataset (${Object.keys(CURSOR_SLUGS).join(", ")})`).option("--filter <key=value...>", "Filter as key=value (e.g. --filter stacker=SP… --filter address=SP…)").option("--limit <n>", "Rows per page").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--json", "Print the full envelope as JSON").addHelpText("after", `
36187
- Examples:
36188
- $ sl datasets query stx-transfers --filter sender=SP2J6ZY... --limit 100
36189
- $ sl datasets query sbtc-events --filter amount.gte=1000
36190
- $ sl datasets query bns-events --cursor 150000:3 --json`).action(async (dataset, options2) => {
36191
- try {
36192
- const params = parseFilters(options2.filter);
36193
- if (options2.limit)
36194
- params.limit = Number.parseInt(options2.limit, 10);
36195
- if (options2.cursor)
36196
- params.cursor = options2.cursor;
36197
- const env = await client2().query(dataset, params);
36198
- output({
36199
- json: options2.json,
36200
- data: env,
36201
- human: () => {
36202
- writeData(JSON.stringify(env.rows, null, 2));
36203
- if (env.next_cursor)
36204
- note(`next_cursor: ${env.next_cursor}`);
36205
- }
36206
- });
36207
- } catch (err) {
36208
- error(`Failed to query dataset: ${err}`);
36209
- process.exit(1);
36210
- }
36211
- });
36212
- }
36213
36176
  // src/commands/index-api.ts
36214
36177
  init_output();
36215
36178
  init_fs();
36216
36179
  init_resolve_auth();
36217
36180
  import { resolve as resolve3 } from "node:path";
36218
36181
  import { Index } from "@secondlayer/sdk";
36219
- var DEFAULT_BASE_URL4 = "https://api.secondlayer.tools";
36220
- function client3() {
36182
+ var DEFAULT_BASE_URL3 = "https://api.secondlayer.tools";
36183
+ function client2() {
36221
36184
  return new Index({
36222
- baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL4,
36185
+ baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL3,
36223
36186
  apiKey: resolveEnvKey()
36224
36187
  });
36225
36188
  }
@@ -36295,7 +36258,7 @@ function registerIndexCommand(program2) {
36295
36258
  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");
36296
36259
  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 (o) => {
36297
36260
  try {
36298
- emit(await client3().ftTransfers.list({
36261
+ emit(await client2().ftTransfers.list({
36299
36262
  ...rangeParams(o),
36300
36263
  sender: o.sender,
36301
36264
  recipient: o.recipient
@@ -36306,7 +36269,7 @@ function registerIndexCommand(program2) {
36306
36269
  });
36307
36270
  rangeFlags(index.command("nft-transfers")).description("List decoded SIP-009 non-fungible-token transfers").option("--sender <principal>", "Filter by sender").option("--recipient <principal>", "Filter by recipient").option("--asset-identifier <id>", "Filter by asset identifier").action(async (o) => {
36308
36271
  try {
36309
- emit(await client3().nftTransfers.list({
36272
+ emit(await client2().nftTransfers.list({
36310
36273
  ...rangeParams(o),
36311
36274
  sender: o.sender,
36312
36275
  recipient: o.recipient,
@@ -36318,7 +36281,7 @@ function registerIndexCommand(program2) {
36318
36281
  });
36319
36282
  rangeFlags(index.command("events")).description("List decoded events by type (stx_*, ft/nft mint/burn, print, …)").requiredOption("--event-type <type>", "Decoded event type (required)").option("--sender <principal>", "Filter by sender").option("--recipient <principal>", "Filter by recipient").option("--asset-identifier <id>", "Filter by asset identifier").action(async (o) => {
36320
36283
  try {
36321
- emit(await client3().events.list({
36284
+ emit(await client2().events.list({
36322
36285
  eventType: o.eventType,
36323
36286
  ...rangeParams(o),
36324
36287
  sender: o.sender,
@@ -36331,7 +36294,7 @@ function registerIndexCommand(program2) {
36331
36294
  });
36332
36295
  rangeFlags(index.command("contract-calls")).description("List decoded contract calls (function, args, result)").option("--function-name <name>", "Filter by called function").option("--sender <principal>", "Filter by caller").action(async (o) => {
36333
36296
  try {
36334
- emit(await client3().contractCalls.list({
36297
+ emit(await client2().contractCalls.list({
36335
36298
  ...rangeParams(o),
36336
36299
  functionName: o.functionName,
36337
36300
  sender: o.sender
@@ -36342,21 +36305,21 @@ function registerIndexCommand(program2) {
36342
36305
  });
36343
36306
  heightFlags(index.command("canonical")).description("List the canonical Stacks block sequence (height + hash)").action(async (o) => {
36344
36307
  try {
36345
- emit(await client3().canonical.list(heightParams(o)), o.json);
36308
+ emit(await client2().canonical.list(heightParams(o)), o.json);
36346
36309
  } catch (err) {
36347
36310
  fail("list canonical blocks", err);
36348
36311
  }
36349
36312
  });
36350
36313
  const blocks = heightFlags(index.command("blocks")).description("List decoded blocks (run `blocks get <ref>` for one block)").action(async (o) => {
36351
36314
  try {
36352
- emit(await client3().blocks.list(heightParams(o)), o.json);
36315
+ emit(await client2().blocks.list(heightParams(o)), o.json);
36353
36316
  } catch (err) {
36354
36317
  fail("list blocks", err);
36355
36318
  }
36356
36319
  });
36357
36320
  blocks.command("get <ref>").description("Get a single block by height or block hash").option("--json", "Print as JSON").action(async (ref, o) => {
36358
36321
  try {
36359
- const block = await client3().blocks.get(/^\d+$/.test(ref) ? Number.parseInt(ref, 10) : ref);
36322
+ const block = await client2().blocks.get(/^\d+$/.test(ref) ? Number.parseInt(ref, 10) : ref);
36360
36323
  emitOne(block, `block ${ref}`, o.json);
36361
36324
  } catch (err) {
36362
36325
  fail("get block", err);
@@ -36364,7 +36327,7 @@ function registerIndexCommand(program2) {
36364
36327
  });
36365
36328
  const transactions = rangeFlags(index.command("transactions")).description("List decoded transactions (run `transactions get <txId>` for one)").option("--type <type>", "Filter by transaction type").option("--sender <principal>", "Filter by sender").action(async (o) => {
36366
36329
  try {
36367
- emit(await client3().transactions.list({
36330
+ emit(await client2().transactions.list({
36368
36331
  ...rangeParams(o),
36369
36332
  type: o.type,
36370
36333
  sender: o.sender
@@ -36375,14 +36338,14 @@ function registerIndexCommand(program2) {
36375
36338
  });
36376
36339
  transactions.command("get <txId>").description("Get a single transaction by tx_id").option("--json", "Print as JSON").action(async (txId, o) => {
36377
36340
  try {
36378
- emitOne(await client3().transactions.get(txId), `tx ${txId}`, o.json);
36341
+ emitOne(await client2().transactions.get(txId), `tx ${txId}`, o.json);
36379
36342
  } catch (err) {
36380
36343
  fail("get transaction", err);
36381
36344
  }
36382
36345
  });
36383
36346
  heightFlags(index.command("stacking")).description("List decoded PoX-4 stacking actions").option("--function-name <name>", "Filter by PoX function name").option("--stacker <principal>", "Filter by stacker").option("--caller <principal>", "Filter by caller").action(async (o) => {
36384
36347
  try {
36385
- emit(await client3().stacking.list({
36348
+ emit(await client2().stacking.list({
36386
36349
  ...heightParams(o),
36387
36350
  functionName: o.functionName,
36388
36351
  stacker: o.stacker,
@@ -36394,7 +36357,7 @@ function registerIndexCommand(program2) {
36394
36357
  });
36395
36358
  const mempool = index.command("mempool").description("List pending mempool transactions (run `mempool get <txId>` for one)").option("--contract-id <id>", "Filter to pending calls to a contract").option("--sender <principal>", "Filter by sender").option("--type <type>", "Filter by transaction type").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--limit <n>", "Rows per page").option("--json", "Print the full envelope as JSON").action(async (o) => {
36396
36359
  try {
36397
- emit(await client3().mempool.list({
36360
+ emit(await client2().mempool.list({
36398
36361
  contractId: o.contractId,
36399
36362
  sender: o.sender,
36400
36363
  type: o.type,
@@ -36407,7 +36370,7 @@ function registerIndexCommand(program2) {
36407
36370
  });
36408
36371
  mempool.command("get <txId>").description("Get a single pending transaction by tx_id (404 once mined)").option("--json", "Print as JSON").action(async (txId, o) => {
36409
36372
  try {
36410
- emitOne(await client3().mempool.get(txId), `pending tx ${txId}`, o.json);
36373
+ emitOne(await client2().mempool.get(txId), `pending tx ${txId}`, o.json);
36411
36374
  } catch (err) {
36412
36375
  fail("get mempool tx", err);
36413
36376
  }
@@ -36417,7 +36380,7 @@ function registerIndexCommand(program2) {
36417
36380
  init_output();
36418
36381
  init_resolve_auth();
36419
36382
  import { SecondLayer as SecondLayer4 } from "@secondlayer/sdk";
36420
- var DEFAULT_BASE_URL5 = "https://api.secondlayer.tools";
36383
+ var DEFAULT_BASE_URL4 = "https://api.secondlayer.tools";
36421
36384
  function registerKeysCommand(program2) {
36422
36385
  const keys = program2.command("keys").description("Manage API keys");
36423
36386
  keys.command("create").description("Mint a scoped streams/index read key (requires an account-level key)").option("--product <product>", "Key scope: streams or index", "streams").option("--name <name>", "Optional label for the key").option("--json", "Print the full response as JSON").action(async (o) => {
@@ -36432,7 +36395,7 @@ function registerKeysCommand(program2) {
36432
36395
  }
36433
36396
  try {
36434
36397
  const sl = new SecondLayer4({
36435
- baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL5,
36398
+ baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL4,
36436
36399
  apiKey
36437
36400
  });
36438
36401
  const minted = await sl.apiKeys.create({
@@ -37359,7 +37322,7 @@ async function stopStack(options2) {
37359
37322
  }
37360
37323
  }
37361
37324
  function registerLocalCommand(program2) {
37362
- const local = program2.command("local").description("Manage local development environment and Stacks node").hook("preAction", async (_thisCommand, actionCommand) => {
37325
+ const local = markFrozen(program2.command("local", { hidden: true }).description("Manage local development environment and Stacks node")).hook("preAction", async (_thisCommand, actionCommand) => {
37363
37326
  if (actionCommand.name() === "help")
37364
37327
  return;
37365
37328
  await requireLocalNetwork();
@@ -37944,7 +37907,6 @@ program.commandsGroup("Data products:");
37944
37907
  registerSubgraphsCommand(program);
37945
37908
  registerSubscriptionsCommand(program);
37946
37909
  registerStreamsCommand(program);
37947
- registerDatasetsCommand(program);
37948
37910
  registerIndexCommand(program);
37949
37911
  program.commandsGroup("Project & codegen:");
37950
37912
  registerProjectCommand(program);
@@ -37972,5 +37934,5 @@ registerAccountCommand(program);
37972
37934
  registerKeysCommand(program);
37973
37935
  program.parse();
37974
37936
 
37975
- //# debugId=5C2D0497F3EEA0AA64756E2164756E21
37937
+ //# debugId=B164F591CA98B53C64756E2164756E21
37976
37938
  //# sourceMappingURL=cli.js.map