@leofcoin/chain 1.4.76 → 1.4.77

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.
@@ -2003,6 +2003,7 @@ class State extends Contract {
2003
2003
  this.#blocks[index] = { hash, ...block.decoded };
2004
2004
  this.#blockHashMap.set(hash, index);
2005
2005
  globalThis.debug(`resolved block: ${hash} @${index} ${formatBytes(size)}`);
2006
+ globalThis.pubsub.publish('block-resolved', { hash, index });
2006
2007
  this.#lastResolved = this.#blocks[index];
2007
2008
  this.#lastResolvedTime = Date.now();
2008
2009
  }
@@ -2203,6 +2204,7 @@ class State extends Contract {
2203
2204
  }
2204
2205
  this.#blocks[block.index].loaded = true;
2205
2206
  globalThis.debug(`loaded block: ${block.hash} @${block.index}`);
2207
+ globalThis.pubsub.publish('block-loaded', { ...block });
2206
2208
  }
2207
2209
  }
2208
2210
  return true;
package/exports/chain.js CHANGED
@@ -629,6 +629,7 @@ class State extends Contract {
629
629
  this.#blocks[index] = { hash, ...block.decoded };
630
630
  this.#blockHashMap.set(hash, index);
631
631
  globalThis.debug(`resolved block: ${hash} @${index} ${formatBytes(size)}`);
632
+ globalThis.pubsub.publish('block-resolved', { hash, index });
632
633
  this.#lastResolved = this.#blocks[index];
633
634
  this.#lastResolvedTime = Date.now();
634
635
  }
@@ -829,6 +830,7 @@ class State extends Contract {
829
830
  }
830
831
  this.#blocks[block.index].loaded = true;
831
832
  globalThis.debug(`loaded block: ${block.hash} @${block.index}`);
833
+ globalThis.pubsub.publish('block-loaded', { ...block });
832
834
  }
833
835
  }
834
836
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.76",
3
+ "version": "1.4.77",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",