@1sat/sweep-ui 0.0.19 → 0.0.21
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/dist/components/SweepApp.d.ts +3 -3
- package/dist/components/SweepApp.d.ts.map +1 -1
- package/dist/components/asset-preview.d.ts +5 -5
- package/dist/components/asset-preview.d.ts.map +1 -1
- package/dist/components/connect-wallet.d.ts +1 -1
- package/dist/components/connect-wallet.d.ts.map +1 -1
- package/dist/components/opns-section.d.ts +2 -2
- package/dist/components/opns-section.d.ts.map +1 -1
- package/dist/components/sweep-progress.d.ts +1 -1
- package/dist/components/sweep-progress.d.ts.map +1 -1
- package/dist/components/tx-history.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +3 -3
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +9 -9
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +2 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +5 -5
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/wif-input.d.ts +1 -1
- package/dist/components/wif-input.d.ts.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1911 -1757
- package/dist/lib/legacy-send.d.ts +2 -2
- package/dist/lib/legacy-send.d.ts.map +1 -1
- package/dist/lib/scanner.d.ts +3 -3
- package/dist/lib/scanner.d.ts.map +1 -1
- package/dist/lib/services.d.ts +1 -1
- package/dist/lib/services.d.ts.map +1 -1
- package/dist/lib/sweeper.d.ts +3 -3
- package/dist/lib/sweeper.d.ts.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/wallet.d.ts +2 -2
- package/dist/lib/wallet.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +53 -44
- package/src/components/SweepApp.tsx +480 -222
- package/src/components/asset-preview.tsx +380 -97
- package/src/components/connect-wallet.tsx +50 -25
- package/src/components/opns-section.tsx +167 -60
- package/src/components/sweep-progress.tsx +40 -17
- package/src/components/tx-history.tsx +30 -17
- package/src/components/ui/badge.tsx +17 -14
- package/src/components/ui/button.tsx +26 -22
- package/src/components/ui/card.tsx +76 -17
- package/src/components/ui/input.tsx +7 -7
- package/src/components/ui/tabs.tsx +51 -12
- package/src/components/wif-input.tsx +243 -135
- package/src/index.ts +54 -19
- package/src/lib/legacy-send.ts +110 -106
- package/src/lib/scanner.ts +45 -40
- package/src/lib/services.ts +11 -9
- package/src/lib/sweeper.ts +67 -54
- package/src/lib/utils.ts +11 -11
- package/src/lib/wallet.ts +16 -13
- package/src/types.ts +3 -3
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { cn } from
|
|
1
|
+
import { type VariantProps, cva } from 'class-variance-authority'
|
|
2
|
+
import type * as React from 'react'
|
|
3
|
+
import { cn } from '../../lib/utils'
|
|
4
4
|
|
|
5
5
|
const buttonVariants = cva(
|
|
6
6
|
"inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
7
7
|
{
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
|
-
default:
|
|
11
|
-
destructive:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
11
|
+
destructive:
|
|
12
|
+
'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40',
|
|
13
|
+
outline:
|
|
14
|
+
'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50',
|
|
15
|
+
secondary:
|
|
16
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
17
|
+
ghost:
|
|
18
|
+
'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
19
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
16
20
|
},
|
|
17
21
|
size: {
|
|
18
|
-
default:
|
|
22
|
+
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
19
23
|
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
-
sm:
|
|
21
|
-
lg:
|
|
22
|
-
icon:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
sm: 'h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5',
|
|
25
|
+
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
26
|
+
icon: 'size-9',
|
|
27
|
+
'icon-xs': "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
28
|
+
'icon-sm': 'size-8',
|
|
29
|
+
'icon-lg': 'size-10',
|
|
26
30
|
},
|
|
27
31
|
},
|
|
28
32
|
defaultVariants: {
|
|
29
|
-
variant:
|
|
30
|
-
size:
|
|
33
|
+
variant: 'default',
|
|
34
|
+
size: 'default',
|
|
31
35
|
},
|
|
32
|
-
}
|
|
36
|
+
},
|
|
33
37
|
)
|
|
34
38
|
|
|
35
39
|
function Button({
|
|
36
40
|
className,
|
|
37
|
-
variant =
|
|
38
|
-
size =
|
|
41
|
+
variant = 'default',
|
|
42
|
+
size = 'default',
|
|
39
43
|
...props
|
|
40
|
-
}: React.ComponentProps<
|
|
44
|
+
}: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants>) {
|
|
41
45
|
return (
|
|
42
46
|
<button
|
|
43
47
|
data-slot="button"
|
|
@@ -1,32 +1,91 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { cn } from
|
|
1
|
+
import type * as React from 'react'
|
|
2
|
+
import { cn } from '../../lib/utils'
|
|
3
3
|
|
|
4
|
-
function Card({ className, ...props }: React.ComponentProps<
|
|
5
|
-
return (
|
|
4
|
+
function Card({ className, ...props }: React.ComponentProps<'div'>) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
data-slot="card"
|
|
8
|
+
className={cn(
|
|
9
|
+
'flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm',
|
|
10
|
+
className,
|
|
11
|
+
)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
6
15
|
}
|
|
7
16
|
|
|
8
|
-
function CardHeader({ className, ...props }: React.ComponentProps<
|
|
9
|
-
return (
|
|
17
|
+
function CardHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
data-slot="card-header"
|
|
21
|
+
className={cn(
|
|
22
|
+
'@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6',
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
10
28
|
}
|
|
11
29
|
|
|
12
|
-
function CardTitle({ className, ...props }: React.ComponentProps<
|
|
13
|
-
return (
|
|
30
|
+
function CardTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
data-slot="card-title"
|
|
34
|
+
className={cn('leading-none font-semibold', className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
14
38
|
}
|
|
15
39
|
|
|
16
|
-
function CardDescription({ className, ...props }: React.ComponentProps<
|
|
17
|
-
return (
|
|
40
|
+
function CardDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
data-slot="card-description"
|
|
44
|
+
className={cn('text-sm text-muted-foreground', className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
18
48
|
}
|
|
19
49
|
|
|
20
|
-
function CardAction({ className, ...props }: React.ComponentProps<
|
|
21
|
-
return (
|
|
50
|
+
function CardAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
data-slot="card-action"
|
|
54
|
+
className={cn(
|
|
55
|
+
'col-start-2 row-span-2 row-start-1 self-start justify-self-end',
|
|
56
|
+
className,
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
22
61
|
}
|
|
23
62
|
|
|
24
|
-
function CardContent({ className, ...props }: React.ComponentProps<
|
|
25
|
-
return (
|
|
63
|
+
function CardContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
data-slot="card-content"
|
|
67
|
+
className={cn('px-6', className)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
26
71
|
}
|
|
27
72
|
|
|
28
|
-
function CardFooter({ className, ...props }: React.ComponentProps<
|
|
29
|
-
return (
|
|
73
|
+
function CardFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="card-footer"
|
|
77
|
+
className={cn('flex items-center px-6 [.border-t]:pt-6', className)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
30
81
|
}
|
|
31
82
|
|
|
32
|
-
export {
|
|
83
|
+
export {
|
|
84
|
+
Card,
|
|
85
|
+
CardHeader,
|
|
86
|
+
CardFooter,
|
|
87
|
+
CardTitle,
|
|
88
|
+
CardAction,
|
|
89
|
+
CardDescription,
|
|
90
|
+
CardContent,
|
|
91
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { cn } from
|
|
1
|
+
import type * as React from 'react'
|
|
2
|
+
import { cn } from '../../lib/utils'
|
|
3
3
|
|
|
4
|
-
function Input({ className, type, ...props }: React.ComponentProps<
|
|
4
|
+
function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
|
|
5
5
|
return (
|
|
6
6
|
<input
|
|
7
7
|
type={type}
|
|
8
8
|
data-slot="input"
|
|
9
9
|
className={cn(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
className
|
|
10
|
+
'h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30',
|
|
11
|
+
'focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50',
|
|
12
|
+
'aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40',
|
|
13
|
+
className,
|
|
14
14
|
)}
|
|
15
15
|
{...props}
|
|
16
16
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { cn } from
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cn } from '../../lib/utils'
|
|
3
3
|
|
|
4
4
|
type TabsContextValue = {
|
|
5
5
|
value: string
|
|
@@ -11,41 +11,80 @@ const TabsContext = React.createContext<TabsContextValue | null>(null)
|
|
|
11
11
|
function useTabsContext() {
|
|
12
12
|
const context = React.useContext(TabsContext)
|
|
13
13
|
if (!context) {
|
|
14
|
-
throw new Error(
|
|
14
|
+
throw new Error('Tabs components must be used within a <Tabs> provider')
|
|
15
15
|
}
|
|
16
16
|
return context
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
function Tabs({
|
|
19
|
+
function Tabs({
|
|
20
|
+
value,
|
|
21
|
+
onValueChange,
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: React.ComponentProps<'div'> & {
|
|
25
|
+
value: string
|
|
26
|
+
onValueChange: (value: string) => void
|
|
27
|
+
}) {
|
|
20
28
|
return (
|
|
21
29
|
<TabsContext.Provider value={{ value, onValueChange }}>
|
|
22
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
data-slot="tabs"
|
|
32
|
+
className={cn('flex flex-col gap-2', className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
23
35
|
</TabsContext.Provider>
|
|
24
36
|
)
|
|
25
37
|
}
|
|
26
38
|
|
|
27
|
-
function TabsList({ className, ...props }: React.ComponentProps<
|
|
28
|
-
return (
|
|
39
|
+
function TabsList({ className, ...props }: React.ComponentProps<'div'>) {
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
42
|
+
data-slot="tabs-list"
|
|
43
|
+
className={cn(
|
|
44
|
+
'inline-flex h-9 items-center justify-start gap-1 rounded-lg bg-muted p-1 text-muted-foreground',
|
|
45
|
+
className,
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
)
|
|
29
50
|
}
|
|
30
51
|
|
|
31
|
-
function TabsTrigger({
|
|
52
|
+
function TabsTrigger({
|
|
53
|
+
value,
|
|
54
|
+
className,
|
|
55
|
+
...props
|
|
56
|
+
}: React.ComponentProps<'button'> & { value: string }) {
|
|
32
57
|
const context = useTabsContext()
|
|
33
58
|
const isActive = context.value === value
|
|
34
59
|
return (
|
|
35
60
|
<button
|
|
36
61
|
data-slot="tabs-trigger"
|
|
37
|
-
data-active={isActive ?
|
|
38
|
-
className={cn(
|
|
62
|
+
data-active={isActive ? '' : undefined}
|
|
63
|
+
className={cn(
|
|
64
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50',
|
|
65
|
+
isActive && 'bg-background text-foreground shadow-sm',
|
|
66
|
+
className,
|
|
67
|
+
)}
|
|
39
68
|
onClick={() => context.onValueChange(value)}
|
|
40
69
|
{...props}
|
|
41
70
|
/>
|
|
42
71
|
)
|
|
43
72
|
}
|
|
44
73
|
|
|
45
|
-
function TabsContent({
|
|
74
|
+
function TabsContent({
|
|
75
|
+
value,
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}: React.ComponentProps<'div'> & { value: string }) {
|
|
46
79
|
const context = useTabsContext()
|
|
47
80
|
if (context.value !== value) return null
|
|
48
|
-
return (
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
data-slot="tabs-content"
|
|
84
|
+
className={cn('mt-2', className)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
49
88
|
}
|
|
50
89
|
|
|
51
90
|
export { Tabs, TabsList, TabsTrigger, TabsContent }
|