@secondlayer/subgraphs 8.0.4 → 8.1.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/index.js CHANGED
@@ -681,7 +681,7 @@ import { createHash } from "node:crypto";
681
681
  // package.json
682
682
  var package_default = {
683
683
  name: "@secondlayer/subgraphs",
684
- version: "8.0.4",
684
+ version: "8.1.1",
685
685
  description: "Describe the Stacks data you want as one TypeScript file; it fills itself and survives reorgs.",
686
686
  license: "MIT",
687
687
  repository: {
@@ -737,7 +737,7 @@ var package_default = {
737
737
  prepublishOnly: "bun run build"
738
738
  },
739
739
  dependencies: {
740
- "@secondlayer/shared": "^15.0.2",
740
+ "@secondlayer/shared": "^15.3.1",
741
741
  "@secondlayer/stacks": "^6.5.4",
742
742
  "@secondlayer/verify": "^0.6.3",
743
743
  esbuild: "^0.28.2",
@@ -1992,6 +1992,7 @@ function generateIndexSchema(target, opts = {}) {
1992
1992
  }
1993
1993
  var INDEX_CODEGEN_TABLES = Object.keys(SOURCE_READ_TYPES);
1994
1994
  // src/schema/deployer.ts
1995
+ import { stacksNetworkFromEnv } from "@secondlayer/shared/db/queries/instance";
1995
1996
  import { sql } from "kysely";
1996
1997
  function toJsonSafe(obj) {
1997
1998
  return JSON.parse(JSON.stringify(obj, (_key, value) => typeof value === "bigint" ? value.toString() : value));
@@ -2093,7 +2094,7 @@ async function deploySchema(db, def, handlerPath, opts) {
2093
2094
  schemaHash: hash,
2094
2095
  handlerCode: opts.handlerCode,
2095
2096
  startBlock: def.startBlock,
2096
- network: opts.network ?? process.env.NETWORK ?? "mainnet"
2097
+ network: opts.network ?? stacksNetworkFromEnv()
2097
2098
  } : null;
2098
2099
  const pin = pinInput ? computePin(pinInput) : null;
2099
2100
  const preimage = pinInput ? pinPreimage(pinInput) : null;
@@ -2349,6 +2350,7 @@ function getDefault(type) {
2349
2350
  }
2350
2351
  // src/runtime/block-source.ts
2351
2352
  import { getSourceDb as getSourceDb2 } from "@secondlayer/shared/db";
2353
+ import { resolveChainTip } from "@secondlayer/shared/db/queries/integrity";
2352
2354
  import {
2353
2355
  BillingPausedError,
2354
2356
  createInternalIndexHttpClient
@@ -2775,8 +2777,7 @@ class PostgresBlockSource {
2775
2777
  this.feed = feed;
2776
2778
  }
2777
2779
  async getTip() {
2778
- const progress = await getSourceDb2().selectFrom("index_progress").selectAll().where("network", "=", process.env.NETWORK ?? "mainnet").executeTakeFirst();
2779
- return progress ? Number(progress.highest_seen_block) : 0;
2780
+ return await resolveChainTip(getSourceDb2(), "seen") ?? 0;
2780
2781
  }
2781
2782
  loadBlockRange(fromHeight, toHeight) {
2782
2783
  return loadBlockRange(getSourceDb2(), fromHeight, toHeight, {
@@ -3016,5 +3017,5 @@ export {
3016
3017
  validateSubgraphDefinition
3017
3018
  };
3018
3019
 
3019
- //# debugId=04236E6021C4C9A964756E2164756E21
3020
+ //# debugId=198DD7038C6BBA4D64756E2164756E21
3020
3021
  //# sourceMappingURL=index.js.map