feat: share PSBT as text

This commit is contained in:
Vlad Stan
2022-08-03 13:50:07 +03:00
parent 5414e3e772
commit 5e20c4314b
2 changed files with 40 additions and 5 deletions
@@ -39,6 +39,7 @@ async function payment(path) {
showCoinSelect: false,
showChecking: false,
showChange: false,
showPsbt: false,
feeRate: 1
}
},
@@ -103,13 +104,11 @@ async function payment(path) {
await this.serialSignerRef.hwwSendPsbt(this.psbtBase64, txData)
await this.serialSignerRef.isSendingPsbt()
}
console.log('### hwwSendPsbt')
} catch (error) {
console.error(error)
this.$q.notify({
type: 'warning',
message: 'Cannot check and sign PSBT!',
caption: `${error}`,
timeout: 10000
})
} finally {
@@ -117,6 +116,24 @@ async function payment(path) {
this.psbtBase64 = null
}
},
showPsbtDialog: async function () {
try {
const valid = await this.$refs.paymentFormRef.validate()
if (!valid) return
const data = await this.createPsbt()
if (data) {
this.showPsbt = true
}
} catch (error) {
this.$q.notify({
type: 'warning',
message: 'Failed to create PSBT!',
caption: `${error}`,
timeout: 10000
})
}
},
createPsbt: async function () {
try {
console.log('### this.createPsbt')
@@ -136,6 +153,7 @@ async function payment(path) {
)
this.psbtBase64 = data
return data
} catch (err) {
LNbits.utils.notifyApiError(err)
}