@xyo-network/react-chain-boundwitness 1.3.14 → 1.3.15

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.
@@ -1,6 +1,101 @@
1
- // src/index.ts
2
- var index_default = {};
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/components/BlockBoundWitnessDetails.tsx
5
+ import { Divider, TableCell, TableHead, TableRow } from "@mui/material";
6
+ import { filterAs } from "@xylabs/array";
7
+ import { ErrorRender } from "@xylabs/react-error";
8
+ import { FlexCol } from "@xylabs/react-flexbox";
9
+ import { usePromise } from "@xylabs/react-promise";
10
+ import { isBoundWitness } from "@xyo-network/boundwitness-model";
11
+ import { PayloadBuilder } from "@xyo-network/payload-builder";
12
+ import { BoundWitnessPayloadsTable, BoundWitnessSignatureTable, BWActions, HashHeadingPaper, HeadingPaper } from "@xyo-network/react-boundwitness-plugin";
13
+ import { useTxsFromBlock } from "@xyo-network/react-chain-blockchain";
14
+ import { HashTableCell, usePayloadHash } from "@xyo-network/react-shared";
15
+ import { TableEx } from "@xyo-network/react-table";
16
+ import { isTransactionBoundWitness } from "@xyo-network/xl1-protocol";
17
+ import React from "react";
18
+ import { FaSignature } from "react-icons/fa";
19
+ import { GrTransaction } from "react-icons/gr";
20
+ import { VscSymbolMethod, VscSymbolNamespace } from "react-icons/vsc";
21
+ var BlockBoundWitnessDetails = /* @__PURE__ */ __name(({ ref, block, paper, children, ...props }) => {
22
+ const boundWitness = block?.[0];
23
+ const payloads = block?.[1];
24
+ const hash = usePayloadHash(boundWitness);
25
+ const [transactions, txFromBlockError] = useTxsFromBlock(block);
26
+ const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {
27
+ const bws = filterAs(payloads ?? [], (payload) => !isTransactionBoundWitness(payload) && isBoundWitness(payload) ? payload : void 0);
28
+ return await PayloadBuilder.hashPairs(bws);
29
+ }, [
30
+ payloads
31
+ ]);
32
+ const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0;
33
+ return /* @__PURE__ */ React.createElement(FlexCol, {
34
+ alignItems: "stretch",
35
+ rowGap: 4,
36
+ ...props
37
+ }, /* @__PURE__ */ React.createElement(ErrorRender, {
38
+ error: txFromBlockError ?? bwsFromBlockError,
39
+ scope: "BlockBoundWitnessDetails.tsx"
40
+ }), /* @__PURE__ */ React.createElement(HashHeadingPaper, {
41
+ hash,
42
+ paperProps: {
43
+ sx: {
44
+ p: 2
45
+ }
46
+ },
47
+ AdornmentEnd: /* @__PURE__ */ React.createElement(BWActions, {
48
+ boundwitness: boundWitness
49
+ }),
50
+ identiconProps: {
51
+ p: 0.75,
52
+ size: 24
53
+ }
54
+ }), /* @__PURE__ */ React.createElement(Divider, {
55
+ flexItem: true
56
+ }), transactions?.length && /* @__PURE__ */ React.createElement(FlexCol, {
57
+ alignItems: "stretch",
58
+ rowGap: 1,
59
+ mb: 1
60
+ }, /* @__PURE__ */ React.createElement(HeadingPaper, {
61
+ IconComponent: /* @__PURE__ */ React.createElement(GrTransaction, null),
62
+ heading: "Transactions"
63
+ }), /* @__PURE__ */ React.createElement(TableEx, null, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, null, "Hash"))), transactions?.map(([, txHash]) => /* @__PURE__ */ React.createElement(TableRow, {
64
+ key: hash + txHash
65
+ }, /* @__PURE__ */ React.createElement(HashTableCell, {
66
+ title: hash
67
+ }, hash))))), /* @__PURE__ */ React.createElement(FlexCol, {
68
+ alignItems: "stretch",
69
+ rowGap: 1,
70
+ mb: 1
71
+ }, /* @__PURE__ */ React.createElement(HeadingPaper, {
72
+ IconComponent: /* @__PURE__ */ React.createElement(VscSymbolNamespace, null),
73
+ heading: "Payloads"
74
+ }), /* @__PURE__ */ React.createElement(BoundWitnessPayloadsTable, {
75
+ boundwitness: boundWitness
76
+ })), hasNonTxBoundWitnesses ? /* @__PURE__ */ React.createElement(FlexCol, {
77
+ alignItems: "stretch",
78
+ rowGap: 1,
79
+ mb: 1
80
+ }, /* @__PURE__ */ React.createElement(HeadingPaper, {
81
+ IconComponent: /* @__PURE__ */ React.createElement(VscSymbolMethod, null),
82
+ heading: "Bound Witnesses"
83
+ }), /* @__PURE__ */ React.createElement(TableEx, null, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, null, "Schema"))), nonTxBoundWitnesses?.map(([, bwHash]) => /* @__PURE__ */ React.createElement(TableRow, {
84
+ key: hash + bwHash
85
+ }, /* @__PURE__ */ React.createElement(HashTableCell, {
86
+ title: hash
87
+ }, hash))))) : null, /* @__PURE__ */ React.createElement(FlexCol, {
88
+ alignItems: "stretch",
89
+ rowGap: 1,
90
+ mb: 1
91
+ }, /* @__PURE__ */ React.createElement(HeadingPaper, {
92
+ IconComponent: /* @__PURE__ */ React.createElement(FaSignature, null),
93
+ heading: "Signatures"
94
+ }), /* @__PURE__ */ React.createElement(BoundWitnessSignatureTable, {
95
+ block: boundWitness
96
+ })));
97
+ }, "BlockBoundWitnessDetails");
3
98
  export {
4
- index_default as default
99
+ BlockBoundWitnessDetails
5
100
  };
