@secondlayer/cli 9.3.2 → 9.4.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 +45 -34
- package/dist/cli.js.map +6 -6
- package/package.json +5 -15
package/dist/cli.js
CHANGED
|
@@ -29095,27 +29095,41 @@ export default defineSubgraph({
|
|
|
29095
29095
|
}
|
|
29096
29096
|
function poxStacking(name) {
|
|
29097
29097
|
return `import { defineSubgraph } from "@secondlayer/subgraphs";
|
|
29098
|
+
import { POX5_ABI } from "@secondlayer/stacks/pox5";
|
|
29098
29099
|
|
|
29099
29100
|
/**
|
|
29100
|
-
* Track
|
|
29101
|
-
* extension, increase, aggregation, signer-key authorizations.
|
|
29101
|
+
* Track PoX-5 \`stake\` calls with their arguments already decoded.
|
|
29102
29102
|
*
|
|
29103
|
-
*
|
|
29104
|
-
*
|
|
29103
|
+
* pox-5 replaced pox-4 when Epoch 4.0 activated (Bitcoin block 960,230,
|
|
29104
|
+
* 2026-07-30). SIP-045 reshaped the API: stacking became bonds + staking, so
|
|
29105
|
+
* the entry point is \`stake\`, not \`stack-stx\`.
|
|
29106
|
+
*
|
|
29107
|
+
* The source pairs \`abi\` with \`functionName\`, which is what makes
|
|
29108
|
+
* \`event.input\` a typed, named argument set instead of positional
|
|
29109
|
+
* \`args[0] as bigint\`. Add one source per function you want to track.
|
|
29105
29110
|
*
|
|
29106
29111
|
* Query examples once deployed:
|
|
29107
|
-
* GET /v1/subgraphs/${name}/calls?
|
|
29112
|
+
* GET /v1/subgraphs/${name}/calls?caller=SP1...
|
|
29108
29113
|
* GET /v1/subgraphs/${name}/calls?caller=SP1...
|
|
29109
29114
|
*/
|
|
29110
29115
|
export default defineSubgraph({
|
|
29111
29116
|
name: "${name}",
|
|
29112
29117
|
version: "1.0.0",
|
|
29113
|
-
description: "PoX-
|
|
29118
|
+
description: "PoX-5 stake calls with decoded arguments",
|
|
29114
29119
|
|
|
29115
29120
|
sources: {
|
|
29116
29121
|
pox: {
|
|
29117
29122
|
type: "contract_call",
|
|
29118
|
-
|
|
29123
|
+
// pox-5 is the live PoX contract since Epoch 4.0 activated at Bitcoin
|
|
29124
|
+
// block 960,230 (2026-07-30). Stacking history before that is pox-4 —
|
|
29125
|
+
// point a second source at \`.pox-4\` if you need it.
|
|
29126
|
+
contractId: "SP000000000000000000002Q6VF78.pox-5",
|
|
29127
|
+
// \`abi\` + \`functionName\` together are what type \`event.input\`: the
|
|
29128
|
+
// arguments cannot be typed without knowing which function was called.
|
|
29129
|
+
// POX5_ABI ships \`as const\` in @secondlayer/stacks, so there is no
|
|
29130
|
+
// hand-copied ABI to drift. Add a source per function you care about.
|
|
29131
|
+
functionName: "stake",
|
|
29132
|
+
abi: POX5_ABI,
|
|
29119
29133
|
},
|
|
29120
29134
|
},
|
|
29121
29135
|
|
|
@@ -29124,6 +29138,8 @@ export default defineSubgraph({
|
|
|
29124
29138
|
columns: {
|
|
29125
29139
|
function_name: { type: "text", indexed: true, search: true },
|
|
29126
29140
|
caller: { type: "principal", indexed: true, search: true },
|
|
29141
|
+
amount_ustx: { type: "uint" },
|
|
29142
|
+
num_cycles: { type: "uint" },
|
|
29127
29143
|
result_ok: { type: "boolean" },
|
|
29128
29144
|
},
|
|
29129
29145
|
},
|
|
@@ -29131,12 +29147,14 @@ export default defineSubgraph({
|
|
|
29131
29147
|
|
|
29132
29148
|
handlers: {
|
|
29133
29149
|
pox: (event, ctx) => {
|
|
29134
|
-
//
|
|
29135
|
-
//
|
|
29150
|
+
// \`event.input\` is the decoded, named, typed argument set — no
|
|
29151
|
+
// \`args[0] as bigint\`. Hover \`amountUstx\` and it is a bigint.
|
|
29136
29152
|
const resultHex = event.resultHex ?? "";
|
|
29137
29153
|
ctx.insert("calls", {
|
|
29138
29154
|
function_name: event.functionName || ctx.tx.functionName || "",
|
|
29139
29155
|
caller: ctx.tx.sender,
|
|
29156
|
+
amount_ustx: event.input.amountUstx,
|
|
29157
|
+
num_cycles: event.input.numCycles,
|
|
29140
29158
|
result_ok: resultHex.startsWith("0x07"), // 0x07 = response-ok type tag
|
|
29141
29159
|
});
|
|
29142
29160
|
},
|
|
@@ -29249,7 +29267,10 @@ function deriveBaseUrl(apiUrl) {
|
|
|
29249
29267
|
// src/commands/subgraph-test.ts
|
|
29250
29268
|
var exports_subgraph_test = {};
|
|
29251
29269
|
__export(exports_subgraph_test, {
|
|
29252
|
-
runSubgraphTest: () => runSubgraphTest
|
|
29270
|
+
runSubgraphTest: () => runSubgraphTest,
|
|
29271
|
+
loadCassette: () => loadCassette,
|
|
29272
|
+
filterHashOf: () => filterHashOf,
|
|
29273
|
+
DECODER_VERSION: () => DECODER_VERSION
|
|
29253
29274
|
});
|
|
29254
29275
|
import { createHash } from "node:crypto";
|
|
29255
29276
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -29262,11 +29283,11 @@ function filterHashOf(sources) {
|
|
|
29262
29283
|
const stable = JSON.stringify(Object.fromEntries(Object.entries(sources).sort(([a4], [b2]) => a4.localeCompare(b2))), (_k, v2) => typeof v2 === "bigint" ? `${v2}n` : v2);
|
|
29263
29284
|
return createHash("sha256").update(stable).digest("hex").slice(0, 16);
|
|
29264
29285
|
}
|
|
29265
|
-
function cassettePath(name) {
|
|
29266
|
-
return resolve2(
|
|
29286
|
+
function cassettePath(name, dir = CASSETTE_DIR) {
|
|
29287
|
+
return resolve2(dir, `${name}.json`);
|
|
29267
29288
|
}
|
|
29268
|
-
function loadCassette(name, filterHash) {
|
|
29269
|
-
const path11 = cassettePath(name);
|
|
29289
|
+
function loadCassette(name, filterHash, dir = CASSETTE_DIR) {
|
|
29290
|
+
const path11 = cassettePath(name, dir);
|
|
29270
29291
|
if (!existsSync2(path11))
|
|
29271
29292
|
return null;
|
|
29272
29293
|
let parsed;
|
|
@@ -30873,10 +30894,10 @@ function registerIndexCommand(program2) {
|
|
|
30873
30894
|
fail("list nft transfers", err);
|
|
30874
30895
|
}
|
|
30875
30896
|
});
|
|
30876
|
-
rangeFlags(index.command("events")).description("List decoded events by type (stx_*, ft/nft mint/burn, print, …)").
|
|
30897
|
+
rangeFlags(index.command("events")).description("List decoded events by type (stx_*, ft/nft mint/burn, print, …)").option("--event-type <type>", "Decoded event type").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 (o3) => {
|
|
30877
30898
|
try {
|
|
30878
30899
|
emit(await client().events.list({
|
|
30879
|
-
eventType: o3.eventType,
|
|
30900
|
+
eventType: o3.eventType ?? o3.types,
|
|
30880
30901
|
...rangeParams(o3),
|
|
30881
30902
|
sender: o3.sender,
|
|
30882
30903
|
recipient: o3.recipient,
|
|
@@ -34741,7 +34762,7 @@ var {
|
|
|
34741
34762
|
// package.json
|
|
34742
34763
|
var package_default = {
|
|
34743
34764
|
name: "@secondlayer/cli",
|
|
34744
|
-
version: "9.
|
|
34765
|
+
version: "9.4.0",
|
|
34745
34766
|
repository: {
|
|
34746
34767
|
type: "git",
|
|
34747
34768
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -34766,11 +34787,7 @@ var package_default = {
|
|
|
34766
34787
|
import: "./dist/plugins/index.js"
|
|
34767
34788
|
}
|
|
34768
34789
|
},
|
|
34769
|
-
files: [
|
|
34770
|
-
"dist",
|
|
34771
|
-
"templates",
|
|
34772
|
-
"README.md"
|
|
34773
|
-
],
|
|
34790
|
+
files: ["dist", "templates", "README.md"],
|
|
34774
34791
|
scripts: {
|
|
34775
34792
|
build: "bunup",
|
|
34776
34793
|
dev: "bunup --watch",
|
|
@@ -34778,22 +34795,16 @@ var package_default = {
|
|
|
34778
34795
|
typecheck: "tsc --noEmit",
|
|
34779
34796
|
prepublishOnly: "bun run build"
|
|
34780
34797
|
},
|
|
34781
|
-
keywords: [
|
|
34782
|
-
"stacks",
|
|
34783
|
-
"clarity",
|
|
34784
|
-
"blockchain",
|
|
34785
|
-
"smart-contracts",
|
|
34786
|
-
"cli"
|
|
34787
|
-
],
|
|
34798
|
+
keywords: ["stacks", "clarity", "blockchain", "smart-contracts", "cli"],
|
|
34788
34799
|
author: "",
|
|
34789
34800
|
license: "MIT",
|
|
34790
34801
|
dependencies: {
|
|
34791
34802
|
"@inquirer/prompts": "^8.2.0",
|
|
34792
34803
|
"@secondlayer/bundler": "^0.4.0",
|
|
34793
34804
|
"@secondlayer/scaffold": "^1.5.1",
|
|
34794
|
-
"@secondlayer/sdk": "^6.
|
|
34805
|
+
"@secondlayer/sdk": "^6.47.0",
|
|
34795
34806
|
"@secondlayer/shared": "^7.4.0",
|
|
34796
|
-
"@secondlayer/stacks": "^3.
|
|
34807
|
+
"@secondlayer/stacks": "^3.2.0",
|
|
34797
34808
|
"@secondlayer/subgraphs": "^3.23.1",
|
|
34798
34809
|
"@biomejs/js-api": "^0.7.0",
|
|
34799
34810
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
@@ -36972,7 +36983,7 @@ function registerStreamsCommand(program2) {
|
|
|
36972
36983
|
process.exit(1);
|
|
36973
36984
|
}
|
|
36974
36985
|
});
|
|
36975
|
-
const events = streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--limit <n>", "page size (1-1000, default 100)", "100").option("--json", "Output as JSON (streams always emits JSON)").addHelpText("after", `
|
|
36986
|
+
const events = streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--event-type <type>", "alias for a single-value --types (the Index spelling)").option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--limit <n>", "page size (1-1000, default 100)", "100").option("--json", "Output as JSON (streams always emits JSON)").addHelpText("after", `
|
|
36976
36987
|
Examples:
|
|
36977
36988
|
$ sl streams events --types stx_transfer,print --limit 50
|
|
36978
36989
|
$ sl streams events --not-types print --contract-id SP00....token,SP01....token
|
|
@@ -36980,7 +36991,7 @@ Examples:
|
|
|
36980
36991
|
$ sl streams events --cursor 150000:3`).action(async (options3) => {
|
|
36981
36992
|
try {
|
|
36982
36993
|
const envelope = await client2().events.list({
|
|
36983
|
-
types: parseTypes(options3.types),
|
|
36994
|
+
types: parseTypes(options3.types ?? options3.eventType),
|
|
36984
36995
|
notTypes: parseTypes(options3.notTypes, "--not-types"),
|
|
36985
36996
|
contractId: parseList(options3.contractId),
|
|
36986
36997
|
sender: parseList(options3.sender),
|
|
@@ -38621,5 +38632,5 @@ registerAccountCommand(program);
|
|
|
38621
38632
|
registerKeysCommand(program);
|
|
38622
38633
|
program.parse();
|
|
38623
38634
|
|
|
38624
|
-
//# debugId=
|
|
38635
|
+
//# debugId=7399D6CA5840E86964756E2164756E21
|
|
38625
38636
|
//# sourceMappingURL=cli.js.map
|