@xyo-network/react-chain-blockchain 1.3.18 → 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.
Files changed (39) hide show
  1. package/dist/browser/index.mjs +29 -26
  2. package/dist/browser/index.mjs.map +1 -1
  3. package/dist/types/components/transactions/submit/SubmitChain.d.ts.map +1 -1
  4. package/dist/types/context/analyzer/Provider.d.ts.map +1 -1
  5. package/dist/types/context/analyzer/context.d.ts +22 -2
  6. package/dist/types/context/analyzer/context.d.ts.map +1 -1
  7. package/dist/types/context/analyzer/state.d.ts +3 -3
  8. package/dist/types/context/analyzer/state.d.ts.map +1 -1
  9. package/dist/types/context/analyzer/use.d.ts +8 -1
  10. package/dist/types/context/analyzer/use.d.ts.map +1 -1
  11. package/dist/types/context/chain/Context.d.ts +19 -2
  12. package/dist/types/context/chain/Context.d.ts.map +1 -1
  13. package/dist/types/context/chain/State.d.ts +3 -3
  14. package/dist/types/context/chain/State.d.ts.map +1 -1
  15. package/dist/types/context/chain/use.d.ts +7 -1
  16. package/dist/types/context/chain/use.d.ts.map +1 -1
  17. package/dist/types/context/polling/context.d.ts +16 -2
  18. package/dist/types/context/polling/context.d.ts.map +1 -1
  19. package/dist/types/context/polling/state.d.ts +3 -3
  20. package/dist/types/context/polling/state.d.ts.map +1 -1
  21. package/dist/types/context/polling/use.d.ts +6 -1
  22. package/dist/types/context/polling/use.d.ts.map +1 -1
  23. package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts +1 -3
  24. package/dist/types/hooks/chain-iterator/useChainIteratorParams.d.ts.map +1 -1
  25. package/package.json +43 -43
  26. package/src/components/block/table/Ex.stories.tsx +2 -2
  27. package/src/components/transactions/submit/SubmitChain.tsx +23 -21
  28. package/src/context/analyzer/Provider.tsx +3 -2
  29. package/src/context/analyzer/context.ts +1 -1
  30. package/src/context/analyzer/state.ts +3 -3
  31. package/src/context/analyzer/use.ts +1 -1
  32. package/src/context/chain/Context.ts +1 -1
  33. package/src/context/chain/Provider.tsx +1 -1
  34. package/src/context/chain/State.ts +3 -3
  35. package/src/context/chain/use.ts +1 -1
  36. package/src/context/polling/Provider.tsx +1 -1
  37. package/src/context/polling/context.ts +1 -1
  38. package/src/context/polling/state.ts +3 -3
  39. package/src/context/polling/use.ts +1 -1
@@ -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 "@xyo-network/react-shared";
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 (!analyzers2) return;
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 "@xyo-network/react-shared";
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 "@xyo-network/react-shared";
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 "@xyo-network/react-shared";
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 "@xyo-network/react-shared";
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
- const randomAccount = await Account.random();
255
- const [transactionBoundWitness] = await buildTransaction(chainTx.chain, [], [], randomAccount, chainTx.nbf, chainTx.exp);
256
- const insertQuery = new PayloadBuilder({
257
- schema: ArchivistInsertQuerySchema
258
- }).build();
259
- const [queryBoundWitness] = await new QueryBoundWitnessBuilder().payloads([
260
- transactionBoundWitness
261
- ]).query(insertQuery).signer(randomAccount).build();
262
- const response = await axios.post(network.href, [
263
- queryBoundWitness,
264
- [
265
- insertQuery,
266
- transactionBoundWitness,
267
- chainTx
268
- ]
269
- ]);
270
- if (response.data.errors.length > 0) {
271
- setError(new Error(response.data.errors.map((e) => e.message).join("\n")));
272
- } else {
273
- setResult(response.data.data);
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) => {