@xyo-network/xl1-protocol-sdk 2.1.3 → 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/CreatableProvider/AbstractCreatableProvider.d.ts +1 -0
- package/dist/neutral/CreatableProvider/AbstractCreatableProvider.d.ts.map +1 -1
- package/dist/neutral/config/Actor.d.ts +6 -0
- package/dist/neutral/config/Actor.d.ts.map +1 -1
- package/dist/neutral/config/Actors.d.ts +1 -0
- package/dist/neutral/config/Actors.d.ts.map +1 -1
- package/dist/neutral/config/Base.d.ts +1 -0
- package/dist/neutral/config/Base.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +4 -0
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/HostActor.d.ts +6 -0
- package/dist/neutral/config/HostActor.d.ts.map +1 -1
- package/dist/neutral/config/storage/Storage.d.ts +1 -0
- package/dist/neutral/config/storage/Storage.d.ts.map +1 -1
- package/dist/neutral/config/storage/driver/R2.d.ts +1 -0
- package/dist/neutral/config/storage/driver/R2.d.ts.map +1 -1
- package/dist/neutral/context/Actor.d.ts +6 -0
- package/dist/neutral/context/Actor.d.ts.map +1 -1
- package/dist/neutral/context/HostActor.d.ts +6 -0
- package/dist/neutral/context/HostActor.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.d.ts +2 -0
- package/dist/neutral/getFileConfig.d.ts.map +1 -1
- package/dist/neutral/getFileConfig.mjs +5 -0
- package/dist/neutral/getFileConfig.mjs.map +2 -2
- package/dist/neutral/index.mjs +21 -17
- package/dist/neutral/index.mjs.map +3 -3
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts +6 -0
- package/dist/neutral/model/CreatableProviderContext.zod.d.ts.map +1 -1
- package/dist/neutral/summary/primitives/schemas/schemasMaxStep.d.ts +1 -1
- package/dist/neutral/summary/primitives/schemas/schemasMaxStep.d.ts.map +1 -1
- package/dist/neutral/test/index.mjs +5 -0
- package/dist/neutral/test/index.mjs.map +2 -2
- package/package.json +15 -19
package/dist/neutral/index.mjs
CHANGED
|
@@ -1393,6 +1393,11 @@ var R2ConfigZod = z13.object({
|
|
|
1393
1393
|
title: "storage.r2.bucket",
|
|
1394
1394
|
type: "string"
|
|
1395
1395
|
}),
|
|
1396
|
+
chainStateBucket: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1397
|
+
description: "Cloudflare R2 bucket for the mutable chain state (the head pointer); defaults to `bucket` when unset",
|
|
1398
|
+
title: "storage.r2.chainStateBucket",
|
|
1399
|
+
type: "string"
|
|
1400
|
+
}),
|
|
1396
1401
|
prefix: z13.string().nonempty().optional().register(globalRegistry9, {
|
|
1397
1402
|
description: "Optional key prefix namespacing this store within the bucket",
|
|
1398
1403
|
title: "storage.r2.prefix",
|
|
@@ -3576,7 +3581,7 @@ import {
|
|
|
3576
3581
|
BlockViewerMoniker,
|
|
3577
3582
|
isChainQualifiedHeadConfig as isChainQualifiedHeadConfig4,
|
|
3578
3583
|
isChainQualifiedRangeConfig as isChainQualifiedRangeConfig4,
|
|
3579
|
-
StepSizes as
|
|
3584
|
+
StepSizes as StepSizes12,
|
|
3580
3585
|
TransferSchema as TransferSchema2
|
|
3581
3586
|
} from "@xyo-network/xl1-protocol-lib";
|
|
3582
3587
|
import { Semaphore } from "async-mutex";
|
|
@@ -3798,8 +3803,7 @@ async function blocksStepSummaryFromRange(context, semaphores, blockViewer, summ
|
|
|
3798
3803
|
}
|
|
3799
3804
|
|
|
3800
3805
|
// src/summary/primitives/schemas/schemasMaxStep.ts
|
|
3801
|
-
|
|
3802
|
-
var schemasMaxStep = StepSizes10.length - 1;
|
|
3806
|
+
var schemasMaxStep = 5;
|
|
3803
3807
|
|
|
3804
3808
|
// src/summary/primitives/schemas/schemasStepSummaryFromRange.ts
|
|
3805
3809
|
import { assertEx as assertEx29 } from "@xylabs/sdk-js";
|
|
@@ -3809,7 +3813,7 @@ import {
|
|
|
3809
3813
|
isHashMeta,
|
|
3810
3814
|
PayloadBuilder as PayloadBuilder17
|
|
3811
3815
|
} from "@xyo-network/sdk-js";
|
|
3812
|
-
import { StepSizes as
|
|
3816
|
+
import { StepSizes as StepSizes10 } from "@xyo-network/xl1-protocol-lib";
|
|
3813
3817
|
async function schemasStepSummaryFromRange(context, semaphores, blockViewer, summaryMap, range) {
|
|
3814
3818
|
const [frameHead] = assertEx29(await blockViewer.blockByNumber(range[1]), () => `Block not found for number: ${range[1]}`);
|
|
3815
3819
|
const frameSize = range[1] - range[0] + 1;
|
|
@@ -3831,8 +3835,8 @@ async function schemasStepSummaryFromRange(context, semaphores, blockViewer, sum
|
|
|
3831
3835
|
schemas
|
|
3832
3836
|
});
|
|
3833
3837
|
} else {
|
|
3834
|
-
const step =
|
|
3835
|
-
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(", ")}`);
|
|
3836
3840
|
const summaryResult = await summaryMap.get(`${frameHead._hash}|${frameSize}`);
|
|
3837
3841
|
if (isAnyPayload5(summaryResult)) {
|
|
3838
3842
|
result = summaryResult;
|
|
@@ -3906,7 +3910,7 @@ var transfersMaxStep = 4;
|
|
|
3906
3910
|
// src/summary/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
3907
3911
|
import { assertEx as assertEx31, spanRootAsync as spanRootAsync6 } from "@xylabs/sdk-js";
|
|
3908
3912
|
import { isAnyPayload as isAnyPayload6 } from "@xyo-network/sdk-js";
|
|
3909
|
-
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as
|
|
3913
|
+
import { asXL1BlockNumber as asXL1BlockNumber7, StepSizes as StepSizes11 } from "@xyo-network/xl1-protocol-lib";
|
|
3910
3914
|
function transfersSummaryKey(frameHeadHash, frameSize) {
|
|
3911
3915
|
return `${frameHeadHash}|${frameSize}`;
|
|
3912
3916
|
}
|
|
@@ -3933,8 +3937,8 @@ async function transfersStepSummaryFromRange(context, semaphores, blockViewer, s
|
|
|
3933
3937
|
transfers
|
|
3934
3938
|
};
|
|
3935
3939
|
} else {
|
|
3936
|
-
const step =
|
|
3937
|
-
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(", ")}`);
|
|
3938
3942
|
const key = transfersSummaryKey(frameHead._hash, frameSize);
|
|
3939
3943
|
const summaryResult = await summaryMap.get(key);
|
|
3940
3944
|
if (isAnyPayload6(summaryResult)) {
|
|
@@ -4022,9 +4026,9 @@ async function transfersSummary(context, semaphores, blockViewer, summaryMap, co
|
|
|
4022
4026
|
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
4023
4027
|
var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
4024
4028
|
moniker = SimpleAccountBalanceViewer.defaultMoniker;
|
|
4025
|
-
_balanceStepSemaphores =
|
|
4029
|
+
_balanceStepSemaphores = StepSizes12.map(() => new Semaphore(20));
|
|
4026
4030
|
_blockViewer;
|
|
4027
|
-
_transferStepSemaphores =
|
|
4031
|
+
_transferStepSemaphores = StepSizes12.map(() => new Semaphore(20));
|
|
4028
4032
|
get balancesSummaryMap() {
|
|
4029
4033
|
return this.params.balancesSummaryMap;
|
|
4030
4034
|
}
|
|
@@ -4145,7 +4149,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4145
4149
|
}
|
|
4146
4150
|
async distillTransferHistory(address, range, max = 50) {
|
|
4147
4151
|
return await this.spanAsync("distillTransferHistory", async () => {
|
|
4148
|
-
if (range[1] - range[0] <=
|
|
4152
|
+
if (range[1] - range[0] <= StepSizes12[0] || max <= 1) {
|
|
4149
4153
|
return Array.from({ length: range[1] - range[0] + 1 }, (_, i) => range[1] - i).slice(0, max).map((n) => asXL1BlockNumber8(n, true));
|
|
4150
4154
|
}
|
|
4151
4155
|
const frames = deepCalculateFramesFromRange(asXL1BlockRange10(range, true), transfersMaxStep);
|
|
@@ -4160,7 +4164,7 @@ var SimpleAccountBalanceViewer = class extends AbstractCreatableProvider {
|
|
|
4160
4164
|
});
|
|
4161
4165
|
const resultBlockNumbers = /* @__PURE__ */ new Set();
|
|
4162
4166
|
for (const [frame] of sortedTransferSummaryPairs) {
|
|
4163
|
-
if (frame[1] - frame[0] + 1 >
|
|
4167
|
+
if (frame[1] - frame[0] + 1 > StepSizes12[0]) {
|
|
4164
4168
|
const values = await this.distillTransferHistory(address, asXL1BlockRange10([frame[0], frame[1] - 1], true), max - resultBlockNumbers.size);
|
|
4165
4169
|
for (const value of values) {
|
|
4166
4170
|
resultBlockNumbers.add(value);
|
|
@@ -4234,7 +4238,7 @@ import {
|
|
|
4234
4238
|
BlockViewerMoniker as BlockViewerMoniker2,
|
|
4235
4239
|
FinalizationViewerMoniker,
|
|
4236
4240
|
stepSize as stepSize2,
|
|
4237
|
-
StepSizes as
|
|
4241
|
+
StepSizes as StepSizes13
|
|
4238
4242
|
} from "@xyo-network/xl1-protocol-lib";
|
|
4239
4243
|
import { Semaphore as Semaphore2 } from "async-mutex";
|
|
4240
4244
|
|
|
@@ -4278,7 +4282,7 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
4278
4282
|
finalizationViewer;
|
|
4279
4283
|
payloadCache = new LruCacheMap2({ max: 1e4 });
|
|
4280
4284
|
signedHydratedBlockWithHashMetaCache = new LruCacheMap2({ max: 2e3, ttl: 1e3 * 60 * 60 });
|
|
4281
|
-
_blockStepSemaphores =
|
|
4285
|
+
_blockStepSemaphores = StepSizes13.map(() => new Semaphore2(20));
|
|
4282
4286
|
_blocksSummaryMap;
|
|
4283
4287
|
_headPollHash;
|
|
4284
4288
|
_headPollInProgress = false;
|
|
@@ -6987,7 +6991,7 @@ import {
|
|
|
6987
6991
|
isBlockBoundWitness,
|
|
6988
6992
|
rewardAddressFromStepIdentity,
|
|
6989
6993
|
StepRewardFractions,
|
|
6990
|
-
StepSizes as
|
|
6994
|
+
StepSizes as StepSizes14,
|
|
6991
6995
|
XL1_PROTOCOL_VERSION,
|
|
6992
6996
|
XYO_STEP_REWARD_ADDRESS as XYO_STEP_REWARD_ADDRESS3,
|
|
6993
6997
|
XYO_ZERO_ADDRESS as XYO_ZERO_ADDRESS2
|
|
@@ -7069,7 +7073,7 @@ async function buildBlock(options) {
|
|
|
7069
7073
|
}
|
|
7070
7074
|
}
|
|
7071
7075
|
const completedStepRewardTransfers = [];
|
|
7072
|
-
for (const [i, step] of
|
|
7076
|
+
for (const [i, step] of StepSizes14.entries()) {
|
|
7073
7077
|
if (blockNumber < step) {
|
|
7074
7078
|
break;
|
|
7075
7079
|
}
|