@xyo-network/xl1-protocol-sdk 1.18.18 → 1.18.20
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/dist/neutral/index.mjs +49 -50
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -1
- package/dist/neutral/simple/finalization/SimpleFinalizationViewer.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +34 -32
- package/src/simple/block/SimpleBlockViewer.ts +11 -11
- package/src/simple/finalization/SimpleFinalizationViewer.ts +2 -3
- package/src/summary/primitives/balances/balancesSummary.ts +1 -1
- package/src/summary/primitives/schemas/schemasSummary.ts +1 -1
- package/src/summary/primitives/transfers/transfersSummary.ts +1 -1
package/dist/neutral/index.mjs
CHANGED
|
@@ -3053,7 +3053,6 @@ import {
|
|
|
3053
3053
|
assertEx as assertEx28,
|
|
3054
3054
|
exists as exists3,
|
|
3055
3055
|
isDefined as isDefined17,
|
|
3056
|
-
spanRootAsync as spanRootAsync4,
|
|
3057
3056
|
ZERO_ADDRESS
|
|
3058
3057
|
} from "@xylabs/sdk-js";
|
|
3059
3058
|
import {
|
|
@@ -3187,7 +3186,7 @@ async function balancesSummary(context, config) {
|
|
|
3187
3186
|
}
|
|
3188
3187
|
}
|
|
3189
3188
|
return [balances, { range, head: headHash }];
|
|
3190
|
-
});
|
|
3189
|
+
}, { timeBudgetLimit: 500 });
|
|
3191
3190
|
}
|
|
3192
3191
|
|
|
3193
3192
|
// src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
|
|
@@ -3275,7 +3274,7 @@ async function schemasSummary(context, config) {
|
|
|
3275
3274
|
}
|
|
3276
3275
|
}
|
|
3277
3276
|
return [results, { range, head: headHash }];
|
|
3278
|
-
});
|
|
3277
|
+
}, { timeBudgetLimit: 500 });
|
|
3279
3278
|
}
|
|
3280
3279
|
|
|
3281
3280
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
@@ -3310,7 +3309,7 @@ async function transfersSummary(context, config) {
|
|
|
3310
3309
|
}
|
|
3311
3310
|
}
|
|
3312
3311
|
return [transfers, { range, head: headHash }];
|
|
3313
|
-
});
|
|
3312
|
+
}, { timeBudgetLimit: 500 });
|
|
3314
3313
|
}
|
|
3315
3314
|
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
3316
3315
|
return `${frameHeadHash}|${frameSize}`;
|
|
@@ -3554,37 +3553,39 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
3554
3553
|
this._blockViewer = await this.locator.getInstance(BlockViewerMoniker);
|
|
3555
3554
|
}
|
|
3556
3555
|
async qualifiedAccountBalanceHistories(addresses, config) {
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
address
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3556
|
+
return await this.spanAsync("qualifiedAccountBalanceHistories", async () => {
|
|
3557
|
+
const head = isChainQualifiedHeadConfig(config) ? config.head : await this.blockViewer.currentBlockHash();
|
|
3558
|
+
const range = isChainQualifiedRangeConfig(config) ? config.range : asXL1BlockRange10([
|
|
3559
|
+
0,
|
|
3560
|
+
assertEx28(
|
|
3561
|
+
await this.blockViewer.blockByHash(head),
|
|
3562
|
+
() => `Error: Could not find block with hash ${head}`
|
|
3563
|
+
)[0].block
|
|
3564
|
+
]);
|
|
3565
|
+
const qualifiedEntries = await Promise.all(addresses.map(async (address) => [
|
|
3566
|
+
address,
|
|
3567
|
+
await this.qualifiedAccountBalanceHistory(address, range)
|
|
3568
|
+
]));
|
|
3569
|
+
const entries = qualifiedEntries.map(([address, [history]]) => {
|
|
3570
|
+
return [address, history];
|
|
3571
|
+
});
|
|
3572
|
+
const qualifiedRange = qualifiedEntries[0][1][1].range;
|
|
3573
|
+
const qualifiedHeadHash = qualifiedEntries[0][1][1].head;
|
|
3574
|
+
for (const [_, [__, { range: range2, head: head2 }]] of qualifiedEntries) {
|
|
3575
|
+
assertEx28(
|
|
3576
|
+
range2[0] === qualifiedRange[0] && range2[1] === qualifiedRange[1],
|
|
3577
|
+
() => "Inconsistent ranges in qualifiedAccountBalanceHistories"
|
|
3578
|
+
);
|
|
3579
|
+
assertEx28(
|
|
3580
|
+
head2 === qualifiedHeadHash,
|
|
3581
|
+
() => "Inconsistent head hashes in qualifiedAccountBalanceHistories"
|
|
3582
|
+
);
|
|
3583
|
+
}
|
|
3584
|
+
return [Object.fromEntries(entries), { range: qualifiedRange, head: qualifiedHeadHash }];
|
|
3585
|
+
}, { timeBudgetLimit: 200 });
|
|
3585
3586
|
}
|
|
3586
3587
|
async qualifiedAccountBalances(address, config) {
|
|
3587
|
-
return await
|
|
3588
|
+
return await this.spanAsync("qualifiedAccountsBalances", async () => {
|
|
3588
3589
|
const qualifiedSummary = await balancesSummary(
|
|
3589
3590
|
{ ...this.balanceSummaryContext },
|
|
3590
3591
|
config
|
|
@@ -3595,7 +3596,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
3595
3596
|
result[addr] = AttoXL12(summaryBalance < 0n ? 0n : summaryBalance);
|
|
3596
3597
|
}
|
|
3597
3598
|
return [result, qualifiedSummary[1]];
|
|
3598
|
-
});
|
|
3599
|
+
}, { timeBudgetLimit: 200 });
|
|
3599
3600
|
}
|
|
3600
3601
|
async startHandler() {
|
|
3601
3602
|
await super.startHandler();
|
|
@@ -3681,8 +3682,7 @@ import {
|
|
|
3681
3682
|
assertEx as assertEx29,
|
|
3682
3683
|
exists as exists4,
|
|
3683
3684
|
isDefined as isDefined18,
|
|
3684
|
-
isUndefined as isUndefined5
|
|
3685
|
-
spanRootAsync as spanRootAsync5
|
|
3685
|
+
isUndefined as isUndefined5
|
|
3686
3686
|
} from "@xylabs/sdk-js";
|
|
3687
3687
|
import {
|
|
3688
3688
|
asSignedHydratedBlockWithHashMeta,
|
|
@@ -3754,13 +3754,13 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3754
3754
|
return { ...await super.paramsHandler(params) };
|
|
3755
3755
|
}
|
|
3756
3756
|
async blockByHash(hash) {
|
|
3757
|
-
return await
|
|
3757
|
+
return await this.spanAsync("blockByHash", async () => {
|
|
3758
3758
|
const cache = this.hydratedBlockCache;
|
|
3759
3759
|
return await cache.get(hash);
|
|
3760
|
-
},
|
|
3760
|
+
}, { timeBudgetLimit: 200 });
|
|
3761
3761
|
}
|
|
3762
3762
|
async blockByNumber(blockNumber) {
|
|
3763
|
-
return await
|
|
3763
|
+
return await this.spanAsync("blockByNumber", async () => {
|
|
3764
3764
|
const [head] = await this.currentBlock();
|
|
3765
3765
|
if (isUndefined5(head)) {
|
|
3766
3766
|
return null;
|
|
@@ -3773,10 +3773,10 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3773
3773
|
},
|
|
3774
3774
|
store: this.store
|
|
3775
3775
|
}, blockNumber)) ?? null;
|
|
3776
|
-
},
|
|
3776
|
+
}, { timeBudgetLimit: 200 });
|
|
3777
3777
|
}
|
|
3778
3778
|
async blocksByHash(hash, limit = 50) {
|
|
3779
|
-
return await
|
|
3779
|
+
return await this.spanAsync("blocksByHash", async () => {
|
|
3780
3780
|
assertEx29(limit > 0, () => "limit must be greater than 0");
|
|
3781
3781
|
assertEx29(limit <= 100, () => "limit must be less than 100");
|
|
3782
3782
|
const blocks = [];
|
|
@@ -3788,10 +3788,10 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3788
3788
|
current = await this.blockByHash(previousHash);
|
|
3789
3789
|
}
|
|
3790
3790
|
return blocks.map((b) => asSignedHydratedBlockWithHashMeta(b, true));
|
|
3791
|
-
},
|
|
3791
|
+
}, { timeBudgetLimit: 200 });
|
|
3792
3792
|
}
|
|
3793
3793
|
async blocksByNumber(blockNumber, limit = 50) {
|
|
3794
|
-
return await
|
|
3794
|
+
return await this.spanAsync("blocksByNumber", async () => {
|
|
3795
3795
|
assertEx29(limit > 0, () => "limit must be greater than 0");
|
|
3796
3796
|
assertEx29(limit <= 100, () => "limit must be less than 100");
|
|
3797
3797
|
const blocks = [];
|
|
@@ -3803,16 +3803,16 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3803
3803
|
current = await this.blockByNumber(previousNumber);
|
|
3804
3804
|
}
|
|
3805
3805
|
return blocks.map((b) => asSignedHydratedBlockWithHashMeta(b, true));
|
|
3806
|
-
},
|
|
3806
|
+
}, { timeBudgetLimit: 200 });
|
|
3807
3807
|
}
|
|
3808
3808
|
async chainId(blockNumber = "latest") {
|
|
3809
|
-
return await
|
|
3809
|
+
return await this.spanAsync("chainId", async () => {
|
|
3810
3810
|
const block = assertEx29(
|
|
3811
3811
|
blockNumber === "latest" ? await this.currentBlock() : await this.blockByNumber(blockNumber),
|
|
3812
3812
|
() => `Could not find block for block number ${blockNumber}`
|
|
3813
3813
|
);
|
|
3814
3814
|
return block[0].chain;
|
|
3815
|
-
});
|
|
3815
|
+
}, { timeBudgetLimit: 200 });
|
|
3816
3816
|
}
|
|
3817
3817
|
async createHandler() {
|
|
3818
3818
|
await super.createHandler();
|
|
@@ -4215,8 +4215,7 @@ SimpleFinalizationRunner = __decorateClass([
|
|
|
4215
4215
|
|
|
4216
4216
|
// src/simple/finalization/SimpleFinalizationViewer.ts
|
|
4217
4217
|
import {
|
|
4218
|
-
assertEx as assertEx31
|
|
4219
|
-
spanRootAsync as spanRootAsync6
|
|
4218
|
+
assertEx as assertEx31
|
|
4220
4219
|
} from "@xylabs/sdk-js";
|
|
4221
4220
|
import {
|
|
4222
4221
|
asSignedHydratedBlockWithStorageMeta as asSignedHydratedBlockWithStorageMeta2
|
|
@@ -4249,7 +4248,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4249
4248
|
this._store = { chainMap: readPayloadMapFromStore(this.params.finalizedArchivist) };
|
|
4250
4249
|
}
|
|
4251
4250
|
async head() {
|
|
4252
|
-
return await
|
|
4251
|
+
return await this.spanAsync("head", async () => {
|
|
4253
4252
|
const currentHead = assertEx31(await this.getCurrentHead(), () => "Could not find most recent block [currentBlock]");
|
|
4254
4253
|
const cache = this.hydratedBlockCache;
|
|
4255
4254
|
const block = await cache.get(currentHead._hash);
|
|
@@ -4257,7 +4256,7 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4257
4256
|
console.log(`Could not find current block with hash ${currentHead._hash}`);
|
|
4258
4257
|
}
|
|
4259
4258
|
return assertEx31(block, () => "Could not find current block");
|
|
4260
|
-
},
|
|
4259
|
+
}, { timeBudgetLimit: 200 });
|
|
4261
4260
|
}
|
|
4262
4261
|
async headBlock() {
|
|
4263
4262
|
return (await this.head())[0];
|