chore: aahaaa\

This commit is contained in:
Vlad Stan
2022-10-11 18:09:07 +03:00
parent a95e62406d
commit ae9ab55fae

View File

@@ -281,7 +281,7 @@ page_container %}
filled filled
dense dense
v-model.number="sendData.amount" v-model.number="sendData.amount"
label="Amount (sats) *" label="Amount (tokens) *"
type="number" type="number"
class="q-mb-lg" class="q-mb-lg"
></q-input> ></q-input>
@@ -297,7 +297,7 @@ page_container %}
<q-input <q-input
filled filled
dense dense
v-model="sendData.tokens" v-model="sendData.tokensBase64"
label="tokens" label="tokens"
type="textarea" type="textarea"
class="q-mb-lg" class="q-mb-lg"
@@ -311,6 +311,9 @@ page_container %}
color="grey" color="grey"
>Show Tokens</q-btn >Show Tokens</q-btn
> >
<q-btn v-else @click="burnTokens" outline color="grey"
>Burn Tokens</q-btn
>
<q-btn v-close-popup flat color="grey" class="q-ml-auto" <q-btn v-close-popup flat color="grey" class="q-ml-auto"
>Close</q-btn >Close</q-btn
@@ -430,7 +433,8 @@ page_container %}
sendData: { sendData: {
amount: 0, amount: 0,
memo: '', memo: '',
tokens: '' tokens: '',
tokensBase64: ''
}, },
showInvoiceDetails: false, showInvoiceDetails: false,
showPayInvoice: false, showPayInvoice: false,
@@ -858,6 +862,7 @@ page_container %}
showSendTokensDialog: function () { showSendTokensDialog: function () {
this.sendData.tokens = '' this.sendData.tokens = ''
this.sendData.tokensBase64 = ''
this.sendData.amount = 0 this.sendData.amount = 0
this.sendData.memo = '' this.sendData.memo = ''
this.showSendTokens = true this.showSendTokens = true
@@ -973,14 +978,31 @@ page_container %}
message: `Cannot select amount for denomination ${amount}` message: `Cannot select amount for denomination ${amount}`
}) })
this.sendData.tokens = '' this.sendData.tokens = ''
this.sendData.tokensBase64 = ''
return return
} }
} }
console.log('### sendTokens', sendTokens) console.log('### sendTokens', sendTokens)
this.sendData.tokens = JSON.stringify(sendTokens) this.sendData.tokens = sendTokens
this.sendData.tokensBase64 = btoa(JSON.stringify(sendTokens))
return sendTokens return sendTokens
}, },
burnTokens: function () {
for (const token of this.sendData.tokens) {
const secretIndex = this.tokens.findIndex(
t => t.promises?.length && t.secrets.find(s => s == token.secret)
)
if (secretIndex >= 0) {
token.blindedMessages?.splice(secretIndex, 1)
token.promises?.splice(secretIndex, 1)
token.randomBlindingFactors?.splice(secretIndex, 1)
token.secrets?.splice(secretIndex, 1)
}
}
console.log('### this.tokens', this.tokens)
},
findTokenForAmount: function (amount) { findTokenForAmount: function (amount) {
for (const token of this.tokens) { for (const token of this.tokens) {
const index = token.promises?.findIndex(p => p.amount === amount) const index = token.promises?.findIndex(p => p.amount === amount)