feat: buttonConfig pins are optional

This commit is contained in:
Vlad Stan 2022-08-19 17:49:01 +03:00
parent 83f998fe37
commit 5b59cdcd0d
5 changed files with 14 additions and 16 deletions

View file

@ -83,7 +83,6 @@
filled
dense
v-model.trim="config.buttonOnePin"
type="number"
label="Pin Number (Button 1)"
></q-input>
</div>
@ -94,7 +93,6 @@
filled
dense
v-model.trim="config.buttonTwoPin"
type="number"
label="Pin Number (Button 2)"
></q-input>
</div>

View file

@ -5,12 +5,8 @@ async function serialPortConfig(path) {
props: ['config'],
template: t,
data() {
return {
}
return {}
},
methods: {
},
methods: {}
})
}

View file

@ -243,7 +243,7 @@
<div class="row q-mt-lg">
<div class="col-12">
<q-badge class="text-subtitle2" color="yellow" text-color="black">
<span>Check data on the display of the hardware device.</span>
<span>Confirm on the hardware device also.</span>
</q-badge>
</div>
</div>

View file

@ -336,6 +336,7 @@ async function serialSigner(path) {
this.hww.showPasswordDialog = true
await this.sendCommandSecure(COMMAND_PASSWORD)
} catch (error) {
console.log(error)
this.$q.notify({
type: 'warning',
message: 'Failed to connect to Hardware Wallet!',
@ -599,11 +600,14 @@ async function serialSigner(path) {
)
const publicKeyHex = publicKey.toHex().slice(2)
await this.sendCommandClearText(COMMAND_PAIR, [
publicKeyHex,
this.config.buttonOnePin,
this.config.buttonTwoPin
])
const args = [publicKeyHex]
if (Number.isInteger(+this.config.buttonOnePin)) {
args.push(this.config.buttonOnePin)
}
if (Number.isInteger(+this.config.buttonTwoPin)) {
args.push(this.config.buttonTwoPin)
}
await this.sendCommandClearText(COMMAND_PAIR, args)
this.$q.notify({
type: 'positive',
message: 'Pairing started!',

View file

@ -21,8 +21,8 @@ const PAIRING_CONTROL_TEXT = 'lnbits'
const HWW_DEFAULT_CONFIG = Object.freeze({
name: '',
buttonOnePin: 0,
buttonTwoPin: 35,
buttonOnePin: '',
buttonTwoPin: '',
baudRate: 9600,
bufferSize: 255,
dataBits: 8,