import "../types/structs.scrypt"; import "stdUtils.scrypt"; library _opcat_labs_scrypt_ts_opcat_4_0_0__rs__TxHashPreimageUtils { static function getTxHashFromTxHashPreimage(_opcat_labs_scrypt_ts_opcat_4_0_0__rs__TxHashPreimage txHashPreimage) : bytes { require(len(txHashPreimage.version) == 4); int inputCount = _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.inputList, 72); int outputCount = _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils.checkLenDivisibleBy(txHashPreimage.outputList, 72); return hash256(txHashPreimage.version + _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils.writeVarInt(inputCount) + txHashPreimage.inputList + _opcat_labs_scrypt_ts_opcat_4_0_0__rs__StdUtils.writeVarInt(outputCount) + txHashPreimage.outputList + txHashPreimage.nLockTime); } static function getInputByteString(_opcat_labs_scrypt_ts_opcat_4_0_0__rs__TxHashPreimage txHashPreimage, int inputIndex) : bytes { return txHashPreimage.inputList[inputIndex * 72 : (inputIndex + 1) * 72]; } static function getOutputByteString(_opcat_labs_scrypt_ts_opcat_4_0_0__rs__TxHashPreimage txHashPreimage, int outputIndex) : bytes { return txHashPreimage.outputList[outputIndex * 72 : (outputIndex + 1) * 72]; } }