@leofcoin/chain 1.7.139 → 1.7.142

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.
@@ -7,6 +7,21 @@ if (globalThis.localStorage && !TARGETS) {
7
7
  TARGETS = JSON.parse(DEBUG);
8
8
  }
9
9
  }
10
+ const getLogger = (trace) => (trace ? console.trace : console.log);
11
+ const debug$3 = (target, text, trace) => {
12
+ const _logger = getLogger(trace);
13
+ if (!TARGETS)
14
+ return;
15
+ if (TARGETS === true ||
16
+ TARGETS?.indexOf(target) !== -1 ||
17
+ TARGETS?.indexOf("*") !== -1 ||
18
+ TARGETS?.indexOf(target.split("/")[0]) !== -1)
19
+ if (text)
20
+ _logger("\x1b[34m\x1b[1m%s", `${target}: ${text}`, "\x1b[0m");
21
+ else
22
+ _logger("\x1b[34m\x1b[1m%s", `${target}`, "\x1b[0m");
23
+ };
24
+ const createDebugger = (target) => (text, trace) => debug$3(target, text, trace);
10
25
 
11
26
  /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */
12
27
  /**
@@ -4117,7 +4132,7 @@ const isResolveError = (error) => error.name === 'ResolveError';
4117
4132
  const isExecutionError = (error) => error.name === 'ExecutionError';
4118
4133
 
4119
4134
  // import State from './state'
4120
- const debug$2 = globalThis.createDebugger('leofcoin/machine');
4135
+ const debug$2 = createDebugger('leofcoin/machine');
4121
4136
  class Machine {
4122
4137
  constructor(blocks) {
4123
4138
  this.states = {
@@ -4614,7 +4629,7 @@ class Jobber {
4614
4629
  }
4615
4630
  }
4616
4631
 
4617
- const debug$1 = globalThis.createDebugger('leofcoin/state');
4632
+ const debug$1 = createDebugger('leofcoin/state');
4618
4633
  class State extends Contract {
4619
4634
  #resolveErrored;
4620
4635
  #lastResolvedTime;
@@ -5687,7 +5702,7 @@ class ConnectionMonitor {
5687
5702
  }
5688
5703
  }
5689
5704
 
5690
- const debug = globalThis.createDebugger('leofcoin/chain');
5705
+ const debug = createDebugger('leofcoin/chain');
5691
5706
  // check if browser or local
5692
5707
  class Chain extends VersionControl {
5693
5708
  #state;
@@ -1,4 +1,3 @@
1
- import '@vandeurenglenn/debug';
2
1
  import { Address } from './types.js';
3
2
  import { VersionControl } from './version-control.js';
4
3
  export default class Chain extends VersionControl {
package/exports/chain.js CHANGED
@@ -1,4 +1,4 @@
1
- import '@vandeurenglenn/debug';
1
+ import { createDebugger } from '@vandeurenglenn/debug';
2
2
  import { formatBytes, jsonStringifyBigInt, jsonParseBigInt, parseUnits, formatUnits } from '@leofcoin/utils';
3
3
  import { TransactionMessage, BlockMessage, ContractMessage, BWMessage, BWRequestMessage } from '@leofcoin/messages';
4
4
  import addresses, { contractFactory } from '@leofcoin/addresses';
@@ -272,7 +272,7 @@ class Contract extends Transaction {
272
272
  }
273
273
 
274
274
  // import State from './state'
275
- const debug$2 = globalThis.createDebugger('leofcoin/machine');
275
+ const debug$2 = createDebugger('leofcoin/machine');
276
276
  class Machine {
277
277
  constructor(blocks) {
278
278
  this.states = {
@@ -769,7 +769,7 @@ class Jobber {
769
769
  }
770
770
  }
771
771
 
772
- const debug$1 = globalThis.createDebugger('leofcoin/state');
772
+ const debug$1 = createDebugger('leofcoin/state');
773
773
  class State extends Contract {
774
774
  #resolveErrored;
775
775
  #lastResolvedTime;
@@ -1842,7 +1842,7 @@ class ConnectionMonitor {
1842
1842
  }
1843
1843
  }
1844
1844
 
1845
- const debug = globalThis.createDebugger('leofcoin/chain');
1845
+ const debug = createDebugger('leofcoin/chain');
1846
1846
  // check if browser or local
1847
1847
  class Chain extends VersionControl {
1848
1848
  #state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.139",
3
+ "version": "1.7.142",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {