diff --git a/.env.example b/.env.example index afe929ed3..1c478cd99 100644 --- a/.env.example +++ b/.env.example @@ -75,4 +75,5 @@ OPENNODE_API_ENDPOINT=https://api.opennode.com/ OPENNODE_KEY=OPENNODE_ADMIN_KEY # FakeWallet -FAKE_WALLET_KEY=E9873D79C6D87DC0FB6A5778633389F4453213303DA61F20BD67FC233AA33262 \ No newline at end of file +FAKE_WALLET_SECRET="ToTheMoon1" +LNBITS_DENOMINATION=sats \ No newline at end of file diff --git a/lnbits/core/static/js/wallet.js b/lnbits/core/static/js/wallet.js index ac88549ce..8d58302bf 100644 --- a/lnbits/core/static/js/wallet.js +++ b/lnbits/core/static/js/wallet.js @@ -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, diff --git a/lnbits/core/templates/core/wallet.html b/lnbits/core/templates/core/wallet.html index 9ca00ad50..189d1547f 100644 --- a/lnbits/core/templates/core/wallet.html +++ b/lnbits/core/templates/core/wallet.html @@ -15,8 +15,8 @@

- {% raw %}{{ formattedBalance }}{% endraw %} - sat + {% raw %}{{ formattedBalance }} {% endraw %} + {{LNBITS_DENOMINATION}}