trac-msb 0.0.32 → 0.0.34

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.
Files changed (3) hide show
  1. package/msb.mjs +2 -1
  2. package/package.json +53 -6
  3. package/src/index.js +9 -6
package/msb.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import MainSettlementBus from './src/index.js';
2
+
2
3
  const opts = {
3
4
  stores_directory : 'stores/',
4
- store_name : process.argv[2],
5
+ store_name : typeof process !== "undefined" ? process.argv[2] : Pear.config.args[0],
5
6
  bootstrap: 'e442c6aadc8419c2439552ebecc79ffdc993dd816f9d2d6f562eef56e71ab9ba',
6
7
  channel: Buffer.alloc(32).fill('00bptracnetworkmainsettlementbus'),
7
8
  tx : Buffer.alloc(32).fill('bptracnetworkmainsettlementbustx')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trac-msb",
3
- "main": "src/index.js",
4
- "version": "0.0.32",
3
+ "main": "msb.mjs",
4
+ "version": "0.0.34",
5
5
  "pear": {
6
6
  "name": "trac-msb",
7
7
  "type": "terminal"
@@ -14,8 +14,7 @@
14
14
  "dependencies": {
15
15
  "autobase": "7.0.45",
16
16
  "b4a": "1.6.7",
17
- "bare-fs": "4.0.1",
18
- "bare-readline": "^1.0.7",
17
+ "bare": "^1.17.1",
19
18
  "brittle": "3.0.0",
20
19
  "corestore": "7.0.22",
21
20
  "debounceify": "1.1.0",
@@ -29,8 +28,56 @@
29
28
  "protomux-wakeup": "^2.2.1",
30
29
  "ready-resource": "^1.0.0",
31
30
  "safety-catch": "1.0.2",
32
- "trac-wallet": "^0.0.3",
33
- "xache": "1.2.0"
31
+ "trac-wallet": "^0.0.26",
32
+ "xache": "1.2.0",
33
+ "bare-assert": "^1.0.1",
34
+ "assert": "npm:bare-node-assert",
35
+ "bare-buffer": "^3.1.2",
36
+ "buffer": "npm:bare-node-buffer",
37
+ "bare-subprocess": "^2.0.4",
38
+ "child_process": "npm:bare-node-child-process",
39
+ "bare-console": "^4.1.0",
40
+ "console": "npm:bare-node-console",
41
+ "bare-crypto": "^1.0.0",
42
+ "crypto": "npm:bare-node-crypto",
43
+ "bare-events": "^2.2.0",
44
+ "events": "npm:bare-node-events",
45
+ "bare-fs": "^2.1.5",
46
+ "fs": "npm:bare-node-fs",
47
+ "bare-http1": "^2.0.3",
48
+ "http": "npm:bare-node-http",
49
+ "bare-https": "^1.0.0",
50
+ "https": "npm:bare-node-https",
51
+ "bare-inspector": "^1.1.2",
52
+ "inspector": "npm:bare-node-inspector",
53
+ "bare-module": "^1.2.5",
54
+ "module": "npm:bare-node-module",
55
+ "bare-os": "^2.2.0",
56
+ "os": "npm:bare-node-os",
57
+ "bare-path": "^2.1.0",
58
+ "path": "npm:bare-node-path",
59
+ "bare-process": "^1.3.0",
60
+ "process": "npm:bare-node-process",
61
+ "bare-readline": "^1.0.0",
62
+ "readline": "npm:bare-node-readline",
63
+ "bare-repl": "^1.0.3",
64
+ "repl": "npm:bare-node-repl",
65
+ "bare-stream": "^1.0.0",
66
+ "stream": "npm:bare-node-stream",
67
+ "bare-timers" : "^1.0.0",
68
+ "timers": "npm:bare-node-timers",
69
+ "bare-tls": "^1.0.0",
70
+ "tls": "npm:bare-node-tls",
71
+ "bare-tty": "^3.2.0",
72
+ "tty": "npm:bare-node-tty",
73
+ "bare-url": "^1.0.7",
74
+ "url": "npm:bare-node-url",
75
+ "bare-utils": "^1.0.0",
76
+ "util": "npm:bare-node-util",
77
+ "bare-worker": "^1.0.0",
78
+ "worker_threads": "npm:bare-node-worker-threads",
79
+ "bare-zlib": "^1.0.0",
80
+ "zlib": "npm:bare-node-zlib"
34
81
  },
35
82
  "publishConfig": {
36
83
  "registry": "https://registry.npmjs.org",
package/src/index.js CHANGED
@@ -4,13 +4,14 @@ import Hyperswarm from 'hyperswarm';
4
4
  import ReadyResource from 'ready-resource';
5
5
  import b4a from 'b4a';
6
6
  import Hyperbee from 'hyperbee';
7
- import readline from 'bare-readline';
7
+ import readline from 'readline';
8
8
  import crypto from 'hypercore-crypto';
9
9
  import { sanitizeTransaction, addWriter } from './functions.js';
10
10
  import w from 'protomux-wakeup';
11
11
  import PeerWallet from "trac-wallet"
12
- import fs from 'node:fs';
13
12
  import Corestore from 'corestore';
13
+ import tty from 'tty'
14
+ import {Buffer} from 'buffer'
14
15
 
15
16
  const wakeup = new w();
16
17
 
@@ -96,7 +97,7 @@ export class MainSettlementBus extends ReadyResource {
96
97
  }
97
98
  console.log('View Length:', this.base.view.core.length);
98
99
  console.log('View Signed Length:', this.base.view.core.signedLength);
99
- console.log('MSB Key:', Buffer(this.base.view.core.key).toString('hex'));
100
+ console.log('MSB Key:', new Buffer(this.base.view.core.key).toString('hex'));
100
101
  this.writerLocalKey = b4a.toString(this.base.local.key, 'hex');
101
102
  if (this.replicate) await this._replicate();
102
103
  if (this.enable_txchannel) {
@@ -116,7 +117,9 @@ export class MainSettlementBus extends ReadyResource {
116
117
 
117
118
  async updater(){
118
119
  while(true){
119
- await this.base.append(null);
120
+ if(this.base.writable){
121
+ await this.base.append(null);
122
+ }
120
123
  await this.sleep(10_000);
121
124
  }
122
125
  }
@@ -273,8 +276,8 @@ export class MainSettlementBus extends ReadyResource {
273
276
 
274
277
  async interactiveMode() {
275
278
  const rl = readline.createInterface({
276
- input: process.stdin,
277
- output: process.stdout,
279
+ input: new tty.ReadStream(0),
280
+ output: new tty.WriteStream(1)
278
281
  });
279
282
 
280
283
  console.log('MSB started. Available commands:');