@leofcoin/chain 1.0.5 → 1.0.6

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/chain.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  var bignumber = require('@ethersproject/bignumber');
4
4
  var units = require('@ethersproject/units');
5
- var chalk = require('chalk');
6
5
  require('vm');
7
6
  var protons = require('protons');
8
7
  var codecFormatInterface = require('@leofcoin/codec-format-interface');
@@ -10,17 +9,8 @@ require('@vandeurenglenn/base58');
10
9
 
11
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
11
 
13
- var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
14
12
  var protons__default = /*#__PURE__*/_interopDefaultLegacy(protons);
15
13
 
16
- // import { promisify } from 'util'
17
-
18
- const info = text => console.log(chalk__default["default"].blueBright(text));
19
-
20
- const subinfo = text => console.log(chalk__default["default"].magentaBright(text));
21
- // export const write = promisify(writeFile)
22
- // export const read = promisify(readFile)
23
-
24
14
  var proto$4 = `
25
15
  message ContractMessage {
26
16
  required string creator = 1;
@@ -266,8 +256,8 @@ console.log(e);
266
256
  globalThis.msg = this.#createMessage(contractMessage.decoded.creator);
267
257
  // globalThis.msg = {sender: contractMessage.decoded.creator}
268
258
  this.#contracts[contractMessage.hash] = new Contract(...params);
269
- info(`loaded contract: ${contractMessage.hash}`);
270
- subinfo(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
259
+ debug(`loaded contract: ${contractMessage.hash}`);
260
+ debug(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
271
261
  } catch (e) {
272
262
  console.log(e);
273
263
  console.warn(`removing contract ${contractMessage.hash}`);
@@ -485,7 +475,7 @@ class Chain {
485
475
  console.log(this.#blocks);
486
476
  let blocksSynced = localIndex > 0 ? localIndex - index : index;
487
477
  blocksSynced += 1;
488
- info(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
478
+ debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`);
489
479
 
490
480
  this.#blocks.length;
491
481
  (this.#blocks.length) - blocksSynced;
@@ -599,7 +589,7 @@ class Chain {
599
589
  this.#lastBlock = {hash: blockMessage.hash, ...blockMessage.decoded};
600
590
  await blockStore.put(blockMessage.hash, blockMessage.encoded);
601
591
  await chainStore.put('lastBlock', new TextEncoder().encode(blockMessage.hash));
602
- info(`added block: ${blockMessage.hash}`);
592
+ debug(`added block: ${blockMessage.hash}`);
603
593
  let promises = [];
604
594
  let contracts = [];
605
595
  for (let transaction of blockMessage.decoded.transactions) {