@xyo-network/react-chain-blockchain 1.3.17 → 1.3.19
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 +37 -32
- package/dist/browser/index.mjs.map +1 -1
- package/dist/types/components/transactions/TransactionsQuickTipButton.d.ts.map +1 -1
- package/dist/types/components/transactions/submit/SubmitChain.d.ts.map +1 -1
- package/dist/types/context/analyzer/Provider.d.ts.map +1 -1
- package/dist/types/context/analyzer/context.d.ts +22 -2
- package/dist/types/context/analyzer/context.d.ts.map +1 -1
- package/dist/types/context/analyzer/state.d.ts +3 -3
- package/dist/types/context/analyzer/state.d.ts.map +1 -1
- package/dist/types/context/analyzer/use.d.ts +8 -1
- package/dist/types/context/analyzer/use.d.ts.map +1 -1
- package/dist/types/context/chain/Context.d.ts +19 -2
- package/dist/types/context/chain/Context.d.ts.map +1 -1
- package/dist/types/context/chain/State.d.ts +3 -3
- package/dist/types/context/chain/State.d.ts.map +1 -1
- package/dist/types/context/chain/use.d.ts +7 -1
- package/dist/types/context/chain/use.d.ts.map +1 -1
- package/dist/types/context/polling/context.d.ts +16 -2
- package/dist/types/context/polling/context.d.ts.map +1 -1
- package/dist/types/context/polling/state.d.ts +3 -3
- package/dist/types/context/polling/state.d.ts.map +1 -1
- package/dist/types/context/polling/use.d.ts +6 -1
- package/dist/types/context/polling/use.d.ts.map +1 -1
- package/dist/types/helpers/txsFromBlock.d.ts +2 -8
- package/dist/types/helpers/txsFromBlock.d.ts.map +1 -1
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts +1 -3
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/dist/types/hooks/useTxsFromBlock.d.ts +1 -7
- package/dist/types/hooks/useTxsFromBlock.d.ts.map +1 -1
- package/package.json +45 -44
- package/src/components/block/table/Ex.stories.tsx +2 -2
- package/src/components/transactions/TransactionsQuickTipButton.tsx +2 -1
- package/src/components/transactions/submit/SubmitChain.tsx +23 -21
- package/src/context/analyzer/Provider.tsx +3 -2
- package/src/context/analyzer/context.ts +1 -1
- package/src/context/analyzer/state.ts +3 -3
- package/src/context/analyzer/use.ts +1 -1
- package/src/context/chain/Context.ts +1 -1
- package/src/context/chain/Provider.tsx +1 -1
- package/src/context/chain/State.ts +3 -3
- package/src/context/chain/use.ts +1 -1
- package/src/context/polling/Provider.tsx +1 -1
- package/src/context/polling/context.ts +1 -1
- package/src/context/polling/state.ts +3 -3
- package/src/context/polling/use.ts +1 -1
- package/src/helpers/txsFromBlock.ts +6 -4
package/dist/browser/index.mjs
CHANGED
|
@@ -8,10 +8,11 @@ import { usePayloadHash } from "@xyo-network/react-shared";
|
|
|
8
8
|
import React13 from "react";
|
|
9
9
|
|
|
10
10
|
// src/context/analyzer/context.ts
|
|
11
|
-
import { createContextEx } from "@
|
|
11
|
+
import { createContextEx } from "@xylabs/react-shared";
|
|
12
12
|
var ChainAnalyzersContext = createContextEx();
|
|
13
13
|
|
|
14
14
|
// src/context/analyzer/Provider.tsx
|
|
15
|
+
import { isUndefined } from "@xylabs/typeof";
|
|
15
16
|
import React, { useCallback, useMemo, useState } from "react";
|
|
16
17
|
var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp, children }) => {
|
|
17
18
|
const [analyzersState, setAnalyzersState] = useState(analyzersProp ?? {});
|
|
@@ -23,7 +24,7 @@ var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp,
|
|
|
23
24
|
analyzersProp
|
|
24
25
|
]);
|
|
25
26
|
const addAnalyzers = useCallback((analyzers2) => {
|
|
26
|
-
if (
|
|
27
|
+
if (isUndefined(analyzers2)) return;
|
|
27
28
|
setAnalyzersState((prev) => ({
|
|
28
29
|
...prev,
|
|
29
30
|
...analyzers2
|
|
@@ -56,11 +57,11 @@ var ChainAnalyzersProvider = /* @__PURE__ */ __name(({ analyzers: analyzersProp,
|
|
|
56
57
|
}, "ChainAnalyzersProvider");
|
|
57
58
|
|
|
58
59
|
// src/context/analyzer/use.ts
|
|
59
|
-
import { useContextEx } from "@
|
|
60
|
+
import { useContextEx } from "@xylabs/react-shared";
|
|
60
61
|
var useChainAnalyzersContext = /* @__PURE__ */ __name((required = false) => useContextEx(ChainAnalyzersContext, "ChainAnalyzers", required), "useChainAnalyzersContext");
|
|
61
62
|
|
|
62
63
|
// src/context/chain/Context.ts
|
|
63
|
-
import { createContextEx as createContextEx2 } from "@
|
|
64
|
+
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
64
65
|
var ChainInfoContext = createContextEx2();
|
|
65
66
|
|
|
66
67
|
// src/context/chain/Provider.tsx
|
|
@@ -115,7 +116,7 @@ var ChainInfoProvider = /* @__PURE__ */ __name(({ children, chainArchivist: chai
|
|
|
115
116
|
}, "ChainInfoProvider");
|
|
116
117
|
|
|
117
118
|
// src/context/polling/context.ts
|
|
118
|
-
import { createContextEx as createContextEx3 } from "@
|
|
119
|
+
import { createContextEx as createContextEx3 } from "@xylabs/react-shared";
|
|
119
120
|
var ChainPollingContext = createContextEx3();
|
|
120
121
|
|
|
121
122
|
// src/context/polling/Provider.tsx
|
|
@@ -139,7 +140,7 @@ var ChainPollingProvider = /* @__PURE__ */ __name(({ children, pollingState: pol
|
|
|
139
140
|
}, "ChainPollingProvider");
|
|
140
141
|
|
|
141
142
|
// src/context/polling/use.ts
|
|
142
|
-
import { useContextEx as useContextEx2 } from "@
|
|
143
|
+
import { useContextEx as useContextEx2 } from "@xylabs/react-shared";
|
|
143
144
|
var useChainPollingContext = /* @__PURE__ */ __name((required = false) => useContextEx2(ChainPollingContext, "ChainPolling", required), "useChainPollingContext");
|
|
144
145
|
|
|
145
146
|
// src/components/transactions/submit/Builder.tsx
|
|
@@ -251,26 +252,28 @@ var SubmitChainTransaction = /* @__PURE__ */ __name(() => {
|
|
|
251
252
|
const [result, setResult] = useState5();
|
|
252
253
|
const [error, setError] = useState5();
|
|
253
254
|
const onSubmitTx = /* @__PURE__ */ __name(async (chainTx) => {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
255
|
+
if (network) {
|
|
256
|
+
const randomAccount = await Account.random();
|
|
257
|
+
const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], [], randomAccount, chainTx.nbf, chainTx.exp);
|
|
258
|
+
const insertQuery = new PayloadBuilder({
|
|
259
|
+
schema: ArchivistInsertQuerySchema
|
|
260
|
+
}).build();
|
|
261
|
+
const [queryBoundWitness] = await new QueryBoundWitnessBuilder().payloads([
|
|
262
|
+
transactionBoundWitness
|
|
263
|
+
]).query(insertQuery).signer(randomAccount).build();
|
|
264
|
+
const response = await axios.post(network.href, [
|
|
265
|
+
queryBoundWitness,
|
|
266
|
+
[
|
|
267
|
+
insertQuery,
|
|
268
|
+
transactionBoundWitness,
|
|
269
|
+
chainTx
|
|
270
|
+
]
|
|
271
|
+
]);
|
|
272
|
+
if (response.data.errors.length > 0) {
|
|
273
|
+
setError(new Error(response.data.errors.map((e) => e.message).join("\n")));
|
|
274
|
+
} else {
|
|
275
|
+
setResult(response.data.data);
|
|
276
|
+
}
|
|
274
277
|
}
|
|
275
278
|
}, "onSubmitTx");
|
|
276
279
|
const onNetworkChange = /* @__PURE__ */ __name((url) => {
|
|
@@ -587,11 +590,13 @@ var useIterateChain = /* @__PURE__ */ __name((chainIteratorParams, maxDepth) =>
|
|
|
587
590
|
import { usePromise as usePromise4 } from "@xylabs/react-promise";
|
|
588
591
|
|
|
589
592
|
// src/helpers/txsFromBlock.ts
|
|
593
|
+
import { SignedHydratedBlockWrapper } from "@xyo-network/chain-wrappers";
|
|
590
594
|
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
591
|
-
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
592
595
|
var txsFromBlock = /* @__PURE__ */ __name(async (block) => {
|
|
593
|
-
const
|
|
594
|
-
|
|
596
|
+
const wrapper = await SignedHydratedBlockWrapper.parse(block);
|
|
597
|
+
const txs = wrapper.transactions;
|
|
598
|
+
const txPayloads = txs.map((tx) => tx.boundWitness);
|
|
599
|
+
return await PayloadBuilder4.hashPairs(txPayloads);
|
|
595
600
|
}, "txsFromBlock");
|
|
596
601
|
|
|
597
602
|
// src/hooks/useTxsFromBlock.ts
|
|
@@ -649,7 +654,7 @@ var TransactionsQuickTipButton = /* @__PURE__ */ __name(({ block, ...props }) =>
|
|
|
649
654
|
textOverflow: "ellipsis",
|
|
650
655
|
whiteSpace: "nowrap"
|
|
651
656
|
}
|
|
652
|
-
},
|
|
657
|
+
}, hash)), /* @__PURE__ */ React8.createElement(FlexRow, null, /* @__PURE__ */ React8.createElement(Collapse, {
|
|
653
658
|
in: copied,
|
|
654
659
|
unmountOnExit: true
|
|
655
660
|
}, /* @__PURE__ */ React8.createElement(Alert2, null, /* @__PURE__ */ React8.createElement(AlertTitle, null, "Previous hash copied to clipboard")))))))), /* @__PURE__ */ React8.createElement(Snackbar, {
|
|
@@ -729,10 +734,10 @@ var buildBlockChainRenderComponent = /* @__PURE__ */ __name(async (BlockComponen
|
|
|
729
734
|
|
|
730
735
|
// src/components/block/helpers/payloadCountsFromBlock.ts
|
|
731
736
|
import { BoundWitnessSchema } from "@xyo-network/boundwitness-model";
|
|
732
|
-
import { isTransactionBoundWitness
|
|
737
|
+
import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
|
|
733
738
|
var payloadCountsFromBlock = /* @__PURE__ */ __name(([block, payloads]) => {
|
|
734
739
|
const publicPayloads = block.payload_schemas.filter((schema) => schema !== BoundWitnessSchema);
|
|
735
|
-
const transactionHashes = payloads.filter((payload) =>
|
|
740
|
+
const transactionHashes = payloads.filter((payload) => isTransactionBoundWitness(payload)).flatMap((payload) => payload.payload_hashes);
|
|
736
741
|
const privateHashes = transactionHashes.filter((hash) => !publicPayloads.includes(hash));
|
|
737
742
|
return [
|
|
738
743
|
publicPayloads.length,
|