@secondlayer/cli 16.2.0 → 16.3.1

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
@@ -2288,6 +2288,24 @@ function resolveDataPlaneKey() {
2288
2288
  return resolveAccountKey();
2289
2289
  return resolveApiKey();
2290
2290
  }
2291
+ async function resolveHostedAuth() {
2292
+ if (isMerchantUrl()) {
2293
+ const accountKey = resolveAccountKey();
2294
+ if (accountKey) {
2295
+ return {
2296
+ apiUrl: resolveApiUrl(),
2297
+ ephemeralKey: accountKey,
2298
+ fromEnv: true
2299
+ };
2300
+ }
2301
+ }
2302
+ return resolveAuth();
2303
+ }
2304
+ function assertInstanceOrAccountKey(url = resolveApiUrl()) {
2305
+ if (resolveAccountKey())
2306
+ return;
2307
+ assertInstanceUrl(url);
2308
+ }
2291
2309
  var init_resolve_auth = __esm(() => {
2292
2310
  init_session();
2293
2311
  });
@@ -16232,7 +16250,25 @@ function parseContractId(contractId) {
16232
16250
  // src/plugins/clarinet/index.ts
16233
16251
  import { toCamelCase } from "@secondlayer/stacks/clarity";
16234
16252
  import { normalizeAbi as normalizeAbi2 } from "@secondlayer/stacks/clarity";
16235
- import { initSimnet } from "@stacks/clarinet-sdk";
16253
+ function isModuleNotFoundError(error, moduleName) {
16254
+ if (!(error instanceof Error))
16255
+ return false;
16256
+ const code = error.code;
16257
+ if (code !== "MODULE_NOT_FOUND" && code !== "ERR_MODULE_NOT_FOUND") {
16258
+ return false;
16259
+ }
16260
+ return error.message.includes(moduleName);
16261
+ }
16262
+ async function importClarinetSdk() {
16263
+ try {
16264
+ return await import("@stacks/clarinet-sdk");
16265
+ } catch (error) {
16266
+ if (isModuleNotFoundError(error, "@stacks/clarinet-sdk")) {
16267
+ throw new Error(CLARINET_SDK_INSTALL_HINT);
16268
+ }
16269
+ throw error;
16270
+ }
16271
+ }
16236
16272
  function sanitizeContractName(name) {
16237
16273
  return toCamelCase(name);
16238
16274
  }
@@ -16299,6 +16335,7 @@ function classifyContract(contractId, manifest) {
16299
16335
  async function loadClarinetContracts(options = {}) {
16300
16336
  const manifestPath = options.path || "./Clarinet.toml";
16301
16337
  try {
16338
+ const { initSimnet } = await importClarinetSdk();
16302
16339
  const simnet = await initSimnet(manifestPath);
16303
16340
  const contractInterfaces = simnet.getContractsInterfaces();
16304
16341
  const contracts = [];
@@ -16346,6 +16383,7 @@ async function hasClarinetProject(path = "./Clarinet.toml") {
16346
16383
  return false;
16347
16384
  }
16348
16385
  }
16386
+ var CLARINET_SDK_INSTALL_HINT = "This command needs @stacks/clarinet-sdk. Install it in your project: bun add -d @stacks/clarinet-sdk";
16349
16387
  var init_clarinet = () => {};
16350
16388
 
16351
16389
  // src/utils/config.ts
@@ -204294,7 +204332,7 @@ var {
204294
204332
  // package.json
204295
204333
  var package_default = {
204296
204334
  name: "@secondlayer/cli",
204297
- version: "16.2.0",
204335
+ version: "16.3.1",
204298
204336
  description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
204299
204337
  repository: {
204300
204338
  type: "git",
@@ -204329,7 +204367,7 @@ var package_default = {
204329
204367
  dependencies: {
204330
204368
  "@biomejs/js-api": "^0.7.0",
204331
204369
  "@biomejs/wasm-nodejs": "^1.9.0",
204332
- "@dsnp/parquetjs": "^1.8.8",
204370
+ "@dsnp/parquetjs": "~1.8.8",
204333
204371
  "@inquirer/prompts": "^8.2.0",
204334
204372
  "@opentui/core": "^0.5.3",
204335
204373
  "@opentui/react": "^0.5.3",
@@ -204338,7 +204376,7 @@ var package_default = {
204338
204376
  "@secondlayer/sdk": "^11.0.0",
204339
204377
  "@secondlayer/shared": "^11.8.1",
204340
204378
  "@secondlayer/stacks": "^6.1.0",
204341
- "@secondlayer/subgraphs": "^6.0.0",
204379
+ "@secondlayer/subgraphs": "^6.1.0",
204342
204380
  esbuild: "^0.28.2",
204343
204381
  react: "^19.1.0",
204344
204382
  "smol-toml": "^1.8.0",
@@ -206798,7 +206836,7 @@ async function createChainWebhook(name, opts) {
206798
206836
  secondlayer webhooks get ${name}`);
206799
206837
  }
206800
206838
  async function getWebhookClient() {
206801
- const { apiUrl, ephemeralKey } = await resolveAuth();
206839
+ const { apiUrl, ephemeralKey } = await resolveHostedAuth();
206802
206840
  return new SecondLayer4({ baseUrl: apiUrl, apiKey: ephemeralKey });
206803
206841
  }
206804
206842
  function addWebhookScaffold(parent, commandSpec, opts) {
@@ -207464,7 +207502,7 @@ POST result (client-side, not logged):`));
207464
207502
  }
207465
207503
  function registerWebhooksCommand(program) {
207466
207504
  const webhooks = program.command("webhooks").alias("hooks").description("Manage webhooks: a signed POST to a URL you run");
207467
- webhooks.hook("preAction", () => assertInstanceUrl());
207505
+ webhooks.hook("preAction", () => assertInstanceOrAccountKey());
207468
207506
  attachWebhookSubcommands(webhooks);
207469
207507
  }
207470
207508
  // src/commands/devnet.ts
@@ -209672,5 +209710,5 @@ registerCreditsCommand(program);
209672
209710
  registerArchiveCommand(program);
209673
209711
  program.parse();
209674
209712
 
209675
- //# debugId=8F597010AF7694DA64756E2164756E21
209713
+ //# debugId=29D0F1BFB142444864756E2164756E21
209676
209714
  //# sourceMappingURL=cli.js.map