@secondlayer/cli 22.2.1 → 22.3.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/dist/cli.js CHANGED
@@ -2552,9 +2552,11 @@ var init_output = __esm(() => {
2552
2552
 
2553
2553
  // src/lib/api-client.ts
2554
2554
  import { ApiError, SecondLayer } from "@secondlayer/sdk";
2555
- function nextStepHint(status) {
2555
+ function nextStepHint(status, detail) {
2556
2556
  if (status === undefined)
2557
2557
  return;
2558
+ if (status === 402)
2559
+ return detail === "spend_cap_reached" ? `You reached your monthly spend cap. Raise it: ${CREDITS_URL}` : `Add credits to create webhooks and deploy subgraphs: ${CREDITS_URL}`;
2558
2560
  if (status === 403)
2559
2561
  return "You may not have access — check your active project with `secondlayer whoami`.";
2560
2562
  if (status === 404)
@@ -2591,7 +2593,9 @@ function handleApiError(err, action) {
2591
2593
  process.exit(1);
2592
2594
  }
2593
2595
  const detail = err instanceof Error ? err.message : String(err);
2594
- printError(`Failed to ${action}: ${detail}`, { hint: nextStepHint(status) });
2596
+ printError(`Failed to ${action}: ${detail}`, {
2597
+ hint: nextStepHint(status, detail)
2598
+ });
2595
2599
  process.exit(1);
2596
2600
  }
2597
2601
  function withErrorHandling(fn, options) {
@@ -2671,6 +2675,7 @@ async function getContractPrintSchema(contractId) {
2671
2675
  }
2672
2676
  return client.index.printSchema(contractId);
2673
2677
  }
2678
+ var CREDITS_URL = "https://www.secondlayer.tools/account/credits";
2674
2679
  var init_api_client = __esm(() => {
2675
2680
  init_http();
2676
2681
  init_output();
@@ -29488,7 +29493,7 @@ var init_git_status = () => {};
29488
29493
 
29489
29494
  // ../../node_modules/typescript/lib/typescript.js
29490
29495
  var require_typescript = __commonJS(function(exports, module) {
29491
- var __dirname = "/private/tmp/claude-501/-Users-ryan-projects-secondlayer/4f1ff871-fdfe-4888-bbdd-00bea3291e94/scratchpad/wt-check/node_modules/typescript/lib", __filename = "/private/tmp/claude-501/-Users-ryan-projects-secondlayer/4f1ff871-fdfe-4888-bbdd-00bea3291e94/scratchpad/wt-check/node_modules/typescript/lib/typescript.js";
29496
+ var __dirname = "/Users/ryan/projects/secondlayer/node_modules/typescript/lib", __filename = "/Users/ryan/projects/secondlayer/node_modules/typescript/lib/typescript.js";
29492
29497
  /*! *****************************************************************************
29493
29498
  Copyright (c) Microsoft Corporation. All rights reserved.
29494
29499
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -200330,7 +200335,9 @@ var init_subgraphs2 = __esm(() => {
200330
200335
 
200331
200336
  // src/commands/index-api.ts
200332
200337
  import { resolve as resolve6 } from "node:path";
200333
- import { Index as Index3 } from "@secondlayer/sdk";
200338
+ import {
200339
+ Index as Index3
200340
+ } from "@secondlayer/sdk";
200334
200341
  import {
200335
200342
  DECODED_EVENT_TYPES as DECODED_EVENT_TYPES3
200336
200343
  } from "@secondlayer/shared";
@@ -200372,6 +200379,14 @@ function parseRuneSort(value) {
200372
200379
  }
200373
200380
  return value;
200374
200381
  }
200382
+ function parseIndexOrder(value) {
200383
+ if (value === undefined)
200384
+ return;
200385
+ if (value !== "asc" && value !== "desc") {
200386
+ throw new Error(`invalid --order "${value}"; expected asc or desc`);
200387
+ }
200388
+ return value;
200389
+ }
200375
200390
  function parseRuneKinds(value) {
200376
200391
  if (value === undefined)
200377
200392
  return;
@@ -200429,10 +200444,12 @@ function registerIndexCommand(program) {
200429
200444
  const index = program.command("index").description("Query decoded Index data (events + contract calls)");
200430
200445
  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");
200431
200446
  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");
200432
- 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) => {
200447
+ const orderFlag = (cmd) => cmd.option("--order <asc|desc>", "asc (default) reads oldest first; desc reads newest first");
200448
+ orderFlag(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) => {
200433
200449
  try {
200434
200450
  emit(await client().ftTransfers.list({
200435
200451
  ...rangeParams(o),
200452
+ order: parseIndexOrder(o.order),
200436
200453
  sender: o.sender,
200437
200454
  recipient: o.recipient
200438
200455
  }), o.json);
@@ -200440,10 +200457,11 @@ function registerIndexCommand(program) {
200440
200457
  fail("list ft transfers", err);
200441
200458
  }
200442
200459
  });
200443
- 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) => {
200460
+ orderFlag(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) => {
200444
200461
  try {
200445
200462
  emit(await client().nftTransfers.list({
200446
200463
  ...rangeParams(o),
200464
+ order: parseIndexOrder(o.order),
200447
200465
  sender: o.sender,
200448
200466
  recipient: o.recipient,
200449
200467
  assetIdentifier: o.assetIdentifier
@@ -200452,11 +200470,12 @@ function registerIndexCommand(program) {
200452
200470
  fail("list nft transfers", err);
200453
200471
  }
200454
200472
  });
200455
- rangeFlags(index.command("events")).description("List decoded events by type (stx_*, ft/nft mint/burn, print, …)").option("--event-type <type>", `decoded event type (${VALID_INDEX_TYPES.join(", ")})`).option("--types <type>", "alias for --event-type, ONE value (the Streams spelling)").option("--sender <principal>", "Filter by sender").option("--recipient <principal>", "Filter by recipient").option("--asset-identifier <id>", "Filter by asset identifier").action(async (o) => {
200473
+ orderFlag(rangeFlags(index.command("events"))).description("List decoded events by type (stx_*, ft/nft mint/burn, print, …)").option("--event-type <type>", `decoded event type (${VALID_INDEX_TYPES.join(", ")})`).option("--types <type>", "alias for --event-type, ONE value (the Streams spelling)").option("--sender <principal>", "Filter by sender").option("--recipient <principal>", "Filter by recipient").option("--asset-identifier <id>", "Filter by asset identifier").action(async (o) => {
200456
200474
  try {
200457
200475
  emit(await client().events.list({
200458
200476
  eventType: parseIndexEventType(o.eventType, o.types),
200459
200477
  ...rangeParams(o),
200478
+ order: parseIndexOrder(o.order),
200460
200479
  sender: o.sender,
200461
200480
  recipient: o.recipient,
200462
200481
  assetIdentifier: o.assetIdentifier
@@ -202711,7 +202730,7 @@ var {
202711
202730
  // package.json
202712
202731
  var package_default = {
202713
202732
  name: "@secondlayer/cli",
202714
- version: "22.2.1",
202733
+ version: "22.3.0",
202715
202734
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
202716
202735
  repository: {
202717
202736
  type: "git",
@@ -202750,7 +202769,7 @@ var package_default = {
202750
202769
  "@inquirer/prompts": "^8.2.0",
202751
202770
  "@secondlayer/bundler": "^0.7.1",
202752
202771
  "@secondlayer/scaffold": "^1.6.2",
202753
- "@secondlayer/sdk": "^15.4.2",
202772
+ "@secondlayer/sdk": "^15.5.0",
202754
202773
  "@secondlayer/shared": "^14.0.0",
202755
202774
  "@secondlayer/stacks": "^6.5.1",
202756
202775
  "@secondlayer/subgraphs": "^7.7.1",
@@ -208927,5 +208946,5 @@ registerCreditsCommand(program);
208927
208946
  registerArchiveCommand(program);
208928
208947
  program.parse();
208929
208948
 
208930
- //# debugId=4A210BBAEC45C4F264756E2164756E21
208949
+ //# debugId=BC182F143EF2A01564756E2164756E21
208931
208950
  //# sourceMappingURL=cli.js.map