@leofcoin/chain 1.7.37 → 1.7.43
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/exports/browser/{browser-WUe24rfW-DADoCQbN.js → browser-DQJ6xf_F-C6-szetT.js} +3 -3
- package/exports/browser/browser-store.js +120 -64
- package/exports/browser/{client-I9x7CFr1-C021SRFJ.js → client-Depp28gl-B4Mz_hP5.js} +64 -31
- package/exports/browser/{index-sw14JvKD-Bt1IbdaP.js → index-BeqbCwUk-k7nFljXa.js} +1 -1
- package/exports/browser/{index-In1Jzp-v-k_wpCs2M.js → index-DqPlTtAJ-BCTqnABp.js} +422 -408
- package/exports/browser/{messages-lzTD4EMU-9sp08uR5.js → messages-RYLqPGkg-Jd6OizO7.js} +1 -1
- package/exports/browser/{node-browser-D_OVxIm6.js → node-browser-lePEPRA6.js} +24284 -22250
- package/exports/browser/node-browser.js +1 -1
- package/exports/browser/workers/machine-worker.js +19 -9
- package/exports/machine.d.ts +1 -1
- package/exports/state.d.ts +2 -2
- package/exports/workers/machine-worker.js +19 -9
- package/package.json +5 -5
- /package/exports/browser/{browser-AyxSBUXj-pguCHlVu.js → browser-pguCHlVu-pguCHlVu.js} +0 -0
- /package/exports/browser/{qr-scanner-worker.min-RaSiJc_R-Dy0qkKA4.js → qr-scanner-worker.min-Dy0qkKA4-Dy0qkKA4.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
1
|
+
export { N as default } from './node-browser-lePEPRA6.js';
|
|
2
2
|
import './index-XTbRdu6H.js';
|
|
@@ -64,19 +64,26 @@ class LittlePubSub {
|
|
|
64
64
|
return this.subscribers[event].value;
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
|
-
subscribe(event, handler,
|
|
67
|
+
subscribe(event, handler, options) {
|
|
68
68
|
if (!this.hasSubscribers(event))
|
|
69
69
|
this.subscribers[event] = { handlers: [], value: undefined };
|
|
70
|
-
context = this._handleContext(handler, context);
|
|
71
|
-
|
|
70
|
+
const context = this._handleContext(handler, options?.context);
|
|
71
|
+
const _handler = handler.bind(context);
|
|
72
|
+
this.subscribers[event].handlers.push(_handler);
|
|
73
|
+
if (this.subscribers[event].value !== undefined)
|
|
74
|
+
_handler(this.subscribers[event].value, undefined);
|
|
72
75
|
}
|
|
73
|
-
unsubscribe(event, handler,
|
|
76
|
+
unsubscribe(event, handler, options) {
|
|
77
|
+
if (!options)
|
|
78
|
+
options = { keepValue: false };
|
|
74
79
|
if (!this.hasSubscribers(event))
|
|
75
80
|
return;
|
|
76
|
-
context = this._handleContext(handler, context);
|
|
81
|
+
const context = this._handleContext(handler, options.context);
|
|
77
82
|
const index = this.subscribers[event].handlers.indexOf(handler.bind(context));
|
|
78
83
|
this.subscribers[event].handlers.splice(index);
|
|
79
|
-
if
|
|
84
|
+
// delete event if no handlers left but supports keeping value for later use
|
|
85
|
+
// (like when unsubscribing from a value that is still needed because others might subscibe to it)
|
|
86
|
+
if (this.subscribers[event].handlers.length === 0 && !options.keepValue)
|
|
80
87
|
delete this.subscribers[event];
|
|
81
88
|
}
|
|
82
89
|
publish(event, value, verbose) {
|
|
@@ -96,13 +103,13 @@ class LittlePubSub {
|
|
|
96
103
|
publishVerbose(event, value) {
|
|
97
104
|
this.publish(event, value, true);
|
|
98
105
|
}
|
|
99
|
-
once(event) {
|
|
106
|
+
once(event, options) {
|
|
100
107
|
return new Promise((resolve) => {
|
|
101
108
|
const cb = (value) => {
|
|
102
109
|
resolve(value);
|
|
103
|
-
this.unsubscribe(event, cb);
|
|
110
|
+
this.unsubscribe(event, cb, options);
|
|
104
111
|
};
|
|
105
|
-
this.subscribe(event, cb);
|
|
112
|
+
this.subscribe(event, cb, options);
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
}
|
|
@@ -476,6 +483,9 @@ worker.onmessage(({ id, type, input }) => {
|
|
|
476
483
|
case 'lastBlock':
|
|
477
484
|
respond(id, lastBlock);
|
|
478
485
|
break;
|
|
486
|
+
case 'lastBlockHeight':
|
|
487
|
+
respond(id, lastBlock.index);
|
|
488
|
+
break;
|
|
479
489
|
case 'latestTransactions':
|
|
480
490
|
respond(id, latestTransactions);
|
|
481
491
|
break;
|
package/exports/machine.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export default class Machine {
|
|
|
53
53
|
getBlock(index: any): Promise<any>;
|
|
54
54
|
addLoadedBlock(block: any): Promise<any>;
|
|
55
55
|
latestTransactions(): Promise<any>;
|
|
56
|
-
delete(hash: any): Promise<
|
|
56
|
+
delete(hash: any): Promise<unknown>;
|
|
57
57
|
/**
|
|
58
58
|
*
|
|
59
59
|
* @returns Promise
|
package/exports/state.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export default class State extends Contract {
|
|
|
18
18
|
sync: SyncState;
|
|
19
19
|
chain: ChainState;
|
|
20
20
|
};
|
|
21
|
-
get blockHashMap():
|
|
21
|
+
get blockHashMap(): MapIterator<[any, any]>;
|
|
22
22
|
get loaded(): boolean;
|
|
23
23
|
get resolving(): boolean;
|
|
24
24
|
get contracts(): Promise<any>;
|
|
@@ -38,7 +38,7 @@ export default class State extends Contract {
|
|
|
38
38
|
hash: string;
|
|
39
39
|
previousHash: string;
|
|
40
40
|
};
|
|
41
|
-
get lastBlockHeight():
|
|
41
|
+
get lastBlockHeight(): Promise<any> | 0;
|
|
42
42
|
getBlock(index: any): Promise<any>;
|
|
43
43
|
getBlocks(from?: any, to?: any): Promise<[]>;
|
|
44
44
|
get totalSize(): number;
|
|
@@ -64,19 +64,26 @@ class LittlePubSub {
|
|
|
64
64
|
return this.subscribers[event].value;
|
|
65
65
|
return undefined;
|
|
66
66
|
}
|
|
67
|
-
subscribe(event, handler,
|
|
67
|
+
subscribe(event, handler, options) {
|
|
68
68
|
if (!this.hasSubscribers(event))
|
|
69
69
|
this.subscribers[event] = { handlers: [], value: undefined };
|
|
70
|
-
context = this._handleContext(handler, context);
|
|
71
|
-
|
|
70
|
+
const context = this._handleContext(handler, options?.context);
|
|
71
|
+
const _handler = handler.bind(context);
|
|
72
|
+
this.subscribers[event].handlers.push(_handler);
|
|
73
|
+
if (this.subscribers[event].value !== undefined)
|
|
74
|
+
_handler(this.subscribers[event].value, undefined);
|
|
72
75
|
}
|
|
73
|
-
unsubscribe(event, handler,
|
|
76
|
+
unsubscribe(event, handler, options) {
|
|
77
|
+
if (!options)
|
|
78
|
+
options = { keepValue: false };
|
|
74
79
|
if (!this.hasSubscribers(event))
|
|
75
80
|
return;
|
|
76
|
-
context = this._handleContext(handler, context);
|
|
81
|
+
const context = this._handleContext(handler, options.context);
|
|
77
82
|
const index = this.subscribers[event].handlers.indexOf(handler.bind(context));
|
|
78
83
|
this.subscribers[event].handlers.splice(index);
|
|
79
|
-
if
|
|
84
|
+
// delete event if no handlers left but supports keeping value for later use
|
|
85
|
+
// (like when unsubscribing from a value that is still needed because others might subscibe to it)
|
|
86
|
+
if (this.subscribers[event].handlers.length === 0 && !options.keepValue)
|
|
80
87
|
delete this.subscribers[event];
|
|
81
88
|
}
|
|
82
89
|
publish(event, value, verbose) {
|
|
@@ -96,13 +103,13 @@ class LittlePubSub {
|
|
|
96
103
|
publishVerbose(event, value) {
|
|
97
104
|
this.publish(event, value, true);
|
|
98
105
|
}
|
|
99
|
-
once(event) {
|
|
106
|
+
once(event, options) {
|
|
100
107
|
return new Promise((resolve) => {
|
|
101
108
|
const cb = (value) => {
|
|
102
109
|
resolve(value);
|
|
103
|
-
this.unsubscribe(event, cb);
|
|
110
|
+
this.unsubscribe(event, cb, options);
|
|
104
111
|
};
|
|
105
|
-
this.subscribe(event, cb);
|
|
112
|
+
this.subscribe(event, cb, options);
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
}
|
|
@@ -476,6 +483,9 @@ worker.onmessage(({ id, type, input }) => {
|
|
|
476
483
|
case 'lastBlock':
|
|
477
484
|
respond(id, lastBlock);
|
|
478
485
|
break;
|
|
486
|
+
case 'lastBlockHeight':
|
|
487
|
+
respond(id, lastBlock.index);
|
|
488
|
+
break;
|
|
479
489
|
case 'latestTransactions':
|
|
480
490
|
respond(id, latestTransactions);
|
|
481
491
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.43",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
56
56
|
"@types/semver": "^7.5.8",
|
|
57
57
|
"@vandeurenglenn/debug": "^1.2.5",
|
|
58
|
-
"rollup": "^4.21.
|
|
58
|
+
"rollup": "^4.21.3",
|
|
59
59
|
"rollup-plugin-modify": "^3.0.0",
|
|
60
60
|
"tape": "^5.8.1",
|
|
61
61
|
"tslib": "^2.7.0"
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"@leofcoin/messages": "^1.4.15",
|
|
70
70
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
71
71
|
"@leofcoin/networks": "^1.1.6",
|
|
72
|
-
"@leofcoin/peernet": "^1.1.
|
|
73
|
-
"@leofcoin/storage": "^3.5.
|
|
72
|
+
"@leofcoin/peernet": "^1.1.80",
|
|
73
|
+
"@leofcoin/storage": "^3.5.32",
|
|
74
74
|
"@leofcoin/utils": "^1.1.18",
|
|
75
|
-
"@leofcoin/workers": "^1.5.
|
|
75
|
+
"@leofcoin/workers": "^1.5.7",
|
|
76
76
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
77
77
|
"@vandeurenglenn/easy-worker": "^1.0.2",
|
|
78
78
|
"semver": "^7.6.3"
|
|
File without changes
|
|
File without changes
|