scryptlib
Advanced tools
Comparing version 2.1.36 to 2.1.37
{ | ||
"name": "scryptlib", | ||
"version": "2.1.36", | ||
"version": "2.1.37", | ||
"description": "Javascript SDK for integration of Bitcoin SV Smart Contracts written in sCrypt language.", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -837,3 +837,3 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
getSignatures(tx: Transaction, privateKey: PrivateKey, inputIndex: number, sigtype?: number): any; | ||
getPreimage(tx: Transaction, inputIndex: number, sigtype?: number, isLowS?: boolean): any; | ||
getPreimage(tx: Transaction, inputIndex: number, sigtype?: number, isLowS?: boolean, csIdx?: number): any; | ||
} | ||
@@ -986,3 +986,3 @@ | ||
getSignature(inputIndex: number, privateKey?: PrivateKey | Array<PrivateKey>, sigtype?: number): string | Array<string>; | ||
getPreimage(inputIndex: number, sigtype?: number, isLowS?: boolean): string; | ||
getPreimage(inputIndex: number, sigtype?: number, isLowS?: boolean, csIdx?: number): string; | ||
addInputFromPrevTx(prevTx: Transaction, outputIndex?: number): this; | ||
@@ -989,0 +989,0 @@ addDummyInput(script: Script, satoshis: number): this; |
@@ -24,6 +24,6 @@ 'use strict' | ||
function getLowSPreimage (tx, sigtype, inputIndex, inputLockingScript, inputAmount) { | ||
function getLowSPreimage (tx, sigtype, inputIndex, subscript, inputAmount) { | ||
var i = 0 | ||
do { | ||
var preimage = Sighash.sighashPreimage(tx, sigtype, inputIndex, inputLockingScript, inputAmount) | ||
var preimage = Sighash.sighashPreimage(tx, sigtype, inputIndex, subscript, inputAmount) | ||
@@ -215,11 +215,13 @@ var sighash = Hash.sha256sha256(preimage) | ||
* @param {boolean} isLowS - true if the sig hash is safe for low s. | ||
* @param {number} csIdx - the index of OP_CODESEPARATOR | ||
* @abstract | ||
*/ | ||
Input.prototype.getPreimage = function (transaction, inputIndex, sigtype, isLowS) { | ||
Input.prototype.getPreimage = function (transaction, inputIndex, sigtype, isLowS, csIdx) { | ||
$.checkState(this.output instanceof Output) | ||
sigtype = sigtype || (Signature.SIGHASH_ALL | Signature.SIGHASH_FORKID) | ||
isLowS = isLowS || false | ||
var subscript = typeof csIdx === 'number' ? this.output.script.subScript(csIdx) : this.output.script | ||
return isLowS | ||
? getLowSPreimage(transaction, sigtype, inputIndex, this.output.script, this.output.satoshisBN) | ||
: Sighash.sighashPreimage(transaction, sigtype, inputIndex, this.output.script, this.output.satoshisBN) | ||
? getLowSPreimage(transaction, sigtype, inputIndex, subscript, this.output.satoshisBN) | ||
: Sighash.sighashPreimage(transaction, sigtype, inputIndex, subscript, this.output.satoshisBN) | ||
} | ||
@@ -226,0 +228,0 @@ |
@@ -1474,3 +1474,3 @@ 'use strict' | ||
Transaction.prototype.getPreimage = function (inputIndex, sigtype, isLowS) { | ||
Transaction.prototype.getPreimage = function (inputIndex, sigtype, isLowS, csIdx) { | ||
$.checkArgumentType(inputIndex, 'number', 'inputIndex') | ||
@@ -1480,3 +1480,3 @@ sigtype = sigtype || (Signature.SIGHASH_ALL | Signature.SIGHASH_FORKID) | ||
inputIndex = inputIndex || 0 | ||
var preimage = this.inputs[inputIndex].getPreimage(this, inputIndex, sigtype, isLowS) | ||
var preimage = this.inputs[inputIndex].getPreimage(this, inputIndex, sigtype, isLowS, csIdx) | ||
return preimage.toString('hex') | ||
@@ -1483,0 +1483,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
976040
24058