feat: broadcast transaction (partial solution)

This commit is contained in:
Vlad Stan
2022-08-03 13:50:01 +03:00
parent 6098b8308e
commit 367faf437a
5 changed files with 101 additions and 17 deletions
@@ -639,8 +639,10 @@ new Vue({
)
if (data) {
this.payment.signedTx = JSON.parse(data.tx_json)
this.payment.signedTxHex = data.tx_hex
} else {
this.payment.signedTx = null
his.payment.signedTxHex = null
}
}
} else {
@@ -688,6 +690,27 @@ new Vue({
console.log('### sharePsbtWithAnimatedQRCode')
},
broadcastTransaction: async function () {
console.log('### broadcastTransaction', this.payment.signedTxHex)
try {
const wallet = this.g.user.wallets[0]
await LNbits.api.request(
'POST',
'/watchonly/api/v1/tx',
wallet.adminkey,
{tx_hex: this.payment.signedTxHex}
)
} catch (error) {
this.$q.notify({
type: 'warning',
message: 'Failed to broadcast!',
caption: `${error}`,
timeout: 10000
})
}
},
//################### UTXOs ###################
scanAllAddresses: async function () {
await this.refreshAddresses()
@@ -262,6 +262,8 @@ const tableData = {
psbtBase64: '',
psbtBase64Signed: '',
signedTx: null,
signedTxHex: null,
sentTxId: null,
utxoSelectionModes: [
'Manual',
'Random',