feat: add spinner while wallet account is created

This commit is contained in:
Vlad Stan 2022-08-02 12:59:10 +03:00
parent f202d80241
commit 35ab1e7d9c
3 changed files with 13 additions and 4 deletions

View file

@ -462,7 +462,10 @@ async function serialSigner(path) {
}, },
hwwXpub: async function (path) { hwwXpub: async function (path) {
try { try {
console.log('### hwwXpub', COMMAND_XPUB + ' ' + this.network + ' ' + path) console.log(
'### hwwXpub',
COMMAND_XPUB + ' ' + this.network + ' ' + path
)
await this.writer.write( await this.writer.write(
COMMAND_XPUB + ' ' + this.network + ' ' + path + '\n' COMMAND_XPUB + ' ' + this.network + ' ' + path + '\n'
) )

View file

@ -215,12 +215,14 @@
<q-btn <q-btn
unelevated unelevated
color="primary" color="primary"
label="Add Watch-Only Account"
:disable=" :disable="
(formDialog.data.masterpub == null && accountPath == null)|| (formDialog.data.masterpub == null && accountPath == null)||
formDialog.data.title == null" formDialog.data.title == null || showCreating"
type="submit" type="submit"
>Add Watch-Only Account</q-btn
> >
</q-btn>
<q-spinner v-if="showCreating" color="primary" size="2em"></q-spinner>
<q-btn v-close-popup flat color="grey" class="q-ml-auto" <q-btn v-close-popup flat color="grey" class="q-ml-auto"
>Cancel</q-btn >Cancel</q-btn
> >

View file

@ -28,6 +28,7 @@ async function walletList(path) {
}, },
accountPath: '', accountPath: '',
filter: '', filter: '',
showCreating: false,
addressTypeOptions: [ addressTypeOptions: [
{ {
label: 'Pay-to-pubkey-hash scripts (P2PKH)', label: 'Pay-to-pubkey-hash scripts (P2PKH)',
@ -39,7 +40,7 @@ async function walletList(path) {
label: 'Pay-to-witness-pubkey-hash scripts (P2WPKH)', label: 'Pay-to-witness-pubkey-hash scripts (P2WPKH)',
value: 'wpkh', value: 'wpkh',
pathMainnet: "m/84'/0'/0'", pathMainnet: "m/84'/0'/0'",
pathTestnet: "m/84'/1'/0'", pathTestnet: "m/84'/1'/0'"
}, },
{ {
label: 'Pay-to-script-hash scripts (P2SH-P2WPKH)', label: 'Pay-to-script-hash scripts (P2SH-P2WPKH)',
@ -103,9 +104,11 @@ async function walletList(path) {
}, },
addWalletAccount: async function () { addWalletAccount: async function () {
this.showCreating = true
const data = _.omit(this.formDialog.data, 'wallet') const data = _.omit(this.formDialog.data, 'wallet')
data.network = this.network data.network = this.network
await this.createWalletAccount(data) await this.createWalletAccount(data)
this.showCreating = false
}, },
createWalletAccount: async function (data) { createWalletAccount: async function (data) {
try { try {
@ -119,6 +122,7 @@ async function walletList(path) {
} else { } else {
data.masterpub = `${outputType}([${fingerprint}/${path}]${xpub}/{0,1}/*)` data.masterpub = `${outputType}([${fingerprint}/${path}]${xpub}/{0,1}/*)`
} }
console.log('### data.masterpub', data.masterpub)
} }
const response = await LNbits.api.request( const response = await LNbits.api.request(
'POST', 'POST',