@lunarislab/state-sync 1.1.11 → 1.1.12

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/classes/Saver.js CHANGED
@@ -8,7 +8,7 @@ class Saver {
8
8
  this.dbID = config.dbID;
9
9
  this.onLog = config.onLog;
10
10
  this.getItemID = config.getItemID ? config.getItemID : (log) => log.address;
11
- this.db = new this.client.level(client.levelPath + `/${config.dbID}`.replace('//', "/"), { valueEncoding: "json" });
11
+ this.db = new this.client.level(`${client.levelPath}/${config.dbID}`.replace('//', "/"), { valueEncoding: "json" });
12
12
  }
13
13
  ;
14
14
  // save some env variables in the db
@@ -24,6 +24,7 @@ class Saver {
24
24
  }
25
25
  ;
26
26
  async init() {
27
+ await this.db.open();
27
28
  const env = await this.getEnv();
28
29
  this.lastBlockNum = env?.lastBlockNum ? BigInt(env.lastBlockNum) : 0n;
29
30
  await this._updateEnv();
@@ -32,6 +32,7 @@ class Watcher {
32
32
  event: (0, viem_1.parseAbiItem)(this.event),
33
33
  });
34
34
  logs.forEach(l => this.emitter.emit("logs", l));
35
+ block = block + gap > this.currentBlockNum ? this.currentBlockNum : block + gap;
35
36
  }
36
37
  catch (e) {
37
38
  const err = e;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "viem": "^2.21.58"
9
9
  },
10
10
  "name": "@lunarislab/state-sync",
11
- "version": "1.1.11",
11
+ "version": "1.1.12",
12
12
  "main": "index.js",
13
13
  "scripts": {
14
14
  "test": "ts-node ./test.ts",