Add utxo chart to address page
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { MempoolBlockDelta, MempoolBlockDeltaCompressed, MempoolDeltaChange, TransactionCompressed } from "../interfaces/websocket.interface";
|
||||
import { TransactionStripped } from "../interfaces/node-api.interface";
|
||||
import { AmountShortenerPipe } from "./pipes/amount-shortener.pipe";
|
||||
const amountShortenerPipe = new AmountShortenerPipe();
|
||||
|
||||
export function isMobile(): boolean {
|
||||
return (window.innerWidth <= 767.98);
|
||||
@@ -184,6 +186,33 @@ export function uncompressDeltaChange(block: number, delta: MempoolBlockDeltaCom
|
||||
};
|
||||
}
|
||||
|
||||
export function renderSats(value: number, network: string, mode: 'sats' | 'btc' | 'auto' = 'auto'): string {
|
||||
let prefix = '';
|
||||
switch (network) {
|
||||
case 'liquid':
|
||||
prefix = 'L';
|
||||
break;
|
||||
case 'liquidtestnet':
|
||||
prefix = 'tL';
|
||||
break;
|
||||
case 'testnet':
|
||||
case 'testnet4':
|
||||
prefix = 't';
|
||||
break;
|
||||
case 'signet':
|
||||
prefix = 's';
|
||||
break;
|
||||
}
|
||||
if (mode === 'btc' || (mode === 'auto' && value >= 1000000)) {
|
||||
return `${amountShortenerPipe.transform(value / 100000000)} ${prefix}BTC`;
|
||||
} else {
|
||||
if (prefix.length) {
|
||||
prefix += '-';
|
||||
}
|
||||
return `${amountShortenerPipe.transform(value)} ${prefix}sats`;
|
||||
}
|
||||
}
|
||||
|
||||
export function insecureRandomUUID(): string {
|
||||
const hexDigits = '0123456789abcdef';
|
||||
const uuidLengths = [8, 4, 4, 4, 12];
|
||||
|
||||
Reference in New Issue
Block a user