6
101
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export default {}\n"],"mappings":";AAAA,IAAA,gBAAe,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/components/BlockBoundWitnessDetails.tsx"],"sourcesContent":["import {\n Divider, TableCell, TableHead, TableRow,\n} from '@mui/material'\nimport { filterAs } from '@xylabs/array'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { FlexCol } from '@xylabs/react-flexbox'\nimport { usePromise } from '@xylabs/react-promise'\nimport { isBoundWitness } from '@xyo-network/boundwitness-model'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport {\n BoundWitnessPayloadsTable,\n BoundWitnessSignatureTable,\n BWActions,\n HashHeadingPaper,\n HeadingPaper,\n} from '@xyo-network/react-boundwitness-plugin'\nimport { useTxsFromBlock } from '@xyo-network/react-chain-blockchain'\nimport { HashTableCell, usePayloadHash } from '@xyo-network/react-shared'\nimport { TableEx } from '@xyo-network/react-table'\nimport { isTransactionBoundWitness, type SignedHydratedBlock } from '@xyo-network/xl1-protocol'\nimport React from 'react'\nimport { FaSignature } from 'react-icons/fa'\nimport { GrTransaction } from 'react-icons/gr'\nimport { VscSymbolMethod, VscSymbolNamespace } from 'react-icons/vsc'\n\nexport interface BoundWitnessDetailsProps extends FlexBoxProps {\n block?: SignedHydratedBlock\n}\n\nexport const BlockBoundWitnessDetails = ({\n ref, block, paper, children, ...props\n}: BoundWitnessDetailsProps & { ref?: React.Ref<unknown | null> }) => {\n const boundWitness = block?.[0]\n const payloads = block?.[1]\n\n const hash = usePayloadHash(boundWitness)\n\n const [transactions, txFromBlockError] = useTxsFromBlock(block)\n\n const [nonTxBoundWitnesses, bwsFromBlockError] = usePromise(async () => {\n const bws = filterAs(payloads ?? [], payload =>\n (!isTransactionBoundWitness(payload) && isBoundWitness(payload)) ? payload : undefined)\n return await PayloadBuilder.hashPairs(bws)\n }, [payloads])\n\n const hasNonTxBoundWitnesses = (nonTxBoundWitnesses?.length ?? 0) > 0\n\n return (\n <FlexCol alignItems=\"stretch\" rowGap={4} {...props}>\n <ErrorRender error={txFromBlockError ?? bwsFromBlockError} scope=\"BlockBoundWitnessDetails.tsx\" />\n <HashHeadingPaper\n hash={hash}\n paperProps={{ sx: { p: 2 } }}\n AdornmentEnd={<BWActions boundwitness={boundWitness} />}\n identiconProps={{ p: 0.75, size: 24 }}\n />\n <Divider flexItem />\n {transactions?.length && (\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<GrTransaction />} heading=\"Transactions\" />\n <TableEx>\n <TableHead>\n <TableRow>\n <TableCell>\n Hash\n </TableCell>\n </TableRow>\n </TableHead>\n {\n transactions?.map(([, txHash]) => (\n <TableRow\n key={hash + txHash}\n // onClick={() => handleOnClick(hash)} sx={{ cursor: 'pointer' }}\n >\n <HashTableCell title={hash}>{hash}</HashTableCell>\n </TableRow>\n ))\n }\n </TableEx>\n </FlexCol>\n )}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<VscSymbolNamespace />} heading=\"Payloads\" />\n <BoundWitnessPayloadsTable boundwitness={boundWitness} />\n </FlexCol>\n {hasNonTxBoundWitnesses\n ? (\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<VscSymbolMethod />} heading=\"Bound Witnesses\" />\n <TableEx>\n <TableHead>\n <TableRow>\n <TableCell>\n Schema\n </TableCell>\n </TableRow>\n </TableHead>\n {\n nonTxBoundWitnesses?.map(([, bwHash]) => (\n <TableRow\n key={hash + bwHash}\n // onClick={() => handleOnClick(hash)} sx={{ cursor: 'pointer' }}\n >\n <HashTableCell title={hash}>{hash}</HashTableCell>\n </TableRow>\n ))\n }\n </TableEx>\n </FlexCol>\n )\n : null}\n <FlexCol alignItems=\"stretch\" rowGap={1} mb={1}>\n <HeadingPaper IconComponent={<FaSignature />} heading=\"Signatures\" />\n <BoundWitnessSignatureTable block={boundWitness} />\n </FlexCol>\n </FlexCol>\n )\n}\n"],"mappings":";;;;AAAA,SACEA,SAASC,WAAWC,WAAWC,gBAC1B;AACP,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,SAASC,eAAe;AACxB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,sBAAsB;AAC/B,SACEC,2BACAC,4BACAC,WACAC,kBACAC,oBACK;AACP,SAASC,uBAAuB;AAChC,SAASC,eAAeC,sBAAsB;AAC9C,SAASC,eAAe;AACxB,SAASC,iCAA2D;AACpE,OAAOC,WAAW;AAClB,SAASC,mBAAmB;AAC5B,SA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,MAAU,MAAA,CAAA,CAAA,GAMbzC,cAAc0C,IAAI,CAAC,CAAA,EAAGC,MAAAA,MACpB,sBAAA,cAACH,UAAAA;IACCI,KAAK9C,OAAO6C;KAGZ,sBAAA,cAACE,eAAAA;IAAcC,OAAOhD;KAAOA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAO3C,sBAAA,cAACkB,SAAAA;IAAQC,YAAW;IAAUC,QAAQ;IAAGe,IAAI;KAC3C,sBAAA,cAACC,cAAAA;IAAaC,eAAe,sBAAA,cAACY,oBAAAA,IAAAA;IAAuBV,SAAQ;MAC7D,sBAAA,cAACW,2BAAAA;IAA0BpB,cAAchC;OAE1CkB,yBAEK,sBAAA,cAACE,SAAAA;IAAQC,YAAW;IAAUC,QAAQ;IAAGe,IAAI;KAC3C,sBAAA,cAACC,cAAAA;IAAaC,eAAe,sBAAA,cAACc,iBAAAA,IAAAA;IAAoBZ,SAAQ;MAC1D,sBAAA,cAACC,SAAAA,MACC,sBAAA,cAACC,WAAAA,MACC,sBAAA,cAACC,UAAAA,MACC,sBAAA,cAACC,WAAAA,MAAU,QAAA,CAAA,CAAA,GAMbtC,qBAAqBuC,IAAI,CAAC,CAAA,EAAGQ,MAAAA,MAC3B,sBAAA,cAACV,UAAAA;IACCI,KAAK9C,OAAOoD;KAGZ,sBAAA,cAACL,eAAAA;IAAcC,OAAOhD;KAAOA,IAAAA,CAAAA,CAAAA,CAAAA,CAAAA,IAOzC,MACJ,sBAAA,cAACkB,SAAAA;IAAQC,YAAW;IAAUC,QAAQ;IAAGe,IAAI;KAC3C,sBAAA,cAACC,cAAAA;IAAaC,eAAe,sBAAA,cAACgB,aAAAA,IAAAA;IAAgBd,SAAQ;MACtD,sBAAA,cAACe,4BAAAA;IAA2B5D,OAAOI;;AAI3C,GAxFwC;","names":["Divider","TableCell","TableHead","TableRow","filterAs","ErrorRender","FlexCol","usePromise","isBoundWitness","PayloadBuilder","BoundWitnessPayloadsTable","BoundWitnessSignatureTable","BWActions","HashHeadingPaper","HeadingPaper","useTxsFromBlock","HashTableCell","usePayloadHash","TableEx","isTransactionBoundWitness","React","FaSignature","GrTransaction","VscSymbolMethod","VscSymbolNamespace","BlockBoundWitnessDetails","ref","block","paper","children","props","boundWitness","payloads","hash","usePayloadHash","transactions","txFromBlockError","useTxsFromBlock","nonTxBoundWitnesses","bwsFromBlockError","usePromise","bws","filterAs","payload","isTransactionBoundWitness","isBoundWitness","undefined","PayloadBuilder","hashPairs","hasNonTxBoundWitnesses","length","FlexCol","alignItems","rowGap","ErrorRender","error","scope","HashHeadingPaper","paperProps","sx","p","AdornmentEnd","BWActions","boundwitness","identiconProps","size","Divider","flexItem","mb","HeadingPaper","IconComponent","GrTransaction","heading","TableEx","TableHead","TableRow","TableCell","map","txHash","key","HashTableCell","title","VscSymbolNamespace","BoundWitnessPayloadsTable","VscSymbolMethod","bwHash","FaSignature","BoundWitnessSignatureTable"]}
@@ -0,0 +1,2 @@
1
+ export * from './BlockBoundWitnessDetails.tsx';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
@@ -1,3 +1,2 @@
1
- declare const _default: {};
2
- export default _default;
1
+ export * from './components/index.ts';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,wBAAiB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/package.json",
3
3
  "name": "@xyo-network/react-chain-boundwitness",
4
- "version": "1.3.14",
4
+ "version": "1.3.15",
5
5
  "description": "XYO Layer One React SDK BoundWitness",
6
6
  "homepage": "https://xylabs.com",
7
7
  "bugs": {
@@ -39,7 +39,7 @@
39
39
  "@xylabs/react-promise": "^6.2.19",
40
40
  "@xyo-network/payload-builder": "^3.14.16",
41
41
  "@xyo-network/react-boundwitness-plugin": "^5.2.7",
42
- "@xyo-network/react-chain-blockchain": "^1.3.14",
42
+ "@xyo-network/react-chain-blockchain": "^1.3.15",
43
43
  "@xyo-network/react-payload-details": "^5.2.7",
44
44
  "@xyo-network/react-shared": "^5.2.7",
45
45
  "@xyo-network/react-table": "^5.2.7",
@@ -0,0 +1 @@
1
+ export * from './BlockBoundWitnessDetails.tsx'
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export default {}
1
+ export * from './components/index.ts'