@lunarislab/state-sync 1.1.15 → 1.1.16
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/Syncer.js +2 -1
- package/classes/Watcher.js +2 -2
- package/package.json +1 -1
package/classes/Syncer.js
CHANGED
@@ -24,7 +24,7 @@ class Syncer extends SimpleEmitter_1.SimpleEmitter {
|
|
24
24
|
;
|
25
25
|
async _commit() {
|
26
26
|
const date = Date.now();
|
27
|
-
// If the last push was less than
|
27
|
+
// If the last push was less than "commitInterval" ago, don't commit
|
28
28
|
if (this.lastPush > date - this.commitInterval)
|
29
29
|
return;
|
30
30
|
this.lastPush = date;
|
@@ -38,6 +38,7 @@ class Syncer extends SimpleEmitter_1.SimpleEmitter {
|
|
38
38
|
async start() {
|
39
39
|
await this.saver.init();
|
40
40
|
this.watcher.on('log', async (log) => {
|
41
|
+
this.emit('log', { log: log });
|
41
42
|
this.logs.push(log);
|
42
43
|
await this._commit();
|
43
44
|
});
|
package/classes/Watcher.js
CHANGED
@@ -31,7 +31,7 @@ class Watcher {
|
|
31
31
|
address: contracts,
|
32
32
|
event: (0, viem_1.parseAbiItem)(this.event),
|
33
33
|
});
|
34
|
-
logs.forEach(l => this.emitter.emit("
|
34
|
+
logs.forEach(l => this.emitter.emit("log", l));
|
35
35
|
block = block + gap > this.currentBlockNum ? this.currentBlockNum : block + gap;
|
36
36
|
}
|
37
37
|
catch (e) {
|
@@ -56,7 +56,7 @@ class Watcher {
|
|
56
56
|
address: this.contracts,
|
57
57
|
event: (0, viem_1.parseAbiItem)(this.event),
|
58
58
|
});
|
59
|
-
logs.forEach(l => this.emitter.emit("
|
59
|
+
logs.forEach(l => this.emitter.emit("log", l));
|
60
60
|
});
|
61
61
|
});
|
62
62
|
}
|