@secondlayer/cli 8.7.0 → 8.7.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 +29 -88
- package/dist/cli.js.map +6 -7
- package/package.json +4 -4
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.
|
|
31814
|
+
version: "8.7.1",
|
|
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.
|
|
31865
|
-
"@secondlayer/shared": "^6.
|
|
31864
|
+
"@secondlayer/sdk": "^6.21.0",
|
|
31865
|
+
"@secondlayer/shared": "^6.30.0",
|
|
31866
31866
|
"@secondlayer/stacks": "^2.5.0",
|
|
31867
|
-
"@secondlayer/subgraphs": "^3.
|
|
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",
|
|
@@ -34672,8 +34672,7 @@ function sbtcFlows(name) {
|
|
|
34672
34672
|
|
|
34673
34673
|
/**
|
|
34674
34674
|
* Track sBTC protocol flows: deposits, withdrawals, signer rotations,
|
|
34675
|
-
* governance updates
|
|
34676
|
-
* \`/v1/datasets/sbtc/events\` surface but in your own subgraph.
|
|
34675
|
+
* governance updates — your own indexed view of the sbtc-registry contract.
|
|
34677
34676
|
*
|
|
34678
34677
|
* Source contract: sbtc-registry (mainnet).
|
|
34679
34678
|
*
|
|
@@ -34740,13 +34739,10 @@ function poxStacking(name) {
|
|
|
34740
34739
|
|
|
34741
34740
|
/**
|
|
34742
34741
|
* Track Stacking lifecycle calls on PoX-4 — solo stacking, delegation,
|
|
34743
|
-
* extension, increase, aggregation, signer-key authorizations.
|
|
34744
|
-
* the shape of the Foundation Datasets \`/v1/datasets/pox-4/calls\`
|
|
34745
|
-
* surface as your own subgraph.
|
|
34742
|
+
* extension, increase, aggregation, signer-key authorizations.
|
|
34746
34743
|
*
|
|
34747
34744
|
* 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.
|
|
34745
|
+
* calls. Decoding function args + raw_result is left to your handler.
|
|
34750
34746
|
*
|
|
34751
34747
|
* Query examples once deployed:
|
|
34752
34748
|
* GET /v1/subgraphs/${name}/calls?function_name=stack-stx
|
|
@@ -34794,8 +34790,7 @@ function bnsNames(name) {
|
|
|
34794
34790
|
|
|
34795
34791
|
/**
|
|
34796
34792
|
* Track BNS-V2 name lifecycle events — registrations, transfers,
|
|
34797
|
-
* renewals, burns, airdrops.
|
|
34798
|
-
* \`/v1/datasets/bns/name-events\` surface as your own subgraph.
|
|
34793
|
+
* renewals, burns, airdrops.
|
|
34799
34794
|
*
|
|
34800
34795
|
* Source: BNS-V2 print events (topic-discriminated payloads).
|
|
34801
34796
|
*
|
|
@@ -35347,6 +35342,9 @@ Stopped watching.`);
|
|
|
35347
35342
|
...options2.databaseUrl ? { databaseUrl: options2.databaseUrl } : {},
|
|
35348
35343
|
...visibility ? { visibility } : {}
|
|
35349
35344
|
});
|
|
35345
|
+
if (result.start_block_clamped) {
|
|
35346
|
+
info(` Free tier indexes forward from deploy (start block ${result.start_block}) — upgrade for genesis backfill.`);
|
|
35347
|
+
}
|
|
35350
35348
|
const printDeployFooter = async () => {
|
|
35351
35349
|
try {
|
|
35352
35350
|
const { apiUrl } = await resolveAuth();
|
|
@@ -36154,72 +36152,16 @@ Examples:
|
|
|
36154
36152
|
}
|
|
36155
36153
|
});
|
|
36156
36154
|
}
|
|
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
36155
|
// src/commands/index-api.ts
|
|
36214
36156
|
init_output();
|
|
36215
36157
|
init_fs();
|
|
36216
36158
|
init_resolve_auth();
|
|
36217
36159
|
import { resolve as resolve3 } from "node:path";
|
|
36218
36160
|
import { Index } from "@secondlayer/sdk";
|
|
36219
|
-
var
|
|
36220
|
-
function
|
|
36161
|
+
var DEFAULT_BASE_URL3 = "https://api.secondlayer.tools";
|
|
36162
|
+
function client2() {
|
|
36221
36163
|
return new Index({
|
|
36222
|
-
baseUrl: process.env.SL_API_URL ??
|
|
36164
|
+
baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL3,
|
|
36223
36165
|
apiKey: resolveEnvKey()
|
|
36224
36166
|
});
|
|
36225
36167
|
}
|
|
@@ -36295,7 +36237,7 @@ function registerIndexCommand(program2) {
|
|
|
36295
36237
|
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
36238
|
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
36239
|
try {
|
|
36298
|
-
emit(await
|
|
36240
|
+
emit(await client2().ftTransfers.list({
|
|
36299
36241
|
...rangeParams(o),
|
|
36300
36242
|
sender: o.sender,
|
|
36301
36243
|
recipient: o.recipient
|
|
@@ -36306,7 +36248,7 @@ function registerIndexCommand(program2) {
|
|
|
36306
36248
|
});
|
|
36307
36249
|
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
36250
|
try {
|
|
36309
|
-
emit(await
|
|
36251
|
+
emit(await client2().nftTransfers.list({
|
|
36310
36252
|
...rangeParams(o),
|
|
36311
36253
|
sender: o.sender,
|
|
36312
36254
|
recipient: o.recipient,
|
|
@@ -36318,7 +36260,7 @@ function registerIndexCommand(program2) {
|
|
|
36318
36260
|
});
|
|
36319
36261
|
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
36262
|
try {
|
|
36321
|
-
emit(await
|
|
36263
|
+
emit(await client2().events.list({
|
|
36322
36264
|
eventType: o.eventType,
|
|
36323
36265
|
...rangeParams(o),
|
|
36324
36266
|
sender: o.sender,
|
|
@@ -36331,7 +36273,7 @@ function registerIndexCommand(program2) {
|
|
|
36331
36273
|
});
|
|
36332
36274
|
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
36275
|
try {
|
|
36334
|
-
emit(await
|
|
36276
|
+
emit(await client2().contractCalls.list({
|
|
36335
36277
|
...rangeParams(o),
|
|
36336
36278
|
functionName: o.functionName,
|
|
36337
36279
|
sender: o.sender
|
|
@@ -36342,21 +36284,21 @@ function registerIndexCommand(program2) {
|
|
|
36342
36284
|
});
|
|
36343
36285
|
heightFlags(index.command("canonical")).description("List the canonical Stacks block sequence (height + hash)").action(async (o) => {
|
|
36344
36286
|
try {
|
|
36345
|
-
emit(await
|
|
36287
|
+
emit(await client2().canonical.list(heightParams(o)), o.json);
|
|
36346
36288
|
} catch (err) {
|
|
36347
36289
|
fail("list canonical blocks", err);
|
|
36348
36290
|
}
|
|
36349
36291
|
});
|
|
36350
36292
|
const blocks = heightFlags(index.command("blocks")).description("List decoded blocks (run `blocks get <ref>` for one block)").action(async (o) => {
|
|
36351
36293
|
try {
|
|
36352
|
-
emit(await
|
|
36294
|
+
emit(await client2().blocks.list(heightParams(o)), o.json);
|
|
36353
36295
|
} catch (err) {
|
|
36354
36296
|
fail("list blocks", err);
|
|
36355
36297
|
}
|
|
36356
36298
|
});
|
|
36357
36299
|
blocks.command("get <ref>").description("Get a single block by height or block hash").option("--json", "Print as JSON").action(async (ref, o) => {
|
|
36358
36300
|
try {
|
|
36359
|
-
const block = await
|
|
36301
|
+
const block = await client2().blocks.get(/^\d+$/.test(ref) ? Number.parseInt(ref, 10) : ref);
|
|
36360
36302
|
emitOne(block, `block ${ref}`, o.json);
|
|
36361
36303
|
} catch (err) {
|
|
36362
36304
|
fail("get block", err);
|
|
@@ -36364,7 +36306,7 @@ function registerIndexCommand(program2) {
|
|
|
36364
36306
|
});
|
|
36365
36307
|
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
36308
|
try {
|
|
36367
|
-
emit(await
|
|
36309
|
+
emit(await client2().transactions.list({
|
|
36368
36310
|
...rangeParams(o),
|
|
36369
36311
|
type: o.type,
|
|
36370
36312
|
sender: o.sender
|
|
@@ -36375,14 +36317,14 @@ function registerIndexCommand(program2) {
|
|
|
36375
36317
|
});
|
|
36376
36318
|
transactions.command("get <txId>").description("Get a single transaction by tx_id").option("--json", "Print as JSON").action(async (txId, o) => {
|
|
36377
36319
|
try {
|
|
36378
|
-
emitOne(await
|
|
36320
|
+
emitOne(await client2().transactions.get(txId), `tx ${txId}`, o.json);
|
|
36379
36321
|
} catch (err) {
|
|
36380
36322
|
fail("get transaction", err);
|
|
36381
36323
|
}
|
|
36382
36324
|
});
|
|
36383
36325
|
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
36326
|
try {
|
|
36385
|
-
emit(await
|
|
36327
|
+
emit(await client2().stacking.list({
|
|
36386
36328
|
...heightParams(o),
|
|
36387
36329
|
functionName: o.functionName,
|
|
36388
36330
|
stacker: o.stacker,
|
|
@@ -36394,7 +36336,7 @@ function registerIndexCommand(program2) {
|
|
|
36394
36336
|
});
|
|
36395
36337
|
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
36338
|
try {
|
|
36397
|
-
emit(await
|
|
36339
|
+
emit(await client2().mempool.list({
|
|
36398
36340
|
contractId: o.contractId,
|
|
36399
36341
|
sender: o.sender,
|
|
36400
36342
|
type: o.type,
|
|
@@ -36407,7 +36349,7 @@ function registerIndexCommand(program2) {
|
|
|
36407
36349
|
});
|
|
36408
36350
|
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
36351
|
try {
|
|
36410
|
-
emitOne(await
|
|
36352
|
+
emitOne(await client2().mempool.get(txId), `pending tx ${txId}`, o.json);
|
|
36411
36353
|
} catch (err) {
|
|
36412
36354
|
fail("get mempool tx", err);
|
|
36413
36355
|
}
|
|
@@ -36417,7 +36359,7 @@ function registerIndexCommand(program2) {
|
|
|
36417
36359
|
init_output();
|
|
36418
36360
|
init_resolve_auth();
|
|
36419
36361
|
import { SecondLayer as SecondLayer4 } from "@secondlayer/sdk";
|
|
36420
|
-
var
|
|
36362
|
+
var DEFAULT_BASE_URL4 = "https://api.secondlayer.tools";
|
|
36421
36363
|
function registerKeysCommand(program2) {
|
|
36422
36364
|
const keys = program2.command("keys").description("Manage API keys");
|
|
36423
36365
|
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 +36374,7 @@ function registerKeysCommand(program2) {
|
|
|
36432
36374
|
}
|
|
36433
36375
|
try {
|
|
36434
36376
|
const sl = new SecondLayer4({
|
|
36435
|
-
baseUrl: process.env.SL_API_URL ??
|
|
36377
|
+
baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL4,
|
|
36436
36378
|
apiKey
|
|
36437
36379
|
});
|
|
36438
36380
|
const minted = await sl.apiKeys.create({
|
|
@@ -37944,7 +37886,6 @@ program.commandsGroup("Data products:");
|
|
|
37944
37886
|
registerSubgraphsCommand(program);
|
|
37945
37887
|
registerSubscriptionsCommand(program);
|
|
37946
37888
|
registerStreamsCommand(program);
|
|
37947
|
-
registerDatasetsCommand(program);
|
|
37948
37889
|
registerIndexCommand(program);
|
|
37949
37890
|
program.commandsGroup("Project & codegen:");
|
|
37950
37891
|
registerProjectCommand(program);
|
|
@@ -37972,5 +37913,5 @@ registerAccountCommand(program);
|
|
|
37972
37913
|
registerKeysCommand(program);
|
|
37973
37914
|
program.parse();
|
|
37974
37915
|
|
|
37975
|
-
//# debugId=
|
|
37916
|
+
//# debugId=C4DF51841ACD727C64756E2164756E21
|
|
37976
37917
|
//# sourceMappingURL=cli.js.map
|