You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
537 B

import { LegacyWallet } from './legacy-wallet';
const bitcoin = require('bitcoinjs-lib');
export class WatchOnlyWallet extends LegacyWallet {
static type = 'watchOnly';
static typeReadable = '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;
}
}
}