junderw
6 years ago
35 changed files with 79 additions and 68 deletions
@ -1,14 +1,16 @@ |
|||
// {signature}
|
|||
|
|||
import { Stack } from '../../payments'; |
|||
import * as bscript from '../../script'; |
|||
|
|||
export function check(script: Buffer | Array<number | Buffer>): boolean { |
|||
const chunks = <Array<number | Buffer>>bscript.decompile(script); |
|||
export function check(script: Buffer | Stack): boolean { |
|||
const chunks = bscript.decompile(script) as Stack; |
|||
|
|||
return ( |
|||
chunks.length === 1 && bscript.isCanonicalScriptSignature(<Buffer>chunks[0]) |
|||
chunks.length === 1 && |
|||
bscript.isCanonicalScriptSignature(chunks[0] as Buffer) |
|||
); |
|||
} |
|||
check.toJSON = function() { |
|||
check.toJSON = () => { |
|||
return 'pubKey input'; |
|||
}; |
|||
|
@ -1,17 +1,18 @@ |
|||
// {pubKey} OP_CHECKSIG
|
|||
|
|||
import { Stack } from '../../payments'; |
|||
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); |
|||
export function check(script: Buffer | Stack): boolean { |
|||
const chunks = bscript.decompile(script) as Stack; |
|||
|
|||
return ( |
|||
chunks.length === 2 && |
|||
bscript.isCanonicalPubKey(<Buffer>chunks[0]) && |
|||
bscript.isCanonicalPubKey(chunks[0] as Buffer) && |
|||
chunks[1] === OPS.OP_CHECKSIG |
|||
); |
|||
} |
|||
check.toJSON = function() { |
|||
check.toJSON = () => { |
|||
return 'pubKey output'; |
|||
}; |
|||
|
@ -1,16 +1,17 @@ |
|||
// {signature} {pubKey}
|
|||
|
|||
import { Stack } from '../../payments'; |
|||
import * as bscript from '../../script'; |
|||
|
|||
export function check(script: Buffer | Array<number | Buffer>): boolean { |
|||
const chunks = <Array<number | Buffer>>bscript.decompile(script); |
|||
export function check(script: Buffer | Stack): boolean { |
|||
const chunks = bscript.decompile(script) as Stack; |
|||
|
|||
return ( |
|||
chunks.length === 2 && |
|||
bscript.isCanonicalScriptSignature(<Buffer>chunks[0]) && |
|||
bscript.isCanonicalPubKey(<Buffer>chunks[1]) |
|||
bscript.isCanonicalScriptSignature(chunks[0] as Buffer) && |
|||
bscript.isCanonicalPubKey(chunks[1] as Buffer) |
|||
); |
|||
} |
|||
check.toJSON = function() { |
|||
check.toJSON = () => { |
|||
return 'pubKeyHash input'; |
|||
}; |
|||
|
@ -1,20 +1,21 @@ |
|||
// {signature} {pubKey}
|
|||
|
|||
import { Stack } from '../../payments'; |
|||
import * as bscript from '../../script'; |
|||
|
|||
function isCompressedCanonicalPubKey(pubKey: Buffer): boolean { |
|||
return bscript.isCanonicalPubKey(pubKey) && pubKey.length === 33; |
|||
} |
|||
|
|||
export function check(script: Buffer | Array<number | Buffer>): boolean { |
|||
const chunks = <Array<number | Buffer>>bscript.decompile(script); |
|||
export function check(script: Buffer | Stack): boolean { |
|||
const chunks = bscript.decompile(script) as Stack; |
|||
|
|||
return ( |
|||
chunks.length === 2 && |
|||
bscript.isCanonicalScriptSignature(<Buffer>chunks[0]) && |
|||
isCompressedCanonicalPubKey(<Buffer>chunks[1]) |
|||
bscript.isCanonicalScriptSignature(chunks[0] as Buffer) && |
|||
isCompressedCanonicalPubKey(chunks[1] as Buffer) |
|||
); |
|||
} |
|||
check.toJSON = function() { |
|||
check.toJSON = () => { |
|||
return 'witnessPubKeyHash input'; |
|||
}; |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>, allowIncomplete?: boolean): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack, allowIncomplete?: boolean): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>, allowIncomplete?: boolean): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack, allowIncomplete?: boolean): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,6 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(script: Buffer | Array<number | Buffer>): boolean; |
|||
import { Stack } from '../../payments'; |
|||
export declare function check(script: Buffer | Stack): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
@ -1,5 +1,5 @@ |
|||
/// <reference types="node" />
|
|||
export declare function check(chunks: Array<Buffer>, allowIncomplete?: boolean): boolean; |
|||
export declare function check(chunks: Buffer[], allowIncomplete?: boolean): boolean; |
|||
export declare namespace check { |
|||
var toJSON: () => string; |
|||
} |
|||
|
Loading…
Reference in new issue