@leofcoin/chain 1.4.76 → 1.4.78

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.
@@ -1952,6 +1952,7 @@ class State extends Contract {
1952
1952
  catch (error) {
1953
1953
  console.log({ e: error });
1954
1954
  }
1955
+ globalThis.pubsub.publish('lastBlock', this.lastBlock);
1955
1956
  // load local blocks
1956
1957
  await this.resolveBlocks();
1957
1958
  this.#machine = await new Machine(this.#blocks);
@@ -2003,6 +2004,7 @@ class State extends Contract {
2003
2004
  this.#blocks[index] = { hash, ...block.decoded };
2004
2005
  this.#blockHashMap.set(hash, index);
2005
2006
  globalThis.debug(`resolved block: ${hash} @${index} ${formatBytes(size)}`);
2007
+ globalThis.pubsub.publish('block-resolved', { hash, index });
2006
2008
  this.#lastResolved = this.#blocks[index];
2007
2009
  this.#lastResolvedTime = Date.now();
2008
2010
  }
@@ -2203,6 +2205,7 @@ class State extends Contract {
2203
2205
  }
2204
2206
  this.#blocks[block.index].loaded = true;
2205
2207
  globalThis.debug(`loaded block: ${block.hash} @${block.index}`);
2208
+ globalThis.pubsub.publish('block-loaded', { ...block });
2206
2209
  }
2207
2210
  }
2208
2211
  return true;
package/exports/chain.js CHANGED
@@ -578,6 +578,7 @@ class State extends Contract {
578
578
  catch (error) {
579
579
  console.log({ e: error });
580
580
  }
581
+ globalThis.pubsub.publish('lastBlock', this.lastBlock);
581
582
  // load local blocks
582
583
  await this.resolveBlocks();
583
584
  this.#machine = await new Machine(this.#blocks);
@@ -629,6 +630,7 @@ class State extends Contract {
629
630
  this.#blocks[index] = { hash, ...block.decoded };
630
631
  this.#blockHashMap.set(hash, index);
631
632
  globalThis.debug(`resolved block: ${hash} @${index} ${formatBytes(size)}`);
633
+ globalThis.pubsub.publish('block-resolved', { hash, index });
632
634
  this.#lastResolved = this.#blocks[index];
633
635
  this.#lastResolvedTime = Date.now();
634
636
  }
@@ -829,6 +831,7 @@ class State extends Contract {
829
831
  }
830
832
  this.#blocks[block.index].loaded = true;
831
833
  globalThis.debug(`loaded block: ${block.hash} @${block.index}`);
834
+ globalThis.pubsub.publish('block-loaded', { ...block });
832
835
  }
833
836
  }
834
837
  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.78",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",