@xyo-network/react-chain-shared 1.20.14 → 1.20.16
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/README.md +9 -4338
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/story/buildRandomBlockchain.d.ts +5 -66
- package/dist/browser/story/buildRandomBlockchain.d.ts.map +1 -1
- package/package.json +126 -37
- package/src/components/index.ts +0 -2
- package/src/components/menu-item/ActiveMenuItem.tsx +0 -42
- package/src/components/menu-item/index.ts +0 -1
- package/src/components/stack/DetailsStack.tsx +0 -65
- package/src/components/stack/LabelValueStack.tsx +0 -57
- package/src/components/stack/index.ts +0 -2
- package/src/index.ts +0 -2
- package/src/story/IframeWalletWarningDecorator.tsx +0 -36
- package/src/story/buildRandomBlockchain.ts +0 -16
- package/src/story/index.ts +0 -2
- package/src/types/global.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/menu-item/ActiveMenuItem.tsx","../../src/components/stack/DetailsStack.tsx","../../src/components/stack/LabelValueStack.tsx","../../src/story/buildRandomBlockchain.ts","../../src/story/IframeWalletWarningDecorator.tsx"],"sourcesContent":["import type { MenuItemProps } from '@mui/material'\nimport {\n MenuItem, styled, useTheme,\n} from '@mui/material'\nimport React from 'react'\n\nexport const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({\n active, children, sx, ...props\n}) => {\n const theme = useTheme()\n return (\n <StyledMenuItem\n disableRipple\n sx={{\n // left border color and background color for active state\n 'borderLeft': `5px solid ${active ? theme.vars.palette.secondary.light : 'transparent'}`,\n 'backgroundColor': active ? theme.vars.palette.secondary.dark : 'transparent',\n // force white text color for active state for improved readability with background color\n 'color': active ? 'white' : 'unset',\n '&:hover': {\n // overriding default hover color and backgroundColor since active state conflicts visually with\n // default styles of MenuItem hover\n ...(active ? { backgroundColor: theme.vars.palette.secondary.dark } : {}),\n color: active ? 'white' : 'unset',\n },\n ...sx,\n }}\n {...props}\n >\n {children}\n </StyledMenuItem>\n )\n}\n\nconst StyledMenuItem = styled(MenuItem, { name: 'StyledMenuItem' })(({ theme }) => ({\n display: 'flex-inline',\n flexDirection: 'row',\n gap: theme.spacing(1),\n padding: 0,\n paddingLeft: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}))\n","import type { StackProps } from '@mui/material'\nimport {\n Stack, styled, Tooltip, Typography,\n useTheme,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type {\n ComponentType, ReactNode, SVGAttributes,\n} from 'react'\nimport React, { useMemo } from 'react'\n\nconst isComponentType = (value: unknown): value is ComponentType<SVGAttributes<SVGElement>> =>\n typeof value === 'function'\n || (typeof value === 'object' && value !== null && ('$$typeof' in value || 'render' in value))\n\nexport interface DetailsStackProps extends StackProps {\n IconComponent?: ComponentType<SVGAttributes<SVGElement>> | ReactNode\n heading?: string\n tooltipTitle?: string\n}\n\nexport const DetailsStack: React.FC<DetailsStackProps> = ({\n IconComponent, heading, children, tooltipTitle, ...props\n}) => {\n const theme = useTheme()\n\n const hasTooltip = isDefined(tooltipTitle)\n const resolvedIconComponent = useMemo(() => {\n return isComponentType(IconComponent)\n ? (\n <IconComponent\n style={{\n /** height and marginTop adjusted to account for font not filling container with line-height: 1 */\n height: '0.85rem',\n marginTop: 0.5,\n marginLeft: theme.spacing(1),\n }}\n />\n )\n : IconComponent ?? null\n }, [IconComponent, theme])\n\n return (\n <Stack direction=\"column\" flexGrow={1} flexWrap=\"wrap\" minWidth=\"1px\" {...props}>\n <SectionHeadingTypography>\n {heading}\n {hasTooltip\n ? (\n <Tooltip title={tooltipTitle}>\n <span>{resolvedIconComponent}</span>\n </Tooltip>\n )\n : resolvedIconComponent}\n </SectionHeadingTypography>\n {children}\n </Stack>\n )\n}\n\nconst SectionHeadingTypography = styled(Typography, { name: 'SectionHeadingTypography' })(({ theme }) => ({\n display: 'flex',\n fontFamily: 'monospace',\n lineHeight: 1,\n marginBottom: theme.spacing(1.5),\n}))\n","import type { StackProps } from '@mui/material'\nimport {\n Stack, Typography, useTheme,\n} from '@mui/material'\nimport { ellipsize, isAddress } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface LabelValueStackProps extends StackProps {\n labels: string[]\n values: (string | undefined)[]\n}\n\nexport const LabelValueStack: React.FC<LabelValueStackProps> = ({\n labels, values, ...props\n}) => {\n const theme = useTheme()\n const formattedValue = (value: string | undefined): string | undefined => {\n if (isAddress(value)) {\n return ellipsize(value, 8)\n }\n return value\n }\n return (\n <Stack flexDirection=\"row\" flexGrow={1} {...props}>\n <Stack>\n {labels.map(label => (\n <Typography\n fontWeight=\"300\"\n key={label}\n variant=\"body2\"\n sx={{ borderBottom: `1px solid ${theme.vars?.palette.divider}`, opacity: 0.7 }}\n >\n {label}\n :\n </Typography>\n ))}\n </Stack>\n <Stack alignItems=\"end\" flexGrow={1}>\n {values.map((value, index) => (\n <Typography\n title={value}\n fontFamily=\"monospace\"\n variant=\"body2\"\n // Use matching label as key since values might be the same\n key={labels[index]}\n width=\"100%\"\n sx={{\n display: 'flex', justifyContent: 'end', borderBottom: `1px solid ${theme.vars?.palette.divider}`,\n }}\n >\n {formattedValue(value)}\n </Typography>\n ))}\n </Stack>\n </Stack>\n )\n}\n","import { buildRandomChain } from '@xyo-network/chain-protocol'\nimport { Account } from '@xyo-network/sdk-js'\n\nexport const buildRandomBlockChain = async (blockCount = 10) => {\n // Create a producer\n const initialBlockProducer = await Account.random()\n\n // Create multiple blocks\n const blocks = await buildRandomChain(initialBlockProducer, blockCount)\n return blocks\n}\n\nexport const buildRandomBlockChainBlocksOnly = async (blockCount = 10) => {\n const chain = await buildRandomChain(await Account.random(), blockCount)\n return chain\n}\n","import { Alert, Stack } from '@mui/material'\nimport type { Decorator } from '@storybook/react-vite'\nimport { isXyoGlobal } from '@xyo-network/react-chain-model'\nimport React from 'react'\n\nconst inIframe = globalThis.self !== window.top\n\n/**\n * Storybook decorator that displays warning banners when:\n * - the story is rendered inside an iframe (prompt user to open in a standalone tab), or\n * - the XYO wallet extension is not detected (prompt user to install it).\n *\n * Stories that require direct browser-extension access should use this decorator.\n */\nexport const IframeWalletWarningDecorator: Decorator = (Story, args) => {\n const hasXyoGlobal = isXyoGlobal((globalThis as Record<string, unknown>).xyo)\n return (\n <Stack gap={2}>\n {inIframe\n ? (\n <Alert severity=\"warning\">\n This story is running in an iframe. Please run it in a standalone browser window to test the wallet extension.\n </Alert>\n )\n : null}\n {hasXyoGlobal\n ? null\n : (\n <Alert severity=\"warning\">\n No wallet extension found. Please install the Xyo Wallet Chrome Extension.\n </Alert>\n )}\n <Story {...args} />\n </Stack>\n )\n}\n"],"mappings":";;;;AACA,SACEA,UAAUC,QAAQC,gBACb;AACP,OAAOC,WAAW;AAEX,IAAMC,iBAAiE,wBAAC,EAC7EC,QAAQC,UAAUC,IAAI,GAAGC,MAAAA,MAC1B;AACC,QAAMC,QAAQC,SAAAA;AACd,SACE,sBAAA,cAACC,gBAAAA;IACCC,eAAAA;IACAL,IAAI;;MAEF,cAAc,aAAaF,SAASI,MAAMI,KAAKC,QAAQC,UAAUC,QAAQ,aAAA;MACzE,mBAAmBX,SAASI,MAAMI,KAAKC,QAAQC,UAAUE,OAAO;;MAEhE,SAASZ,SAAS,UAAU;MAC5B,WAAW;;;QAGT,GAAIA,SAAS;UAAEa,iBAAiBT,MAAMI,KAAKC,QAAQC,UAAUE;QAAK,IAAI,CAAC;QACvEE,OAAOd,SAAS,UAAU;MAC5B;MACA,GAAGE;IACL;IACC,GAAGC;KAEHF,QAAAA;AAGP,GA1B8E;AA4B9E,IAAMK,iBAAiBS,OAAOC,UAAU;EAAEC,MAAM;AAAiB,CAAA,EAAG,CAAC,EAAEb,MAAK,OAAQ;EAClFc,SAAS;EACTC,eAAe;EACfC,KAAKhB,MAAMiB,QAAQ,CAAA;EACnBC,SAAS;EACTC,aAAanB,MAAMiB,QAAQ,CAAA;EAC3BG,cAAcpB,MAAMiB,QAAQ,CAAA;AAC9B,EAAA;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OO;AACT,GAH+C;;;ACZ/C,SAASC,OAAOC,SAAAA,cAAa;AAE7B,SAASC,mBAAmB;AAC5B,OAAOC,YAAW;AAElB,IAAMC,WAAWC,WAAWC,SAASC,OAAOC;AASrC,IAAMC,+BAA0C,wBAACC,OAAOC,SAAAA;AAC7D,QAAMC,eAAeC,YAAaR,WAAuCS,GAAG;AAC5E,SACE,gBAAAC,OAAA,cAACC,QAAAA;IAAMC,KAAK;KACTb,WAEK,gBAAAW,OAAA,cAACG,OAAAA;IAAMC,UAAS;KAAU,gHAAA,IAI5B,MACHP,eACG,OAEE,gBAAAG,OAAA,cAACG,OAAAA;IAAMC,UAAS;KAAU,4EAAA,GAIhC,gBAAAJ,OAAA,cAACL,OAAUC,IAAAA,CAAAA;AAGjB,GArBuD;","names":["MenuItem","styled","useTheme","React","ActiveMenuItem","active","children","sx","props","theme","useTheme","StyledMenuItem","disableRipple","vars","palette","secondary","light","dark","backgroundColor","color","styled","MenuItem","name","display","flexDirection","gap","spacing","padding","paddingLeft","marginBottom","Stack","styled","Tooltip","Typography","useTheme","isDefined","React","useMemo","isComponentType","value","DetailsStack","IconComponent","heading","children","tooltipTitle","props","theme","useTheme","hasTooltip","isDefined","resolvedIconComponent","useMemo","React","style","height","marginTop","marginLeft","spacing","Stack","direction","flexGrow","flexWrap","minWidth","SectionHeadingTypography","Tooltip","title","span","styled","Typography","name","display","fontFamily","lineHeight","marginBottom","Stack","Typography","useTheme","ellipsize","isAddress","React","LabelValueStack","labels","values","props","theme","useTheme","formattedValue","value","isAddress","ellipsize","React","Stack","flexDirection","flexGrow","map","label","Typography","fontWeight","key","variant","sx","borderBottom","vars","palette","divider","opacity","alignItems","index","title","fontFamily","width","display","justifyContent","buildRandomChain","Account","buildRandomBlockChain","blockCount","initialBlockProducer","Account","random","blocks","buildRandomChain","buildRandomBlockChainBlocksOnly","chain","Alert","Stack","isXyoGlobal","React","inIframe","globalThis","self","window","top","IframeWalletWarningDecorator","Story","args","hasXyoGlobal","isXyoGlobal","xyo","React","Stack","gap","Alert","severity"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/menu-item/ActiveMenuItem.tsx","../../src/components/stack/DetailsStack.tsx","../../src/components/stack/LabelValueStack.tsx","../../src/story/buildRandomBlockchain.ts","../../src/story/IframeWalletWarningDecorator.tsx"],"sourcesContent":["import type { MenuItemProps } from '@mui/material'\nimport {\n MenuItem, styled, useTheme,\n} from '@mui/material'\nimport React from 'react'\n\nexport const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({\n active, children, sx, ...props\n}) => {\n const theme = useTheme()\n return (\n <StyledMenuItem\n disableRipple\n sx={{\n // left border color and background color for active state\n 'borderLeft': `5px solid ${active ? theme.vars.palette.secondary.light : 'transparent'}`,\n 'backgroundColor': active ? theme.vars.palette.secondary.dark : 'transparent',\n // force white text color for active state for improved readability with background color\n 'color': active ? 'white' : 'unset',\n '&:hover': {\n // overriding default hover color and backgroundColor since active state conflicts visually with\n // default styles of MenuItem hover\n ...(active ? { backgroundColor: theme.vars.palette.secondary.dark } : {}),\n color: active ? 'white' : 'unset',\n },\n ...sx,\n }}\n {...props}\n >\n {children}\n </StyledMenuItem>\n )\n}\n\nconst StyledMenuItem = styled(MenuItem, { name: 'StyledMenuItem' })(({ theme }) => ({\n display: 'flex-inline',\n flexDirection: 'row',\n gap: theme.spacing(1),\n padding: 0,\n paddingLeft: theme.spacing(1),\n marginBottom: theme.spacing(1),\n}))\n","import type { StackProps } from '@mui/material'\nimport {\n Stack, styled, Tooltip, Typography,\n useTheme,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type {\n ComponentType, ReactNode, SVGAttributes,\n} from 'react'\nimport React, { useMemo } from 'react'\n\nconst isComponentType = (value: unknown): value is ComponentType<SVGAttributes<SVGElement>> =>\n typeof value === 'function'\n || (typeof value === 'object' && value !== null && ('$$typeof' in value || 'render' in value))\n\nexport interface DetailsStackProps extends StackProps {\n IconComponent?: ComponentType<SVGAttributes<SVGElement>> | ReactNode\n heading?: string\n tooltipTitle?: string\n}\n\nexport const DetailsStack: React.FC<DetailsStackProps> = ({\n IconComponent, heading, children, tooltipTitle, ...props\n}) => {\n const theme = useTheme()\n\n const hasTooltip = isDefined(tooltipTitle)\n const resolvedIconComponent = useMemo(() => {\n return isComponentType(IconComponent)\n ? (\n <IconComponent\n style={{\n /** height and marginTop adjusted to account for font not filling container with line-height: 1 */\n height: '0.85rem',\n marginTop: 0.5,\n marginLeft: theme.spacing(1),\n }}\n />\n )\n : IconComponent ?? null\n }, [IconComponent, theme])\n\n return (\n <Stack direction=\"column\" flexGrow={1} flexWrap=\"wrap\" minWidth=\"1px\" {...props}>\n <SectionHeadingTypography>\n {heading}\n {hasTooltip\n ? (\n <Tooltip title={tooltipTitle}>\n <span>{resolvedIconComponent}</span>\n </Tooltip>\n )\n : resolvedIconComponent}\n </SectionHeadingTypography>\n {children}\n </Stack>\n )\n}\n\nconst SectionHeadingTypography = styled(Typography, { name: 'SectionHeadingTypography' })(({ theme }) => ({\n display: 'flex',\n fontFamily: 'monospace',\n lineHeight: 1,\n marginBottom: theme.spacing(1.5),\n}))\n","import type { StackProps } from '@mui/material'\nimport {\n Stack, Typography, useTheme,\n} from '@mui/material'\nimport { ellipsize, isAddress } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface LabelValueStackProps extends StackProps {\n labels: string[]\n values: (string | undefined)[]\n}\n\nexport const LabelValueStack: React.FC<LabelValueStackProps> = ({\n labels, values, ...props\n}) => {\n const theme = useTheme()\n const formattedValue = (value: string | undefined): string | undefined => {\n if (isAddress(value)) {\n return ellipsize(value, 8)\n }\n return value\n }\n return (\n <Stack flexDirection=\"row\" flexGrow={1} {...props}>\n <Stack>\n {labels.map(label => (\n <Typography\n fontWeight=\"300\"\n key={label}\n variant=\"body2\"\n sx={{ borderBottom: `1px solid ${theme.vars?.palette.divider}`, opacity: 0.7 }}\n >\n {label}\n :\n </Typography>\n ))}\n </Stack>\n <Stack alignItems=\"end\" flexGrow={1}>\n {values.map((value, index) => (\n <Typography\n title={value}\n fontFamily=\"monospace\"\n variant=\"body2\"\n // Use matching label as key since values might be the same\n key={labels[index]}\n width=\"100%\"\n sx={{\n display: 'flex', justifyContent: 'end', borderBottom: `1px solid ${theme.vars?.palette.divider}`,\n }}\n >\n {formattedValue(value)}\n </Typography>\n ))}\n </Stack>\n </Stack>\n )\n}\n","import { buildRandomChain } from '@xyo-network/chain-protocol'\nimport { Account } from '@xyo-network/sdk-js'\n\ntype BuildRandomChainResult = Awaited<ReturnType<typeof buildRandomChain>>\n\nexport const buildRandomBlockChain = async (blockCount = 10): Promise<BuildRandomChainResult> => {\n // Create a producer\n const initialBlockProducer = await Account.random()\n\n // Create multiple blocks\n const blocks = await buildRandomChain(initialBlockProducer, blockCount)\n return blocks\n}\n\nexport const buildRandomBlockChainBlocksOnly = async (blockCount = 10): Promise<BuildRandomChainResult> => {\n const chain = await buildRandomChain(await Account.random(), blockCount)\n return chain\n}\n","import { Alert, Stack } from '@mui/material'\nimport type { Decorator } from '@storybook/react-vite'\nimport { isXyoGlobal } from '@xyo-network/react-chain-model'\nimport React from 'react'\n\nconst inIframe = globalThis.self !== window.top\n\n/**\n * Storybook decorator that displays warning banners when:\n * - the story is rendered inside an iframe (prompt user to open in a standalone tab), or\n * - the XYO wallet extension is not detected (prompt user to install it).\n *\n * Stories that require direct browser-extension access should use this decorator.\n */\nexport const IframeWalletWarningDecorator: Decorator = (Story, args) => {\n const hasXyoGlobal = isXyoGlobal((globalThis as Record<string, unknown>).xyo)\n return (\n <Stack gap={2}>\n {inIframe\n ? (\n <Alert severity=\"warning\">\n This story is running in an iframe. Please run it in a standalone browser window to test the wallet extension.\n </Alert>\n )\n : null}\n {hasXyoGlobal\n ? null\n : (\n <Alert severity=\"warning\">\n No wallet extension found. Please install the Xyo Wallet Chrome Extension.\n </Alert>\n )}\n <Story {...args} />\n </Stack>\n )\n}\n"],"mappings":";;;;AACA,SACEA,UAAUC,QAAQC,gBACb;AACP,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IAAAA,CAAAA;AAGjB,GArBuD;","names":["MenuItem","styled","useTheme","React","ActiveMenuItem","active","children","sx","props","theme","useTheme","StyledMenuItem","disableRipple","vars","palette","secondary","light","dark","backgroundColor","color","styled","MenuItem","name","display","flexDirection","gap","spacing","padding","paddingLeft","marginBottom","Stack","styled","Tooltip","Typography","useTheme","isDefined","React","useMemo","isComponentType","value","DetailsStack","IconComponent","heading","children","tooltipTitle","props","theme","useTheme","hasTooltip","isDefined","resolvedIconComponent","useMemo","React","style","height","marginTop","marginLeft","spacing","Stack","direction","flexGrow","flexWrap","minWidth","SectionHeadingTypography","Tooltip","title","span","styled","Typography","name","display","fontFamily","lineHeight","marginBottom","Stack","Typography","useTheme","ellipsize","isAddress","React","LabelValueStack","labels","values","props","theme","useTheme","formattedValue","value","isAddress","ellipsize","React","Stack","flexDirection","flexGrow","map","label","Typography","fontWeight","key","variant","sx","borderBottom","vars","palette","divider","opacity","alignItems","index","title","fontFamily","width","display","justifyContent","buildRandomChain","Account","buildRandomBlockChain","blockCount","initialBlockProducer","Account","random","blocks","buildRandomChain","buildRandomBlockChainBlocksOnly","chain","Alert","Stack","isXyoGlobal","React","inIframe","globalThis","self","window","top","IframeWalletWarningDecorator","Story","args","hasXyoGlobal","isXyoGlobal","xyo","React","Stack","gap","Alert","severity"]}
|
|
@@ -1,67 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
readonly __hex: true;
|
|
7
|
-
} & {
|
|
8
|
-
readonly __address: true;
|
|
9
|
-
})[];
|
|
10
|
-
payload_hashes: import("@xylabs/hex").BrandedHash[];
|
|
11
|
-
payload_schemas: import("@xyo-network/sdk-js").BrandedSchema<string>[];
|
|
12
|
-
previous_hashes: (import("@xylabs/hex").BrandedHash | null)[];
|
|
13
|
-
$signatures: import("@xylabs/hex").BrandedHex[];
|
|
14
|
-
block: import("@xyo-network/xl1-protocol-model").XL1BlockNumber;
|
|
15
|
-
chain: import("@xylabs/hex").BrandedHex;
|
|
16
|
-
previous: import("@xylabs/hex").BrandedHash | null;
|
|
17
|
-
$epoch: number;
|
|
18
|
-
_hash: import("@xylabs/hex").BrandedHash;
|
|
19
|
-
_dataHash: import("@xylabs/hex").BrandedHash;
|
|
20
|
-
$destination?: (Lowercase<string> & {
|
|
21
|
-
readonly __hex: true;
|
|
22
|
-
} & {
|
|
23
|
-
readonly __address: true;
|
|
24
|
-
}) | undefined;
|
|
25
|
-
$sourceQuery?: import("@xylabs/hex").BrandedHash | undefined;
|
|
26
|
-
protocol?: number | undefined;
|
|
27
|
-
step_hashes?: import("@xylabs/hex").BrandedHash[] | undefined;
|
|
28
|
-
}, {
|
|
29
|
-
[x: string]: unknown;
|
|
30
|
-
schema: import("@xyo-network/sdk-js").BrandedSchema<string>;
|
|
31
|
-
_hash: import("@xylabs/hex").BrandedHash;
|
|
32
|
-
_dataHash: import("@xylabs/hex").BrandedHash;
|
|
33
|
-
}[]][]>;
|
|
34
|
-
export declare const buildRandomBlockChainBlocksOnly: (blockCount?: number) => Promise<[{
|
|
35
|
-
schema: "network.xyo.boundwitness" & {
|
|
36
|
-
readonly __schema: true;
|
|
37
|
-
};
|
|
38
|
-
addresses: (Lowercase<string> & {
|
|
39
|
-
readonly __hex: true;
|
|
40
|
-
} & {
|
|
41
|
-
readonly __address: true;
|
|
42
|
-
})[];
|
|
43
|
-
payload_hashes: import("@xylabs/hex").BrandedHash[];
|
|
44
|
-
payload_schemas: import("@xyo-network/sdk-js").BrandedSchema<string>[];
|
|
45
|
-
previous_hashes: (import("@xylabs/hex").BrandedHash | null)[];
|
|
46
|
-
$signatures: import("@xylabs/hex").BrandedHex[];
|
|
47
|
-
block: import("@xyo-network/xl1-protocol-model").XL1BlockNumber;
|
|
48
|
-
chain: import("@xylabs/hex").BrandedHex;
|
|
49
|
-
previous: import("@xylabs/hex").BrandedHash | null;
|
|
50
|
-
$epoch: number;
|
|
51
|
-
_hash: import("@xylabs/hex").BrandedHash;
|
|
52
|
-
_dataHash: import("@xylabs/hex").BrandedHash;
|
|
53
|
-
$destination?: (Lowercase<string> & {
|
|
54
|
-
readonly __hex: true;
|
|
55
|
-
} & {
|
|
56
|
-
readonly __address: true;
|
|
57
|
-
}) | undefined;
|
|
58
|
-
$sourceQuery?: import("@xylabs/hex").BrandedHash | undefined;
|
|
59
|
-
protocol?: number | undefined;
|
|
60
|
-
step_hashes?: import("@xylabs/hex").BrandedHash[] | undefined;
|
|
61
|
-
}, {
|
|
62
|
-
[x: string]: unknown;
|
|
63
|
-
schema: import("@xyo-network/sdk-js").BrandedSchema<string>;
|
|
64
|
-
_hash: import("@xylabs/hex").BrandedHash;
|
|
65
|
-
_dataHash: import("@xylabs/hex").BrandedHash;
|
|
66
|
-
}[]][]>;
|
|
1
|
+
import { buildRandomChain } from '@xyo-network/chain-protocol';
|
|
2
|
+
type BuildRandomChainResult = Awaited<ReturnType<typeof buildRandomChain>>;
|
|
3
|
+
export declare const buildRandomBlockChain: (blockCount?: number) => Promise<BuildRandomChainResult>;
|
|
4
|
+
export declare const buildRandomBlockChainBlocksOnly: (blockCount?: number) => Promise<BuildRandomChainResult>;
|
|
5
|
+
export {};
|
|
67
6
|
//# sourceMappingURL=buildRandomBlockchain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRandomBlockchain.d.ts","sourceRoot":"","sources":["../../../src/story/buildRandomBlockchain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildRandomBlockchain.d.ts","sourceRoot":"","sources":["../../../src/story/buildRandomBlockchain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAG9D,KAAK,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAA;AAE1E,eAAO,MAAM,qBAAqB,GAAU,mBAAe,KAAG,OAAO,CAAC,sBAAsB,CAO3F,CAAA;AAED,eAAO,MAAM,+BAA+B,GAAU,mBAAe,KAAG,OAAO,CAAC,sBAAsB,CAGrG,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-shared",
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.16",
|
|
5
5
|
"description": "XYO Layer One React SDK",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -25,72 +25,161 @@
|
|
|
25
25
|
"types": "./dist/browser/index.d.ts",
|
|
26
26
|
"browser": {
|
|
27
27
|
"types": "./dist/browser/index.d.ts",
|
|
28
|
-
"source": "./src/index.ts",
|
|
29
28
|
"default": "./dist/browser/index.mjs"
|
|
30
29
|
},
|
|
31
|
-
"source": "./src/index.ts",
|
|
32
30
|
"default": "./dist/browser/index.mjs"
|
|
33
31
|
},
|
|
34
32
|
"./package.json": "./package.json"
|
|
35
33
|
},
|
|
36
34
|
"module": "./dist/browser/index.mjs",
|
|
37
|
-
"source": "./src/index.ts",
|
|
38
35
|
"types": "./dist/browser/index.d.ts",
|
|
39
36
|
"files": [
|
|
40
37
|
"dist",
|
|
41
|
-
"src",
|
|
42
38
|
"!**/*.bench.*",
|
|
43
39
|
"!**/*.spec.*",
|
|
44
|
-
"!**/*.test.*"
|
|
40
|
+
"!**/*.test.*",
|
|
41
|
+
"README.md"
|
|
45
42
|
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"build-storybook": "storybook build",
|
|
48
|
-
"start": "storybook dev -p 6006"
|
|
49
|
-
},
|
|
50
43
|
"dependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@xyo-network/
|
|
44
|
+
"@mui/material": ">=6 <8",
|
|
45
|
+
"@storybook/react-vite": "^10.3.5",
|
|
46
|
+
"@xylabs/sdk-js": "~5.0.95",
|
|
47
|
+
"@xyo-network/chain-protocol": "~1.20.16",
|
|
48
|
+
"@xyo-network/react-chain-model": "~1.20.16"
|
|
55
49
|
},
|
|
56
50
|
"devDependencies": {
|
|
57
51
|
"@emotion/react": "~11.14.0",
|
|
58
52
|
"@emotion/styled": "~11.14.1",
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
53
|
+
"@opentelemetry/api": "^1",
|
|
54
|
+
"@types/node": "^25.5.2",
|
|
61
55
|
"@types/react": "~19.2.14",
|
|
62
|
-
"@xylabs/ts-scripts-common": "~7.
|
|
63
|
-
"@xylabs/ts-scripts-
|
|
64
|
-
"@xylabs/tsconfig": "~7.
|
|
65
|
-
"@xylabs/tsconfig-dom": "~7.
|
|
66
|
-
"@xylabs/tsconfig-react": "~7.
|
|
67
|
-
"@xyo-network/
|
|
68
|
-
"
|
|
56
|
+
"@xylabs/ts-scripts-common": "~7.9.3",
|
|
57
|
+
"@xylabs/ts-scripts-pnpm": "~7.9.3",
|
|
58
|
+
"@xylabs/tsconfig": "~7.9.3",
|
|
59
|
+
"@xylabs/tsconfig-dom": "~7.9.3",
|
|
60
|
+
"@xylabs/tsconfig-react": "~7.9.3",
|
|
61
|
+
"@xyo-network/account": "~5.3.30",
|
|
62
|
+
"@xyo-network/account-model": "~5.3.30",
|
|
63
|
+
"@xyo-network/api-models": "~5.3.30",
|
|
64
|
+
"@xyo-network/archivist-abstract": "~5.3.30",
|
|
65
|
+
"@xyo-network/archivist-generic": "~5.3.30",
|
|
66
|
+
"@xyo-network/archivist-memory": "~5.3.30",
|
|
67
|
+
"@xyo-network/archivist-model": "~5.3.30",
|
|
68
|
+
"@xyo-network/archivist-view": "~5.3.30",
|
|
69
|
+
"@xyo-network/archivist-wrapper": "~5.3",
|
|
70
|
+
"@xyo-network/boundwitness-builder": "~5.3.30",
|
|
71
|
+
"@xyo-network/boundwitness-validator": "~5.3.30",
|
|
72
|
+
"@xyo-network/bridge-abstract": "~5.3.30",
|
|
73
|
+
"@xyo-network/bridge-model": "~5.3.30",
|
|
74
|
+
"@xyo-network/config-payload-plugin": "~5.3.30",
|
|
75
|
+
"@xyo-network/data": "~5.3.30",
|
|
76
|
+
"@xyo-network/diviner-abstract": "~5.3",
|
|
77
|
+
"@xyo-network/diviner-boundwitness-memory": "~5.3.30",
|
|
78
|
+
"@xyo-network/diviner-identity": "~5.3.30",
|
|
79
|
+
"@xyo-network/diviner-model": "~5.3.30",
|
|
80
|
+
"@xyo-network/diviner-payload-generic": "~5.3.30",
|
|
81
|
+
"@xyo-network/diviner-payload-model": "~5.3.30",
|
|
82
|
+
"@xyo-network/diviner-wrapper": "~5.3",
|
|
83
|
+
"@xyo-network/dns": "~5.3.30",
|
|
84
|
+
"@xyo-network/domain-payload-plugin": "~5.3.30",
|
|
85
|
+
"@xyo-network/elliptic": "~5.3.30",
|
|
86
|
+
"@xyo-network/hash": "~5.3.30",
|
|
87
|
+
"@xyo-network/huri": "~5.3.30",
|
|
88
|
+
"@xyo-network/manifest-model": "~5.3.30",
|
|
89
|
+
"@xyo-network/module-abstract": "~5.3.30",
|
|
90
|
+
"@xyo-network/module-model": "~5.3.30",
|
|
91
|
+
"@xyo-network/module-resolver": "~5.3.30",
|
|
92
|
+
"@xyo-network/module-wrapper": "~5.3",
|
|
93
|
+
"@xyo-network/network": "~5.3.30",
|
|
94
|
+
"@xyo-network/node-abstract": "~5.3.30",
|
|
95
|
+
"@xyo-network/node-memory": "~5.3.30",
|
|
96
|
+
"@xyo-network/node-model": "~5.3.30",
|
|
97
|
+
"@xyo-network/node-view": "~5.3.30",
|
|
98
|
+
"@xyo-network/node-wrapper": "~5.3",
|
|
99
|
+
"@xyo-network/payload-builder": "~5.3.30",
|
|
100
|
+
"@xyo-network/payload-model": "~5.3.30",
|
|
101
|
+
"@xyo-network/payload-validator": "~5.3.30",
|
|
102
|
+
"@xyo-network/previous-hash-store-model": "~5.3.30",
|
|
103
|
+
"@xyo-network/sdk-js": "~5.3.30",
|
|
104
|
+
"@xyo-network/sentinel-abstract": "~5.3.30",
|
|
105
|
+
"@xyo-network/sentinel-memory": "~5.3.30",
|
|
106
|
+
"@xyo-network/sentinel-model": "~5.3.30",
|
|
107
|
+
"@xyo-network/wallet-model": "~5.3.30",
|
|
108
|
+
"@xyo-network/wasm": "~5.3.30",
|
|
109
|
+
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
110
|
+
"@xyo-network/witness-model": "~5.3.30",
|
|
111
|
+
"ajv": "^8",
|
|
112
|
+
"axios": "^1.14.0",
|
|
113
|
+
"esbuild": "*",
|
|
69
114
|
"ethers": "^6.16.0",
|
|
115
|
+
"mongodb": "^7.1.1",
|
|
116
|
+
"pako": "~2.1.0",
|
|
70
117
|
"react": "~19.2.4",
|
|
71
118
|
"react-dom": "~19.2.4",
|
|
72
|
-
"storybook": "^10.3.
|
|
119
|
+
"storybook": "^10.3.5",
|
|
73
120
|
"typescript": "~5.9.3",
|
|
74
|
-
"vite": "~8.0.
|
|
121
|
+
"vite": "~8.0.7",
|
|
75
122
|
"zod": "^4.3.6"
|
|
76
123
|
},
|
|
77
124
|
"peerDependencies": {
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"@xyo-network/
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
125
|
+
"@xyo-network/account": "~5.3.30",
|
|
126
|
+
"@xyo-network/account-model": "~5.3.30",
|
|
127
|
+
"@xyo-network/api-models": "~5.3.30",
|
|
128
|
+
"@xyo-network/archivist-abstract": "~5.3.30",
|
|
129
|
+
"@xyo-network/archivist-generic": "~5.3.30",
|
|
130
|
+
"@xyo-network/archivist-memory": "~5.3.30",
|
|
131
|
+
"@xyo-network/archivist-model": "~5.3.30",
|
|
132
|
+
"@xyo-network/archivist-view": "~5.3.30",
|
|
133
|
+
"@xyo-network/boundwitness-builder": "~5.3.30",
|
|
134
|
+
"@xyo-network/boundwitness-validator": "~5.3.30",
|
|
135
|
+
"@xyo-network/bridge-abstract": "~5.3.30",
|
|
136
|
+
"@xyo-network/bridge-model": "~5.3.30",
|
|
137
|
+
"@xyo-network/config-payload-plugin": "~5.3.30",
|
|
138
|
+
"@xyo-network/data": "~5.3.30",
|
|
139
|
+
"@xyo-network/diviner-boundwitness-memory": "~5.3.30",
|
|
140
|
+
"@xyo-network/diviner-identity": "~5.3.30",
|
|
141
|
+
"@xyo-network/diviner-model": "~5.3.30",
|
|
142
|
+
"@xyo-network/diviner-payload-generic": "~5.3.30",
|
|
143
|
+
"@xyo-network/diviner-payload-model": "~5.3.30",
|
|
144
|
+
"@xyo-network/dns": "~5.3.30",
|
|
145
|
+
"@xyo-network/domain-payload-plugin": "~5.3.30",
|
|
146
|
+
"@xyo-network/elliptic": "~5.3.30",
|
|
147
|
+
"@xyo-network/hash": "~5.3.30",
|
|
148
|
+
"@xyo-network/huri": "~5.3.30",
|
|
149
|
+
"@xyo-network/manifest-model": "~5.3.30",
|
|
150
|
+
"@xyo-network/module-abstract": "~5.3.30",
|
|
151
|
+
"@xyo-network/module-model": "~5.3.30",
|
|
152
|
+
"@xyo-network/module-resolver": "~5.3.30",
|
|
153
|
+
"@xyo-network/network": "~5.3.30",
|
|
154
|
+
"@xyo-network/node-abstract": "~5.3.30",
|
|
155
|
+
"@xyo-network/node-memory": "~5.3.30",
|
|
156
|
+
"@xyo-network/node-model": "~5.3.30",
|
|
157
|
+
"@xyo-network/node-view": "~5.3.30",
|
|
158
|
+
"@xyo-network/payload-builder": "~5.3.30",
|
|
159
|
+
"@xyo-network/payload-model": "~5.3.30",
|
|
160
|
+
"@xyo-network/payload-validator": "~5.3.30",
|
|
161
|
+
"@xyo-network/previous-hash-store-model": "~5.3.30",
|
|
162
|
+
"@xyo-network/sdk-js": "~5.3.25",
|
|
163
|
+
"@xyo-network/sentinel-abstract": "~5.3.30",
|
|
164
|
+
"@xyo-network/sentinel-memory": "~5.3.30",
|
|
165
|
+
"@xyo-network/sentinel-model": "~5.3.30",
|
|
166
|
+
"@xyo-network/wallet-model": "~5.3.30",
|
|
167
|
+
"@xyo-network/wasm": "~5.3.30",
|
|
168
|
+
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
169
|
+
"@xyo-network/witness-model": "~5.3.30",
|
|
170
|
+
"pako": "~2.1.0",
|
|
171
|
+
"react": "~19.2.4"
|
|
87
172
|
},
|
|
88
173
|
"engines": {
|
|
89
|
-
"node": ">=
|
|
174
|
+
"node": ">=24"
|
|
90
175
|
},
|
|
91
176
|
"engineStrict": true,
|
|
92
177
|
"publishConfig": {
|
|
93
178
|
"access": "restricted"
|
|
94
179
|
},
|
|
95
|
-
"docs": "dist/docs.json"
|
|
96
|
-
|
|
180
|
+
"docs": "dist/docs.json",
|
|
181
|
+
"scripts": {
|
|
182
|
+
"build-storybook": "storybook build",
|
|
183
|
+
"start": "storybook dev -p 6006"
|
|
184
|
+
}
|
|
185
|
+
}
|
package/src/components/index.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { MenuItemProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
MenuItem, styled, useTheme,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
export const ActiveMenuItem: React.FC<MenuItemProps & { active?: boolean }> = ({
|
|
8
|
-
active, children, sx, ...props
|
|
9
|
-
}) => {
|
|
10
|
-
const theme = useTheme()
|
|
11
|
-
return (
|
|
12
|
-
<StyledMenuItem
|
|
13
|
-
disableRipple
|
|
14
|
-
sx={{
|
|
15
|
-
// left border color and background color for active state
|
|
16
|
-
'borderLeft': `5px solid ${active ? theme.vars.palette.secondary.light : 'transparent'}`,
|
|
17
|
-
'backgroundColor': active ? theme.vars.palette.secondary.dark : 'transparent',
|
|
18
|
-
// force white text color for active state for improved readability with background color
|
|
19
|
-
'color': active ? 'white' : 'unset',
|
|
20
|
-
'&:hover': {
|
|
21
|
-
// overriding default hover color and backgroundColor since active state conflicts visually with
|
|
22
|
-
// default styles of MenuItem hover
|
|
23
|
-
...(active ? { backgroundColor: theme.vars.palette.secondary.dark } : {}),
|
|
24
|
-
color: active ? 'white' : 'unset',
|
|
25
|
-
},
|
|
26
|
-
...sx,
|
|
27
|
-
}}
|
|
28
|
-
{...props}
|
|
29
|
-
>
|
|
30
|
-
{children}
|
|
31
|
-
</StyledMenuItem>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const StyledMenuItem = styled(MenuItem, { name: 'StyledMenuItem' })(({ theme }) => ({
|
|
36
|
-
display: 'flex-inline',
|
|
37
|
-
flexDirection: 'row',
|
|
38
|
-
gap: theme.spacing(1),
|
|
39
|
-
padding: 0,
|
|
40
|
-
paddingLeft: theme.spacing(1),
|
|
41
|
-
marginBottom: theme.spacing(1),
|
|
42
|
-
}))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ActiveMenuItem.tsx'
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { StackProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Stack, styled, Tooltip, Typography,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@mui/material'
|
|
6
|
-
import { isDefined } from '@xylabs/sdk-js'
|
|
7
|
-
import type {
|
|
8
|
-
ComponentType, ReactNode, SVGAttributes,
|
|
9
|
-
} from 'react'
|
|
10
|
-
import React, { useMemo } from 'react'
|
|
11
|
-
|
|
12
|
-
const isComponentType = (value: unknown): value is ComponentType<SVGAttributes<SVGElement>> =>
|
|
13
|
-
typeof value === 'function'
|
|
14
|
-
|| (typeof value === 'object' && value !== null && ('$$typeof' in value || 'render' in value))
|
|
15
|
-
|
|
16
|
-
export interface DetailsStackProps extends StackProps {
|
|
17
|
-
IconComponent?: ComponentType<SVGAttributes<SVGElement>> | ReactNode
|
|
18
|
-
heading?: string
|
|
19
|
-
tooltipTitle?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const DetailsStack: React.FC<DetailsStackProps> = ({
|
|
23
|
-
IconComponent, heading, children, tooltipTitle, ...props
|
|
24
|
-
}) => {
|
|
25
|
-
const theme = useTheme()
|
|
26
|
-
|
|
27
|
-
const hasTooltip = isDefined(tooltipTitle)
|
|
28
|
-
const resolvedIconComponent = useMemo(() => {
|
|
29
|
-
return isComponentType(IconComponent)
|
|
30
|
-
? (
|
|
31
|
-
<IconComponent
|
|
32
|
-
style={{
|
|
33
|
-
/** height and marginTop adjusted to account for font not filling container with line-height: 1 */
|
|
34
|
-
height: '0.85rem',
|
|
35
|
-
marginTop: 0.5,
|
|
36
|
-
marginLeft: theme.spacing(1),
|
|
37
|
-
}}
|
|
38
|
-
/>
|
|
39
|
-
)
|
|
40
|
-
: IconComponent ?? null
|
|
41
|
-
}, [IconComponent, theme])
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Stack direction="column" flexGrow={1} flexWrap="wrap" minWidth="1px" {...props}>
|
|
45
|
-
<SectionHeadingTypography>
|
|
46
|
-
{heading}
|
|
47
|
-
{hasTooltip
|
|
48
|
-
? (
|
|
49
|
-
<Tooltip title={tooltipTitle}>
|
|
50
|
-
<span>{resolvedIconComponent}</span>
|
|
51
|
-
</Tooltip>
|
|
52
|
-
)
|
|
53
|
-
: resolvedIconComponent}
|
|
54
|
-
</SectionHeadingTypography>
|
|
55
|
-
{children}
|
|
56
|
-
</Stack>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const SectionHeadingTypography = styled(Typography, { name: 'SectionHeadingTypography' })(({ theme }) => ({
|
|
61
|
-
display: 'flex',
|
|
62
|
-
fontFamily: 'monospace',
|
|
63
|
-
lineHeight: 1,
|
|
64
|
-
marginBottom: theme.spacing(1.5),
|
|
65
|
-
}))
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { StackProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Stack, Typography, useTheme,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import { ellipsize, isAddress } from '@xylabs/sdk-js'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
export interface LabelValueStackProps extends StackProps {
|
|
9
|
-
labels: string[]
|
|
10
|
-
values: (string | undefined)[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const LabelValueStack: React.FC<LabelValueStackProps> = ({
|
|
14
|
-
labels, values, ...props
|
|
15
|
-
}) => {
|
|
16
|
-
const theme = useTheme()
|
|
17
|
-
const formattedValue = (value: string | undefined): string | undefined => {
|
|
18
|
-
if (isAddress(value)) {
|
|
19
|
-
return ellipsize(value, 8)
|
|
20
|
-
}
|
|
21
|
-
return value
|
|
22
|
-
}
|
|
23
|
-
return (
|
|
24
|
-
<Stack flexDirection="row" flexGrow={1} {...props}>
|
|
25
|
-
<Stack>
|
|
26
|
-
{labels.map(label => (
|
|
27
|
-
<Typography
|
|
28
|
-
fontWeight="300"
|
|
29
|
-
key={label}
|
|
30
|
-
variant="body2"
|
|
31
|
-
sx={{ borderBottom: `1px solid ${theme.vars?.palette.divider}`, opacity: 0.7 }}
|
|
32
|
-
>
|
|
33
|
-
{label}
|
|
34
|
-
:
|
|
35
|
-
</Typography>
|
|
36
|
-
))}
|
|
37
|
-
</Stack>
|
|
38
|
-
<Stack alignItems="end" flexGrow={1}>
|
|
39
|
-
{values.map((value, index) => (
|
|
40
|
-
<Typography
|
|
41
|
-
title={value}
|
|
42
|
-
fontFamily="monospace"
|
|
43
|
-
variant="body2"
|
|
44
|
-
// Use matching label as key since values might be the same
|
|
45
|
-
key={labels[index]}
|
|
46
|
-
width="100%"
|
|
47
|
-
sx={{
|
|
48
|
-
display: 'flex', justifyContent: 'end', borderBottom: `1px solid ${theme.vars?.palette.divider}`,
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{formattedValue(value)}
|
|
52
|
-
</Typography>
|
|
53
|
-
))}
|
|
54
|
-
</Stack>
|
|
55
|
-
</Stack>
|
|
56
|
-
)
|
|
57
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Alert, Stack } from '@mui/material'
|
|
2
|
-
import type { Decorator } from '@storybook/react-vite'
|
|
3
|
-
import { isXyoGlobal } from '@xyo-network/react-chain-model'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
const inIframe = globalThis.self !== window.top
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Storybook decorator that displays warning banners when:
|
|
10
|
-
* - the story is rendered inside an iframe (prompt user to open in a standalone tab), or
|
|
11
|
-
* - the XYO wallet extension is not detected (prompt user to install it).
|
|
12
|
-
*
|
|
13
|
-
* Stories that require direct browser-extension access should use this decorator.
|
|
14
|
-
*/
|
|
15
|
-
export const IframeWalletWarningDecorator: Decorator = (Story, args) => {
|
|
16
|
-
const hasXyoGlobal = isXyoGlobal((globalThis as Record<string, unknown>).xyo)
|
|
17
|
-
return (
|
|
18
|
-
<Stack gap={2}>
|
|
19
|
-
{inIframe
|
|
20
|
-
? (
|
|
21
|
-
<Alert severity="warning">
|
|
22
|
-
This story is running in an iframe. Please run it in a standalone browser window to test the wallet extension.
|
|
23
|
-
</Alert>
|
|
24
|
-
)
|
|
25
|
-
: null}
|
|
26
|
-
{hasXyoGlobal
|
|
27
|
-
? null
|
|
28
|
-
: (
|
|
29
|
-
<Alert severity="warning">
|
|
30
|
-
No wallet extension found. Please install the Xyo Wallet Chrome Extension.
|
|
31
|
-
</Alert>
|
|
32
|
-
)}
|
|
33
|
-
<Story {...args} />
|
|
34
|
-
</Stack>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { buildRandomChain } from '@xyo-network/chain-protocol'
|
|
2
|
-
import { Account } from '@xyo-network/sdk-js'
|
|
3
|
-
|
|
4
|
-
export const buildRandomBlockChain = async (blockCount = 10) => {
|
|
5
|
-
// Create a producer
|
|
6
|
-
const initialBlockProducer = await Account.random()
|
|
7
|
-
|
|
8
|
-
// Create multiple blocks
|
|
9
|
-
const blocks = await buildRandomChain(initialBlockProducer, blockCount)
|
|
10
|
-
return blocks
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const buildRandomBlockChainBlocksOnly = async (blockCount = 10) => {
|
|
14
|
-
const chain = await buildRandomChain(await Account.random(), blockCount)
|
|
15
|
-
return chain
|
|
16
|
-
}
|
package/src/story/index.ts
DELETED
package/src/types/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|