fix eslint

This commit is contained in:
Stepan Snigirev 2020-07-05 10:22:08 +02:00
parent bd39adf8fc
commit bdcaa2021f
2 changed files with 7 additions and 6 deletions

View file

@ -143,11 +143,11 @@ export class AbstractWallet {
if (this.secret.startsWith('BC1')) this.secret = this.secret.toLowerCase();
// [fingerprint/derivation]zpub
let re = /\[([^\]]+)\](.*)/;
let m = this.secret.match(re);
if(m && m.length==3){
let hexFingerprint = m[1].split("/")[0];
if(hexFingerprint.length == 8){
const re = /\[([^\]]+)\](.*)/;
const m = this.secret.match(re);
if (m && m.length === 3) {
let hexFingerprint = m[1].split('/')[0];
if (hexFingerprint.length === 8) {
hexFingerprint = Buffer.from(hexFingerprint, 'hex').reverse().toString('hex');
this.masterFingerprint = parseInt(hexFingerprint, 16);
}

View file

@ -120,7 +120,8 @@ describe('Watch only wallet', () => {
});
it('can import zpub with master fingerprint', async () => {
const zpub = "[8cce63f8/84h/0h/0h]zpub6s2RJ9qAEBW8Abhojs6LyDzF7gttcDr6EsR3Umu2aptZBb45e734rGtt4KqsCMmNyR1EEzUU2ugdVYez2VywQvAbBjUSKn8ho4Zk2c5otkk";
const zpub =
'[8cce63f8/84h/0h/0h]zpub6s2RJ9qAEBW8Abhojs6LyDzF7gttcDr6EsR3Umu2aptZBb45e734rGtt4KqsCMmNyR1EEzUU2ugdVYez2VywQvAbBjUSKn8ho4Zk2c5otkk';
const w = new WatchOnlyWallet();
w.setSecret(zpub);
w.init();