@leofcoin/chain 1.4.77 → 1.4.79

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,4 +1,4 @@
1
- import { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, C as ContractMessage, T as TransactionMessage, R as RawTransactionMessage, g as getDefaultExportFromCjs, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-fa2c6beb.js';
1
+ import { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, C as ContractMessage, T as TransactionMessage, R as RawTransactionMessage, g as getDefaultExportFromCjs, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-c3f4012c.js';
2
2
 
3
3
  const logger$1 = new Logger(version$1);
4
4
  const _constructorGuard = {};
@@ -1952,6 +1952,7 @@ class State extends Contract {
1952
1952
  catch (error) {
1953
1953
  console.log({ e: error });
1954
1954
  }
1955
+ globalThis.pubsub.publish('lastBlock', this.lastBlock);
1955
1956
  // load local blocks
1956
1957
  await this.resolveBlocks();
1957
1958
  this.#machine = await new Machine(this.#blocks);
@@ -1,5 +1,5 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-b35d8f46.js';
2
- import './index-fa2c6beb.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-44a01a16.js';
2
+ import './index-c3f4012c.js';
3
3
 
4
4
  /**
5
5
  * @params {String} network
@@ -43,6 +43,8 @@ var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
43
43
 
44
44
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
45
45
 
46
+ bn.exports;
47
+
46
48
  (function (module) {
47
49
  (function (module, exports) {
48
50
 
@@ -1,5 +1,5 @@
1
- import { F as FormatInterface } from './node-browser-b35d8f46.js';
2
- import './index-fa2c6beb.js';
1
+ import { F as FormatInterface } from './node-browser-44a01a16.js';
2
+ import './index-c3f4012c.js';
3
3
 
4
4
  var proto$b = {
5
5
  data: new Uint8Array(),
@@ -1,4 +1,4 @@
1
- import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-fa2c6beb.js';
1
+ import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-c3f4012c.js';
2
2
 
3
3
  var nodeConfig = async (config = {
4
4
  network: 'leofcoin:peach',
@@ -91,55 +91,55 @@ globalThis.debug = text => {
91
91
  if (globalThis.DEBUG) console.log('\x1b[34m\x1b[1m%s', text, '\x1b[0m'); // bright blue
92
92
  };
93
93
 
94
- class LittlePubSub {
95
- subscribers = {};
96
- verbose;
97
- constructor(verbose = false) {
98
- this.verbose = verbose;
99
- }
100
- #handleContext(handler, context) {
101
- if (typeof context === 'undefined') {
102
- context = handler;
103
- }
104
- return context;
105
- }
106
- hasSubscribers(event) {
107
- return this.subscribers[event] ? true : false;
108
- }
109
- subscribe(event, handler, context) {
110
- if (!this.hasSubscribers(event))
111
- this.subscribers[event] = { handlers: [], value: undefined };
112
- context = this.#handleContext(handler, context);
113
- this.subscribers[event].handlers.push(handler.bind(context));
114
- }
115
- unsubscribe(event, handler, context) {
116
- if (!this.hasSubscribers(event))
117
- return;
118
- context = this.#handleContext(handler, context);
119
- const index = this.subscribers[event].handlers.indexOf(handler.bind(context));
120
- this.subscribers[event].handlers.splice(index);
121
- if (this.subscribers[event].handlers.length === 0)
122
- delete this.subscribers[event];
123
- }
124
- publish(event, change) {
125
- if (!this.hasSubscribers(event))
126
- return;
127
- if (this.verbose || this.subscribers[event].value !== change) {
128
- this.subscribers[event].value = change;
129
- this.subscribers[event].handlers.forEach((handler) => {
130
- handler(change, this.subscribers[event].value);
131
- });
132
- }
133
- }
134
- once(event) {
135
- return new Promise((resolve) => {
136
- const cb = (value) => {
137
- this.unsubscribe(event, cb);
138
- resolve(value);
139
- };
140
- this.subscribe(event, cb);
141
- });
142
- }
94
+ class LittlePubSub {
95
+ subscribers = {};
96
+ verbose;
97
+ constructor(verbose) {
98
+ this.verbose = verbose;
99
+ }
100
+ _handleContext(handler, context) {
101
+ if (typeof context === 'undefined') {
102
+ context = handler;
103
+ }
104
+ return context;
105
+ }
106
+ hasSubscribers(event) {
107
+ return this.subscribers[event] ? true : false;
108
+ }
109
+ subscribe(event, handler, context) {
110
+ if (!this.hasSubscribers(event))
111
+ this.subscribers[event] = { handlers: [], value: undefined };
112
+ context = this._handleContext(handler, context);
113
+ this.subscribers[event].handlers.push(handler.bind(context));
114
+ }
115
+ unsubscribe(event, handler, context) {
116
+ if (!this.hasSubscribers(event))
117
+ return;
118
+ context = this._handleContext(handler, context);
119
+ const index = this.subscribers[event].handlers.indexOf(handler.bind(context));
120
+ this.subscribers[event].handlers.splice(index);
121
+ if (this.subscribers[event].handlers.length === 0)
122
+ delete this.subscribers[event];
123
+ }
124
+ publish(event, change) {
125
+ if (!this.hasSubscribers(event))
126
+ return;
127
+ if (this.verbose || this.subscribers[event]?.value !== change) {
128
+ this.subscribers[event].value = change;
129
+ this.subscribers[event].handlers.forEach((handler) => {
130
+ handler(change, this.subscribers[event].value);
131
+ });
132
+ }
133
+ }
134
+ once(event) {
135
+ return new Promise((resolve) => {
136
+ const cb = (value) => {
137
+ this.unsubscribe(event, cb);
138
+ resolve(value);
139
+ };
140
+ this.subscribe(event, cb);
141
+ });
142
+ }
143
143
  }
144
144
 
145
145
  // base-x encoding / decoding
@@ -20257,7 +20257,7 @@ class Identity {
20257
20257
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
20258
20258
  }
20259
20259
  else {
20260
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-502d190c-60cfcc02.js');
20260
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-b203939f-54b1df28.js');
20261
20261
  const { identity, accounts } = await importee.default(password, this.network);
20262
20262
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20263
20263
  await globalThis.walletStore.put('version', String(1));
@@ -20428,7 +20428,7 @@ class Peernet {
20428
20428
  this.root = options.root;
20429
20429
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20430
20430
  // FolderMessageResponse
20431
- } = await import(/* webpackChunkName: "messages" */ './messages-cd01524c-8d88d84b.js');
20431
+ } = await import(/* webpackChunkName: "messages" */ './messages-7138679c-83b46e4a.js');
20432
20432
  /**
20433
20433
  * proto Object containing protos
20434
20434
  * @type {Object}
@@ -1,2 +1,2 @@
1
- export { N as default } from './node-browser-b35d8f46.js';
2
- import './index-fa2c6beb.js';
1
+ export { N as default } from './node-browser-44a01a16.js';
2
+ import './index-c3f4012c.js';
@@ -43,6 +43,8 @@ var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
43
43
 
44
44
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
45
45
 
46
+ bn.exports;
47
+
46
48
  (function (module) {
47
49
  (function (module, exports) {
48
50
 
@@ -43,6 +43,8 @@ var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
43
43
 
44
44
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
45
45
 
46
+ bn.exports;
47
+
46
48
  (function (module) {
47
49
  (function (module, exports) {
48
50
 
package/exports/chain.js CHANGED
@@ -578,6 +578,7 @@ class State extends Contract {
578
578
  catch (error) {
579
579
  console.log({ e: error });
580
580
  }
581
+ globalThis.pubsub.publish('lastBlock', this.lastBlock);
581
582
  // load local blocks
582
583
  await this.resolveBlocks();
583
584
  this.#machine = await new Machine(this.#blocks);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.4.77",
3
+ "version": "1.4.79",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": "./exports/node.js",