FakeWallet own denomination now working

This commit is contained in:
benarc
2022-02-02 17:28:00 +00:00
parent 568a1be91f
commit 75e78d2ab6
4 changed files with 72 additions and 44 deletions
+30 -25
View File
@@ -161,14 +161,14 @@ new Vue({
{
name: 'sat',
align: 'right',
label: 'Amount (sat)',
label: 'Amount (' + LNBITS_DENOMINATION + ')',
field: 'sat',
sortable: true
},
{
name: 'fee',
align: 'right',
label: 'Fee (msat)',
label: 'Fee (m' + LNBITS_DENOMINATION + ')',
field: 'fee'
}
],
@@ -191,7 +191,11 @@ new Vue({
},
computed: {
formattedBalance: function () {
return LNbits.utils.formatSat(this.balance || this.g.wallet.sat)
if (LNBITS_DENOMINATION != 'sats') {
return this.balance / 100
} else {
return LNbits.utils.formatSat(this.balance || this.g.wallet.sat)
}
},
filteredPayments: function () {
var q = this.paymentsTable.filter
@@ -250,28 +254,27 @@ new Vue({
this.parse.data.paymentChecker = null
this.parse.camera.show = false
},
updateBalance: function(credit){
updateBalance: function (credit) {
if (LNBITS_DENOMINATION != 'sats') {
credit = credit * 100
}
LNbits.api
.request(
'PUT',
'/api/v1/wallet/balance/' + credit,
this.g.wallet.inkey
)
.catch(err => {
LNbits.utils.notifyApiError(err)
})
.then(response => {
let data = response.data
if (data.status === 'ERROR') {
this.$q.notify({
timeout: 5000,
type: 'warning',
message: `Failed to update.`,
})
return
}
this.balance = this.balance + data.balance
})
.request('PUT', '/api/v1/wallet/balance/' + credit, this.g.wallet.inkey)
.catch(err => {
LNbits.utils.notifyApiError(err)
})
.then(response => {
let data = response.data
if (data.status === 'ERROR') {
this.$q.notify({
timeout: 5000,
type: 'warning',
message: `Failed to update.`
})
return
}
this.balance = this.balance + data.balance
})
},
closeReceiveDialog: function () {
setTimeout(() => {
@@ -295,7 +298,9 @@ new Vue({
},
createInvoice: function () {
this.receive.status = 'loading'
if (LNBITS_DENOMINATION != 'sats') {
this.receive.data.amount = this.receive.data.amount * 100
}
LNbits.api
.createInvoice(
this.g.wallet,