@secondlayer/cli 5.4.4 → 5.4.6

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/dist/cli.js CHANGED
@@ -32321,7 +32321,7 @@ var {
32321
32321
  // package.json
32322
32322
  var package_default = {
32323
32323
  name: "@secondlayer/cli",
32324
- version: "5.4.4",
32324
+ version: "5.4.6",
32325
32325
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32326
32326
  type: "module",
32327
32327
  bin: {
@@ -32367,7 +32367,7 @@ var package_default = {
32367
32367
  "@secondlayer/sdk": "^3.6.0",
32368
32368
  "@secondlayer/shared": "^6.4.3",
32369
32369
  "@secondlayer/stacks": "^2.2.0",
32370
- "@secondlayer/subgraphs": "^2.0.3",
32370
+ "@secondlayer/subgraphs": "^2.0.8",
32371
32371
  "@biomejs/js-api": "^0.7.0",
32372
32372
  "@biomejs/wasm-nodejs": "^1.9.0",
32373
32373
  esbuild: "^0.19.0",
@@ -33750,7 +33750,17 @@ function printDead(rows) {
33750
33750
  async function confirmOrExit(message, yes) {
33751
33751
  if (yes)
33752
33752
  return true;
33753
- const ok = await confirm({ message });
33753
+ let ok = false;
33754
+ try {
33755
+ ok = await confirm({ message });
33756
+ } catch (promptErr) {
33757
+ const m = promptErr instanceof Error ? promptErr.message : String(promptErr);
33758
+ if (m.includes("ExitPromptError") || m.includes("force closed")) {
33759
+ error("Interactive prompt unavailable. Re-run with -y to skip confirmation.");
33760
+ process.exit(1);
33761
+ }
33762
+ throw promptErr;
33763
+ }
33754
33764
  if (!ok) {
33755
33765
  info("Cancelled");
33756
33766
  return false;
@@ -34862,6 +34872,10 @@ export default defineSubgraph({
34862
34872
  version: "1.0.0",
34863
34873
  description: "sBTC deposits, withdrawals, signer rotations, governance",
34864
34874
 
34875
+ // Skip pre-sBTC history. Raise this (e.g., to a recent block near tip) for
34876
+ // a smaller backfill, or lower it if you need every sBTC event from genesis.
34877
+ startBlock: 860000,
34878
+
34865
34879
  sources: {
34866
34880
  registry: {
34867
34881
  type: "print_event",
@@ -34884,18 +34898,19 @@ export default defineSubgraph({
34884
34898
 
34885
34899
  handlers: {
34886
34900
  registry: (event, ctx) => {
34887
- // biome-ignore lint/suspicious/noExplicitAny: print payload shape varies by topic
34888
- const payload = (event as any).payload ?? {};
34889
- const topic = payload.topic;
34890
- if (typeof topic !== "string") return;
34901
+ // biome-ignore lint/suspicious/noExplicitAny: print event shape varies by topic
34902
+ const e = event as any;
34903
+ const topic = typeof e.topic === "string" ? e.topic : null;
34904
+ if (!topic) return;
34905
+ const data = (e.data ?? {}) as Record<string, unknown>;
34891
34906
 
34892
34907
  ctx.insert("flows", {
34893
34908
  topic,
34894
- request_id: payload["request-id"] ?? null,
34895
- amount: payload.amount ? String(payload.amount) : null,
34896
- sender: payload.sender ?? null,
34897
- bitcoin_txid: payload["bitcoin-txid"] ?? null,
34898
- burn_height: payload["burn-height"] ?? null,
34909
+ request_id: data.requestId ?? null,
34910
+ amount: data.amount != null ? String(data.amount) : null,
34911
+ sender: (data.sender as string) ?? null,
34912
+ bitcoin_txid: (data.bitcoinTxid as string) ?? null,
34913
+ burn_height: data.burnHeight ?? null,
34899
34914
  });
34900
34915
  },
34901
34916
  },
@@ -34997,19 +35012,20 @@ export default defineSubgraph({
34997
35012
 
34998
35013
  handlers: {
34999
35014
  bns: (event, ctx) => {
35000
- // biome-ignore lint/suspicious/noExplicitAny: print payload shape
35001
- const payload = (event as any).payload ?? {};
35002
- const topic = payload.topic;
35003
- if (typeof topic !== "string") return;
35004
- const namespace = decodeBuffUtf8(payload.namespace);
35005
- const nameLabel = decodeBuffUtf8(payload.name);
35015
+ // biome-ignore lint/suspicious/noExplicitAny: print event shape
35016
+ const e = event as any;
35017
+ const topic = typeof e.topic === "string" ? e.topic : null;
35018
+ if (!topic) return;
35019
+ const data = (e.data ?? {}) as Record<string, unknown>;
35020
+ const namespace = decodeBuffUtf8(data.namespace);
35021
+ const nameLabel = decodeBuffUtf8(data.name);
35006
35022
  if (!namespace || !nameLabel) return;
35007
35023
  ctx.insert("names", {
35008
35024
  topic,
35009
35025
  namespace,
35010
35026
  name: nameLabel,
35011
35027
  fqn: \`\${nameLabel}.\${namespace}\`,
35012
- owner: topic === "burn-name" ? null : (payload.owner ?? null),
35028
+ owner: topic === "burn-name" ? null : ((data.owner as string) ?? null),
35013
35029
  });
35014
35030
  },
35015
35031
  },
@@ -35829,10 +35845,20 @@ ${rows.length} row(s)`));
35829
35845
  return;
35830
35846
  }
35831
35847
  }
35832
- const result = await deleteSubgraphApi(name, {
35833
- force: options2.force
35834
- });
35835
- success(result.message);
35848
+ try {
35849
+ const result = await deleteSubgraphApi(name, {
35850
+ force: options2.force
35851
+ });
35852
+ success(result.message);
35853
+ } catch (delErr) {
35854
+ const msg = delErr instanceof Error ? delErr.message : String(delErr);
35855
+ const status = delErr?.status;
35856
+ if (status === 404 || /not found/i.test(msg)) {
35857
+ info(`Subgraph "${name}" not found (already deleted?)`);
35858
+ return;
35859
+ }
35860
+ throw delErr;
35861
+ }
35836
35862
  } catch (err) {
35837
35863
  handleApiError(err, "delete subgraph");
35838
35864
  }
@@ -36975,8 +37001,13 @@ function registerProjectCommand(program2) {
36975
37001
  body: { name, slug }
36976
37002
  });
36977
37003
  success(`Created project ${res.name} (${res.slug})`);
36978
- const path2 = await writeActiveProject(res.slug, process.cwd());
36979
- info(dim(`Bound to this directory → ${path2}`));
37004
+ const config = await loadConfig();
37005
+ if (!config.defaultProject) {
37006
+ await saveConfig({ ...config, defaultProject: res.slug });
37007
+ info(dim("Set as your default project."));
37008
+ } else {
37009
+ info(dim(`To use this project, run: sl project use ${res.slug}`));
37010
+ }
36980
37011
  info(dim("Next: sl subgraphs deploy <file.ts>"));
36981
37012
  } catch (err) {
36982
37013
  handleProjectError(err);
@@ -37017,6 +37048,7 @@ function registerProjectCommand(program2) {
37017
37048
  const path2 = await writeActiveProject(slug, process.cwd());
37018
37049
  success(`Bound to project "${slug}"`);
37019
37050
  info(dim(`Written to ${path2}`));
37051
+ info(dim("Tip: add `.secondlayer/` to .gitignore — it's account-personal."));
37020
37052
  });
37021
37053
  project.command("current").description("Show the active project for this directory").action(async () => {
37022
37054
  const config = await loadConfig();
@@ -37095,5 +37127,5 @@ registerAccountCommand(program);
37095
37127
  registerBillingCommand(program);
37096
37128
  program.parse();
37097
37129
 
37098
- //# debugId=200225BF0391B2CF64756E2164756E21
37130
+ //# debugId=CB87EFABAE883E2964756E2164756E21
37099
37131
  //# sourceMappingURL=cli.js.map