@xyo-network/xl1-protocol-sdk 1.19.9 → 1.19.10
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 +18 -4
- package/dist/neutral/index.mjs.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/finalization/SimpleFinalizationViewer.ts +24 -6
package/dist/neutral/index.mjs
CHANGED
|
@@ -4317,8 +4317,16 @@ import {
|
|
|
4317
4317
|
} from "@xyo-network/xl1-protocol";
|
|
4318
4318
|
var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
4319
4319
|
moniker = SimpleFinalizationViewer.defaultMoniker;
|
|
4320
|
+
_chainContractViewer;
|
|
4321
|
+
_chainId;
|
|
4320
4322
|
_store;
|
|
4321
4323
|
_signedHydratedBlockCache;
|
|
4324
|
+
get chainContractViewer() {
|
|
4325
|
+
return this._chainContractViewer;
|
|
4326
|
+
}
|
|
4327
|
+
get chainId() {
|
|
4328
|
+
return this._chainId;
|
|
4329
|
+
}
|
|
4322
4330
|
get finalizedArchivist() {
|
|
4323
4331
|
return this.params.finalizedArchivist;
|
|
4324
4332
|
}
|
|
@@ -4335,11 +4343,15 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4335
4343
|
return this._store;
|
|
4336
4344
|
}
|
|
4337
4345
|
static async paramsHandler(params) {
|
|
4338
|
-
|
|
4339
|
-
|
|
4346
|
+
return {
|
|
4347
|
+
...await super.paramsHandler(params),
|
|
4348
|
+
finalizedArchivist: assertEx33(params.finalizedArchivist, () => "finalizedArchivist is required")
|
|
4349
|
+
};
|
|
4340
4350
|
}
|
|
4341
4351
|
async createHandler() {
|
|
4342
4352
|
await super.createHandler();
|
|
4353
|
+
this._chainContractViewer = await this.locateAndCreate(ChainContractViewerMoniker);
|
|
4354
|
+
this._chainId = await this.chainContractViewer.chainId();
|
|
4343
4355
|
this._store = { chainMap: readPayloadMapFromStore(this.params.finalizedArchivist) };
|
|
4344
4356
|
}
|
|
4345
4357
|
async head() {
|
|
@@ -4364,11 +4376,13 @@ var SimpleFinalizationViewer = class extends AbstractCreatableProvider {
|
|
|
4364
4376
|
}
|
|
4365
4377
|
async getCurrentHead() {
|
|
4366
4378
|
const chainArchivist = this.finalizedArchivist;
|
|
4367
|
-
|
|
4379
|
+
const result = assertEx33(await findMostRecentBlock(chainArchivist), () => "Could not find most recent block [getCurrentHead]");
|
|
4380
|
+
assertEx33(result?.chain === this.chainId, () => "Chain ID does not match head block chain ID");
|
|
4381
|
+
return result;
|
|
4368
4382
|
}
|
|
4369
4383
|
};
|
|
4370
4384
|
__publicField(SimpleFinalizationViewer, "defaultMoniker", FinalizationViewerMoniker);
|
|
4371
|
-
__publicField(SimpleFinalizationViewer, "dependencies", []);
|
|
4385
|
+
__publicField(SimpleFinalizationViewer, "dependencies", [ChainContractViewerMoniker]);
|
|
4372
4386
|
__publicField(SimpleFinalizationViewer, "monikers", [FinalizationViewerMoniker]);
|
|
4373
4387
|
SimpleFinalizationViewer = __decorateClass([
|
|
4374
4388
|
creatableProvider()
|