junderw
6 years ago
No known key found for this signature in database
GPG Key ID: B256185D3A971908
4 changed files with
15 additions and
20 deletions
-
src/templates/witnessscripthash/index.ts
-
src/templates/witnessscripthash/input.ts
-
src/templates/witnessscripthash/output.ts
-
src/types.ts
|
|
@ -1,5 +1,7 @@ |
|
|
|
module.exports = { |
|
|
|
input: require('./input'), |
|
|
|
output: require('./output') |
|
|
|
import * as input from './input' |
|
|
|
import * as output from './output' |
|
|
|
|
|
|
|
export { |
|
|
|
input, |
|
|
|
output, |
|
|
|
} |
|
|
|
export {} |
|
|
|
|
|
@ -1,15 +1,14 @@ |
|
|
|
// <scriptSig> {serialized scriptPubKey script}
|
|
|
|
|
|
|
|
const bscript = require('../../script') |
|
|
|
const types = require('../../types') |
|
|
|
import * as bscript from '../../script' |
|
|
|
const typeforce = require('typeforce') |
|
|
|
|
|
|
|
const p2ms = require('../multisig/') |
|
|
|
const p2pk = require('../pubkey/') |
|
|
|
const p2pkh = require('../pubkeyhash/') |
|
|
|
import * as p2ms from '../multisig' |
|
|
|
import * as p2pk from '../pubkey' |
|
|
|
import * as p2pkh from '../pubkeyhash' |
|
|
|
|
|
|
|
function check (chunks, allowIncomplete) { |
|
|
|
typeforce(types.Array, chunks) |
|
|
|
export function check (chunks: Array<Buffer>, allowIncomplete?: boolean): boolean { |
|
|
|
typeforce(typeforce.Array, chunks) |
|
|
|
if (chunks.length < 1) return false |
|
|
|
|
|
|
|
const witnessScript = chunks[chunks.length - 1] |
|
|
@ -35,6 +34,3 @@ function check (chunks, allowIncomplete) { |
|
|
|
return false |
|
|
|
} |
|
|
|
check.toJSON = function () { return 'witnessScriptHash input' } |
|
|
|
|
|
|
|
module.exports = { check } |
|
|
|
export {} |
|
|
|
|
|
@ -1,9 +1,9 @@ |
|
|
|
// OP_0 {scriptHash}
|
|
|
|
|
|
|
|
const bscript = require('../../script') |
|
|
|
import * as bscript from '../../script' |
|
|
|
const OPS = require('bitcoin-ops') |
|
|
|
|
|
|
|
function check (script) { |
|
|
|
export function check (script: Buffer | Array<number | Buffer>): boolean { |
|
|
|
const buffer = bscript.compile(script) |
|
|
|
|
|
|
|
return buffer.length === 34 && |
|
|
@ -11,6 +11,3 @@ function check (script) { |
|
|
|
buffer[1] === 0x20 |
|
|
|
} |
|
|
|
check.toJSON = function () { return 'Witness scriptHash output' } |
|
|
|
|
|
|
|
module.exports = { check } |
|
|
|
export {} |
|
|
|
|
|
@ -34,4 +34,4 @@ export const Buffer256bit = typeforce.BufferN(32) |
|
|
|
export const Hash160bit = typeforce.BufferN(20) |
|
|
|
export const Hash256bit = typeforce.BufferN(32) |
|
|
|
export * from 'typeforce' |
|
|
|
export { Number } from 'typeforce' |
|
|
|
export { Number, Array } from 'typeforce' |
|
|
|