bitcoinjs-lib/ts_src/templates/pubkey/output.ts
2019-03-06 21:38:36 +09:00

17 lines
434 B
TypeScript

// {pubKey} OP_CHECKSIG
import * as bscript from '../../script';
import { OPS } from '../../script';
export function check(script: Buffer | Array<number | Buffer>): boolean {
const chunks = <Array<number | Buffer>>bscript.decompile(script);
return (
chunks.length === 2 &&
bscript.isCanonicalPubKey(<Buffer>chunks[0]) &&
chunks[1] === OPS.OP_CHECKSIG
);
}
check.toJSON = function() {
return 'pubKey output';
};