feat: hide panels after transaction is broadcast

This commit is contained in:
Vlad Stan 2022-07-22 14:49:14 +03:00
parent 63424d1ca4
commit f102928812
3 changed files with 39 additions and 30 deletions

View File

@ -563,8 +563,6 @@ new Vue({
}
},
broadcastTransaction: async function () {
console.log('### broadcastTransaction', this.payment.signedTxHex)
try {
const wallet = this.g.user.wallets[0]
const {data} = await LNbits.api.request(
@ -574,12 +572,21 @@ new Vue({
{tx_hex: this.payment.signedTxHex}
)
this.payment.sentTxId = data
this.$q.notify({
type: 'positive',
message: 'Transaction broadcasted!',
caption: `${data}`,
timeout: 10000
})
this.hww.psbtSent = false
this.payment.psbtBase64Signed = null
this.payment.signedTxHex = null
this.payment.signedTx = null
this.payment.psbtBase64 = null
await this.scanAddressWithAmount()
} catch (error) {
this.payment.sentTxId = null
this.$q.notify({

View File

@ -1116,12 +1116,11 @@
class="q-mb-md"
></q-separator>
<div
v-if="payment.psbtBase64 && payment.signMode === 'serial-port'"
v-if="serial.selectedPort && payment.psbtBase64 && payment.signMode === 'serial-port'"
class="row items-center no-wrap q-mb-md q-mt-lg"
>
<div class="col-3 q-pr-lg">
<q-btn-dropdown
v-if="serial.selectedPort"
split
class="btn-full"
color="secondary"
@ -1224,7 +1223,6 @@
</div>
<div class="col-3">
<q-toggle
v-if="serial.selectedPort"
label="Show Console"
color="secodary float-left"
v-model="hww.showConsole"
@ -1258,12 +1256,11 @@
class="q-mb-md"
></q-separator>
<div
v-if="hww.authenticated"
v-if="hww.authenticated && hww.psbtSent"
class="row items-center no-wrap q-mb-md"
>
<div class="col-3 q-pr-lg">
<q-btn
v-if="hww.psbtSent"
@click="hwwSignPsbt()"
unelevated
color="green"
@ -1273,8 +1270,7 @@
v-if="hww.signingPsbt == true"
color="primary"
></q-spinner>
</q-btn
>
</q-btn>
</div>
<div class="col-3">
<q-toggle
@ -1286,7 +1282,6 @@
</div>
<div class="col-6">
<q-badge
v-if="hww.psbtSent"
color="yellow"
text-color="black"
multi-line
@ -1374,6 +1369,9 @@
>
</div>
</div>
</div>
</div>
<q-separator
v-if="payment.sentTxId"
class="q-mb-lg"
@ -1382,10 +1380,15 @@
v-if="payment.sentTxId"
class="row items-center no-wrap q-mb-sm"
>
<div class="col-12">
<q-input v-model="payment.sentTxId" filled readonly />
</div>
</div>
<div class="col-3">Transaction Id</div>
<div class="col-9">
<a
style="color: unset"
:href="config.data.mempool_endpoint + '/tx/' + payment.sentTxId"
target="_blank"
>
{{payment.sentTxId}}</a
>
</div>
</div>
</q-card-section>

View File

@ -320,13 +320,12 @@ async def api_tx_broadcast(
raise ValueError(
"Cannot broadcast transaction. Mempool endpoint not defined!"
)
x = bytes.fromhex(data.tx_hex)
# async with httpx.AsyncClient() as client:
# r = await client.post(config.mempool_endpoint + "/api/tx", data=data.tx_hex)
# tx_id = r.text
# return tx_id
return "0f0f0f0f0f0f0f0f0f0f0f00f0f0f0f0f0f0f0f0f0f00f0f0f0f0f0f0.mock.transaction.id"
async with httpx.AsyncClient() as client:
r = await client.post(config.mempool_endpoint + "/api/tx", data=data.tx_hex)
tx_id = r.text
return tx_id
# return "0f0f0f0f0f0f0f0f0f0f0f00f0f0f0f0f0f0f0f0f0f00f0f0f0f0f0f0.mock.transaction.id"
except Exception as e:
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST, detail=str(e))