mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-03-04 01:53:59 +01:00
FakeWallet own denomination now working
This commit is contained in:
parent
568a1be91f
commit
75e78d2ab6
4 changed files with 72 additions and 44 deletions
|
@ -161,14 +161,14 @@ new Vue({
|
||||||
{
|
{
|
||||||
name: 'sat',
|
name: 'sat',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
label: 'Amount (sat)',
|
label: 'Amount (' + LNBITS_DENOMINATION + ')',
|
||||||
field: 'sat',
|
field: 'sat',
|
||||||
sortable: true
|
sortable: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fee',
|
name: 'fee',
|
||||||
align: 'right',
|
align: 'right',
|
||||||
label: 'Fee (msat)',
|
label: 'Fee (m' + LNBITS_DENOMINATION + ')',
|
||||||
field: 'fee'
|
field: 'fee'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -191,7 +191,11 @@ new Vue({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formattedBalance: function () {
|
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 () {
|
filteredPayments: function () {
|
||||||
var q = this.paymentsTable.filter
|
var q = this.paymentsTable.filter
|
||||||
|
@ -250,28 +254,27 @@ new Vue({
|
||||||
this.parse.data.paymentChecker = null
|
this.parse.data.paymentChecker = null
|
||||||
this.parse.camera.show = false
|
this.parse.camera.show = false
|
||||||
},
|
},
|
||||||
updateBalance: function(credit){
|
updateBalance: function (credit) {
|
||||||
|
if (LNBITS_DENOMINATION != 'sats') {
|
||||||
|
credit = credit * 100
|
||||||
|
}
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request('PUT', '/api/v1/wallet/balance/' + credit, this.g.wallet.inkey)
|
||||||
'PUT',
|
.catch(err => {
|
||||||
'/api/v1/wallet/balance/' + credit,
|
LNbits.utils.notifyApiError(err)
|
||||||
this.g.wallet.inkey
|
})
|
||||||
)
|
.then(response => {
|
||||||
.catch(err => {
|
let data = response.data
|
||||||
LNbits.utils.notifyApiError(err)
|
if (data.status === 'ERROR') {
|
||||||
})
|
this.$q.notify({
|
||||||
.then(response => {
|
timeout: 5000,
|
||||||
let data = response.data
|
type: 'warning',
|
||||||
if (data.status === 'ERROR') {
|
message: `Failed to update.`
|
||||||
this.$q.notify({
|
})
|
||||||
timeout: 5000,
|
return
|
||||||
type: 'warning',
|
}
|
||||||
message: `Failed to update.`,
|
this.balance = this.balance + data.balance
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
|
||||||
this.balance = this.balance + data.balance
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
closeReceiveDialog: function () {
|
closeReceiveDialog: function () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -295,7 +298,9 @@ new Vue({
|
||||||
},
|
},
|
||||||
createInvoice: function () {
|
createInvoice: function () {
|
||||||
this.receive.status = 'loading'
|
this.receive.status = 'loading'
|
||||||
|
if (LNBITS_DENOMINATION != 'sats') {
|
||||||
|
this.receive.data.amount = this.receive.data.amount * 100
|
||||||
|
}
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.createInvoice(
|
.createInvoice(
|
||||||
this.g.wallet,
|
this.g.wallet,
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
v-model="scope.value"
|
v-model="scope.value"
|
||||||
dense
|
dense
|
||||||
autofocus
|
autofocus
|
||||||
type="number"
|
mask="#.##"
|
||||||
|
fill-mask="0"
|
||||||
|
reverse-fill-mask
|
||||||
@keyup.enter="updateBalance(scope.value)"
|
@keyup.enter="updateBalance(scope.value)"
|
||||||
>
|
>
|
||||||
<template v-slot:append>
|
<template v-slot:append>
|
||||||
|
@ -169,7 +171,17 @@
|
||||||
<q-tooltip>{{ props.row.date }}</q-tooltip>
|
<q-tooltip>{{ props.row.date }}</q-tooltip>
|
||||||
{{ props.row.dateFrom }}
|
{{ props.row.dateFrom }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width key="sat" :props="props">
|
{% endraw %}
|
||||||
|
<q-td
|
||||||
|
auto-width
|
||||||
|
key="sat"
|
||||||
|
v-if="'{{LNBITS_DENOMINATION}}' != 'sats'"
|
||||||
|
:props="props"
|
||||||
|
>{% raw %} {{ parseFloat(String(props.row.fsat).replaceAll(",",
|
||||||
|
"")) / 100 }}
|
||||||
|
</q-td>
|
||||||
|
|
||||||
|
<q-td auto-width key="sat" v-else :props="props">
|
||||||
{{ props.row.fsat }}
|
{{ props.row.fsat }}
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width key="fee" :props="props">
|
<q-td auto-width key="fee" :props="props">
|
||||||
|
@ -251,7 +263,7 @@
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<h6 class="text-subtitle1 q-mt-none q-mb-sm">
|
<h6 class="text-subtitle1 q-mt-none q-mb-sm">
|
||||||
{{ SITE_TITLE }} wallet: <strong><em>{{ wallet.name }}</em></strong>
|
{{ SITE_TITLE }} Wallet: <strong><em>{{ wallet.name }}</em></strong>
|
||||||
</h6>
|
</h6>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
|
@ -370,13 +382,15 @@
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
v-model.number="receive.data.amount"
|
v-model.number="receive.data.amount"
|
||||||
type="number"
|
label="Amount ({{LNBITS_DENOMINATION}}) *"
|
||||||
:label="`Amount ({{LNBITS_DENOMINATION}}) *`"
|
mask="#.##"
|
||||||
|
fill-mask="0"
|
||||||
|
reverse-fill-mask
|
||||||
:min="receive.minMax[0]"
|
:min="receive.minMax[0]"
|
||||||
:max="receive.minMax[1]"
|
:max="receive.minMax[1]"
|
||||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||||
></q-input
|
></q-input>
|
||||||
>{% else %}
|
{% else %}
|
||||||
<q-select
|
<q-select
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
|
@ -390,24 +404,24 @@
|
||||||
dense
|
dense
|
||||||
v-model.number="receive.data.amount"
|
v-model.number="receive.data.amount"
|
||||||
type="number"
|
type="number"
|
||||||
:label="`Amount (${receive.unit}) *`"
|
label="Amount ({{LNBITS_DENOMINATION}}) *"
|
||||||
:step="receive.unit != 'sat' ? '0.001' : '1'"
|
:step="receive.unit != 'sat' ? '0.001' : '1'"
|
||||||
:min="receive.minMax[0]"
|
:min="receive.minMax[0]"
|
||||||
:max="receive.minMax[1]"
|
:max="receive.minMax[1]"
|
||||||
:readonly="receive.lnurl && receive.lnurl.fixed"
|
:readonly="receive.lnurl && receive.lnurl.fixed"
|
||||||
></q-input>
|
></q-input>
|
||||||
{% endif %} {% raw %}
|
{% endif %}
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
v-model.trim="receive.data.memo"
|
v-model.trim="receive.data.memo"
|
||||||
label="Memo *"
|
label="Memo"
|
||||||
placeholder="LNbits invoice"
|
|
||||||
></q-input>
|
></q-input>
|
||||||
|
{% raw %}
|
||||||
<div v-if="receive.status == 'pending'" class="row q-mt-lg">
|
<div v-if="receive.status == 'pending'" class="row q-mt-lg">
|
||||||
<q-btn
|
<q-btn
|
||||||
unelevated
|
unelevatedamountamount
|
||||||
color="primary"
|
color="primary"
|
||||||
:disable="receive.data.memo == null || receive.data.amount == null || receive.data.amount <= 0"
|
:disable="receive.data.memo == null || receive.data.amount == null || receive.data.amount <= 0"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
@ -451,9 +465,12 @@
|
||||||
<q-dialog v-model="parse.show" @hide="closeParseDialog">
|
<q-dialog v-model="parse.show" @hide="closeParseDialog">
|
||||||
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
<q-card class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
||||||
<div v-if="parse.invoice">
|
<div v-if="parse.invoice">
|
||||||
{% raw %}
|
<h6 v-if="'{{LNBITS_DENOMINATION}}' != 'sats'" class="q-my-none">
|
||||||
<h6 class="q-my-none">
|
{% raw %} {{ parseFloat(String(parse.invoice.fsat).replaceAll(",", ""))
|
||||||
{{ parse.invoice.fsat }} {{LNBITS_DENOMINATION}}
|
/ 100 }} {% endraw %} {{LNBITS_DENOMINATION}} {% raw %}
|
||||||
|
</h6>
|
||||||
|
<h6 v-else class="q-my-none">
|
||||||
|
{{ parse.invoice.fsat }}{% endraw %} {{LNBITS_DENOMINATION}} {% raw %}
|
||||||
</h6>
|
</h6>
|
||||||
<q-separator class="q-my-sm"></q-separator>
|
<q-separator class="q-my-sm"></q-separator>
|
||||||
<p class="text-wrap">
|
<p class="text-wrap">
|
||||||
|
@ -532,6 +549,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
{% endraw %}
|
||||||
<q-input
|
<q-input
|
||||||
filled
|
filled
|
||||||
dense
|
dense
|
||||||
|
@ -542,6 +560,7 @@
|
||||||
:max="parse.lnurlpay.maxSendable / 1000"
|
:max="parse.lnurlpay.maxSendable / 1000"
|
||||||
:readonly="parse.lnurlpay.fixed"
|
:readonly="parse.lnurlpay.fixed"
|
||||||
></q-input>
|
></q-input>
|
||||||
|
{% raw %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-8 q-pl-md" v-if="parse.lnurlpay.commentAllowed > 0">
|
<div class="col-8 q-pl-md" v-if="parse.lnurlpay.commentAllowed > 0">
|
||||||
<q-input
|
<q-input
|
||||||
|
|
|
@ -22,7 +22,8 @@ Vue.component('lnbits-wallet-list', {
|
||||||
activeWallet: null,
|
activeWallet: null,
|
||||||
activeBalance: [],
|
activeBalance: [],
|
||||||
showForm: false,
|
showForm: false,
|
||||||
walletName: ''
|
walletName: '',
|
||||||
|
LNBITS_DENOMINATION: LNBITS_DENOMINATION
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
|
@ -43,7 +44,8 @@ Vue.component('lnbits-wallet-list', {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label lines="1">{{ wallet.name }}</q-item-label>
|
<q-item-label lines="1">{{ wallet.name }}</q-item-label>
|
||||||
<q-item-label caption>{{ wallet.live_fsat }} sat</q-item-label>
|
<q-item-label v-if="LNBITS_DENOMINATION != 'sats'" caption>{{ parseFloat(String(wallet.live_fsat).replaceAll(",", "")) / 100 }} {{ LNBITS_DENOMINATION }}</q-item-label>
|
||||||
|
<q-item-label v-else caption>{{ wallet.live_fsat }} {{ LNBITS_DENOMINATION }}</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
<q-item-section side v-show="activeWallet && activeWallet.id === wallet.id">
|
<q-item-section side v-show="activeWallet && activeWallet.id === wallet.id">
|
||||||
<q-icon name="chevron_right" color="grey-5" size="md"></q-icon>
|
<q-icon name="chevron_right" color="grey-5" size="md"></q-icon>
|
||||||
|
@ -194,11 +196,11 @@ Vue.component('lnbits-payment-details', {
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3"><b>Amount</b>:</div>
|
<div class="col-3"><b>Amount</b>:</div>
|
||||||
<div class="col-9">{{ (payment.amount / 1000).toFixed(3) }} sat</div>
|
<div class="col-9">{{ (payment.amount / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3"><b>Fee</b>:</div>
|
<div class="col-3"><b>Fee</b>:</div>
|
||||||
<div class="col-9">{{ (payment.fee / 1000).toFixed(3) }} sat</div>
|
<div class="col-9">{{ (payment.fee / 1000).toFixed(3) }} {{LNBITS_DENOMINATION}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3"><b>Payment hash</b>:</div>
|
<div class="col-3"><b>Payment hash</b>:</div>
|
||||||
|
|
|
@ -192,6 +192,8 @@
|
||||||
<script src="/static/js/components.js"></script>
|
<script src="/static/js/components.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const themes = {{ LNBITS_THEME_OPTIONS | tojson }}
|
const themes = {{ LNBITS_THEME_OPTIONS | tojson }}
|
||||||
|
const LNBITS_DENOMINATION = {{ LNBITS_DENOMINATION | tojson}}
|
||||||
|
console.log(LNBITS_DENOMINATION)
|
||||||
if(themes && themes.length) {
|
if(themes && themes.length) {
|
||||||
window.allowedThemes = themes.map(str => str.trim())
|
window.allowedThemes = themes.map(str => str.trim())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue