fix: testnet is in the bip32 derivation path

This commit is contained in:
Vlad Stan 2022-08-02 11:00:35 +03:00
parent 2ac8ee95b0
commit f202d80241
3 changed files with 12 additions and 7 deletions

View File

@ -4,10 +4,9 @@ async function serialSigner(path) {
name: 'serial-signer',
template: t,
props: ['sats-denominated'],
props: ['sats-denominated', 'network'],
data: function () {
return {
network: 'Mainnet', // todo: hardcoded for now
selectedPort: null,
writableStreamClosed: null,
writer: null,
@ -463,6 +462,7 @@ async function serialSigner(path) {
},
hwwXpub: async function (path) {
try {
console.log('### hwwXpub', COMMAND_XPUB + ' ' + this.network + ' ' + path)
await this.writer.write(
COMMAND_XPUB + ' ' + this.network + ' ' + path + '\n'
)

View File

@ -32,22 +32,26 @@ async function walletList(path) {
{
label: 'Pay-to-pubkey-hash scripts (P2PKH)',
value: 'pkh',
path: "m/44'/0'/0'"
pathMainnet: "m/44'/0'/0'",
pathTestnet: "m/44'/1'/0'"
},
{
label: 'Pay-to-witness-pubkey-hash scripts (P2WPKH)',
value: 'wpkh',
path: "m/84'/0'/0'"
pathMainnet: "m/84'/0'/0'",
pathTestnet: "m/84'/1'/0'",
},
{
label: 'Pay-to-script-hash scripts (P2SH-P2WPKH)',
value: 'sh',
path: "m/49'/0'/0'"
pathMainnet: "m/49'/0'/0'",
pathTestnet: "m/49'/1'/0'"
},
{
label: 'Pay-to-taproot outputs (P2TR)',
value: 'tr',
path: "m/86'/0'/0'"
pathMainnet: "m/86'/0'/0'",
pathTestnet: "m/86'/1'/0'"
}
],
@ -265,7 +269,7 @@ async function walletList(path) {
handleAddressTypeChanged: function (value) {
const addressType =
this.addressTypeOptions.find(t => t.value === value) || {}
this.accountPath = addressType.path
this.accountPath = addressType[`path${this.network}`]
}
},
created: async function () {

View File

@ -10,6 +10,7 @@
<template v-slot:serial>
<serial-signer
ref="serialSigner"
:network="config.network"
:sats-denominated="config.sats_denominated"
@signed:psbt="updateSignedPsbt"
></serial-signer>