@secondlayer/cli 5.4.5 → 5.4.7

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.5",
32324
+ version: "5.4.7",
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,21 @@ 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
+ if (!process.stdin.isTTY) {
33754
+ error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
33755
+ process.exit(1);
33756
+ }
33757
+ let ok = false;
33758
+ try {
33759
+ ok = await confirm({ message });
33760
+ } catch (promptErr) {
33761
+ const m = promptErr instanceof Error ? promptErr.message : String(promptErr);
33762
+ if (m.includes("ExitPromptError") || m.includes("force closed")) {
33763
+ error("Interactive prompt unavailable. Re-run with -y to skip confirmation.");
33764
+ process.exit(1);
33765
+ }
33766
+ throw promptErr;
33767
+ }
33754
33768
  if (!ok) {
33755
33769
  info("Cancelled");
33756
33770
  return false;
@@ -34862,6 +34876,10 @@ export default defineSubgraph({
34862
34876
  version: "1.0.0",
34863
34877
  description: "sBTC deposits, withdrawals, signer rotations, governance",
34864
34878
 
34879
+ // Skip pre-sBTC history. Raise this (e.g., to a recent block near tip) for
34880
+ // a smaller backfill, or lower it if you need every sBTC event from genesis.
34881
+ startBlock: 860000,
34882
+
34865
34883
  sources: {
34866
34884
  registry: {
34867
34885
  type: "print_event",
@@ -34884,18 +34902,19 @@ export default defineSubgraph({
34884
34902
 
34885
34903
  handlers: {
34886
34904
  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;
34905
+ // biome-ignore lint/suspicious/noExplicitAny: print event shape varies by topic
34906
+ const e = event as any;
34907
+ const topic = typeof e.topic === "string" ? e.topic : null;
34908
+ if (!topic) return;
34909
+ const data = (e.data ?? {}) as Record<string, unknown>;
34891
34910
 
34892
34911
  ctx.insert("flows", {
34893
34912
  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,
34913
+ request_id: data.requestId ?? null,
34914
+ amount: data.amount != null ? String(data.amount) : null,
34915
+ sender: (data.sender as string) ?? null,
34916
+ bitcoin_txid: (data.bitcoinTxid as string) ?? null,
34917
+ burn_height: data.burnHeight ?? null,
34899
34918
  });
34900
34919
  },
34901
34920
  },
@@ -34997,19 +35016,20 @@ export default defineSubgraph({
34997
35016
 
34998
35017
  handlers: {
34999
35018
  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);
35019
+ // biome-ignore lint/suspicious/noExplicitAny: print event shape
35020
+ const e = event as any;
35021
+ const topic = typeof e.topic === "string" ? e.topic : null;
35022
+ if (!topic) return;
35023
+ const data = (e.data ?? {}) as Record<string, unknown>;
35024
+ const namespace = decodeBuffUtf8(data.namespace);
35025
+ const nameLabel = decodeBuffUtf8(data.name);
35006
35026
  if (!namespace || !nameLabel) return;
35007
35027
  ctx.insert("names", {
35008
35028
  topic,
35009
35029
  namespace,
35010
35030
  name: nameLabel,
35011
35031
  fqn: \`\${nameLabel}.\${namespace}\`,
35012
- owner: topic === "burn-name" ? null : (payload.owner ?? null),
35032
+ owner: topic === "burn-name" ? null : ((data.owner as string) ?? null),
35013
35033
  });
35014
35034
  },
35015
35035
  },
@@ -35810,6 +35830,10 @@ ${rows.length} row(s)`));
35810
35830
  subgraphs.command("delete <name>").description("Delete a subgraph and its data").option("-y, --yes", "Skip confirmation").option("--force", "Cancel active operations and force delete").action(async (name, options2) => {
35811
35831
  try {
35812
35832
  if (!options2.yes && !options2.force) {
35833
+ if (!process.stdin.isTTY) {
35834
+ error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
35835
+ process.exit(1);
35836
+ }
35813
35837
  const { confirm: confirm4 } = await import("@inquirer/prompts");
35814
35838
  let ok = false;
35815
35839
  try {
@@ -35829,10 +35853,20 @@ ${rows.length} row(s)`));
35829
35853
  return;
35830
35854
  }
35831
35855
  }
35832
- const result = await deleteSubgraphApi(name, {
35833
- force: options2.force
35834
- });
35835
- success(result.message);
35856
+ try {
35857
+ const result = await deleteSubgraphApi(name, {
35858
+ force: options2.force
35859
+ });
35860
+ success(result.message);
35861
+ } catch (delErr) {
35862
+ const msg = delErr instanceof Error ? delErr.message : String(delErr);
35863
+ const status = delErr?.status;
35864
+ if (status === 404 || /not found/i.test(msg)) {
35865
+ info(`Subgraph "${name}" not found (already deleted?)`);
35866
+ return;
35867
+ }
35868
+ throw delErr;
35869
+ }
35836
35870
  } catch (err) {
35837
35871
  handleApiError(err, "delete subgraph");
35838
35872
  }
@@ -37101,5 +37135,5 @@ registerAccountCommand(program);
37101
37135
  registerBillingCommand(program);
37102
37136
  program.parse();
37103
37137
 
37104
- //# debugId=461B712EBC3F36FC64756E2164756E21
37138
+ //# debugId=3A9945EA76A81FFE64756E2164756E21
37105
37139
  //# sourceMappingURL=cli.js.map