UNPKG

nerve-sdk-js

Version:
44 lines (35 loc) 1.11 kB
var TxSignatures = function TxSignatures(bufferReader) { this.list = []; this.isPersonalSign = false; while (!bufferReader.isFinished() && bufferReader.remainLength() > 32) { this.list.push(new Item(bufferReader)); } if (!bufferReader.isFinished()) { this.isPersonalSign = bufferReader.readBoolean(); } }; var Item = function Item(bufferReader) { var length = bufferReader.readUInt8(); this.publicKey = bufferReader.slice(length); this.signData = bufferReader.readBytesByLength(); }; TxSignatures.prototype.getPrintInfo = function () { var result = '"list": ['; for (var i = 0; i < this.list.length; i++) { if (i > 0) { result += ","; } result += this.list[i].getPrintInfo(); } result += ']'; result += ', "isPersonalSign": ' + this.isPersonalSign; return result; }; Item.prototype.getPrintInfo = function () { var result = "{\n"; result += " pubkey : " + this.publicKey.toString('hex') + ',\n'; result += " signData : " + this.signData.toString('hex') + '\n'; result += " }"; return result; }; module.exports = TxSignatures;