BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/bitcoin-ui/bitcoin-core

Bitcoin UI core

bitcoin-ui/bitcoin-core
FreeUtility

Types, exact formatting utilities, class helpers, and shared component styles.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/dennisonbertram/bitcoin-ui/main/public/r/bitcoin-core.json

Source

lib/bitcoin.tsraw.githubusercontent.com/dennisonbertram/bitcoin-ui/main/public/r/bitcoin-core.json · first 6 KB
1export type BitcoinNetwork = "mainnet" | "testnet" | "signet" | "regtest";
2
3export type ScriptType =
4 | "p2pkh"
5 | "p2sh"
6 | "p2wpkh"
7 | "p2wsh"
8 | "p2tr"
9 | "op-return"
10 | "unknown";
11
12export type TransactionState =
13 | "confirmed"
14 | "pending"
15 | "replaced"
16 | "conflicted";
17
18export type AmountUnit = "sat" | "btc" | "auto";
19
20export type BitcoinSearchKind =
21 | "block-height"
22 | "hash"
23 | "address"
24 | "unknown";
25
26export type SatoshiValue = bigint | number | string;
27
28export interface BitcoinBlock {
29 height: number;
30 hash: string;
31 timestamp: number | Date;
32 transactionCount: number;
33 size: number;
34 weight: number;
35 miner?: string;
36 feeTotal?: SatoshiValue;
37}
38
39export interface BitcoinTransaction {
40 txid: string;
41 value: SatoshiValue;
42 fee: SatoshiValue;
43 vsize: number;
44 timestamp?: number | Date;
45 confirmations?: number;
46 state: TransactionState;
47}
48
49export interface BitcoinUtxo {
50 txid: string;
51 vout: number;
52 value: SatoshiValue;
53 confirmations: number;
54 scriptType: ScriptType;
55 address?: string;
56 spendable?: boolean;
57}
58
59export interface TransactionEndpoint {
60 id: string;
61 address?: string;
62 label?: string;
63 value: SatoshiValue;
64 scriptType?: ScriptType;
65 coinbase?: boolean;
66}
67
68export interface FeeEstimate {
69 label: string;
70 blocks: number;
71 satPerVbyte: number;
72 minutes?: number;
73}
74
75const SATOSHIS_PER_BTC = BigInt(100_000_000);
76
77export function toSatoshis(value: SatoshiValue): bigint {
78 if (typeof value === "bigint") return value;
79
80 if (typeof value === "number") {
81 if (!Number.isFinite(value)) {
82 throw new TypeError("Satoshi value must be finite.");
83 }
84 return BigInt(Math.trunc(value));
85 }
86
87 if (!/^-?\d+$/.test(value.trim())) {
88 throw new TypeError("Satoshi value must be an integer string.");
89 }
90
91 return BigInt(value);
92}
93
94export function formatSats(
95 value: SatoshiValue,
96 options: Intl.NumberFormatOptions = {},
97) {
98 const sats = toSatoshis(value);
99 return new Intl.NumberFormat("en-US", {
100 maximumFractionDigits: 0,
101 ...options,
102 }).format(sats);
103}
104
105export function formatBtc(
106 value: SatoshiValue,
107 {
108 minimumFractionDigits = 0,
109 maximumFractionDigits = 8,
110 }: {
111 minimumFractionDigits?: number;
112 maximumFractionDigits?: number;
113 } = {},
114) {
115 const sats = toSatoshis(value);
116 const negative = sats < BigInt(0);
117 const absolute = negative ? -sats : sats;
118 const whole = absolute / SATOSHIS_PER_BTC;
119 const remainder = absolute % SATOSHIS_PER_BTC;
120// … truncated

What it pulls in

npm packages

  • clsx
  • tailwind-merge

Files it writes

  • lib/bitcoin.ts
  • lib/utils.ts
  • components/bitcoin/shared.ts

Facts

Registry
bitcoin-ui
Type
registry:lib
Access
Free
Files written
3
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

dennisonbertram.github.io dennisonbertram/bitcoin-ui on GitHub Raw registry item This item as JSON
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex