@leofcoin/chain 1.7.117 → 1.7.119
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/chain.js +26 -25
- package/exports/browser/{client-icdGX62_-D7-443eN.js → client-Lwke64Zq-DO2uqAHA.js} +1 -1
- package/exports/browser/{messages-BzsDq0Y4-ZkUqf4eM.js → messages-C22qRxnF-tW3z5FMF.js} +1 -1
- package/exports/browser/{node-browser-CUMhie0d.js → node-browser-C5GuLP_b.js} +4 -4
- package/exports/browser/node-browser.js +1 -1
- package/exports/chain.js +16 -15
- package/exports/contract.d.ts +0 -1
- package/package.json +2 -2
package/exports/browser/chain.js
CHANGED
|
@@ -1129,7 +1129,7 @@ var hasRequiredRe;
|
|
|
1129
1129
|
function requireRe () {
|
|
1130
1130
|
if (hasRequiredRe) return re.exports;
|
|
1131
1131
|
hasRequiredRe = 1;
|
|
1132
|
-
(function (module, exports) {
|
|
1132
|
+
(function (module, exports$1) {
|
|
1133
1133
|
|
|
1134
1134
|
const {
|
|
1135
1135
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -1137,14 +1137,14 @@ function requireRe () {
|
|
|
1137
1137
|
MAX_LENGTH,
|
|
1138
1138
|
} = requireConstants();
|
|
1139
1139
|
const debug = requireDebug();
|
|
1140
|
-
exports = module.exports = {};
|
|
1140
|
+
exports$1 = module.exports = {};
|
|
1141
1141
|
|
|
1142
1142
|
// The actual regexps go on exports.re
|
|
1143
|
-
const re = exports.re = [];
|
|
1144
|
-
const safeRe = exports.safeRe = [];
|
|
1145
|
-
const src = exports.src = [];
|
|
1146
|
-
const safeSrc = exports.safeSrc = [];
|
|
1147
|
-
const t = exports.t = {};
|
|
1143
|
+
const re = exports$1.re = [];
|
|
1144
|
+
const safeRe = exports$1.safeRe = [];
|
|
1145
|
+
const src = exports$1.src = [];
|
|
1146
|
+
const safeSrc = exports$1.safeSrc = [];
|
|
1147
|
+
const t = exports$1.t = {};
|
|
1148
1148
|
let R = 0;
|
|
1149
1149
|
|
|
1150
1150
|
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
@@ -1308,7 +1308,7 @@ function requireRe () {
|
|
|
1308
1308
|
createToken('LONETILDE', '(?:~>?)');
|
|
1309
1309
|
|
|
1310
1310
|
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
1311
|
-
exports.tildeTrimReplace = '$1~';
|
|
1311
|
+
exports$1.tildeTrimReplace = '$1~';
|
|
1312
1312
|
|
|
1313
1313
|
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
1314
1314
|
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -1318,7 +1318,7 @@ function requireRe () {
|
|
|
1318
1318
|
createToken('LONECARET', '(?:\\^)');
|
|
1319
1319
|
|
|
1320
1320
|
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
1321
|
-
exports.caretTrimReplace = '$1^';
|
|
1321
|
+
exports$1.caretTrimReplace = '$1^';
|
|
1322
1322
|
|
|
1323
1323
|
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
1324
1324
|
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
@@ -1331,7 +1331,7 @@ function requireRe () {
|
|
|
1331
1331
|
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
1332
1332
|
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
1333
1333
|
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
1334
|
-
exports.comparatorTrimReplace = '$1$2$3';
|
|
1334
|
+
exports$1.comparatorTrimReplace = '$1$2$3';
|
|
1335
1335
|
|
|
1336
1336
|
// Something like `1.2.3 - 1.2.4`
|
|
1337
1337
|
// Note that these all use the loose form, because they'll be
|
|
@@ -3993,7 +3993,6 @@ class Contract extends Transaction {
|
|
|
3993
3993
|
constructor(config) {
|
|
3994
3994
|
super(config);
|
|
3995
3995
|
}
|
|
3996
|
-
async init() { }
|
|
3997
3996
|
/**
|
|
3998
3997
|
*
|
|
3999
3998
|
* @param {Address} creator
|
|
@@ -4794,19 +4793,28 @@ class State extends Contract {
|
|
|
4794
4793
|
#knownBlocksHandler;
|
|
4795
4794
|
async init() {
|
|
4796
4795
|
this.jobber = new Jobber(this.resolveTimeout);
|
|
4797
|
-
if (super.init)
|
|
4798
|
-
await super.init();
|
|
4799
4796
|
await globalThis.peernet.addRequestHandler('lastBlock', this.#lastBlockHandler);
|
|
4800
4797
|
await globalThis.peernet.addRequestHandler('knownBlocks', this.#knownBlocksHandler);
|
|
4801
4798
|
await globalThis.peernet.addRequestHandler('chainState', this.#chainStateHandler);
|
|
4799
|
+
let localBlockHash;
|
|
4800
|
+
let blockMessage;
|
|
4801
|
+
let localBlock;
|
|
4802
4802
|
try {
|
|
4803
|
-
await globalThis.chainStore.has('lastBlock');
|
|
4803
|
+
const rawBlock = await globalThis.chainStore.has('lastBlock');
|
|
4804
|
+
console.log({ rawBlock });
|
|
4805
|
+
if (rawBlock) {
|
|
4806
|
+
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
|
|
4807
|
+
blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
|
|
4808
|
+
blockMessage = await new BlockMessage(blockMessage);
|
|
4809
|
+
localBlock = { ...blockMessage.decoded, hash: localBlockHash };
|
|
4810
|
+
}
|
|
4811
|
+
else {
|
|
4812
|
+
localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
|
|
4813
|
+
}
|
|
4804
4814
|
}
|
|
4805
4815
|
catch {
|
|
4806
|
-
|
|
4816
|
+
localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
|
|
4807
4817
|
}
|
|
4808
|
-
globalThis.pubsub.publish('lastBlock', await this.lastBlock);
|
|
4809
|
-
// load local blocks
|
|
4810
4818
|
try {
|
|
4811
4819
|
this.knownBlocks = await blockStore.keys();
|
|
4812
4820
|
}
|
|
@@ -4815,14 +4823,7 @@ class State extends Contract {
|
|
|
4815
4823
|
throw error;
|
|
4816
4824
|
}
|
|
4817
4825
|
try {
|
|
4818
|
-
|
|
4819
|
-
try {
|
|
4820
|
-
const localBlock = await globalThis.chainStore.get('lastBlock');
|
|
4821
|
-
localBlockHash = new TextDecoder().decode(localBlock);
|
|
4822
|
-
}
|
|
4823
|
-
catch (error) { }
|
|
4824
|
-
if (localBlockHash && localBlockHash !== '0x0') {
|
|
4825
|
-
const blockMessage = new BlockMessage(await peernet.get(localBlockHash, 'block'));
|
|
4826
|
+
if (localBlock.hash && localBlock.hash !== '0x0') {
|
|
4826
4827
|
try {
|
|
4827
4828
|
const states = {
|
|
4828
4829
|
lastBlock: JSON.parse(new TextDecoder().decode(await globalThis.stateStore.get('lastBlock')))
|
|
@@ -8491,7 +8491,7 @@ class Peernet {
|
|
|
8491
8491
|
this.root = options.root;
|
|
8492
8492
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
8493
8493
|
// FolderMessageResponse
|
|
8494
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
8494
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-C22qRxnF-tW3z5FMF.js');
|
|
8495
8495
|
/**
|
|
8496
8496
|
* proto Object containing protos
|
|
8497
8497
|
* @type {Object}
|
|
@@ -8585,7 +8585,7 @@ class Peernet {
|
|
|
8585
8585
|
if (this.#starting || this.#started)
|
|
8586
8586
|
return;
|
|
8587
8587
|
this.#starting = true;
|
|
8588
|
-
const importee = await import('./client-
|
|
8588
|
+
const importee = await import('./client-Lwke64Zq-DO2uqAHA.js');
|
|
8589
8589
|
/**
|
|
8590
8590
|
* @access public
|
|
8591
8591
|
* @type {PeernetClient}
|
|
@@ -8813,8 +8813,8 @@ class Peernet {
|
|
|
8813
8813
|
closestPeer = Object.values(providers)[0];
|
|
8814
8814
|
debug(`closest peer for ${hash} is ${closestPeer?.address}`);
|
|
8815
8815
|
// get peer instance by id
|
|
8816
|
-
if (!closestPeer || !closestPeer.id)
|
|
8817
|
-
return
|
|
8816
|
+
if (!closestPeer || !closestPeer.id || !closestPeer.address)
|
|
8817
|
+
return undefined;
|
|
8818
8818
|
const id = closestPeer.id;
|
|
8819
8819
|
const peer = this.connections[id];
|
|
8820
8820
|
if (!peer || !peer?.connected) {
|
package/exports/chain.js
CHANGED
|
@@ -222,7 +222,6 @@ class Contract extends Transaction {
|
|
|
222
222
|
constructor(config) {
|
|
223
223
|
super(config);
|
|
224
224
|
}
|
|
225
|
-
async init() { }
|
|
226
225
|
/**
|
|
227
226
|
*
|
|
228
227
|
* @param {Address} creator
|
|
@@ -921,19 +920,28 @@ class State extends Contract {
|
|
|
921
920
|
#knownBlocksHandler;
|
|
922
921
|
async init() {
|
|
923
922
|
this.jobber = new Jobber(this.resolveTimeout);
|
|
924
|
-
if (super.init)
|
|
925
|
-
await super.init();
|
|
926
923
|
await globalThis.peernet.addRequestHandler('lastBlock', this.#lastBlockHandler);
|
|
927
924
|
await globalThis.peernet.addRequestHandler('knownBlocks', this.#knownBlocksHandler);
|
|
928
925
|
await globalThis.peernet.addRequestHandler('chainState', this.#chainStateHandler);
|
|
926
|
+
let localBlockHash;
|
|
927
|
+
let blockMessage;
|
|
928
|
+
let localBlock;
|
|
929
929
|
try {
|
|
930
|
-
await globalThis.chainStore.has('lastBlock');
|
|
930
|
+
const rawBlock = await globalThis.chainStore.has('lastBlock');
|
|
931
|
+
console.log({ rawBlock });
|
|
932
|
+
if (rawBlock) {
|
|
933
|
+
localBlockHash = new TextDecoder().decode(await globalThis.chainStore.get('lastBlock'));
|
|
934
|
+
blockMessage = await globalThis.peernet.get(localBlockHash, 'block');
|
|
935
|
+
blockMessage = await new BlockMessage(blockMessage);
|
|
936
|
+
localBlock = { ...blockMessage.decoded, hash: localBlockHash };
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
|
|
940
|
+
}
|
|
931
941
|
}
|
|
932
942
|
catch {
|
|
933
|
-
|
|
943
|
+
localBlock = { index: 0, hash: '0x0', previousHash: '0x0' };
|
|
934
944
|
}
|
|
935
|
-
globalThis.pubsub.publish('lastBlock', await this.lastBlock);
|
|
936
|
-
// load local blocks
|
|
937
945
|
try {
|
|
938
946
|
this.knownBlocks = await blockStore.keys();
|
|
939
947
|
}
|
|
@@ -942,14 +950,7 @@ class State extends Contract {
|
|
|
942
950
|
throw error;
|
|
943
951
|
}
|
|
944
952
|
try {
|
|
945
|
-
|
|
946
|
-
try {
|
|
947
|
-
const localBlock = await globalThis.chainStore.get('lastBlock');
|
|
948
|
-
localBlockHash = new TextDecoder().decode(localBlock);
|
|
949
|
-
}
|
|
950
|
-
catch (error) { }
|
|
951
|
-
if (localBlockHash && localBlockHash !== '0x0') {
|
|
952
|
-
const blockMessage = new BlockMessage(await peernet.get(localBlockHash, 'block'));
|
|
953
|
+
if (localBlock.hash && localBlock.hash !== '0x0') {
|
|
953
954
|
try {
|
|
954
955
|
const states = {
|
|
955
956
|
lastBlock: JSON.parse(new TextDecoder().decode(await globalThis.stateStore.get('lastBlock')))
|
package/exports/contract.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.119",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@leofcoin/messages": "^1.4.40",
|
|
70
70
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
71
71
|
"@leofcoin/networks": "^1.1.25",
|
|
72
|
-
"@leofcoin/peernet": "^1.1.
|
|
72
|
+
"@leofcoin/peernet": "^1.1.104",
|
|
73
73
|
"@leofcoin/storage": "^3.5.38",
|
|
74
74
|
"@leofcoin/utils": "^1.1.40",
|
|
75
75
|
"@leofcoin/workers": "^1.5.27",
|