@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.
Files changed (60) hide show
  1. package/dist/components/SweepApp.d.ts +3 -3
  2. package/dist/components/SweepApp.d.ts.map +1 -1
  3. package/dist/components/asset-preview.d.ts +5 -5
  4. package/dist/components/asset-preview.d.ts.map +1 -1
  5. package/dist/components/connect-wallet.d.ts +1 -1
  6. package/dist/components/connect-wallet.d.ts.map +1 -1
  7. package/dist/components/opns-section.d.ts +2 -2
  8. package/dist/components/opns-section.d.ts.map +1 -1
  9. package/dist/components/sweep-progress.d.ts +1 -1
  10. package/dist/components/sweep-progress.d.ts.map +1 -1
  11. package/dist/components/tx-history.d.ts.map +1 -1
  12. package/dist/components/ui/badge.d.ts +3 -3
  13. package/dist/components/ui/badge.d.ts.map +1 -1
  14. package/dist/components/ui/button.d.ts +3 -3
  15. package/dist/components/ui/button.d.ts.map +1 -1
  16. package/dist/components/ui/card.d.ts +9 -9
  17. package/dist/components/ui/card.d.ts.map +1 -1
  18. package/dist/components/ui/input.d.ts +2 -2
  19. package/dist/components/ui/input.d.ts.map +1 -1
  20. package/dist/components/ui/tabs.d.ts +5 -5
  21. package/dist/components/ui/tabs.d.ts.map +1 -1
  22. package/dist/components/wif-input.d.ts +1 -1
  23. package/dist/components/wif-input.d.ts.map +1 -1
  24. package/dist/index.d.ts +19 -19
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1911 -1757
  27. package/dist/lib/legacy-send.d.ts +2 -2
  28. package/dist/lib/legacy-send.d.ts.map +1 -1
  29. package/dist/lib/scanner.d.ts +3 -3
  30. package/dist/lib/scanner.d.ts.map +1 -1
  31. package/dist/lib/services.d.ts +1 -1
  32. package/dist/lib/services.d.ts.map +1 -1
  33. package/dist/lib/sweeper.d.ts +3 -3
  34. package/dist/lib/sweeper.d.ts.map +1 -1
  35. package/dist/lib/utils.d.ts +1 -1
  36. package/dist/lib/utils.d.ts.map +1 -1
  37. package/dist/lib/wallet.d.ts +2 -2
  38. package/dist/lib/wallet.d.ts.map +1 -1
  39. package/dist/types.d.ts.map +1 -1
  40. package/package.json +53 -44
  41. package/src/components/SweepApp.tsx +480 -222
  42. package/src/components/asset-preview.tsx +380 -97
  43. package/src/components/connect-wallet.tsx +50 -25
  44. package/src/components/opns-section.tsx +167 -60
  45. package/src/components/sweep-progress.tsx +40 -17
  46. package/src/components/tx-history.tsx +30 -17
  47. package/src/components/ui/badge.tsx +17 -14
  48. package/src/components/ui/button.tsx +26 -22
  49. package/src/components/ui/card.tsx +76 -17
  50. package/src/components/ui/input.tsx +7 -7
  51. package/src/components/ui/tabs.tsx +51 -12
  52. package/src/components/wif-input.tsx +243 -135
  53. package/src/index.ts +54 -19
  54. package/src/lib/legacy-send.ts +110 -106
  55. package/src/lib/scanner.ts +45 -40
  56. package/src/lib/services.ts +11 -9
  57. package/src/lib/sweeper.ts +67 -54
  58. package/src/lib/utils.ts +11 -11
  59. package/src/lib/wallet.ts +16 -13
  60. package/src/types.ts +3 -3
@@ -1,43 +1,47 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
- import { cn } from "../../lib/utils"
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: "bg-primary text-primary-foreground hover:bg-primary/90",
11
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
12
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
13
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
14
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
15
- link: "text-primary underline-offset-4 hover:underline",
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: "h-9 px-4 py-2 has-[>svg]:px-3",
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: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
21
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
22
- icon: "size-9",
23
- "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
24
- "icon-sm": "size-8",
25
- "icon-lg": "size-10",
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: "default",
30
- size: "default",
33
+ variant: 'default',
34
+ size: 'default',
31
35
  },
32
- }
36
+ },
33
37
  )
34
38
 
35
39
  function Button({
36
40
  className,
37
- variant = "default",
38
- size = "default",
41
+ variant = 'default',
42
+ size = 'default',
39
43
  ...props
40
- }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants>) {
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 "react"
2
- import { cn } from "../../lib/utils"
1
+ import type * as React from 'react'
2
+ import { cn } from '../../lib/utils'
3
3
 
4
- function Card({ className, ...props }: React.ComponentProps<"div">) {
5
- return (<div data-slot="card" className={cn("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm", className)} {...props} />)
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<"div">) {
9
- return (<div data-slot="card-header" className={cn("@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", className)} {...props} />)
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<"div">) {
13
- return (<div data-slot="card-title" className={cn("leading-none font-semibold", className)} {...props} />)
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<"div">) {
17
- return (<div data-slot="card-description" className={cn("text-sm text-muted-foreground", className)} {...props} />)
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<"div">) {
21
- return (<div data-slot="card-action" className={cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className)} {...props} />)
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<"div">) {
25
- return (<div data-slot="card-content" className={cn("px-6", className)} {...props} />)
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<"div">) {
29
- return (<div data-slot="card-footer" className={cn("flex items-center px-6 [.border-t]:pt-6", className)} {...props} />)
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 { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent }
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 "react"
2
- import { cn } from "../../lib/utils"
1
+ import type * as React from 'react'
2
+ import { cn } from '../../lib/utils'
3
3
 
4
- function Input({ className, type, ...props }: React.ComponentProps<"input">) {
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
- "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
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 "react"
2
- import { cn } from "../../lib/utils"
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("Tabs components must be used within a <Tabs> provider")
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({ value, onValueChange, className, ...props }: React.ComponentProps<"div"> & { value: string; onValueChange: (value: string) => void }) {
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 data-slot="tabs" className={cn("flex flex-col gap-2", className)} {...props} />
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<"div">) {
28
- return (<div data-slot="tabs-list" className={cn("inline-flex h-9 items-center justify-start gap-1 rounded-lg bg-muted p-1 text-muted-foreground", className)} {...props} />)
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({ value, className, ...props }: React.ComponentProps<"button"> & { value: string }) {
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 ? "" : undefined}
38
- className={cn("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", isActive && "bg-background text-foreground shadow-sm", className)}
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({ value, className, ...props }: React.ComponentProps<"div"> & { value: string }) {
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 (<div data-slot="tabs-content" className={cn("mt-2", className)} {...props} />)
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 }