Add BTC conversion utils

This commit is contained in:
2024-12-18 12:30:12 +04:00
parent 1b78cb4cb4
commit 50b0f2cd7a
2 changed files with 27 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
export function floatToBtc(number) {
return Number(number.toFixed(8))
}
export function btcToSats(btc) {
return Math.round(btc * 100_000_000);
}
export function satsToBtc(sats) {
return Math.round((sats / 100_000_000) * 100_000_000) / 100_000_000;
}