@leofcoin/chain 1.7.8 → 1.7.9
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 +15 -2
- package/exports/chain.js +15 -2
- package/exports/machine.d.ts +1 -0
- package/exports/state.d.ts +1 -1
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -3925,6 +3925,7 @@ class Machine {
|
|
|
3925
3925
|
totalBlocks: 0
|
|
3926
3926
|
}
|
|
3927
3927
|
};
|
|
3928
|
+
this.wantList = [];
|
|
3928
3929
|
// @ts-ignore
|
|
3929
3930
|
return this.#init(blocks);
|
|
3930
3931
|
}
|
|
@@ -3980,8 +3981,14 @@ class Machine {
|
|
|
3980
3981
|
}
|
|
3981
3982
|
case 'ask': {
|
|
3982
3983
|
if (data.question === 'contract' || data.question === 'transaction') {
|
|
3983
|
-
|
|
3984
|
-
|
|
3984
|
+
try {
|
|
3985
|
+
const input = await peernet.get(data.input);
|
|
3986
|
+
this.worker.postMessage({ id: data.id, input });
|
|
3987
|
+
}
|
|
3988
|
+
catch (error) {
|
|
3989
|
+
console.error(error);
|
|
3990
|
+
this.wantList.push(data.input);
|
|
3991
|
+
}
|
|
3985
3992
|
}
|
|
3986
3993
|
}
|
|
3987
3994
|
}
|
|
@@ -4342,6 +4349,12 @@ class State extends Contract {
|
|
|
4342
4349
|
#totalSize;
|
|
4343
4350
|
#machine;
|
|
4344
4351
|
#loaded;
|
|
4352
|
+
/**
|
|
4353
|
+
* contains transactions we need before we can successfully load
|
|
4354
|
+
*/
|
|
4355
|
+
get wantList() {
|
|
4356
|
+
return this.#machine.wantList;
|
|
4357
|
+
}
|
|
4345
4358
|
get state() {
|
|
4346
4359
|
return {
|
|
4347
4360
|
sync: this.#syncState,
|
package/exports/chain.js
CHANGED
|
@@ -292,6 +292,7 @@ class Machine {
|
|
|
292
292
|
totalBlocks: 0
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
|
+
this.wantList = [];
|
|
295
296
|
// @ts-ignore
|
|
296
297
|
return this.#init(blocks);
|
|
297
298
|
}
|
|
@@ -347,8 +348,14 @@ class Machine {
|
|
|
347
348
|
}
|
|
348
349
|
case 'ask': {
|
|
349
350
|
if (data.question === 'contract' || data.question === 'transaction') {
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
try {
|
|
352
|
+
const input = await peernet.get(data.input);
|
|
353
|
+
this.worker.postMessage({ id: data.id, input });
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
console.error(error);
|
|
357
|
+
this.wantList.push(data.input);
|
|
358
|
+
}
|
|
352
359
|
}
|
|
353
360
|
}
|
|
354
361
|
}
|
|
@@ -709,6 +716,12 @@ class State extends Contract {
|
|
|
709
716
|
#totalSize;
|
|
710
717
|
#machine;
|
|
711
718
|
#loaded;
|
|
719
|
+
/**
|
|
720
|
+
* contains transactions we need before we can successfully load
|
|
721
|
+
*/
|
|
722
|
+
get wantList() {
|
|
723
|
+
return this.#machine.wantList;
|
|
724
|
+
}
|
|
712
725
|
get state() {
|
|
713
726
|
return {
|
|
714
727
|
sync: this.#syncState,
|
package/exports/machine.d.ts
CHANGED
package/exports/state.d.ts
CHANGED