@acala-network/chopsticks 0.3.8 → 0.3.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.
|
@@ -35,7 +35,7 @@ export declare class Blockchain {
|
|
|
35
35
|
setHead(block: Block): Promise<void>;
|
|
36
36
|
submitExtrinsic(extrinsic: HexString): Promise<HexString>;
|
|
37
37
|
newBlock(params?: BuildBlockParams): Promise<Block>;
|
|
38
|
-
upcomingBlock(
|
|
38
|
+
upcomingBlock(skipCount?: number): Promise<Block>;
|
|
39
39
|
dryRunExtrinsic(extrinsic: HexString | {
|
|
40
40
|
call: HexString;
|
|
41
41
|
address: string;
|
package/dist/blockchain/index.js
CHANGED
|
@@ -119,8 +119,8 @@ class Blockchain {
|
|
|
119
119
|
await this.#txpool.buildBlock(params);
|
|
120
120
|
return this.#head;
|
|
121
121
|
}
|
|
122
|
-
async upcomingBlock(
|
|
123
|
-
return this.#txpool.upcomingBlock(
|
|
122
|
+
async upcomingBlock(skipCount = 0) {
|
|
123
|
+
return this.#txpool.upcomingBlock(skipCount);
|
|
124
124
|
}
|
|
125
125
|
async dryRunExtrinsic(extrinsic, at) {
|
|
126
126
|
await this.api.isReady;
|
|
@@ -27,5 +27,5 @@ export declare class TxPool {
|
|
|
27
27
|
get pendingExtrinsics(): HexString[];
|
|
28
28
|
submitExtrinsic(extrinsic: HexString): void;
|
|
29
29
|
buildBlock(params?: BuildBlockParams): Promise<void>;
|
|
30
|
-
upcomingBlock(
|
|
30
|
+
upcomingBlock(skipCount?: number): Promise<Block>;
|
|
31
31
|
}
|
|
@@ -19,11 +19,11 @@ class TxPool {
|
|
|
19
19
|
#pool = [];
|
|
20
20
|
#mode;
|
|
21
21
|
#inherentProvider;
|
|
22
|
+
#last;
|
|
22
23
|
#lastBuildBlockPromise = Promise.resolve();
|
|
23
|
-
#last = new rxjs_1.ReplaySubject(1);
|
|
24
|
-
#upcoming = this.#last.pipe((0, rxjs_1.share)());
|
|
25
24
|
constructor(chain, inherentProvider, mode = BuildBlockMode.Batch) {
|
|
26
25
|
this.#chain = chain;
|
|
26
|
+
this.#last = new rxjs_1.BehaviorSubject(chain.head);
|
|
27
27
|
this.#mode = mode;
|
|
28
28
|
this.#inherentProvider = inherentProvider;
|
|
29
29
|
}
|
|
@@ -51,10 +51,10 @@ class TxPool {
|
|
|
51
51
|
await this.#lastBuildBlockPromise;
|
|
52
52
|
this.#last.next(this.#chain.head);
|
|
53
53
|
}
|
|
54
|
-
async upcomingBlock(
|
|
55
|
-
if (
|
|
56
|
-
throw new Error('
|
|
57
|
-
return (0, rxjs_1.firstValueFrom)(this.#
|
|
54
|
+
async upcomingBlock(skipCount = 0) {
|
|
55
|
+
if (skipCount < 0)
|
|
56
|
+
throw new Error('skipCount needs to be greater or equal to 0');
|
|
57
|
+
return (0, rxjs_1.firstValueFrom)(this.#last.pipe((0, operators_1.skip)(1 + skipCount), (0, operators_1.take)(1)));
|
|
58
58
|
}
|
|
59
59
|
async #buildBlock(wait, params) {
|
|
60
60
|
await this.#chain.api.isReady;
|