junderw
6 years ago
No known key found for this signature in database
GPG Key ID: B256185D3A971908
20 changed files with
63 additions and
43 deletions
-
src/templates/multisig/input.js
-
src/templates/multisig/output.js
-
src/templates/pubkey/input.js
-
src/templates/pubkey/output.js
-
src/templates/pubkeyhash/input.js
-
src/templates/pubkeyhash/output.js
-
src/templates/scripthash/input.js
-
src/templates/scripthash/output.js
-
src/templates/witnesscommitment/output.js
-
src/templates/witnesspubkeyhash/input.js
-
src/templates/witnesspubkeyhash/output.js
-
src/templates/witnessscripthash/input.js
-
src/templates/witnessscripthash/output.js
-
types/templates/multisig/index.d.ts
-
types/templates/pubkey/index.d.ts
-
types/templates/pubkeyhash/index.d.ts
-
types/templates/scripthash/index.d.ts
-
types/templates/witnesscommitment/index.d.ts
-
types/templates/witnesspubkeyhash/index.d.ts
-
types/templates/witnessscripthash/index.d.ts
|
|
@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
|
|
|
const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function partialSignature(value) { |
|
|
|
return value === script_1.OPS.OP_0 || bscript.isCanonicalScriptSignature(value); |
|
|
|
return (value === script_1.OPS.OP_0 || bscript.isCanonicalScriptSignature(value)); |
|
|
|
} |
|
|
|
function check(script, allowIncomplete) { |
|
|
|
const chunks = bscript.decompile(script); |
|
|
@ -18,4 +18,6 @@ function check(script, allowIncomplete) { |
|
|
|
return chunks.slice(1).every(bscript.isCanonicalScriptSignature); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'multisig input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'multisig input'; |
|
|
|
}; |
|
|
|
|
|
@ -31,4 +31,6 @@ function check(script, allowIncomplete) { |
|
|
|
return keys.every(bscript.isCanonicalPubKey); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'multi-sig output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'multi-sig output'; |
|
|
|
}; |
|
|
|
|
|
@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
|
|
|
const bscript = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const chunks = bscript.decompile(script); |
|
|
|
return chunks.length === 1 && |
|
|
|
bscript.isCanonicalScriptSignature(chunks[0]); |
|
|
|
return (chunks.length === 1 && bscript.isCanonicalScriptSignature(chunks[0])); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'pubKey input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'pubKey input'; |
|
|
|
}; |
|
|
|
|
|
@ -5,9 +5,11 @@ const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const chunks = bscript.decompile(script); |
|
|
|
return chunks.length === 2 && |
|
|
|
return (chunks.length === 2 && |
|
|
|
bscript.isCanonicalPubKey(chunks[0]) && |
|
|
|
chunks[1] === script_1.OPS.OP_CHECKSIG; |
|
|
|
chunks[1] === script_1.OPS.OP_CHECKSIG); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'pubKey output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'pubKey output'; |
|
|
|
}; |
|
|
|
|
|
@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
|
|
|
const bscript = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const chunks = bscript.decompile(script); |
|
|
|
return chunks.length === 2 && |
|
|
|
return (chunks.length === 2 && |
|
|
|
bscript.isCanonicalScriptSignature(chunks[0]) && |
|
|
|
bscript.isCanonicalPubKey(chunks[1]); |
|
|
|
bscript.isCanonicalPubKey(chunks[1])); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'pubKeyHash input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'pubKeyHash input'; |
|
|
|
}; |
|
|
|
|
|
@ -5,12 +5,14 @@ const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const buffer = bscript.compile(script); |
|
|
|
return buffer.length === 25 && |
|
|
|
return (buffer.length === 25 && |
|
|
|
buffer[0] === script_1.OPS.OP_DUP && |
|
|
|
buffer[1] === script_1.OPS.OP_HASH160 && |
|
|
|
buffer[2] === 0x14 && |
|
|
|
buffer[23] === script_1.OPS.OP_EQUALVERIFY && |
|
|
|
buffer[24] === script_1.OPS.OP_CHECKSIG; |
|
|
|
buffer[24] === script_1.OPS.OP_CHECKSIG); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'pubKeyHash output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'pubKeyHash output'; |
|
|
|
}; |
|
|
|
|
|
@ -24,8 +24,7 @@ function check(script, allowIncomplete) { |
|
|
|
return false; |
|
|
|
// is witness?
|
|
|
|
if (chunks.length === 1) { |
|
|
|
return p2wsho.check(redeemScriptChunks) || |
|
|
|
p2wpkho.check(redeemScriptChunks); |
|
|
|
return (p2wsho.check(redeemScriptChunks) || p2wpkho.check(redeemScriptChunks)); |
|
|
|
} |
|
|
|
// match types
|
|
|
|
if (p2pkh.input.check(scriptSigChunks) && |
|
|
@ -40,4 +39,6 @@ function check(script, allowIncomplete) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'scriptHash input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'scriptHash input'; |
|
|
|
}; |
|
|
|
|
|
@ -5,10 +5,12 @@ const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const buffer = bscript.compile(script); |
|
|
|
return buffer.length === 23 && |
|
|
|
return (buffer.length === 23 && |
|
|
|
buffer[0] === script_1.OPS.OP_HASH160 && |
|
|
|
buffer[1] === 0x14 && |
|
|
|
buffer[22] === script_1.OPS.OP_EQUAL; |
|
|
|
buffer[22] === script_1.OPS.OP_EQUAL); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'scriptHash output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'scriptHash output'; |
|
|
|
}; |
|
|
|
|
|
@ -8,13 +8,15 @@ const script_1 = require("../../script"); |
|
|
|
const HEADER = Buffer.from('aa21a9ed', 'hex'); |
|
|
|
function check(script) { |
|
|
|
const buffer = bscript.compile(script); |
|
|
|
return buffer.length > 37 && |
|
|
|
return (buffer.length > 37 && |
|
|
|
buffer[0] === script_1.OPS.OP_RETURN && |
|
|
|
buffer[1] === 0x24 && |
|
|
|
buffer.slice(2, 6).equals(HEADER); |
|
|
|
buffer.slice(2, 6).equals(HEADER)); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'Witness commitment output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'Witness commitment output'; |
|
|
|
}; |
|
|
|
function encode(commitment) { |
|
|
|
typeforce(types.Hash256bit, commitment); |
|
|
|
const buffer = Buffer.allocUnsafe(36); |
|
|
|
|
|
@ -7,9 +7,11 @@ function isCompressedCanonicalPubKey(pubKey) { |
|
|
|
} |
|
|
|
function check(script) { |
|
|
|
const chunks = bscript.decompile(script); |
|
|
|
return chunks.length === 2 && |
|
|
|
return (chunks.length === 2 && |
|
|
|
bscript.isCanonicalScriptSignature(chunks[0]) && |
|
|
|
isCompressedCanonicalPubKey(chunks[1]); |
|
|
|
isCompressedCanonicalPubKey(chunks[1])); |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'witnessPubKeyHash input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'witnessPubKeyHash input'; |
|
|
|
}; |
|
|
|
|
|
@ -5,9 +5,9 @@ const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const buffer = bscript.compile(script); |
|
|
|
return buffer.length === 22 && |
|
|
|
buffer[0] === script_1.OPS.OP_0 && |
|
|
|
buffer[1] === 0x14; |
|
|
|
return buffer.length === 22 && buffer[0] === script_1.OPS.OP_0 && buffer[1] === 0x14; |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'Witness pubKeyHash output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'Witness pubKeyHash output'; |
|
|
|
}; |
|
|
|
|
|
@ -31,4 +31,6 @@ function check(chunks, allowIncomplete) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'witnessScriptHash input'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'witnessScriptHash input'; |
|
|
|
}; |
|
|
|
|
|
@ -5,9 +5,9 @@ const bscript = require("../../script"); |
|
|
|
const script_1 = require("../../script"); |
|
|
|
function check(script) { |
|
|
|
const buffer = bscript.compile(script); |
|
|
|
return buffer.length === 34 && |
|
|
|
buffer[0] === script_1.OPS.OP_0 && |
|
|
|
buffer[1] === 0x20; |
|
|
|
return buffer.length === 34 && buffer[0] === script_1.OPS.OP_0 && buffer[1] === 0x20; |
|
|
|
} |
|
|
|
exports.check = check; |
|
|
|
check.toJSON = function () { return 'Witness scriptHash output'; }; |
|
|
|
check.toJSON = function () { |
|
|
|
return 'Witness scriptHash output'; |
|
|
|
}; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|
|
|
@ -1,2 +1,2 @@ |
|
|
|
import * as output from './output'; |
|
|
|
export { output, }; |
|
|
|
export { output }; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|
|
|
@ -1,3 +1,3 @@ |
|
|
|
import * as input from './input'; |
|
|
|
import * as output from './output'; |
|
|
|
export { input, output, }; |
|
|
|
export { input, output }; |
|
|
|