@xyo-network/xl1-protocol-sdk 1.19.9 → 1.19.11
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 +23 -11
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/simple/block/SimpleBlockViewer.d.ts +2 -3
- package/dist/neutral/simple/block/SimpleBlockViewer.d.ts.map +1 -1
- package/dist/neutral/simple/finalization/SimpleFinalizationViewer.d.ts +9 -4
- package/dist/neutral/simple/finalization/SimpleFinalizationViewer.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/simple/block/SimpleBlockViewer.ts +6 -9
- package/src/simple/finalization/SimpleFinalizationViewer.ts +24 -6
package/dist/neutral/index.mjs
CHANGED
|
@@ -3750,12 +3750,10 @@ var prettifyZodError = (error) => {
|
|
|
3750
3750
|
var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
3751
3751
|
moniker = SimpleBlockViewer.defaultMoniker;
|
|
3752
3752
|
_store;
|
|
3753
|
+
chainContractViewer;
|
|
3753
3754
|
finalizationViewer;
|
|
3754
3755
|
_payloadCache;
|
|
3755
3756
|
_signedHydratedBlockCache;
|
|
3756
|
-
get chainContractViewer() {
|
|
3757
|
-
return this.params.chainContractViewer;
|
|
3758
|
-
}
|
|
3759
3757
|
get finalizedArchivist() {
|
|
3760
3758
|
return this.params.finalizedArchivist;
|
|
3761
3759
|
}
|
|
@@ -3779,10 +3777,6 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3779
3777
|
static async paramsHandler(params) {
|
|
3780
3778
|
return {
|
|
3781
3779
|
...await super.paramsHandler(params),
|
|
3782
|
-
chainContractViewer: assertEx29(
|
|
3783
|
-
params.chainContractViewer ?? await params.context?.locator.getInstance(ChainContractViewerMoniker),
|
|
3784
|
-
() => "chainContractViewer is required"
|
|
3785
|
-
),
|
|
3786
3780
|
finalizedArchivist: assertEx29(params.finalizedArchivist, () => "finalizedArchivist is required")
|
|
3787
3781
|
};
|
|
3788
3782
|
}
|
|
@@ -3845,6 +3839,10 @@ var SimpleBlockViewer = class extends AbstractCreatableProvider {
|
|
|
3845
3839
|
}
|
|
3846
3840
|
async createHandler() {
|
|
3847
3841
|
await super.createHandler();
|
|
3842
|
+
this.chainContractViewer = this.params.chainContractViewer ?? assertEx29(
|
|
3843
|
+
await this.locateAndCreate(ChainContractViewerMoniker),
|
|
3844
|
+
() => "chainContractViewer is required"
|
|
3845
|
+
);
|
|
3848
3846
|
this.finalizationViewer = await this.locator.getInstance(FinalizationViewerMoniker);
|
|
3849
3847
|
this._store = { chainMap: readPayloadMapFromStore(this.params.finalizedArchivist) };
|
|
3850
3848
|
}
|
|
@@ -4317,8 +4315,16 @@ import {
|
|
|
4317
4315
|
} from "@xyo-network/xl1-protocol";
|
|
4318
4316
|
var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
4319
4317
|
moniker = SimpleFinalizationViewer.defaultMoniker;
|
|
4318
|
+
_chainContractViewer;
|
|
4319
|
+
_chainId;
|
|
4320
4320
|
_store;
|
|
4321
4321
|
_signedHydratedBlockCache;
|
|
4322
|
+
get chainContractViewer() {
|
|
4323
|
+
return this._chainContractViewer;
|
|
4324
|
+
}
|
|
4325
|
+
get chainId() {
|
|
4326
|
+
return this._chainId;
|
|
4327
|
+
}
|
|
4322
4328
|
get finalizedArchivist() {
|
|
4323
4329
|
return this.params.finalizedArchivist;
|
|
4324
4330
|
}
|
|
@@ -4335,11 +4341,15 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4335
4341
|
return this._store;
|
|
4336
4342
|
}
|
|
4337
4343
|
static async paramsHandler(params) {
|
|
4338
|
-
|
|
4339
|
-
|
|
4344
|
+
return {
|
|
4345
|
+
...await super.paramsHandler(params),
|
|
4346
|
+
finalizedArchivist: assertEx33(params.finalizedArchivist, () => "finalizedArchivist is required")
|
|
4347
|
+
};
|
|
4340
4348
|
}
|
|
4341
4349
|
async createHandler() {
|
|
4342
4350
|
await super.createHandler();
|
|
4351
|
+
this._chainContractViewer = await this.locateAndCreate(ChainContractViewerMoniker);
|
|
4352
|
+
this._chainId = await this.chainContractViewer.chainId();
|
|
4343
4353
|
this._store = { chainMap: readPayloadMapFromStore(this.params.finalizedArchivist) };
|
|
4344
4354
|
}
|
|
4345
4355
|
async head() {
|
|
@@ -4364,11 +4374,13 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4364
4374
|
}
|
|
4365
4375
|
async getCurrentHead() {
|
|
4366
4376
|
const chainArchivist = this.finalizedArchivist;
|
|
4367
|
-
|
|
4377
|
+
const result = assertEx33(await findMostRecentBlock(chainArchivist), () => "Could not find most recent block [getCurrentHead]");
|
|
4378
|
+
assertEx33(result?.chain === this.chainId, () => "Chain ID does not match head block chain ID");
|
|
4379
|
+
return result;
|
|
4368
4380
|
}
|
|
4369
4381
|
};
|
|
4370
4382
|
__publicField(SimpleFinalizationViewer, "defaultMoniker", FinalizationViewerMoniker);
|
|
4371
|
-
__publicField(SimpleFinalizationViewer, "dependencies", []);
|
|
4383
|
+
__publicField(SimpleFinalizationViewer, "dependencies", [ChainContractViewerMoniker]);
|
|
4372
4384
|
__publicField(SimpleFinalizationViewer, "monikers", [FinalizationViewerMoniker]);
|
|
4373
4385
|
SimpleFinalizationViewer = __decorateClass([
|
|
4374
4386
|
creatableProvider()
|