@xyo-network/xl1-react-transaction 1.20.16 → 1.20.18
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,8 +1,8 @@
|
|
|
1
1
|
export type BlockConfirmationStatus = 'confirmed' | 'missed' | 'pending';
|
|
2
|
-
|
|
2
|
+
interface BlockFormattersParams {
|
|
3
3
|
confirmedInBlock: number | undefined;
|
|
4
4
|
currentBlockNumber: number | undefined;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
export declare class BlockFormatters {
|
|
7
7
|
private readonly params;
|
|
8
8
|
constructor(params: BlockFormattersParams);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockFormatters.d.ts","sourceRoot":"","sources":["../../../../src/confirmation/helpers/BlockFormatters.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExE,
|
|
1
|
+
{"version":3,"file":"BlockFormatters.d.ts","sourceRoot":"","sources":["../../../../src/confirmation/helpers/BlockFormatters.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAA;AAExE,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;gBAElC,MAAM,EAAE,qBAAqB;IAIzC,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAsBlC,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAU5E,YAAY,CAAC,WAAW,EAAE,MAAM;CAGjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/confirmation/components/TransactionStackProgress.tsx","../../src/confirmation/helpers/BlockFormatters.ts","../../src/confirmation/helpers/blockProgressColor.ts","../../src/confirmation/helpers/createFilledRange.ts","../../src/confirmation/helpers/getBlockProgress.ts","../../src/confirmation/helpers/isCurrentBlockPassedRange.ts","../../src/confirmation/helpers/passedBlocksInRange.ts","../../src/confirmation/hooks/useBlockRangeState.ts","../../src/confirmation/components/support/BlockConfirmationStats.tsx","../../src/confirmation/components/support/BlockRangeEntryStack.tsx"],"sourcesContent":["import type { StackProps } from '@mui/material'\nimport { LinearProgress, Stack } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport { type BlockRange } from '@xyo-network/xl1-sdk'\nimport React, {\n useLayoutEffect,\n useMemo,\n useRef, useState,\n} from 'react'\n\nimport { BlockFormatters, getBlockProgress } from '../helpers/index.ts'\nimport { useBlockRangeState } from '../hooks/index.ts'\nimport { BlockConfirmationStats, BlockRangeEntryStack } from './support/index.ts'\n\nexport interface TransactionStackProgressProps extends StackProps {\n blockRange?: BlockRange\n confirmedInBlock?: number\n currentBlockNumber?: number\n}\n\nexport const TransactionStackProgress: React.FC<TransactionStackProgressProps> = ({\n blockRange, confirmedInBlock, currentBlockNumber, ...props\n}) => {\n const blockPositionsRef = useRef<{ [blockNumber: number]: HTMLSpanElement | null }>({})\n const updateBlockPositionRefs = (blockNumber: number, ref: HTMLSpanElement | null) => {\n blockPositionsRef.current[blockNumber] = ref\n }\n\n const progressElementRef = useRef<HTMLDivElement | null>(null)\n\n const {\n passedBlocks, progressColor, range, isConfirmed, isExpired,\n } = useBlockRangeState(blockRange, confirmedInBlock, currentBlockNumber)\n\n const blockFormatters = useMemo(() => new BlockFormatters({ confirmedInBlock, currentBlockNumber }), [confirmedInBlock, currentBlockNumber])\n\n const [progressValue, setProgressValue] = useState(0)\n\n useLayoutEffect(() => {\n // prevent updates if the current block is past the confirmed block\n if (isDefined(currentBlockNumber) && isDefined(confirmedInBlock) && currentBlockNumber > confirmedInBlock) {\n return\n }\n const currentBlockNumberElement = isDefined(currentBlockNumber) ? blockPositionsRef.current[currentBlockNumber] : null\n const progressElement = progressElementRef.current\n // since we are relying on htmlElements, we have to use layout effect\n setProgressValue(getBlockProgress(\n currentBlockNumber,\n currentBlockNumberElement,\n progressElement,\n ))\n }, [confirmedInBlock, currentBlockNumber])\n\n return (\n <Stack direction=\"row\" {...props}>\n <Stack width=\"100%\" gap={1}>\n <Stack>\n <LinearProgress ref={progressElementRef} variant=\"determinate\" value={isExpired ? 100 : progressValue} color={progressColor} />\n <Stack direction=\"row\" justifyContent=\"space-between\">\n {range.map((block) => {\n const blockColor = blockFormatters.color(block)\n const blockStatus = blockFormatters.confirmationStatus(block)\n const formattedBlockNumber = blockFormatters.formatNumber(block)\n return (\n <BlockRangeEntryStack\n key={block}\n block={block}\n blockColor={blockColor}\n blockStatus={blockStatus}\n formattedBlockNumber={formattedBlockNumber}\n updateBlockPositionRefs={updateBlockPositionRefs}\n />\n )\n })}\n </Stack>\n </Stack>\n <BlockConfirmationStats\n confirmed={isConfirmed}\n currentBlockColor={isDefined(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : 'text.secondary'}\n currentBlockNumberValue={isDefined(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : 'N/A'}\n passedBlocks={passedBlocks}\n />\n </Stack>\n </Stack>\n )\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport type BlockConfirmationStatus = 'confirmed' | 'missed' | 'pending'\n\ntype BlockFormattersParams = {\n confirmedInBlock: number | undefined\n currentBlockNumber: number | undefined\n}\n\nexport class BlockFormatters {\n private readonly params: BlockFormattersParams\n\n constructor(params: BlockFormattersParams) {\n this.params = params\n }\n\n color(blockNumber: number): string {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (blockNumber === currentBlockNumber) {\n return isDefined(confirmedInBlock) && confirmedInBlock === blockNumber ? 'success.dark' : 'text'\n }\n const status = this.confirmationStatus(blockNumber)\n switch (status) {\n case 'confirmed': {\n return 'success.dark'\n }\n case 'missed': {\n return 'warning.light'\n }\n case 'pending': {\n return 'text.secondary'\n }\n default: {\n return 'text.secondary'\n }\n }\n }\n\n confirmationStatus(blockNumber: number): BlockConfirmationStatus | undefined {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (isDefined(currentBlockNumber)) {\n if (isDefined(confirmedInBlock) && blockNumber === confirmedInBlock) {\n return 'confirmed'\n }\n return currentBlockNumber > blockNumber ? 'missed' : 'pending'\n }\n }\n\n formatNumber(blockNumber: number) {\n return blockNumber.toString().length <= 5 ? new Intl.NumberFormat().format(blockNumber) : `${blockNumber.toString().slice(-2)}`\n }\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\n\nexport const blockProgressColor = (\n confirmedInBlock: number | undefined,\n isExpired: boolean | undefined,\n): LinearProgressProps['color'] => {\n if (isDefined(confirmedInBlock)) {\n return 'success'\n }\n if (isExpired) {\n return 'error'\n }\n return 'primary'\n}\n","import { isUndefined } from '@xylabs/sdk-js'\n\nexport const createFilledRange = (range?: [number, number]): number[] => {\n if (isUndefined(range)) {\n return []\n }\n const [start, end] = range\n if (end < start) {\n console.warn('Invalid range: end is less than start')\n return []\n }\n\n const result: number[] = []\n\n for (let i = start; i <= end; i++) {\n result.push(i)\n }\n\n return result\n}\n","import { isUndefined, isUndefinedOrNull } from '@xylabs/sdk-js'\n\nexport const getBlockProgress = (\n currentBlockNumber: number | undefined,\n currentBlockRef: HTMLSpanElement | null,\n progressElementRef: HTMLDivElement | null,\n) => {\n if (isUndefined(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {\n return 0\n }\n\n const currentBlockOffsetLeft = currentBlockRef.offsetLeft\n const currentBlockOffsetWidth = currentBlockRef.clientWidth / 2\n const currentBlockCenterOffsetLeft = currentBlockOffsetLeft + currentBlockOffsetWidth\n const parentOffsetLeft = progressElementRef.offsetLeft\n const parentWidth = progressElementRef.clientWidth\n\n const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft\n const progress = (relativePosition / parentWidth) * 100\n\n return Math.min(Math.max(progress, 0), 100)\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\n\nexport const isCurrentBlockPassedRange = (\n blockRange: BlockRange | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(blockRange) || !isDefined(currentBlockNumber)) {\n return false\n }\n const [, end] = blockRange\n return currentBlockNumber > end\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport const passedBlocksInRange = (\n range: number[] | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(currentBlockNumber) || !isDefined(range)) {\n return []\n }\n const [start] = range\n return range.filter(block => block < currentBlockNumber && block >= start)\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\nimport { useMemo } from 'react'\n\nimport {\n blockProgressColor, createFilledRange, isCurrentBlockPassedRange, passedBlocksInRange,\n} from '../helpers/index.ts'\n\ninterface BlockRangeState {\n isConfirmed: boolean\n isExpired: boolean\n passedBlocks: number[]\n progressColor: LinearProgressProps['color']\n range: number[]\n}\n\nexport const useBlockRangeState = (\n blockRange: BlockRange | undefined,\n confirmedInBlock: number | undefined,\n currentBlockNumber?: number | undefined,\n): BlockRangeState => {\n const range = useMemo(() => createFilledRange((blockRange)), [blockRange])\n\n const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber])\n\n const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range])\n\n const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired])\n\n const isConfirmed = isDefined(confirmedInBlock)\n\n return {\n isConfirmed, isExpired, passedBlocks, progressColor, range,\n }\n}\n","import { CheckCircleOutline } from '@mui/icons-material'\nimport {\n Grow, Stack, Typography,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface BlockConfirmationStatsProps {\n confirmed?: boolean\n currentBlockColor?: string\n currentBlockNumberValue?: string\n passedBlocks?: number[]\n}\n\nexport const BlockConfirmationStats: React.FC<BlockConfirmationStatsProps> = ({\n confirmed, currentBlockColor, currentBlockNumberValue, passedBlocks,\n}) => {\n return (\n <Stack>\n <Typography\n variant=\"caption\"\n color={currentBlockColor}\n sx={{\n display: 'inline-flex', alignItems: 'center', gap: 0.5,\n }}\n >\n Current Block:\n {' '}\n {currentBlockNumberValue}\n {' '}\n <Grow in={confirmed}>\n <CheckCircleOutline sx={{ width: '0.8em', height: '0.8em' }} color=\"success\" />\n </Grow>\n </Typography>\n <Typography variant=\"caption\" color=\"warning.light\" sx={{ opacity: 0.75 }}>\n Passed Blocks:\n {' '}\n {isDefined(passedBlocks) && passedBlocks.length > 0 ? passedBlocks.map(block => new Intl.NumberFormat().format(block)).join(', ') : 'N/A'}\n </Typography>\n\n </Stack>\n )\n}\n","import type { BoxProps, StackProps } from '@mui/material'\nimport {\n Box, Stack, styled, Tooltip, Typography,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { BlockConfirmationStatus } from '../../helpers/index.ts'\n\nexport interface BlockRangeEntryStackProps extends StackProps {\n block: number\n blockColor: string\n blockStatus: BlockConfirmationStatus | undefined\n formattedBlockNumber: string\n updateBlockPositionRefs?: (blockNumber: number, ref: HTMLSpanElement | null) => void\n}\n\nexport const BlockRangeEntryStack: React.FC<BlockRangeEntryStackProps> = ({\n block, blockColor, blockStatus, formattedBlockNumber, updateBlockPositionRefs, sx, ...props\n}) => {\n return (\n <Stack\n ref={(ref) => { if (updateBlockPositionRefs) updateBlockPositionRefs(block, ref) }}\n key={block}\n sx={{ position: 'relative', ...sx }}\n {...props}\n >\n <Box\n component=\"span\"\n sx={{\n display: 'flex', position: 'relative', width: '100%', height: 5,\n }}\n >\n <StyledBlockNumberIndicator component=\"span\" sx={{ backgroundColor: blockColor }} />\n </Box>\n <Tooltip\n title={`Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`}\n placement=\"top\"\n arrow\n >\n <Typography\n variant=\"caption\"\n sx={{\n color: blockColor,\n cursor: 'pointer',\n opacity: blockStatus === 'missed' ? 0.75 : 1,\n }}\n >\n {formattedBlockNumber}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n\nconst StyledBlockNumberIndicator = styled(Box, { name: 'StyledBlockNumberIndicator' })<BoxProps>(({ theme }) => {\n return theme.unstable_sx({\n position: 'absolute',\n left: 'calc(50% - 1px)',\n transform: 'calc(translateX(-50%) - 1px)',\n height: 3,\n width: '1px',\n backgroundColor: 'primary.main',\n })\n})\n"],"mappings":";;;;AACA,SAASA,gBAAgBC,SAAAA,cAAa;AACtC,SAASC,aAAAA,kBAAiB;AAE1B,OAAOC,UACLC,iBACAC,WAAAA,UACAC,QAAQC,gBACH;;;ACRP,SAASC,iBAAiB;AASnB,IAAMC,kBAAN,MAAMA;EATb,OASaA;;;EACMC;EAEjB,YAAYA,QAA+B;AACzC,SAAKA,SAASA;EAChB;EAEAC,MAAMC,aAA6B;AACjC,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIE,gBAAgBC,oBAAoB;AACtC,aAAOE,UAAUD,gBAAAA,KAAqBA,qBAAqBF,cAAc,iBAAiB;IAC5F;AACA,UAAMI,SAAS,KAAKC,mBAAmBL,WAAAA;AACvC,YAAQI,QAAAA;MACN,KAAK,aAAa;AAChB,eAAO;MACT;MACA,KAAK,UAAU;AACb,eAAO;MACT;MACA,KAAK,WAAW;AACd,eAAO;MACT;MACA,SAAS;AACP,eAAO;MACT;IACF;EACF;EAEAC,mBAAmBL,aAA0D;AAC3E,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIK,UAAUF,kBAAAA,GAAqB;AACjC,UAAIE,UAAUD,gBAAAA,KAAqBF,gBAAgBE,kBAAkB;AACnE,eAAO;MACT;AACA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AAAA,IAAsBE,kBAAkBK,QAAQP,kBAAAA,IAAsB;AAClH,UAAMwB,kBAAkBhB,mBAAmBD;AAE3CY,qBAAiBM,iBACfzB,oBACAuB,2BACAC,eAAAA,CAAAA;EAEJ,GAAG;IAACzB;IAAkBC;GAAmB;AAEzC,SACE,gBAAA0B,OAAA,cAACC,QAAAA;IAAMC,WAAU;IAAO,GAAG3B;KACzB,gBAAAyB,OAAA,cAACC,QAAAA;IAAME,OAAM;IAAOC,KAAK;KACvB,gBAAAJ,OAAA,cAACC,QAAAA,MACC,gBAAAD,OAAA,cAACK,gBAAAA;IAAezB,KAAKE;IAAoBwB,SAAQ;IAAcC,OAAOpB,YAAY,MAAMK;IAAegB,OAAOxB;MAC9G,gBAAAgB,OAAA,cAACC,QAAAA;IAAMC,WAAU;IAAMO,gBAAe;KACnCxB,MAAMyB,IAAI,CAACC,UAAAA;AACV,UAAMC,aAAavB,gBAAgBmB,MAAMG,KAAAA;AACzC,UAAME,cAAcxB,gBAAgByB,mBAAmBH,KAAAA;AACvD,UAAMI,uBAAuB1B,gBAAgB2B,aAAaL,KAAAA;AAC1D,WACE,gBAAAX,OAAA,cAACiB,sBAAAA;MACCC,KAAKP;MACLA;MACAC;MACAC;MACAE;MACArC;;EAGN,CAAA,CAAA,CAAA,GAGJ,gBAAAsB,OAAA,cAACmB,wBAAAA;IACCC,WAAWlC;IACXmC,mBAAmBzB,WAAUtB,kBAAAA,IAAsBe,gBAAgBmB,MAAMlC,kBAAAA,IAAsB;IAC/FgD,yBAAyB1B,WAAUtB,kBAAAA,IAAsB,IAAIiD,KAAKC,aAAY,EAAGC,OAAOnD,kBAAAA,IAAsB;IAC9GS;;AAKV,GAjEiF;","names":["LinearProgress","Stack","isDefined","React","useLayoutEffect","useMemo","useRef","useState","isDefined","BlockFormatters","params","color","blockNumber","currentBlockNumber","confirmedInBlock","isDefined","status","confirmationStatus","formatNumber","toString","length","Intl","NumberFormat","format","slice","isDefined","blockProgressColor","confirmedInBlock","isExpired","isDefined","isUndefined","createFilledRange","range","isUndefined","start","end","console","warn","result","i","push","isUndefined","isUndefinedOrNull","getBlockProgress","currentBlockNumber","currentBlockRef","progressElementRef","isUndefined","isUndefinedOrNull","currentBlockOffsetLeft","offsetLeft","currentBlockOffsetWidth","clientWidth","currentBlockCenterOffsetLeft","parentOffsetLeft","parentWidth","relativePosition","progress","Math","min","max","isDefined","isCurrentBlockPassedRange","blockRange","currentBlockNumber","isDefined","end","isDefined","passedBlocksInRange","range","currentBlockNumber","isDefined","start","filter","block","isDefined","useMemo","useBlockRangeState","blockRange","confirmedInBlock","currentBlockNumber","range","useMemo","createFilledRange","isExpired","isCurrentBlockPassedRange","passedBlocks","passedBlocksInRange","progressColor","blockProgressColor","isConfirmed","isDefined","CheckCircleOutline","Grow","Stack","Typography","isDefined","React","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","passedBlocks","Stack","Typography","variant","color","sx","display","alignItems","gap","Grow","in","CheckCircleOutline","width","height","opacity","isDefined","length","map","block","Intl","NumberFormat","format","join","Box","Stack","styled","Tooltip","Typography","React","BlockRangeEntryStack","block","blockColor","blockStatus","formattedBlockNumber","updateBlockPositionRefs","sx","props","React","Stack","ref","key","position","Box","component","display","width","height","StyledBlockNumberIndicator","backgroundColor","Tooltip","title","Intl","NumberFormat","format","placement","arrow","Typography","variant","color","cursor","opacity","styled","name","theme","unstable_sx","left","transform","TransactionStackProgress","blockRange","confirmedInBlock","currentBlockNumber","props","blockPositionsRef","useRef","updateBlockPositionRefs","blockNumber","ref","current","progressElementRef","passedBlocks","progressColor","range","isConfirmed","isExpired","useBlockRangeState","blockFormatters","useMemo","BlockFormatters","progressValue","setProgressValue","useState","useLayoutEffect","isDefined","currentBlockNumberElement","progressElement","getBlockProgress","React","Stack","direction","width","gap","LinearProgress","variant","value","color","justifyContent","map","block","blockColor","blockStatus","confirmationStatus","formattedBlockNumber","formatNumber","BlockRangeEntryStack","key","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","Intl","NumberFormat","format"]}
|
|
1
|
+
{"version":3,"sources":["../../src/confirmation/components/TransactionStackProgress.tsx","../../src/confirmation/helpers/BlockFormatters.ts","../../src/confirmation/helpers/blockProgressColor.ts","../../src/confirmation/helpers/createFilledRange.ts","../../src/confirmation/helpers/getBlockProgress.ts","../../src/confirmation/helpers/isCurrentBlockPassedRange.ts","../../src/confirmation/helpers/passedBlocksInRange.ts","../../src/confirmation/hooks/useBlockRangeState.ts","../../src/confirmation/components/support/BlockConfirmationStats.tsx","../../src/confirmation/components/support/BlockRangeEntryStack.tsx"],"sourcesContent":["import type { StackProps } from '@mui/material'\nimport { LinearProgress, Stack } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport { type BlockRange } from '@xyo-network/xl1-sdk'\nimport React, {\n useLayoutEffect,\n useMemo,\n useRef, useState,\n} from 'react'\n\nimport { BlockFormatters, getBlockProgress } from '../helpers/index.ts'\nimport { useBlockRangeState } from '../hooks/index.ts'\nimport { BlockConfirmationStats, BlockRangeEntryStack } from './support/index.ts'\n\nexport interface TransactionStackProgressProps extends StackProps {\n blockRange?: BlockRange\n confirmedInBlock?: number\n currentBlockNumber?: number\n}\n\nexport const TransactionStackProgress: React.FC<TransactionStackProgressProps> = ({\n blockRange, confirmedInBlock, currentBlockNumber, ...props\n}) => {\n const blockPositionsRef = useRef<Record<number, HTMLSpanElement | null>>({})\n const updateBlockPositionRefs = (blockNumber: number, ref: HTMLSpanElement | null) => {\n blockPositionsRef.current[blockNumber] = ref\n }\n\n const progressElementRef = useRef<HTMLDivElement | null>(null)\n\n const {\n passedBlocks, progressColor, range, isConfirmed, isExpired,\n } = useBlockRangeState(blockRange, confirmedInBlock, currentBlockNumber)\n\n const blockFormatters = useMemo(() => new BlockFormatters({ confirmedInBlock, currentBlockNumber }), [confirmedInBlock, currentBlockNumber])\n\n const [progressValue, setProgressValue] = useState(0)\n\n useLayoutEffect(() => {\n // prevent updates if the current block is past the confirmed block\n if (isDefined(currentBlockNumber) && isDefined(confirmedInBlock) && currentBlockNumber > confirmedInBlock) {\n return\n }\n const currentBlockNumberElement = isDefined(currentBlockNumber) ? blockPositionsRef.current[currentBlockNumber] : null\n const progressElement = progressElementRef.current\n // since we are relying on htmlElements, we have to use layout effect\n setProgressValue(getBlockProgress(\n currentBlockNumber,\n currentBlockNumberElement,\n progressElement,\n ))\n }, [confirmedInBlock, currentBlockNumber])\n\n return (\n <Stack direction=\"row\" {...props}>\n <Stack width=\"100%\" gap={1}>\n <Stack>\n <LinearProgress ref={progressElementRef} variant=\"determinate\" value={isExpired ? 100 : progressValue} color={progressColor} />\n <Stack direction=\"row\" justifyContent=\"space-between\">\n {range.map((block) => {\n const blockColor = blockFormatters.color(block)\n const blockStatus = blockFormatters.confirmationStatus(block)\n const formattedBlockNumber = blockFormatters.formatNumber(block)\n return (\n <BlockRangeEntryStack\n key={block}\n block={block}\n blockColor={blockColor}\n blockStatus={blockStatus}\n formattedBlockNumber={formattedBlockNumber}\n updateBlockPositionRefs={updateBlockPositionRefs}\n />\n )\n })}\n </Stack>\n </Stack>\n <BlockConfirmationStats\n confirmed={isConfirmed}\n currentBlockColor={isDefined(currentBlockNumber) ? blockFormatters.color(currentBlockNumber) : 'text.secondary'}\n currentBlockNumberValue={isDefined(currentBlockNumber) ? new Intl.NumberFormat().format(currentBlockNumber) : 'N/A'}\n passedBlocks={passedBlocks}\n />\n </Stack>\n </Stack>\n )\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport type BlockConfirmationStatus = 'confirmed' | 'missed' | 'pending'\n\ninterface BlockFormattersParams {\n confirmedInBlock: number | undefined\n currentBlockNumber: number | undefined\n}\n\nexport class BlockFormatters {\n private readonly params: BlockFormattersParams\n\n constructor(params: BlockFormattersParams) {\n this.params = params\n }\n\n color(blockNumber: number): string {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (blockNumber === currentBlockNumber) {\n return isDefined(confirmedInBlock) && confirmedInBlock === blockNumber ? 'success.dark' : 'text'\n }\n const status = this.confirmationStatus(blockNumber)\n switch (status) {\n case 'confirmed': {\n return 'success.dark'\n }\n case 'missed': {\n return 'warning.light'\n }\n case 'pending': {\n return 'text.secondary'\n }\n default: {\n return 'text.secondary'\n }\n }\n }\n\n confirmationStatus(blockNumber: number): BlockConfirmationStatus | undefined {\n const { currentBlockNumber, confirmedInBlock } = this.params\n if (isDefined(currentBlockNumber)) {\n if (isDefined(confirmedInBlock) && blockNumber === confirmedInBlock) {\n return 'confirmed'\n }\n return currentBlockNumber > blockNumber ? 'missed' : 'pending'\n }\n }\n\n formatNumber(blockNumber: number) {\n return blockNumber.toString().length <= 5 ? new Intl.NumberFormat().format(blockNumber) : `${blockNumber.toString().slice(-2)}`\n }\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\n\nexport const blockProgressColor = (\n confirmedInBlock: number | undefined,\n isExpired: boolean | undefined,\n): LinearProgressProps['color'] => {\n if (isDefined(confirmedInBlock)) {\n return 'success'\n }\n if (isExpired) {\n return 'error'\n }\n return 'primary'\n}\n","import { isUndefined } from '@xylabs/sdk-js'\n\nexport const createFilledRange = (range?: [number, number]): number[] => {\n if (isUndefined(range)) {\n return []\n }\n const [start, end] = range\n if (end < start) {\n console.warn('Invalid range: end is less than start')\n return []\n }\n\n const result: number[] = []\n\n for (let i = start; i <= end; i++) {\n result.push(i)\n }\n\n return result\n}\n","import { isUndefined, isUndefinedOrNull } from '@xylabs/sdk-js'\n\nexport const getBlockProgress = (\n currentBlockNumber: number | undefined,\n currentBlockRef: HTMLSpanElement | null,\n progressElementRef: HTMLDivElement | null,\n) => {\n if (isUndefined(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {\n return 0\n }\n\n const currentBlockOffsetLeft = currentBlockRef.offsetLeft\n const currentBlockOffsetWidth = currentBlockRef.clientWidth / 2\n const currentBlockCenterOffsetLeft = currentBlockOffsetLeft + currentBlockOffsetWidth\n const parentOffsetLeft = progressElementRef.offsetLeft\n const parentWidth = progressElementRef.clientWidth\n\n const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft\n const progress = (relativePosition / parentWidth) * 100\n\n return Math.min(Math.max(progress, 0), 100)\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\n\nexport const isCurrentBlockPassedRange = (\n blockRange: BlockRange | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(blockRange) || !isDefined(currentBlockNumber)) {\n return false\n }\n const [, end] = blockRange\n return currentBlockNumber > end\n}\n","import { isDefined } from '@xylabs/sdk-js'\n\nexport const passedBlocksInRange = (\n range: number[] | undefined,\n currentBlockNumber: number | undefined,\n) => {\n if (!isDefined(currentBlockNumber) || !isDefined(range)) {\n return []\n }\n const [start] = range\n return range.filter(block => block < currentBlockNumber && block >= start)\n}\n","import type { LinearProgressProps } from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport type { BlockRange } from '@xyo-network/xl1-sdk'\nimport { useMemo } from 'react'\n\nimport {\n blockProgressColor, createFilledRange, isCurrentBlockPassedRange, passedBlocksInRange,\n} from '../helpers/index.ts'\n\ninterface BlockRangeState {\n isConfirmed: boolean\n isExpired: boolean\n passedBlocks: number[]\n progressColor: LinearProgressProps['color']\n range: number[]\n}\n\nexport const useBlockRangeState = (\n blockRange: BlockRange | undefined,\n confirmedInBlock: number | undefined,\n currentBlockNumber?: number | undefined,\n): BlockRangeState => {\n const range = useMemo(() => createFilledRange((blockRange)), [blockRange])\n\n const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber])\n\n const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range])\n\n const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired])\n\n const isConfirmed = isDefined(confirmedInBlock)\n\n return {\n isConfirmed, isExpired, passedBlocks, progressColor, range,\n }\n}\n","import { CheckCircleOutline } from '@mui/icons-material'\nimport {\n Grow, Stack, Typography,\n} from '@mui/material'\nimport { isDefined } from '@xylabs/sdk-js'\nimport React from 'react'\n\nexport interface BlockConfirmationStatsProps {\n confirmed?: boolean\n currentBlockColor?: string\n currentBlockNumberValue?: string\n passedBlocks?: number[]\n}\n\nexport const BlockConfirmationStats: React.FC<BlockConfirmationStatsProps> = ({\n confirmed, currentBlockColor, currentBlockNumberValue, passedBlocks,\n}) => {\n return (\n <Stack>\n <Typography\n variant=\"caption\"\n color={currentBlockColor}\n sx={{\n display: 'inline-flex', alignItems: 'center', gap: 0.5,\n }}\n >\n Current Block:\n {' '}\n {currentBlockNumberValue}\n {' '}\n <Grow in={confirmed}>\n <CheckCircleOutline sx={{ width: '0.8em', height: '0.8em' }} color=\"success\" />\n </Grow>\n </Typography>\n <Typography variant=\"caption\" color=\"warning.light\" sx={{ opacity: 0.75 }}>\n Passed Blocks:\n {' '}\n {isDefined(passedBlocks) && passedBlocks.length > 0 ? passedBlocks.map(block => new Intl.NumberFormat().format(block)).join(', ') : 'N/A'}\n </Typography>\n\n </Stack>\n )\n}\n","import type { BoxProps, StackProps } from '@mui/material'\nimport {\n Box, Stack, styled, Tooltip, Typography,\n} from '@mui/material'\nimport React from 'react'\n\nimport type { BlockConfirmationStatus } from '../../helpers/index.ts'\n\nexport interface BlockRangeEntryStackProps extends StackProps {\n block: number\n blockColor: string\n blockStatus: BlockConfirmationStatus | undefined\n formattedBlockNumber: string\n updateBlockPositionRefs?: (blockNumber: number, ref: HTMLSpanElement | null) => void\n}\n\nexport const BlockRangeEntryStack: React.FC<BlockRangeEntryStackProps> = ({\n block, blockColor, blockStatus, formattedBlockNumber, updateBlockPositionRefs, sx, ...props\n}) => {\n return (\n <Stack\n ref={(ref) => { if (updateBlockPositionRefs) updateBlockPositionRefs(block, ref) }}\n key={block}\n sx={{ position: 'relative', ...sx }}\n {...props}\n >\n <Box\n component=\"span\"\n sx={{\n display: 'flex', position: 'relative', width: '100%', height: 5,\n }}\n >\n <StyledBlockNumberIndicator component=\"span\" sx={{ backgroundColor: blockColor }} />\n </Box>\n <Tooltip\n title={`Block: ${new Intl.NumberFormat().format(block)} (${blockStatus})`}\n placement=\"top\"\n arrow\n >\n <Typography\n variant=\"caption\"\n sx={{\n color: blockColor,\n cursor: 'pointer',\n opacity: blockStatus === 'missed' ? 0.75 : 1,\n }}\n >\n {formattedBlockNumber}\n </Typography>\n </Tooltip>\n </Stack>\n )\n}\n\nconst StyledBlockNumberIndicator = styled(Box, { name: 'StyledBlockNumberIndicator' })<BoxProps>(({ theme }) => {\n return theme.unstable_sx({\n position: 'absolute',\n left: 'calc(50% - 1px)',\n transform: 'calc(translateX(-50%) - 1px)',\n height: 3,\n width: '1px',\n backgroundColor: 'primary.main',\n })\n})\n"],"mappings":";;;;AACA,SAASA,gBAAgBC,SAAAA,cAAa;AACtC,SAASC,aAAAA,kBAAiB;AAE1B,OAAOC,UACLC,iBACAC,WAAAA,UACAC,QAAQC,gBACH;;;ACRP,SAASC,iBAAiB;AASnB,IAAMC,kBAAN,MAAMA;EATb,OASaA;;;EACMC;EAEjB,YAAYA,QAA+B;AACzC,SAAKA,SAASA;EAChB;EAEAC,MAAMC,aAA6B;AACjC,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIE,gBAAgBC,oBAAoB;AACtC,aAAOE,UAAUD,gBAAAA,KAAqBA,qBAAqBF,cAAc,iBAAiB;IAC5F;AACA,UAAMI,SAAS,KAAKC,mBAAmBL,WAAAA;AACvC,YAAQI,QAAAA;MACN,KAAK,aAAa;AAChB,eAAO;MACT;MACA,KAAK,UAAU;AACb,eAAO;MACT;MACA,KAAK,WAAW;AACd,eAAO;MACT;MACA,SAAS;AACP,eAAO;MACT;IACF;EACF;EAEAC,mBAAmBL,aAA0D;AAC3E,UAAM,EAAEC,oBAAoBC,iBAAgB,IAAK,KAAKJ;AACtD,QAAIK,UAAUF,kBAAAA,GAAq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gBAAAA,KAAqBC,qBAAqBD,kBAAkB;AACzG;IACF;AACA,UAAMwB,4BAA4BD,WAAUtB,kBAAAA,IAAsBE,kBAAkBK,QAAQP,kBAAAA,IAAsB;AAClH,UAAMwB,kBAAkBhB,mBAAmBD;AAE3CY,qBAAiBM,iBACfzB,oBACAuB,2BACAC,eAAAA,CAAAA;EAEJ,GAAG;IAACzB;IAAkBC;GAAmB;AAEzC,SACE,gBAAA0B,OAAA,cAACC,QAAAA;IAAMC,WAAU;IAAO,GAAG3B;KACzB,gBAAAyB,OAAA,cAACC,QAAAA;IAAME,OAAM;IAAOC,KAAK;KACvB,gBAAAJ,OAAA,cAACC,QAAAA,MACC,gBAAAD,OAAA,cAACK,gBAAAA;IAAezB,KAAKE;IAAoBwB,SAAQ;IAAcC,OAAOpB,YAAY,MAAMK;IAAegB,OAAOxB;MAC9G,gBAAAgB,OAAA,cAACC,QAAAA;IAAMC,WAAU;IAAMO,gBAAe;KACnCxB,MAAMyB,IAAI,CAACC,UAAAA;AACV,UAAMC,aAAavB,gBAAgBmB,MAAMG,KAAAA;AACzC,UAAME,cAAcxB,gBAAgByB,mBAAmBH,KAAAA;AACvD,UAAMI,uBAAuB1B,gBAAgB2B,aAAaL,KAAAA;AAC1D,WACE,gBAAAX,OAAA,cAACiB,sBAAAA;MACCC,KAAKP;MACLA;MACAC;MACAC;MACAE;MACArC;;EAGN,CAAA,CAAA,CAAA,GAGJ,gBAAAsB,OAAA,cAACmB,wBAAAA;IACCC,WAAWlC;IACXmC,mBAAmBzB,WAAUtB,kBAAAA,IAAsBe,gBAAgBmB,MAAMlC,kBAAAA,IAAsB;IAC/FgD,yBAAyB1B,WAAUtB,kBAAAA,IAAsB,IAAIiD,KAAKC,aAAY,EAAGC,OAAOnD,kBAAAA,IAAsB;IAC9GS;;AAKV,GAjEiF;","names":["LinearProgress","Stack","isDefined","React","useLayoutEffect","useMemo","useRef","useState","isDefined","BlockFormatters","params","color","blockNumber","currentBlockNumber","confirmedInBlock","isDefined","status","confirmationStatus","formatNumber","toString","length","Intl","NumberFormat","format","slice","isDefined","blockProgressColor","confirmedInBlock","isExpired","isDefined","isUndefined","createFilledRange","range","isUndefined","start","end","console","warn","result","i","push","isUndefined","isUndefinedOrNull","getBlockProgress","currentBlockNumber","currentBlockRef","progressElementRef","isUndefined","isUndefinedOrNull","currentBlockOffsetLeft","offsetLeft","currentBlockOffsetWidth","clientWidth","currentBlockCenterOffsetLeft","parentOffsetLeft","parentWidth","relativePosition","progress","Math","min","max","isDefined","isCurrentBlockPassedRange","blockRange","currentBlockNumber","isDefined","end","isDefined","passedBlocksInRange","range","currentBlockNumber","isDefined","start","filter","block","isDefined","useMemo","useBlockRangeState","blockRange","confirmedInBlock","currentBlockNumber","range","useMemo","createFilledRange","isExpired","isCurrentBlockPassedRange","passedBlocks","passedBlocksInRange","progressColor","blockProgressColor","isConfirmed","isDefined","CheckCircleOutline","Grow","Stack","Typography","isDefined","React","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","passedBlocks","Stack","Typography","variant","color","sx","display","alignItems","gap","Grow","in","CheckCircleOutline","width","height","opacity","isDefined","length","map","block","Intl","NumberFormat","format","join","Box","Stack","styled","Tooltip","Typography","React","BlockRangeEntryStack","block","blockColor","blockStatus","formattedBlockNumber","updateBlockPositionRefs","sx","props","React","Stack","ref","key","position","Box","component","display","width","height","StyledBlockNumberIndicator","backgroundColor","Tooltip","title","Intl","NumberFormat","format","placement","arrow","Typography","variant","color","cursor","opacity","styled","name","theme","unstable_sx","left","transform","TransactionStackProgress","blockRange","confirmedInBlock","currentBlockNumber","props","blockPositionsRef","useRef","updateBlockPositionRefs","blockNumber","ref","current","progressElementRef","passedBlocks","progressColor","range","isConfirmed","isExpired","useBlockRangeState","blockFormatters","useMemo","BlockFormatters","progressValue","setProgressValue","useState","useLayoutEffect","isDefined","currentBlockNumberElement","progressElement","getBlockProgress","React","Stack","direction","width","gap","LinearProgress","variant","value","color","justifyContent","map","block","blockColor","blockStatus","confirmationStatus","formattedBlockNumber","formatNumber","BlockRangeEntryStack","key","BlockConfirmationStats","confirmed","currentBlockColor","currentBlockNumberValue","Intl","NumberFormat","format"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-react-transaction",
|
|
4
|
-
"version": "1.20.
|
|
4
|
+
"version": "1.20.18",
|
|
5
5
|
"description": "XYO Layer One API",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -31,8 +31,6 @@
|
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
34
|
-
"module": "./dist/browser/index.mjs",
|
|
35
|
-
"types": "./dist/browser/index.d.ts",
|
|
36
34
|
"files": [
|
|
37
35
|
"dist",
|
|
38
36
|
"!**/*.bench.*",
|
|
@@ -42,7 +40,7 @@
|
|
|
42
40
|
],
|
|
43
41
|
"dependencies": {
|
|
44
42
|
"@mui/icons-material": "^7",
|
|
45
|
-
"@xyo-network/xl1-sdk": "^1.26.
|
|
43
|
+
"@xyo-network/xl1-sdk": "^1.26.29"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
|
48
46
|
"@emotion/react": "~11.14.0",
|
|
@@ -50,14 +48,13 @@
|
|
|
50
48
|
"@mui/material": "^7.3.9",
|
|
51
49
|
"@opentelemetry/api": "^1",
|
|
52
50
|
"@storybook/react-vite": "^10.3.5",
|
|
53
|
-
"@types/node": "^25.
|
|
51
|
+
"@types/node": "^25.6.0",
|
|
54
52
|
"@types/react": "~19.2.14",
|
|
55
53
|
"@xylabs/sdk-js": "~5.0.95",
|
|
56
|
-
"@xylabs/
|
|
57
|
-
"@xylabs/
|
|
58
|
-
"@xylabs/tsconfig": "~7.
|
|
59
|
-
"@xylabs/tsconfig-
|
|
60
|
-
"@xylabs/tsconfig-react": "~7.9.3",
|
|
54
|
+
"@xylabs/toolchain": "~7.10.7",
|
|
55
|
+
"@xylabs/tsconfig": "~7.10.7",
|
|
56
|
+
"@xylabs/tsconfig-dom": "~7.10.7",
|
|
57
|
+
"@xylabs/tsconfig-react": "~7.10.7",
|
|
61
58
|
"@xyo-network/account": "~5.3.30",
|
|
62
59
|
"@xyo-network/account-model": "~5.3.30",
|
|
63
60
|
"@xyo-network/api-models": "~5.3.30",
|
|
@@ -109,17 +106,17 @@
|
|
|
109
106
|
"@xyo-network/witness-adhoc": "~5.3.30",
|
|
110
107
|
"@xyo-network/witness-model": "~5.3.30",
|
|
111
108
|
"ajv": "^8",
|
|
112
|
-
"axios": "^1.
|
|
113
|
-
"dotenv": "~17.4.
|
|
109
|
+
"axios": "^1.15.0",
|
|
110
|
+
"dotenv": "~17.4.2",
|
|
114
111
|
"esbuild": "*",
|
|
115
112
|
"ethers": "^6.16.0",
|
|
116
113
|
"pako": "~2.1.0",
|
|
117
|
-
"react": "^19.2.
|
|
118
|
-
"react-dom": "^19.2.
|
|
114
|
+
"react": "^19.2.5",
|
|
115
|
+
"react-dom": "^19.2.5",
|
|
119
116
|
"storybook": "^10.3.5",
|
|
120
117
|
"typescript": "~5.9.3",
|
|
121
|
-
"vite": "^8.0.
|
|
122
|
-
"vitest": "^4.1.
|
|
118
|
+
"vite": "^8.0.8",
|
|
119
|
+
"vitest": "^4.1.4",
|
|
123
120
|
"zod": "^4.3.6"
|
|
124
121
|
},
|
|
125
122
|
"peerDependencies": {
|
|
@@ -130,9 +127,6 @@
|
|
|
130
127
|
"engines": {
|
|
131
128
|
"node": ">=24"
|
|
132
129
|
},
|
|
133
|
-
"volta": {
|
|
134
|
-
"node": ">=24"
|
|
135
|
-
},
|
|
136
130
|
"publishConfig": {
|
|
137
131
|
"access": "public"
|
|
138
132
|
}
|