@secondlayer/cli 8.6.4 → 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/README.md +7 -3
- package/dist/cli.js +97 -100
- package/dist/cli.js.map +7 -8
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -30,8 +30,11 @@ export SL_API_KEY=sk-sl_xxxxxxxx
|
|
|
30
30
|
source (and exits non-zero when not logged in). The global `--api-key` /
|
|
31
31
|
`--api-url` flags (and `SL_API_KEY` / `SL_API_URL`) apply to every command.
|
|
32
32
|
|
|
33
|
-
During open beta, reads are public (no key needed)
|
|
34
|
-
|
|
33
|
+
During open beta, reads are public (no key needed) — for subgraphs that means
|
|
34
|
+
**public** subgraphs only (managed deploys default public; BYO deploys and all
|
|
35
|
+
pre-existing subgraphs are private, readable with your key). Writes — deploying,
|
|
36
|
+
publishing, or managing subgraphs and subscriptions — require a session or an
|
|
37
|
+
`sk-sl_` key.
|
|
35
38
|
|
|
36
39
|
## Quickstart
|
|
37
40
|
|
|
@@ -86,7 +89,8 @@ scoped reads and cannot mint (403). Minted keys inherit your plan's tier.
|
|
|
86
89
|
|---|---|
|
|
87
90
|
| `sl subgraphs create <name>` | Scaffold a definition file |
|
|
88
91
|
| `sl subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a subgraph from a deployed contract |
|
|
89
|
-
| `sl subgraphs deploy <file> [--start-block <n>]` | Deploy; `--start-block` overrides the definition |
|
|
92
|
+
| `sl subgraphs deploy <file> [--start-block <n>] [--visibility public\|private]` | Deploy; `--start-block` overrides the definition. Managed deploys default `public`, BYO default `private` |
|
|
93
|
+
| `sl subgraphs publish <name>` / `unpublish <name>` | Flip visibility; publish claims the global public name (409 `PUBLIC_NAME_TAKEN` if claimed) |
|
|
90
94
|
| `sl subgraphs dev <file>` | Watch + hot-redeploy |
|
|
91
95
|
| `sl subgraphs query <name> <table>` | Query a table with filters, sort, pagination |
|
|
92
96
|
| `sl subgraphs list` / `status <name>` / `gaps <name>` | Inspect deployments |
|
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.
|
|
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.
|
|
31866
|
-
"@secondlayer/stacks": "^2.
|
|
31867
|
-
"@secondlayer/subgraphs": "^3.
|
|
31864
|
+
"@secondlayer/sdk": "^6.21.0",
|
|
31865
|
+
"@secondlayer/shared": "^6.30.0",
|
|
31866
|
+
"@secondlayer/stacks": "^2.5.0",
|
|
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",
|
|
@@ -32026,6 +32026,12 @@ async function deleteSubgraphApi(name, options) {
|
|
|
32026
32026
|
async function deploySubgraphApi(data) {
|
|
32027
32027
|
return (await getPlatformClient()).subgraphs.deploy(data);
|
|
32028
32028
|
}
|
|
32029
|
+
async function publishSubgraphApi(name) {
|
|
32030
|
+
return (await getPlatformClient()).subgraphs.publish(name);
|
|
32031
|
+
}
|
|
32032
|
+
async function unpublishSubgraphApi(name) {
|
|
32033
|
+
return (await getPlatformClient()).subgraphs.unpublish(name);
|
|
32034
|
+
}
|
|
32029
32035
|
async function querySubgraphTable(name, table, params = {}) {
|
|
32030
32036
|
return (await getPlatformClient()).subgraphs.queryTable(name, table, params);
|
|
32031
32037
|
}
|
|
@@ -34595,8 +34601,8 @@ function sip010Balances(name) {
|
|
|
34595
34601
|
* source filter.
|
|
34596
34602
|
*
|
|
34597
34603
|
* Query examples once deployed:
|
|
34598
|
-
* GET /
|
|
34599
|
-
* GET /
|
|
34604
|
+
* GET /v1/subgraphs/${name}/balances?_search=SP1...
|
|
34605
|
+
* GET /v1/subgraphs/${name}/balances?holder=SP1...
|
|
34600
34606
|
*/
|
|
34601
34607
|
export default defineSubgraph({
|
|
34602
34608
|
name: "${name}",
|
|
@@ -34666,14 +34672,13 @@ function sbtcFlows(name) {
|
|
|
34666
34672
|
|
|
34667
34673
|
/**
|
|
34668
34674
|
* Track sBTC protocol flows: deposits, withdrawals, signer rotations,
|
|
34669
|
-
* governance updates
|
|
34670
|
-
* \`/v1/datasets/sbtc/events\` surface but in your own subgraph.
|
|
34675
|
+
* governance updates — your own indexed view of the sbtc-registry contract.
|
|
34671
34676
|
*
|
|
34672
34677
|
* Source contract: sbtc-registry (mainnet).
|
|
34673
34678
|
*
|
|
34674
34679
|
* Query examples once deployed:
|
|
34675
|
-
* GET /
|
|
34676
|
-
* GET /
|
|
34680
|
+
* GET /v1/subgraphs/${name}/flows?topic=completed-deposit
|
|
34681
|
+
* GET /v1/subgraphs/${name}/flows?topic=withdrawal-create
|
|
34677
34682
|
*/
|
|
34678
34683
|
export default defineSubgraph({
|
|
34679
34684
|
name: "${name}",
|
|
@@ -34734,17 +34739,14 @@ function poxStacking(name) {
|
|
|
34734
34739
|
|
|
34735
34740
|
/**
|
|
34736
34741
|
* Track Stacking lifecycle calls on PoX-4 — solo stacking, delegation,
|
|
34737
|
-
* extension, increase, aggregation, signer-key authorizations.
|
|
34738
|
-
* the shape of the Foundation Datasets \`/v1/datasets/pox-4/calls\`
|
|
34739
|
-
* surface as your own subgraph.
|
|
34742
|
+
* extension, increase, aggregation, signer-key authorizations.
|
|
34740
34743
|
*
|
|
34741
34744
|
* Note: PoX-4 emits zero print events; this subgraph captures contract
|
|
34742
|
-
* calls. Decoding function args + raw_result is left to your handler
|
|
34743
|
-
* the dataset shows one possible shape.
|
|
34745
|
+
* calls. Decoding function args + raw_result is left to your handler.
|
|
34744
34746
|
*
|
|
34745
34747
|
* Query examples once deployed:
|
|
34746
|
-
* GET /
|
|
34747
|
-
* GET /
|
|
34748
|
+
* GET /v1/subgraphs/${name}/calls?function_name=stack-stx
|
|
34749
|
+
* GET /v1/subgraphs/${name}/calls?caller=SP1...
|
|
34748
34750
|
*/
|
|
34749
34751
|
export default defineSubgraph({
|
|
34750
34752
|
name: "${name}",
|
|
@@ -34788,14 +34790,13 @@ function bnsNames(name) {
|
|
|
34788
34790
|
|
|
34789
34791
|
/**
|
|
34790
34792
|
* Track BNS-V2 name lifecycle events — registrations, transfers,
|
|
34791
|
-
* renewals, burns, airdrops.
|
|
34792
|
-
* \`/v1/datasets/bns/name-events\` surface as your own subgraph.
|
|
34793
|
+
* renewals, burns, airdrops.
|
|
34793
34794
|
*
|
|
34794
34795
|
* Source: BNS-V2 print events (topic-discriminated payloads).
|
|
34795
34796
|
*
|
|
34796
34797
|
* Query examples once deployed:
|
|
34797
|
-
* GET /
|
|
34798
|
-
* GET /
|
|
34798
|
+
* GET /v1/subgraphs/${name}/names?owner=SP1...
|
|
34799
|
+
* GET /v1/subgraphs/${name}/names?_search=alice
|
|
34799
34800
|
*/
|
|
34800
34801
|
export default defineSubgraph({
|
|
34801
34802
|
name: "${name}",
|
|
@@ -34907,6 +34908,13 @@ function parseStartBlockOption(value) {
|
|
|
34907
34908
|
}
|
|
34908
34909
|
return parsed;
|
|
34909
34910
|
}
|
|
34911
|
+
function parseVisibilityOption(value) {
|
|
34912
|
+
if (value === undefined)
|
|
34913
|
+
return;
|
|
34914
|
+
if (value === "public" || value === "private")
|
|
34915
|
+
return value;
|
|
34916
|
+
throw new Error('--visibility must be "public" or "private"');
|
|
34917
|
+
}
|
|
34910
34918
|
function parseSubgraphSpecFormat(value) {
|
|
34911
34919
|
const format = value ?? "openapi";
|
|
34912
34920
|
if (format === "openapi" || format === "agent" || format === "markdown") {
|
|
@@ -35266,7 +35274,7 @@ Stopped watching.`);
|
|
|
35266
35274
|
});
|
|
35267
35275
|
await new Promise(() => {});
|
|
35268
35276
|
});
|
|
35269
|
-
subgraphs.command("deploy <file>").alias("update").description("Deploy a subgraph definition file (alias: update — deploy is create-or-update)").option("--start-block <n>", "Override the subgraph definition startBlock for this deploy").option("--dry-run", "Validate and preview deploy without writing changes").option("-y, --yes", "Skip the reindex confirmation prompt").option("--database-url <url>", "BYO data plane: write the subgraph's schema/rows to your own Postgres. With --dry-run, prints the DDL + grant script and verifies the connection.").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").action(async (file, options2) => {
|
|
35277
|
+
subgraphs.command("deploy <file>").alias("update").description("Deploy a subgraph definition file (alias: update — deploy is create-or-update)").option("--start-block <n>", "Override the subgraph definition startBlock for this deploy").option("--dry-run", "Validate and preview deploy without writing changes").option("-y, --yes", "Skip the reindex confirmation prompt").option("--database-url <url>", "BYO data plane: write the subgraph's schema/rows to your own Postgres. With --dry-run, prints the DDL + grant script and verifies the connection.").option("--strict", "Run `tsc --noEmit` against the handler before deploy (slower; catches TS type errors)").option("--visibility <visibility>", "Read visibility: public (anon /v1 reads, global name claim) or private (your key only). Defaults: managed → public, BYO → private.").action(async (file, options2) => {
|
|
35270
35278
|
try {
|
|
35271
35279
|
const absPath = resolve2(file);
|
|
35272
35280
|
const config = await loadConfig();
|
|
@@ -35274,6 +35282,16 @@ Stopped watching.`);
|
|
|
35274
35282
|
await requireAuth();
|
|
35275
35283
|
}
|
|
35276
35284
|
const dryRun = options2.dryRun;
|
|
35285
|
+
const visibility = parseVisibilityOption(options2.visibility);
|
|
35286
|
+
if (visibility === "public" && options2.databaseUrl && !options2.yes) {
|
|
35287
|
+
const confirmed = await confirm3({
|
|
35288
|
+
message: "⚠ Public BYO subgraph: anonymous reads will query YOUR database. Continue?"
|
|
35289
|
+
});
|
|
35290
|
+
if (!confirmed) {
|
|
35291
|
+
info("Aborted.");
|
|
35292
|
+
process.exit(0);
|
|
35293
|
+
}
|
|
35294
|
+
}
|
|
35277
35295
|
const startBlock = parseStartBlockOption(options2.startBlock);
|
|
35278
35296
|
if (startBlock !== undefined) {
|
|
35279
35297
|
warn(`--start-block ${startBlock} overrides the definition's startBlock for this deploy.`);
|
|
@@ -35321,16 +35339,25 @@ Stopped watching.`);
|
|
|
35321
35339
|
handlerCode,
|
|
35322
35340
|
sourceCode: source,
|
|
35323
35341
|
...deployStartBlock !== undefined ? { startBlock: deployStartBlock } : {},
|
|
35324
|
-
...options2.databaseUrl ? { databaseUrl: options2.databaseUrl } : {}
|
|
35342
|
+
...options2.databaseUrl ? { databaseUrl: options2.databaseUrl } : {},
|
|
35343
|
+
...visibility ? { visibility } : {}
|
|
35325
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
|
+
}
|
|
35326
35348
|
const printDeployFooter = async () => {
|
|
35327
35349
|
try {
|
|
35328
35350
|
const { apiUrl } = await resolveAuth();
|
|
35329
35351
|
const baseUrl = deriveBaseUrl(apiUrl);
|
|
35330
35352
|
const firstTable = Object.keys(effectiveDef.schema ?? {})[0];
|
|
35353
|
+
const isPublic = result.visibility === "public";
|
|
35331
35354
|
info(` Dashboard: ${baseUrl}/platform/subgraphs/${effectiveDef.name}`);
|
|
35332
|
-
if (firstTable) {
|
|
35355
|
+
if (isPublic && firstTable) {
|
|
35356
|
+
info(` Read: ${apiUrl}/v1/subgraphs/${effectiveDef.name}/${firstTable}`);
|
|
35357
|
+
info(` Share: ${apiUrl}/v1/subgraphs/${effectiveDef.name} (public — no key needed)`);
|
|
35358
|
+
} else if (firstTable) {
|
|
35333
35359
|
info(` REST: ${apiUrl}/api/subgraphs/${effectiveDef.name}/${firstTable}`);
|
|
35360
|
+
info(` Publish: sl subgraphs publish ${effectiveDef.name} (open anon /v1 reads)`);
|
|
35334
35361
|
}
|
|
35335
35362
|
info(` Watch: sl subgraphs status ${effectiveDef.name}`);
|
|
35336
35363
|
} catch {}
|
|
@@ -35795,6 +35822,33 @@ ${rows.length} row(s)`));
|
|
|
35795
35822
|
handleApiError(err, "delete subgraph");
|
|
35796
35823
|
}
|
|
35797
35824
|
});
|
|
35825
|
+
subgraphs.command("publish <name>").description("Make a subgraph publicly readable on /v1/subgraphs/<name> (claims the name globally, no key needed to read)").action(async (name) => {
|
|
35826
|
+
try {
|
|
35827
|
+
await requireAuth();
|
|
35828
|
+
const result = await publishSubgraphApi(name);
|
|
35829
|
+
success(`Subgraph "${name}" is now public`);
|
|
35830
|
+
try {
|
|
35831
|
+
const { apiUrl } = await resolveAuth();
|
|
35832
|
+
info(` Share: ${apiUrl}${result.url} (no key needed)`);
|
|
35833
|
+
} catch {}
|
|
35834
|
+
} catch (err) {
|
|
35835
|
+
const status2 = err?.status;
|
|
35836
|
+
if (status2 === 409) {
|
|
35837
|
+
error(`Public name "${name}" is already taken by another account. Rename the subgraph (redeploy under a new name) or keep it private.`);
|
|
35838
|
+
process.exit(1);
|
|
35839
|
+
}
|
|
35840
|
+
handleApiError(err, "publish subgraph");
|
|
35841
|
+
}
|
|
35842
|
+
});
|
|
35843
|
+
subgraphs.command("unpublish <name>").description("Make a subgraph private again — reads require your API key, the public name claim is released").action(async (name) => {
|
|
35844
|
+
try {
|
|
35845
|
+
await requireAuth();
|
|
35846
|
+
await unpublishSubgraphApi(name);
|
|
35847
|
+
success(`Subgraph "${name}" is now private (reads need your key)`);
|
|
35848
|
+
} catch (err) {
|
|
35849
|
+
handleApiError(err, "unpublish subgraph");
|
|
35850
|
+
}
|
|
35851
|
+
});
|
|
35798
35852
|
subgraphs.command("scaffold [contractAddress]").description("Scaffold a defineSubgraph() file from a contract or trait").option("-o, --output <path>", "Output file path (required)").option("-k, --api-key <key>", "Stacks node API key for direct RPC URLs").option("--functions <names>", "Comma-separated public functions to index as typed contract_call tables").option("--trait <std>", "Scaffold a trait-scoped source (sip-009|sip-010|sip-013) — no contract needed").option("--no-install", "Skip bun install after writing package.json").addHelpText("after", `
|
|
35799
35853
|
Examples:
|
|
35800
35854
|
$ sl subgraphs scaffold SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.megapont-ape-club-nft -o subgraphs/apes.ts
|
|
@@ -36098,72 +36152,16 @@ Examples:
|
|
|
36098
36152
|
}
|
|
36099
36153
|
});
|
|
36100
36154
|
}
|
|
36101
|
-
// src/commands/datasets.ts
|
|
36102
|
-
init_output();
|
|
36103
|
-
import { CURSOR_SLUGS, Datasets } from "@secondlayer/sdk";
|
|
36104
|
-
var DEFAULT_BASE_URL3 = "https://api.secondlayer.tools";
|
|
36105
|
-
function client2() {
|
|
36106
|
-
return new Datasets({ baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL3 });
|
|
36107
|
-
}
|
|
36108
|
-
function parseFilters(pairs) {
|
|
36109
|
-
const out = {};
|
|
36110
|
-
for (const pair of pairs ?? []) {
|
|
36111
|
-
const eq = pair.indexOf("=");
|
|
36112
|
-
if (eq <= 0) {
|
|
36113
|
-
throw new Error(`invalid --filter "${pair}" (expected key=value)`);
|
|
36114
|
-
}
|
|
36115
|
-
out[pair.slice(0, eq)] = pair.slice(eq + 1);
|
|
36116
|
-
}
|
|
36117
|
-
return out;
|
|
36118
|
-
}
|
|
36119
|
-
function registerDatasetsCommand(program2) {
|
|
36120
|
-
const datasets = program2.command("datasets").description("Query Foundation Datasets (sBTC, BNS, PoX-4, STX transfers)");
|
|
36121
|
-
datasets.command("list").description("List the dataset catalog + freshness").action(async () => {
|
|
36122
|
-
try {
|
|
36123
|
-
const catalog = await client2().listDatasets();
|
|
36124
|
-
writeData(JSON.stringify(catalog, null, 2));
|
|
36125
|
-
} catch (err) {
|
|
36126
|
-
error(`Failed to list datasets: ${err}`);
|
|
36127
|
-
process.exit(1);
|
|
36128
|
-
}
|
|
36129
|
-
});
|
|
36130
|
-
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", `
|
|
36131
|
-
Examples:
|
|
36132
|
-
$ sl datasets query stx-transfers --filter sender=SP2J6ZY... --limit 100
|
|
36133
|
-
$ sl datasets query sbtc-events --filter amount.gte=1000
|
|
36134
|
-
$ sl datasets query bns-events --cursor 150000:3 --json`).action(async (dataset, options2) => {
|
|
36135
|
-
try {
|
|
36136
|
-
const params = parseFilters(options2.filter);
|
|
36137
|
-
if (options2.limit)
|
|
36138
|
-
params.limit = Number.parseInt(options2.limit, 10);
|
|
36139
|
-
if (options2.cursor)
|
|
36140
|
-
params.cursor = options2.cursor;
|
|
36141
|
-
const env = await client2().query(dataset, params);
|
|
36142
|
-
output({
|
|
36143
|
-
json: options2.json,
|
|
36144
|
-
data: env,
|
|
36145
|
-
human: () => {
|
|
36146
|
-
writeData(JSON.stringify(env.rows, null, 2));
|
|
36147
|
-
if (env.next_cursor)
|
|
36148
|
-
note(`next_cursor: ${env.next_cursor}`);
|
|
36149
|
-
}
|
|
36150
|
-
});
|
|
36151
|
-
} catch (err) {
|
|
36152
|
-
error(`Failed to query dataset: ${err}`);
|
|
36153
|
-
process.exit(1);
|
|
36154
|
-
}
|
|
36155
|
-
});
|
|
36156
|
-
}
|
|
36157
36155
|
// src/commands/index-api.ts
|
|
36158
36156
|
init_output();
|
|
36159
36157
|
init_fs();
|
|
36160
36158
|
init_resolve_auth();
|
|
36161
36159
|
import { resolve as resolve3 } from "node:path";
|
|
36162
36160
|
import { Index } from "@secondlayer/sdk";
|
|
36163
|
-
var
|
|
36164
|
-
function
|
|
36161
|
+
var DEFAULT_BASE_URL3 = "https://api.secondlayer.tools";
|
|
36162
|
+
function client2() {
|
|
36165
36163
|
return new Index({
|
|
36166
|
-
baseUrl: process.env.SL_API_URL ??
|
|
36164
|
+
baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL3,
|
|
36167
36165
|
apiKey: resolveEnvKey()
|
|
36168
36166
|
});
|
|
36169
36167
|
}
|
|
@@ -36239,7 +36237,7 @@ function registerIndexCommand(program2) {
|
|
|
36239
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");
|
|
36240
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) => {
|
|
36241
36239
|
try {
|
|
36242
|
-
emit(await
|
|
36240
|
+
emit(await client2().ftTransfers.list({
|
|
36243
36241
|
...rangeParams(o),
|
|
36244
36242
|
sender: o.sender,
|
|
36245
36243
|
recipient: o.recipient
|
|
@@ -36250,7 +36248,7 @@ function registerIndexCommand(program2) {
|
|
|
36250
36248
|
});
|
|
36251
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) => {
|
|
36252
36250
|
try {
|
|
36253
|
-
emit(await
|
|
36251
|
+
emit(await client2().nftTransfers.list({
|
|
36254
36252
|
...rangeParams(o),
|
|
36255
36253
|
sender: o.sender,
|
|
36256
36254
|
recipient: o.recipient,
|
|
@@ -36262,7 +36260,7 @@ function registerIndexCommand(program2) {
|
|
|
36262
36260
|
});
|
|
36263
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) => {
|
|
36264
36262
|
try {
|
|
36265
|
-
emit(await
|
|
36263
|
+
emit(await client2().events.list({
|
|
36266
36264
|
eventType: o.eventType,
|
|
36267
36265
|
...rangeParams(o),
|
|
36268
36266
|
sender: o.sender,
|
|
@@ -36275,7 +36273,7 @@ function registerIndexCommand(program2) {
|
|
|
36275
36273
|
});
|
|
36276
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) => {
|
|
36277
36275
|
try {
|
|
36278
|
-
emit(await
|
|
36276
|
+
emit(await client2().contractCalls.list({
|
|
36279
36277
|
...rangeParams(o),
|
|
36280
36278
|
functionName: o.functionName,
|
|
36281
36279
|
sender: o.sender
|
|
@@ -36286,21 +36284,21 @@ function registerIndexCommand(program2) {
|
|
|
36286
36284
|
});
|
|
36287
36285
|
heightFlags(index.command("canonical")).description("List the canonical Stacks block sequence (height + hash)").action(async (o) => {
|
|
36288
36286
|
try {
|
|
36289
|
-
emit(await
|
|
36287
|
+
emit(await client2().canonical.list(heightParams(o)), o.json);
|
|
36290
36288
|
} catch (err) {
|
|
36291
36289
|
fail("list canonical blocks", err);
|
|
36292
36290
|
}
|
|
36293
36291
|
});
|
|
36294
36292
|
const blocks = heightFlags(index.command("blocks")).description("List decoded blocks (run `blocks get <ref>` for one block)").action(async (o) => {
|
|
36295
36293
|
try {
|
|
36296
|
-
emit(await
|
|
36294
|
+
emit(await client2().blocks.list(heightParams(o)), o.json);
|
|
36297
36295
|
} catch (err) {
|
|
36298
36296
|
fail("list blocks", err);
|
|
36299
36297
|
}
|
|
36300
36298
|
});
|
|
36301
36299
|
blocks.command("get <ref>").description("Get a single block by height or block hash").option("--json", "Print as JSON").action(async (ref, o) => {
|
|
36302
36300
|
try {
|
|
36303
|
-
const block = await
|
|
36301
|
+
const block = await client2().blocks.get(/^\d+$/.test(ref) ? Number.parseInt(ref, 10) : ref);
|
|
36304
36302
|
emitOne(block, `block ${ref}`, o.json);
|
|
36305
36303
|
} catch (err) {
|
|
36306
36304
|
fail("get block", err);
|
|
@@ -36308,7 +36306,7 @@ function registerIndexCommand(program2) {
|
|
|
36308
36306
|
});
|
|
36309
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) => {
|
|
36310
36308
|
try {
|
|
36311
|
-
emit(await
|
|
36309
|
+
emit(await client2().transactions.list({
|
|
36312
36310
|
...rangeParams(o),
|
|
36313
36311
|
type: o.type,
|
|
36314
36312
|
sender: o.sender
|
|
@@ -36319,14 +36317,14 @@ function registerIndexCommand(program2) {
|
|
|
36319
36317
|
});
|
|
36320
36318
|
transactions.command("get <txId>").description("Get a single transaction by tx_id").option("--json", "Print as JSON").action(async (txId, o) => {
|
|
36321
36319
|
try {
|
|
36322
|
-
emitOne(await
|
|
36320
|
+
emitOne(await client2().transactions.get(txId), `tx ${txId}`, o.json);
|
|
36323
36321
|
} catch (err) {
|
|
36324
36322
|
fail("get transaction", err);
|
|
36325
36323
|
}
|
|
36326
36324
|
});
|
|
36327
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) => {
|
|
36328
36326
|
try {
|
|
36329
|
-
emit(await
|
|
36327
|
+
emit(await client2().stacking.list({
|
|
36330
36328
|
...heightParams(o),
|
|
36331
36329
|
functionName: o.functionName,
|
|
36332
36330
|
stacker: o.stacker,
|
|
@@ -36338,7 +36336,7 @@ function registerIndexCommand(program2) {
|
|
|
36338
36336
|
});
|
|
36339
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) => {
|
|
36340
36338
|
try {
|
|
36341
|
-
emit(await
|
|
36339
|
+
emit(await client2().mempool.list({
|
|
36342
36340
|
contractId: o.contractId,
|
|
36343
36341
|
sender: o.sender,
|
|
36344
36342
|
type: o.type,
|
|
@@ -36351,7 +36349,7 @@ function registerIndexCommand(program2) {
|
|
|
36351
36349
|
});
|
|
36352
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) => {
|
|
36353
36351
|
try {
|
|
36354
|
-
emitOne(await
|
|
36352
|
+
emitOne(await client2().mempool.get(txId), `pending tx ${txId}`, o.json);
|
|
36355
36353
|
} catch (err) {
|
|
36356
36354
|
fail("get mempool tx", err);
|
|
36357
36355
|
}
|
|
@@ -36361,7 +36359,7 @@ function registerIndexCommand(program2) {
|
|
|
36361
36359
|
init_output();
|
|
36362
36360
|
init_resolve_auth();
|
|
36363
36361
|
import { SecondLayer as SecondLayer4 } from "@secondlayer/sdk";
|
|
36364
|
-
var
|
|
36362
|
+
var DEFAULT_BASE_URL4 = "https://api.secondlayer.tools";
|
|
36365
36363
|
function registerKeysCommand(program2) {
|
|
36366
36364
|
const keys = program2.command("keys").description("Manage API keys");
|
|
36367
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) => {
|
|
@@ -36376,7 +36374,7 @@ function registerKeysCommand(program2) {
|
|
|
36376
36374
|
}
|
|
36377
36375
|
try {
|
|
36378
36376
|
const sl = new SecondLayer4({
|
|
36379
|
-
baseUrl: process.env.SL_API_URL ??
|
|
36377
|
+
baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL4,
|
|
36380
36378
|
apiKey
|
|
36381
36379
|
});
|
|
36382
36380
|
const minted = await sl.apiKeys.create({
|
|
@@ -37888,7 +37886,6 @@ program.commandsGroup("Data products:");
|
|
|
37888
37886
|
registerSubgraphsCommand(program);
|
|
37889
37887
|
registerSubscriptionsCommand(program);
|
|
37890
37888
|
registerStreamsCommand(program);
|
|
37891
|
-
registerDatasetsCommand(program);
|
|
37892
37889
|
registerIndexCommand(program);
|
|
37893
37890
|
program.commandsGroup("Project & codegen:");
|
|
37894
37891
|
registerProjectCommand(program);
|
|
@@ -37916,5 +37913,5 @@ registerAccountCommand(program);
|
|
|
37916
37913
|
registerKeysCommand(program);
|
|
37917
37914
|
program.parse();
|
|
37918
37915
|
|
|
37919
|
-
//# debugId=
|
|
37916
|
+
//# debugId=C4DF51841ACD727C64756E2164756E21
|
|
37920
37917
|
//# sourceMappingURL=cli.js.map
|