BlueWallet/class/watch-only-wallet.js

35 lines
586 B
JavaScript
Raw Normal View History

2018-07-08 20:01:52 +01:00
import { LegacyWallet } from './legacy-wallet';
const bitcoin = require('bitcoinjs-lib');
2018-07-08 20:01:52 +01:00
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');
}
valid() {
try {
bitcoin.address.toOutputScript(this.getAddress());
return true;
} catch (e) {
return false;
}
}
2018-07-08 20:01:52 +01:00
}