@xyo-network/xl1-protocol-sdk 2.1.4 → 2.1.5
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
CHANGED
|
@@ -3581,7 +3581,7 @@ import {
|
|
|
3581
3581
|
BlockViewerMoniker,
|
|
3582
3582
|
isChainQualifiedHeadConfig as isChainQualifiedHeadConfig4,
|
|
3583
3583
|
isChainQualifiedRangeConfig as isChainQualifiedRangeConfig4,
|
|
3584
|
-
StepSizes as
|
|
3584
|
+
StepSizes as StepSizes12,
|
|
3585
3585
|
TransferSchema as TransferSchema2
|
|
3586
3586
|
} from "@xyo-network/xl1-protocol-lib";
|
|
3587
3587
|
import { Semaphore } from "async-mutex";
|
|
@@ -3803,8 +3803,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
|
|
|
3803
3803
|
}
|
|
3804
3804
|
|
|
3805
3805
|
// src/summary/primitives/schemas/schemasMaxStep.ts
|
|
3806
|
-
|
|
3807
|
-
var schemasMaxStep = StepSizes10.length - 1;
|
|
3806
|
+
var schemasMaxStep = 5;
|
|
3808
3807
|
|
|
3809
3808
|
// src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
|
|
3810
3809
|
import { assertEx as assertEx29 } from "@xylabs/sdk-js";
|
|
@@ -3814,7 +3813,7 @@ import {
|
|
|
3814
3813
|
isHashMeta,
|
|
3815
3814
|
PayloadBuilder as PayloadBuilder17
|
|
3816
3815
|
} from "@xyo-network/sdk-js";
|
|
3817
|
-
import { StepSizes as
|
|
3816
|
+
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
|
|
3818
3817
|
async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
3819
3818
|
const [frameHead] = assertEx29(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
3820
3819
|
const frameSize = range[1] - range[0] + 1;
|
|
@@ -3836,8 +3835,8 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3836
3835
|
schemas
|
|
3837
3836
|
});
|
|
3838
3837
|
} else {
|
|
3839
|
-
const step =
|
|
3840
|
-
assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${
|
|
3838
|
+
const step = StepSizes10.indexOf(frameSize);
|
|
3839
|
+
assertEx29(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes10.join(", ")}`);
|
|
3841
3840
|
const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
|
|
3842
3841
|
if (isAnyPayload5(summaryResult)) {
|
|
3843
3842
|
result = summaryResult;
|
|
@@ -3911,7 +3910,7 @@ var transfersMaxStep = 4;
|
|
|
3911
3910
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
3912
3911
|
import { assertEx as assertEx31, spanRootAsync as spanRootAsync6 } from "@xylabs/sdk-js";
|
|
3913
3912
|
import { isAnyPayload as isAnyPayload6 } from "@xyo-network/sdk-js";
|
|
3914
|
-
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as
|
|
3913
|
+
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol-lib";
|
|
3915
3914
|
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
3916
3915
|
return `${frameHeadHash}|${frameSize}`;
|
|
3917
3916
|
}
|
|
@@ -3938,8 +3937,8 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
3938
3937
|
transfers
|
|
3939
3938
|
};
|
|
3940
3939
|
} else {
|
|
3941
|
-
const step =
|
|
3942
|
-
assertEx31(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${
|
|
3940
|
+
const step = StepSizes11.indexOf(asXL1BlockNumber7(frameSize, true));
|
|
3941
|
+
assertEx31(step !== -1, () => `Invalid step size: ${frameSize}. Must be one of ${StepSizes11.join(", ")}`);
|
|
3943
3942
|
const key = transfersSummaryKey(frameHead._hash, frameSize);
|
|
3944
3943
|
const summaryResult = await summaryMap.get(key);
|
|
3945
3944
|
if (isAnyPayload6(summaryResult)) {
|
|
@@ -4027,9 +4026,9 @@ async function transfersSummary(context, semaphores, blockViewer, summaryMap, co
|
|
|
4027
4026
|
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
4028
4027
|
var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
4029
4028
|
moniker = SimpleAccountBalanceViewer.defaultMoniker;
|
|
4030
|
-
_balanceStepSemaphores =
|
|
4029
|
+
_balanceStepSemaphores = StepSizes12.map(() => new Semaphore(20));
|
|
4031
4030
|
_blockViewer;
|
|
4032
|
-
_transferStepSemaphores =
|
|
4031
|
+
_transferStepSemaphores = StepSizes12.map(() => new Semaphore(20));
|
|
4033
4032
|
get balancesSummaryMap() {
|
|
4034
4033
|
return this.params.balancesSummaryMap;
|
|
4035
4034
|
}
|
|
@@ -4150,7 +4149,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4150
4149
|
}
|
|
4151
4150
|
async distillTransferHistory(address, range, max = 50) {
|
|
4152
4151
|
return await this.spanAsync("distillTransferHistory", async () => {
|
|
4153
|
-
if (range[1] - range[0] <=
|
|
4152
|
+
if (range[1] - range[0] <= StepSizes12[0] || max <= 1) {
|
|
4154
4153
|
return Array.from({ length: range[1] - range[0] + 1 }, (_, i) => range[1] - i).slice(0, max).map((n) => asXL1BlockNumber8(n, true));
|
|
4155
4154
|
}
|
|
4156
4155
|
const frames = deepCalculateFramesFromRange(asXL1BlockRange10(range, true), transfersMaxStep);
|
|
@@ -4165,7 +4164,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4165
4164
|
});
|
|
4166
4165
|
const resultBlockNumbers = /* @__PURE__ */ new Set();
|
|
4167
4166
|
for (const [frame] of sortedTransferSummaryPairs) {
|
|
4168
|
-
if (frame[1] - frame[0] + 1 >
|
|
4167
|
+
if (frame[1] - frame[0] + 1 > StepSizes12[0]) {
|
|
4169
4168
|
const values = await this.distillTransferHistory(address, asXL1BlockRange10([frame[0], frame[1] - 1], true), max - resultBlockNumbers.size);
|
|
4170
4169
|
for (const value of values) {
|
|
4171
4170
|
resultBlockNumbers.add(value);
|
|
@@ -4239,7 +4238,7 @@ import {
|
|
|
4239
4238
|
BlockViewerMoniker as BlockViewerMoniker2,
|
|
4240
4239
|
FinalizationViewerMoniker,
|
|
4241
4240
|
stepSize as stepSize2,
|
|
4242
|
-
StepSizes as
|
|
4241
|
+
StepSizes as StepSizes13
|
|
4243
4242
|
} from "@xyo-network/xl1-protocol-lib";
|
|
4244
4243
|
import { Semaphore as Semaphore2 } from "async-mutex";
|
|
4245
4244
|
|
|
@@ -4283,7 +4282,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4283
4282
|
finalizationViewer;
|
|
4284
4283
|
payloadCache = new LruCacheMap2({ max: 1e4 });
|
|
4285
4284
|
signedHydratedBlockWithHashMetaCache = new LruCacheMap2({ max: 2e3, ttl: 1e3 * 60 * 60 });
|
|
4286
|
-
_blockStepSemaphores =
|
|
4285
|
+
_blockStepSemaphores = StepSizes13.map(() => new Semaphore2(20));
|
|
4287
4286
|
_blocksSummaryMap;
|
|
4288
4287
|
_headPollHash;
|
|
4289
4288
|
_headPollInProgress = false;
|
|
@@ -6992,7 +6991,7 @@ import {
|
|
|
6992
6991
|
isBlockBoundWitness,
|
|
6993
6992
|
rewardAddressFromStepIdentity,
|
|
6994
6993
|
StepRewardFractions,
|
|
6995
|
-
StepSizes as
|
|
6994
|
+
StepSizes as StepSizes14,
|
|
6996
6995
|
XL1_PROTOCOL_VERSION,
|
|
6997
6996
|
XYO_STEP_REWARD_ADDRESS as XYO_STEP_REWARD_ADDRESS3,
|
|
6998
6997
|
XYO_ZERO_ADDRESS as XYO_ZERO_ADDRESS2
|
|
@@ -7074,7 +7073,7 @@ async function buildBlock(options) {
|
|
|
7074
7073
|
}
|
|
7075
7074
|
}
|
|
7076
7075
|
const completedStepRewardTransfers = [];
|
|
7077
|
-
for (const [i, step] of
|
|
7076
|
+
for (const [i, step] of StepSizes14.entries()) {
|
|
7078
7077
|
if (blockNumber < step) {
|
|
7079
7078
|
break;
|
|
7080
7079
|
}
|