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 () { broadcastTransaction: async function () {
console.log('### broadcastTransaction', this.payment.signedTxHex)
try { try {
const wallet = this.g.user.wallets[0] const wallet = this.g.user.wallets[0]
const {data} = await LNbits.api.request( const {data} = await LNbits.api.request(
@ -574,12 +572,21 @@ new Vue({
{tx_hex: this.payment.signedTxHex} {tx_hex: this.payment.signedTxHex}
) )
this.payment.sentTxId = data this.payment.sentTxId = data
this.$q.notify({ this.$q.notify({
type: 'positive', type: 'positive',
message: 'Transaction broadcasted!', message: 'Transaction broadcasted!',
caption: `${data}`, caption: `${data}`,
timeout: 10000 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) { } catch (error) {
this.payment.sentTxId = null this.payment.sentTxId = null
this.$q.notify({ this.$q.notify({

View File

@ -1116,12 +1116,11 @@
class="q-mb-md" class="q-mb-md"
></q-separator> ></q-separator>
<div <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" class="row items-center no-wrap q-mb-md q-mt-lg"
> >
<div class="col-3 q-pr-lg"> <div class="col-3 q-pr-lg">
<q-btn-dropdown <q-btn-dropdown
v-if="serial.selectedPort"
split split
class="btn-full" class="btn-full"
color="secondary" color="secondary"
@ -1224,7 +1223,6 @@
</div> </div>
<div class="col-3"> <div class="col-3">
<q-toggle <q-toggle
v-if="serial.selectedPort"
label="Show Console" label="Show Console"
color="secodary float-left" color="secodary float-left"
v-model="hww.showConsole" v-model="hww.showConsole"
@ -1258,23 +1256,21 @@
class="q-mb-md" class="q-mb-md"
></q-separator> ></q-separator>
<div <div
v-if="hww.authenticated" v-if="hww.authenticated && hww.psbtSent"
class="row items-center no-wrap q-mb-md" class="row items-center no-wrap q-mb-md"
> >
<div class="col-3 q-pr-lg"> <div class="col-3 q-pr-lg">
<q-btn <q-btn
v-if="hww.psbtSent"
@click="hwwSignPsbt()" @click="hwwSignPsbt()"
unelevated unelevated
color="green" color="green"
class="btn-full" class="btn-full"
>Confirm >Confirm
<q-spinner <q-spinner
v-if="hww.signingPsbt == true" v-if="hww.signingPsbt == true"
color="primary" color="primary"
></q-spinner> ></q-spinner>
</q-btn </q-btn>
>
</div> </div>
<div class="col-3"> <div class="col-3">
<q-toggle <q-toggle
@ -1286,7 +1282,6 @@
</div> </div>
<div class="col-6"> <div class="col-6">
<q-badge <q-badge
v-if="hww.psbtSent"
color="yellow" color="yellow"
text-color="black" text-color="black"
multi-line multi-line
@ -1374,18 +1369,26 @@
> >
</div> </div>
</div> </div>
<q-separator </div>
v-if="payment.sentTxId" </div>
class="q-mb-lg"
></q-separator> <q-separator
<div v-if="payment.sentTxId"
v-if="payment.sentTxId" class="q-mb-lg"
class="row items-center no-wrap q-mb-sm" ></q-separator>
<div
v-if="payment.sentTxId"
class="row items-center no-wrap q-mb-sm"
>
<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 class="col-12">
<q-input v-model="payment.sentTxId" filled readonly />
</div>
</div>
</div> </div>
</div> </div>
</q-card-section> </q-card-section>

View File

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