@xyo-network/react-chain-blockchain 1.5.28 → 1.5.30
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/browser/index.mjs +6 -6
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts +2 -2
- package/dist/types/hooks/chain-iterator/ChainIteratorStore.d.ts.map +1 -1
- package/dist/types/stories/ChainInfoContextDecorator.d.ts.map +1 -1
- package/package.json +39 -39
- package/src/hooks/chain-iterator/ChainIteratorStore.ts +3 -3
- package/src/hooks/useIterateChain.ts +2 -2
- package/src/stories/ChainInfoContextDecorator.tsx +4 -3
package/dist/browser/index.mjs
CHANGED
|
@@ -342,7 +342,7 @@ import React8, { Fragment, useMemo as useMemo6, useState as useState7 } from "re
|
|
|
342
342
|
// src/hooks/chain-iterator/ChainIteratorStore.ts
|
|
343
343
|
import { assertEx } from "@xylabs/assert";
|
|
344
344
|
import { hydrateBlock } from "@xyo-network/chain-protocol";
|
|
345
|
-
import {
|
|
345
|
+
import { ChainBlockNumberIterationService } from "@xyo-network/chain-services";
|
|
346
346
|
import { PayloadBuilder as PayloadBuilder2 } from "@xyo-network/payload-builder";
|
|
347
347
|
var ChainIteratorStore = class _ChainIteratorStore {
|
|
348
348
|
static {
|
|
@@ -360,7 +360,7 @@ var ChainIteratorStore = class _ChainIteratorStore {
|
|
|
360
360
|
}
|
|
361
361
|
static async create(params) {
|
|
362
362
|
const instance = new _ChainIteratorStore();
|
|
363
|
-
const chainIterator = await
|
|
363
|
+
const chainIterator = await ChainBlockNumberIterationService.create(params);
|
|
364
364
|
instance._chainIterator = chainIterator;
|
|
365
365
|
const head = await chainIterator.head();
|
|
366
366
|
const hydratedHead = await hydrateBlock(params.chainArchivist, await PayloadBuilder2.hash(head));
|
|
@@ -546,7 +546,7 @@ var useChainIteratorStore = /* @__PURE__ */ __name((chainIteratorParams) => {
|
|
|
546
546
|
import { assertEx as assertEx3 } from "@xylabs/assert";
|
|
547
547
|
import { usePromise as usePromise3 } from "@xylabs/react-promise";
|
|
548
548
|
import { hydrateBlock as hydrateBlock2 } from "@xyo-network/chain-protocol";
|
|
549
|
-
import {
|
|
549
|
+
import { ChainBlockNumberIterationService as ChainBlockNumberIterationService2 } from "@xyo-network/chain-services";
|
|
550
550
|
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
551
551
|
import { isBlockBoundWitness as isBlockBoundWitness2 } from "@xyo-network/xl1-protocol";
|
|
552
552
|
var getHydratedBlock = /* @__PURE__ */ __name(async (chainArchivist, head) => {
|
|
@@ -557,7 +557,7 @@ var iterateChain = /* @__PURE__ */ __name(async (chainIteratorParams, maxDepth)
|
|
|
557
557
|
const { chainArchivist, head } = chainIteratorParams ?? {};
|
|
558
558
|
const headPayload = assertEx3(isBlockBoundWitness2(head) ? head : null, () => "Head is not a Block Bound Witness");
|
|
559
559
|
const headBlockBoundWitness = assertEx3(isBlockBoundWitness2(headPayload) ? headPayload : null, () => "Invalid head block");
|
|
560
|
-
const chainIterator = await
|
|
560
|
+
const chainIterator = await ChainBlockNumberIterationService2.create({
|
|
561
561
|
head: headBlockBoundWitness,
|
|
562
562
|
chainArchivist
|
|
563
563
|
});
|
|
@@ -2336,7 +2336,7 @@ var ChainArchivistDelayedInsertDecorator = /* @__PURE__ */ __name((Story, contex
|
|
|
2336
2336
|
// src/stories/ChainInfoContextDecorator.tsx
|
|
2337
2337
|
import { assertEx as assertEx5 } from "@xylabs/assert";
|
|
2338
2338
|
import { usePromise as usePromise9 } from "@xylabs/react-promise";
|
|
2339
|
-
import {
|
|
2339
|
+
import { ChainBlockNumberIterationService as ChainBlockNumberIterationService3 } from "@xyo-network/chain-services";
|
|
2340
2340
|
import { findFirstMatching } from "@xyo-network/chain-utils";
|
|
2341
2341
|
import { isBlockBoundWitness as isBlockBoundWitness3 } from "@xyo-network/xl1-protocol";
|
|
2342
2342
|
import React48 from "react";
|
|
@@ -2356,7 +2356,7 @@ var ChainInfoContextDecorator = /* @__PURE__ */ __name((Story, context) => {
|
|
|
2356
2356
|
if (chainArchivist && chainInformation) {
|
|
2357
2357
|
const firstMatch = assertEx5(await findFirstMatching(chainArchivist), () => `No head found in archivist: ${chainArchivist.id} `);
|
|
2358
2358
|
const head = assertEx5(isBlockBoundWitness3(firstMatch) ? firstMatch : void 0, () => `Expected a block bound witness: ${JSON.stringify(firstMatch)}`);
|
|
2359
|
-
return await
|
|
2359
|
+
return await ChainBlockNumberIterationService3.create({
|
|
2360
2360
|
chainArchivist,
|
|
2361
2361
|
head
|
|
2362
2362
|
});
|