trac-msb 0.1.21 → 0.1.22

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.
@@ -1 +1 @@
1
- a5713131ba9b19ceb8154451e490a9bdb23a804a2f83f102b2ff0ea19e5db8d9
1
+ bcda78165dd38ca98045a6f4b0d19f2e1a465d83c7fc6ac052a64802ca163986
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-msb",
3
3
  "main": "msb.mjs",
4
- "version": "0.1.21",
4
+ "version": "0.1.22",
5
5
  "pear": {
6
6
  "name": "trac-msb",
7
7
  "type": "terminal"
package/src/index.js CHANGED
@@ -900,7 +900,14 @@ export class MainSettlementBus extends ReadyResource {
900
900
  console.log('Existing Stream established', pubKey);
901
901
  } else {
902
902
  _this.#validator_stream = _this.#dht_node.connect(b4a.from(pubKey, 'hex'));
903
- _this.#validator = pubKey;
903
+
904
+ _this.#validator_stream.on('open', () => {
905
+ if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey){
906
+ _this.#validator = pubKey;
907
+ console.log('Stream established', pubKey);
908
+ }
909
+ });
910
+
904
911
  _this.#validator_stream.on('close', () => {
905
912
  if(_this.#validator_stream !== null && b4a.toString(_this.#validator_stream.publicKey, 'hex') === pubKey){
906
913
  _this.#validator_stream = null;
@@ -6,7 +6,7 @@ export const EntryType = Object.freeze({
6
6
 
7
7
  export const OperationType = Object.freeze({
8
8
  ADD_ADMIN: 'addAdmin',
9
- APPEND_WHITELIST: 'AppendWhitelist',
9
+ APPEND_WHITELIST: 'appendWhitelist',
10
10
  ADD_WRITER: 'addWriter',
11
11
  REMOVE_WRITER: 'removeWriter',
12
12
  ADD_INDEXER: 'addIndexer',
@@ -3,12 +3,7 @@ import { OperationType } from './constants.js';
3
3
  import fileUtils from './fileUtils.js';
4
4
  import b4a from 'b4a';
5
5
  import Wallet from 'trac-wallet';
6
- // TODO: This class is trying to solve too many problems at once.
7
- // It is responsible for creating messages, verifying them, reading public keys from a file, etc.
8
- // It would be better to separate these concerns into different classes or modules.
9
- // For example, we could have a separate class for file operations, another for message creation, etc.
10
- // This would make the code more modular and easier to maintain.
11
- // It would also make it easier to create tests and mocks in the future.
6
+
12
7
  class MsgUtils {
13
8
 
14
9
  static createMessage(...args) {