feat: share PSBT as text
This commit is contained in:
parent
5414e3e772
commit
5e20c4314b
2 changed files with 40 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<div>
|
<div>
|
||||||
<q-form @submit="checkAndSend" class="q-gutter-md">
|
<q-form @submit="checkAndSend" ref="paymentFormRef" class="q-gutter-md">
|
||||||
<q-card class="q-mt-lg">
|
<q-card class="q-mt-lg">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<send-to
|
<send-to
|
||||||
|
|
@ -175,7 +175,7 @@
|
||||||
>
|
>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable disabled v-close-popup>
|
<q-item @click="showPsbtDialog" clickable v-close-popup>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>Share PSBT</q-item-label>
|
<q-item-label>Share PSBT</q-item-label>
|
||||||
<q-item-label caption
|
<q-item-label caption
|
||||||
|
|
@ -204,4 +204,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-form>
|
</q-form>
|
||||||
|
<q-dialog v-model="showPsbt" position="top">
|
||||||
|
<q-card class="q-pa-lg q-pt-xl">
|
||||||
|
<q-input
|
||||||
|
filled
|
||||||
|
dense
|
||||||
|
v-model.trim="psbtBase64"
|
||||||
|
type="textarea"
|
||||||
|
rows="25"
|
||||||
|
cols="200"
|
||||||
|
label="PSBT"
|
||||||
|
></q-input>
|
||||||
|
|
||||||
|
<div class="row q-mt-lg">
|
||||||
|
<q-btn v-close-popup flat color="grey" class="q-ml-auto">Close</q-btn>
|
||||||
|
</div>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ async function payment(path) {
|
||||||
showCoinSelect: false,
|
showCoinSelect: false,
|
||||||
showChecking: false,
|
showChecking: false,
|
||||||
showChange: false,
|
showChange: false,
|
||||||
|
showPsbt: false,
|
||||||
feeRate: 1
|
feeRate: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -103,13 +104,11 @@ async function payment(path) {
|
||||||
await this.serialSignerRef.hwwSendPsbt(this.psbtBase64, txData)
|
await this.serialSignerRef.hwwSendPsbt(this.psbtBase64, txData)
|
||||||
await this.serialSignerRef.isSendingPsbt()
|
await this.serialSignerRef.isSendingPsbt()
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('### hwwSendPsbt')
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'Cannot check and sign PSBT!',
|
message: 'Cannot check and sign PSBT!',
|
||||||
|
caption: `${error}`,
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
})
|
})
|
||||||
} finally {
|
} finally {
|
||||||
|
|
@ -117,6 +116,24 @@ async function payment(path) {
|
||||||
this.psbtBase64 = null
|
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 () {
|
createPsbt: async function () {
|
||||||
try {
|
try {
|
||||||
console.log('### this.createPsbt')
|
console.log('### this.createPsbt')
|
||||||
|
|
@ -136,6 +153,7 @@ async function payment(path) {
|
||||||
)
|
)
|
||||||
|
|
||||||
this.psbtBase64 = data
|
this.psbtBase64 = data
|
||||||
|
return data
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
LNbits.utils.notifyApiError(err)
|
LNbits.utils.notifyApiError(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue