@xyo-network/xl1-react-transaction 1.20.15 → 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.
@@ -1,22 +0,0 @@
1
- import { isUndefined, isUndefinedOrNull } from '@xylabs/sdk-js'
2
-
3
- export const getBlockProgress = (
4
- currentBlockNumber: number | undefined,
5
- currentBlockRef: HTMLSpanElement | null,
6
- progressElementRef: HTMLDivElement | null,
7
- ) => {
8
- if (isUndefined(currentBlockNumber) || isUndefinedOrNull(currentBlockRef) || isUndefinedOrNull(progressElementRef)) {
9
- return 0
10
- }
11
-
12
- const currentBlockOffsetLeft = currentBlockRef.offsetLeft
13
- const currentBlockOffsetWidth = currentBlockRef.clientWidth / 2
14
- const currentBlockCenterOffsetLeft = currentBlockOffsetLeft + currentBlockOffsetWidth
15
- const parentOffsetLeft = progressElementRef.offsetLeft
16
- const parentWidth = progressElementRef.clientWidth
17
-
18
- const relativePosition = currentBlockCenterOffsetLeft - parentOffsetLeft
19
- const progress = (relativePosition / parentWidth) * 100
20
-
21
- return Math.min(Math.max(progress, 0), 100)
22
- }
@@ -1,6 +0,0 @@
1
- export * from './BlockFormatters.ts'
2
- export * from './blockProgressColor.ts'
3
- export * from './createFilledRange.ts'
4
- export * from './getBlockProgress.ts'
5
- export * from './isCurrentBlockPassedRange.ts'
6
- export * from './passedBlocksInRange.ts'
@@ -1,13 +0,0 @@
1
- import { isDefined } from '@xylabs/sdk-js'
2
- import type { BlockRange } from '@xyo-network/xl1-sdk'
3
-
4
- export const isCurrentBlockPassedRange = (
5
- blockRange: BlockRange | undefined,
6
- currentBlockNumber: number | undefined,
7
- ) => {
8
- if (!isDefined(blockRange) || !isDefined(currentBlockNumber)) {
9
- return false
10
- }
11
- const [, end] = blockRange
12
- return currentBlockNumber > end
13
- }
@@ -1,12 +0,0 @@
1
- import { isDefined } from '@xylabs/sdk-js'
2
-
3
- export const passedBlocksInRange = (
4
- range: number[] | undefined,
5
- currentBlockNumber: number | undefined,
6
- ) => {
7
- if (!isDefined(currentBlockNumber) || !isDefined(range)) {
8
- return []
9
- }
10
- const [start] = range
11
- return range.filter(block => block < currentBlockNumber && block >= start)
12
- }
@@ -1 +0,0 @@
1
- export * from './useBlockRangeState.ts'
@@ -1,27 +0,0 @@
1
- import { isDefined } from '@xylabs/sdk-js'
2
- import type { BlockRange } from '@xyo-network/xl1-sdk'
3
- import { useMemo } from 'react'
4
-
5
- import {
6
- blockProgressColor, createFilledRange, isCurrentBlockPassedRange, passedBlocksInRange,
7
- } from '../helpers/index.ts'
8
-
9
- export const useBlockRangeState = (
10
- blockRange: BlockRange | undefined,
11
- confirmedInBlock: number | undefined,
12
- currentBlockNumber?: number | undefined,
13
- ) => {
14
- const range = useMemo(() => createFilledRange((blockRange)), [blockRange])
15
-
16
- const isExpired = useMemo(() => isCurrentBlockPassedRange(blockRange, currentBlockNumber), [blockRange, currentBlockNumber])
17
-
18
- const passedBlocks = useMemo(() => passedBlocksInRange(range, currentBlockNumber), [currentBlockNumber, range])
19
-
20
- const progressColor = useMemo(() => blockProgressColor(confirmedInBlock, isExpired), [confirmedInBlock, isExpired])
21
-
22
- const isConfirmed = isDefined(confirmedInBlock)
23
-
24
- return {
25
- isConfirmed, isExpired, passedBlocks, progressColor, range,
26
- }
27
- }
@@ -1,3 +0,0 @@
1
- export * from './components/index.ts'
2
- export * from './helpers/index.ts'
3
- export * from './hooks/index.ts'
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './confirmation/index.ts'