refactor: extract wallet-config

This commit is contained in:
Vlad Stan
2022-08-03 13:50:07 +03:00
parent 46dfd337b2
commit b18a4d37e3
7 changed files with 124 additions and 132 deletions
+10 -1
View File
@@ -140,10 +140,19 @@ const readFromSerialPort = serial => {
return readStringUntil
}
function satOrBtc(val, showUnit = true, showSats = false) {
const value = showSats
? LNbits.utils.formatSat(val)
: val == 0
? 0.0
: (val / 100000000).toFixed(8)
if (!showUnit) return value
return showSats ? value + ' sat' : value + ' BTC'
}
function loadTemplateAsync(path) {
const result = new Promise(resolve => {
const xhttp = new XMLHttpRequest()
console.log('### 300')
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {