@xyo-network/react-chain-blockchain 1.3.18 → 1.3.20
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 +29 -26
- package/dist/browser/index.mjs.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/hooks/chain-iterator/useChainIteratorParams.d.ts +1 -3
- package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
- package/package.json +43 -43
- package/src/components/block/table/Ex.stories.tsx +3 -3
- 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/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) => {
|