@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/dist/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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"><img alt=\"Creative Commons Licence\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc/4.0/88x31.png\" /></a><br />This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\">Creative Commons Attribution-NonCommercial 4.0 International License</a>.",
5
5
  "source": "./src/node.js",
6
6
  "main": "./dist/node.js",
package/src/chain.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BigNumber, formatUnits, parseUnits, info } from './utils/utils'
1
+ import { BigNumber, formatUnits, parseUnits } from './utils/utils'
2
2
  import Machine from './machine'
3
3
  import lib from './lib'
4
4
 
@@ -154,7 +154,7 @@ export default class Chain {
154
154
  console.log(this.#blocks);
155
155
  let blocksSynced = localIndex > 0 ? localIndex - index : index
156
156
  blocksSynced += 1
157
- info(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`)
157
+ debug(`synced ${blocksSynced} ${blocksSynced > 1 ? 'blocks' : 'block'}`)
158
158
 
159
159
  const end = this.#blocks.length
160
160
  const start = (this.#blocks.length) - blocksSynced
@@ -268,7 +268,7 @@ export default class Chain {
268
268
  this.#lastBlock = {hash: blockMessage.hash, ...blockMessage.decoded}
269
269
  await blockStore.put(blockMessage.hash, blockMessage.encoded)
270
270
  await chainStore.put('lastBlock', new TextEncoder().encode(blockMessage.hash))
271
- info(`added block: ${blockMessage.hash}`)
271
+ debug(`added block: ${blockMessage.hash}`)
272
272
  let promises = []
273
273
  let contracts = []
274
274
  for (let transaction of blockMessage.decoded.transactions) {
package/src/machine.js CHANGED
@@ -2,7 +2,6 @@ import vm from 'vm'
2
2
  import ContractMessage from './messages/contract'
3
3
  import TransactionMessage from './messages/transaction'
4
4
  import lib from './lib'
5
- import { info, subinfo } from './utils/utils'
6
5
  // import State from './state'
7
6
 
8
7
  export default class Machine {
@@ -62,8 +61,8 @@ console.log(e);
62
61
  globalThis.msg = this.#createMessage(contractMessage.decoded.creator)
63
62
  // globalThis.msg = {sender: contractMessage.decoded.creator}
64
63
  this.#contracts[contractMessage.hash] = new Contract(...params)
65
- info(`loaded contract: ${contractMessage.hash}`);
66
- subinfo(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
64
+ debug(`loaded contract: ${contractMessage.hash}`);
65
+ debug(`size: ${Math.round((contractMessage.encoded.length / 1024) * 100) / 100} kb`);
67
66
  } catch (e) {
68
67
  console.log(e);
69
68
  console.warn(`removing contract ${contractMessage.hash}`);
@@ -2,15 +2,6 @@
2
2
  // import { writeFile, readFile } from 'fs'
3
3
  export { BigNumber } from "@ethersproject/bignumber";
4
4
  export { formatUnits, parseUnits } from '@ethersproject/units'
5
- import chalk from 'chalk'
6
5
 
7
- const info = text => console.log(chalk.blueBright(text))
8
-
9
- const subinfo = text => console.log(chalk.magentaBright(text))
10
-
11
- export {
12
- info,
13
- subinfo
14
- }
15
6
  // export const write = promisify(writeFile)
16
7
  // export const read = promisify(readFile)