refactor: send psbt to device
This commit is contained in:
parent
5d1d2d634a
commit
d5cc8d9187
2 changed files with 9 additions and 15 deletions
|
|
@ -79,10 +79,6 @@ async function payment(path) {
|
||||||
checkAndSend: async function () {
|
checkAndSend: async function () {
|
||||||
this.showChecking = true
|
this.showChecking = true
|
||||||
try {
|
try {
|
||||||
console.log(
|
|
||||||
'### this.checkAndSend',
|
|
||||||
this.serialSignerRef.isConnected()
|
|
||||||
)
|
|
||||||
if (!this.serialSignerRef.isConnected()) {
|
if (!this.serialSignerRef.isConnected()) {
|
||||||
await this.serialSignerRef.openSerialPort()
|
await this.serialSignerRef.openSerialPort()
|
||||||
return
|
return
|
||||||
|
|
@ -93,9 +89,16 @@ async function payment(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.createPsbt()
|
await this.createPsbt()
|
||||||
|
|
||||||
|
if (this.psbtBase64) {
|
||||||
|
await this.serialSignerRef.hwwSendPsbt(this.psbtBase64)
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('### hwwSendPsbt')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
} finally {
|
} finally {
|
||||||
this.showChecking = false
|
this.showChecking = false
|
||||||
|
this.psbtBase64 = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createPsbt: async function () {
|
createPsbt: async function () {
|
||||||
|
|
|
||||||
|
|
@ -271,19 +271,10 @@ async function serialSigner(path) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hwwExecuteDefaultCommand: function () {
|
hwwSendPsbt: async function (psbtBase64) {
|
||||||
if (this.hww.authenticated) {
|
|
||||||
this.hwwSendPsbt()
|
|
||||||
} else {
|
|
||||||
this.hwwShowPasswordDialog()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hwwSendPsbt: async function () {
|
|
||||||
try {
|
try {
|
||||||
this.hww.sendingPsbt = true
|
this.hww.sendingPsbt = true
|
||||||
await this.writer.write(
|
await this.writer.write(COMMAND_SEND_PSBT + ' ' + psbtBase64 + '\n')
|
||||||
COMMAND_SEND_PSBT + ' ' + this.payment.psbtBase64 + '\n'
|
|
||||||
)
|
|
||||||
this.$q.notify({
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Data sent to serial port device!',
|
message: 'Data sent to serial port device!',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue