WIP: preping watch-only wallets

This commit is contained in:
Overtorment 2018-07-08 20:01:52 +01:00
parent 61294450df
commit 67c9e35497
3 changed files with 26 additions and 1 deletions

View File

@ -61,7 +61,7 @@ export class HDLegacyBreadwalletWallet extends HDSegwitP2SHWallet {
let mnemonic = this.secret;
let seed = bip39.mnemonicToSeed(mnemonic);
let root = bitcoin.HDNode.fromSeedBuffer(seed);
let path = "m/0'/1/" + index;
let path = "m/0'/0/" + index;
let child = root.derivePath(path);
return child.keyPair.toWIF();
}

View File

@ -7,3 +7,4 @@ export * from './segwit-p2sh-wallet';
export * from './hd-segwit-p2sh-wallet';
export * from './hd-legacy-breadwallet-wallet';
export * from './hd-legacy-p2pkh-wallet';
export * from './watch-only-wallet';

View File

@ -0,0 +1,24 @@
import { LegacyWallet } from './legacy-wallet';
export class WatchOnlyWallet extends LegacyWallet {
constructor() {
super();
this.type = 'watchOnly';
}
getTypeReadable() {
return 'Watch-only';
}
allowSend() {
return false;
}
getAddress() {
return this.secret;
}
createTx(utxos, amount, fee, toAddress, memo) {
throw new Error('Not supported');
}
}