speedchainnode
Version:
speedchainnode core
38 lines • 2.82 MB
JavaScript
const path = require('path');var gpath = path.join(__dirname, '../../../', 'node_modules'); module.exports=(e=>{var t={};function i(r){var s;return(t[r]||(s=t[r]={i:r,l:!1,exports:{}},e[r].call(s.exports,s,s.exports,i),s.l=!0,s)).exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(r,s,function(t){return e[t]}.bind(null,s));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=767)})([function(e,t){e.exports=require("assert")},function(e,t,i){
/*!
* reader.js - buffer reader for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
*/
let r=i(0),s=i(3),a=i(6),n=Buffer.alloc(0);function o(e,t){if(!(this instanceof o))return new o(e,t);"ArrayBuffer"==e.constructor.name&&(e=Buffer.from(e)),r(Buffer.isBuffer(e),"Must pass a Buffer."),this.data=e,this.offset=0,this.zeroCopy=t||!1,this.stack=[]}o.prototype.assert=function e(t){if(!t)throw new s.EncodingError(this.offset,"Out of bounds read",e)},o.prototype.enforce=function e(t,i){if(!t)throw new s.EncodingError(this.offset,i,e)},o.prototype.getSize=function(){return this.data.length},o.prototype.left=function(){return this.assert(this.offset<=this.data.length),this.data.length-this.offset},o.prototype.seek=function(e){return this.assert(0<=this.offset+e),this.assert(this.offset+e<=this.data.length),this.offset+=e,e},o.prototype.start=function(){return this.stack.push(this.offset),this.offset},o.prototype.end=function(){r(0<this.stack.length);var e=this.stack.pop();return this.offset-e},o.prototype.endData=function(e){r(0<this.stack.length);var t=this.stack.pop(),i=this.offset,s=i-t,a=this.data;return s===a.length?a:this.zeroCopy||e?a.slice(t,i):(e=Buffer.allocUnsafe(s),a.copy(e,0,t,i),e)},o.prototype.destroy=function(){this.data=n,this.offset=0,this.stack.length=0},o.prototype.readU8=function(){this.assert(this.offset+1<=this.data.length);var e=this.data[this.offset];return this.offset+=1,e},o.prototype.readU16=function(){this.assert(this.offset+2<=this.data.length);var e=this.data.readUInt16LE(this.offset,!0);return this.offset+=2,e},o.prototype.readU16BE=function(){this.assert(this.offset+2<=this.data.length);var e=this.data.readUInt16BE(this.offset,!0);return this.offset+=2,e},o.prototype.readU32=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readUInt32LE(this.offset,!0);return this.offset+=4,e},o.prototype.readU32BE=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readUInt32BE(this.offset,!0);return this.offset+=4,e},o.prototype.readU64=function(){this.assert(this.offset+8<=this.data.length);var e=s.readU64(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BE=function(){this.assert(this.offset+8<=this.data.length);var e=s.readU64BE(this.data,this.offset);return this.offset+=8,e},o.prototype.readI8=function(){this.assert(this.offset+1<=this.data.length);var e=this.data.readInt8(this.offset,!0);return this.offset+=1,e},o.prototype.readI16=function(){this.assert(this.offset+2<=this.data.length);var e=this.data.readInt16LE(this.offset,!0);return this.offset+=2,e},o.prototype.readI16BE=function(){this.assert(this.offset+2<=this.data.length);var e=this.data.readInt16BE(this.offset,!0);return this.offset+=2,e},o.prototype.readI32=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readInt32LE(this.offset,!0);return this.offset+=4,e},o.prototype.readI32BE=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readInt32BE(this.offset,!0);return this.offset+=4,e},o.prototype.readI64=function(){this.assert(this.offset+8<=this.data.length);var e=s.readI64(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BE=function(){this.assert(this.offset+8<=this.data.length);var e=s.readI64BE(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64N=function(){this.assert(this.offset+8<=this.data.length);var e=s.readU64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=s.readU64BEN(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64N=function(){this.assert(this.offset+8<=this.data.length);var e=s.readI64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=s.readI64BEN(this.data,this.offset);return this.offset+=8,e},o.prototype.readFloat=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readFloatLE(this.offset,!0);return this.offset+=4,e},o.prototype.readFloatBE=function(){this.assert(this.offset+4<=this.data.length);var e=this.data.readFloatBE(this.offset,!0);return this.offset+=4,e},o.prototype.readDouble=function(){this.assert(this.offset+8<=this.data.length);var e=this.data.readDoubleLE(this.offset,!0);return this.offset+=8,e},o.prototype.readDoubleBE=function(){this.assert(this.offset+8<=this.data.length);var e=this.data.readDoubleBE(this.offset,!0);return this.offset+=8,e},o.prototype.readVarint=function(){var{size:e,value:t}=s.readVarint(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarintN=function(){var{size:e,value:t}=s.readVarintN(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2=function(){var{size:e,value:t}=s.readVarint2(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2N=function(){var{size:e,value:t}=s.readVarint2N(this.data,this.offset);return this.offset+=e,t},o.prototype.readBytes=function(e,t){let i;return r(0<=e),this.assert(this.offset+e<=this.data.length),this.zeroCopy||t?i=this.data.slice(this.offset,this.offset+e):(i=Buffer.allocUnsafe(e),this.data.copy(i,0,this.offset,this.offset+e)),this.offset+=e,i},o.prototype.readVarBytes=function(e){return this.readBytes(this.readVarint(),e)},o.prototype.readString=function(e,t){return r(0<=t),this.assert(this.offset+t<=this.data.length),e=this.data.toString(e,this.offset,this.offset+t),this.offset+=t,e},o.prototype.readHash=function(e){return e?this.readString(e,32):this.readBytes(32)},o.prototype.readVarString=function(e,t){var i=this.readVarint();return this.enforce(!t||i<=t,"String exceeds limit."),this.readString(e,i)},o.prototype.readNullString=function(e){this.assert(this.offset+1<=this.data.length);let t=this.offset;for(;t<this.data.length&&0!==this.data[t];t++);return this.assert(t!==this.data.length),e=this.readString(e,t-this.offset),this.offset=t+1,e},o.prototype.createChecksum=function(){let e=0;0<this.stack.length&&(e=this.stack[this.stack.length-1]);var t=this.data.slice(e,this.offset);return a.hash256(t).readUInt32LE(0,!0)},o.prototype.verifyChecksum=function(){var e=this.createChecksum(),t=this.readU32();return this.enforce(e===t,"Checksum mismatch."),t},e.exports=o},function(e,t,i){
/*!
* util.js - utils for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
*/
let r=i(0),s=i(366),a=i(9),n=i(126),o=t,c={showHidden:!1,depth:20,colors:!1,customInspect:!0,showProxy:!1,maxArrayLength:1/0,breakLength:60};function h(e){switch(e){case 0:return 1;case 1:return 10;case 2:return 100;case 3:return 1e3;case 4:return 1e4;case 5:return 1e5;case 6:return 1e6;case 7:return 1e7;case 8:return 1e8}throw new Error("Exponent is too large.")}o.sprintf=function(){for(var e,t,i,r,s=0,a=arguments[s++],n=[];a;){if(t=/^[^\x25]+/.exec(a))n.push(t[0]);else if(t=/^\x25{2}/.exec(a))n.push("%");else{if(!(t=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(a)))throw"Huh ?!";if(null==(e=arguments[t[1]||s++])||null==e)throw"Too few arguments.";if(/[^s]/.test(t[7])&&"number"!=typeof e)throw"Expecting number but found "+typeof e;switch(t[7]){case"b":e=e.toString(2);break;case"c":e=String.fromCharCode(e);break;case"d":e=parseInt(e);break;case"e":e=t[6]?e.toExponential(t[6]):e.toExponential();break;case"f":e=t[6]?parseFloat(e).toFixed(t[6]):parseFloat(e);break;case"o":e=e.toString(8);break;case"s":e=(e=String(e))&&t[6]?e.substring(0,t[6]):e;break;case"u":e=Math.abs(e);break;case"x":e=e.toString(16);break;case"X":e=e.toString(16).toUpperCase()}e=/[def]/.test(t[7])&&t[2]&&0<=e?"+"+e:e,i=t[3]?"0"==t[3]?"0":t[3].charAt(1):" ",r=t[5]-String(e).length-"".length,i=t[5]?((e,t)=>{for(var i=[];0<t;i[--t]=e);return i.join("")})(i,r):"",n.push(""+(t[4]?e+i:i+e))}a=a.substring(t[0].length)}return n.join("")},o.encrypt=function(e,t,i){Buffer.isBuffer(e)||(r("string"==typeof e),e=Buffer.from(e,"binary")),Buffer.isBuffer(t)||(r("string"==typeof t),t=Buffer.from(t,"binary")),Buffer.isBuffer(i)||(r("string"==typeof i),i=Buffer.from(i,"binary"));var s=n.encipher(i,e,t),a=(s=Buffer.from(s,"binary"),Buffer.alloc(2*s.length));for(let e=0;e<s.length;e++)a[2*e]=97+(s[e]>>4),a[2*e+1]=97+(15&s[e]);return a.toString("binary")},o.decrypt=function(e,t,i){Buffer.isBuffer(e)||(r("string"==typeof e),e=Buffer.from(e,"binary")),Buffer.isBuffer(t)||(r("string"==typeof t),t=Buffer.from(t,"binary")),Buffer.isBuffer(i)||(r("string"==typeof i),i=Buffer.from(i,"binary"));var s=Buffer.alloc(i.length/2);for(let e=0;e<s.length;e++)s[e]=i[2*e]-97<<4|i[2*e+1]-97;return n.decipher(s,e,t).toString("binary")},o.isNumber=function(e){return"number"==typeof e&&isFinite(e)&&e>=-Number.MAX_SAFE_INTEGER&&e<=Number.MAX_SAFE_INTEGER},o.waiting=async function(e){await new Promise((t,i)=>{setTimeout(()=>{t()},e)})},o.isInt=function(e){return Number.isSafeInteger(e)},o.isUint=function(e){return o.isInt(e)&&0<=e},o.isFloat=function(e){return"number"==typeof e&&isFinite(e)},o.isUfloat=function(e){return o.isFloat(e)&&0<=e},o.isI8=function(e){return(0|e)===e&&-128<=e&&e<=127},o.isI16=function(e){return(0|e)===e&&-32768<=e&&e<=32767},o.stringify=function(e,t){if(void 0===e||!e)return"";if("string"==typeof e)return e;if(Array.isArray(e))return e.reduce((e,t)=>e+o.stringify(t),"");if("number"==typeof e||"boolean"==typeof e)return e.toString();if("object"!=typeof e)return Buffer.isBuffer(e)?e.toString("base64"):e;{let i="";return Object.keys(e).sort().map(r=>{t&&t.includes[r]||e[r]&&(i+=r+o.stringify(e[r]))}),i}},o.parseJson=function(e,t){try{return JSON.parse(e)}catch(e){return t||null}},o.hashInt=function(e){return s.str(e)>>>0},o.makeSingleton=function(e){e.singleton=(()=>{let t;return function(){return t=t||new e(...arguments)}})()},o.isI32=function(e){return(0|e)===e},o.isI64=function(e){return o.isInt(e)},o.isU8=function(e){return(255&e)===e},o.isU16=function(e){return(65535&e)===e},o.isU32=function(e){return e>>>0===e},o.isU64=function(e){return o.isUint(e)},o.isAscii=function(e){return"string"==typeof e&&/^[\t\n\r -~]*$/.test(e)},o.isBase58=function(e){return"string"==typeof e&&/^[1-9A-Za-z]+$/.test(e)},o.isBech32=function(e){return"string"==typeof e&&(e.toUpperCase()===e||e.toLowerCase()===e)&&!(e.length<8||90<e.length)&&/^[a-z]{2}1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+$/i.test(e)},o.isHex=function(e){return"string"==typeof e&&e.length%2==0&&/^[0-9A-Fa-f]+$/.test(e)},o.isHex160=function(e){return"string"==typeof e&&40===e.length&&o.isHex(e)},o.isHex256=function(e){return"string"==typeof e&&64===e.length&&o.isHex(e)},o.isSafeAddition=function(e,t){var i,s,a,n;return r(0<=e),r(0<=t),e<=0xfffffffffffff&&t<=0xfffffffffffff||(e=((i=e*(1/4294967296)|0)+(s=t*(1/4294967296)|0)|0)+(1&((a=(e|=0)>>31)&(n=(t|=0)>>31)|~((e+t|0)>>31)&(a^n)))|0,s>>>=0,!((e>>>=0)<(i>>>=0)||e<s)&&0==(4292870144&e))},o.inspectify=function(e,t){return"string"==typeof e?e:(c.colors=!1!==t,a.inspect(e,c))},o.fmt=a.format,o.format=function(e,t){return 0<e.length&&e[0]&&"object"==typeof e[0]?(null==t&&(t=Boolean(process.stdout&&process.stdout.isTTY)),o.inspectify(e[0],t)):o.fmt(...e)},o.log=function(...e){if(process.stdout){var t=o.format(e);process.stdout.write(t+"\n")}else{let t;0<e.length&&(t="object"!=typeof e[0]?o.fmt(...e):e[0]),console.log(t)}},o.error=function(...e){if(process.stderr){var t=o.format(e);process.stderr.write(t+"\n")}else{let t;0<e.length&&(t="object"!=typeof e[0]?o.fmt(...e):e[0]),console.error(t)}},o.hrtime=function(e){var t,i;return process.hrtime?e?([t,i]=process.hrtime(e),1e3*t+i/1e6):process.hrtime():(t=o.ms(),e?([i,e]=e,t-(1e3*i+e/1e6)):[(t-(i=t%1e3))/1e3,1e6*i])},o.now=function(){return Math.floor(o.ms()/1e3)},o.ms=function(){return Date.now()},o.date=function(e){return null==e&&(e=o.now()),new Date(1e3*e).toISOString().slice(0,-5)+"Z"},o.dataOfUTC=function(e){return("number"!=typeof e||14<e||e<-12)&&(e=(new Date).getTimezoneOffset()/60*-1),new Date(Date.now()+36e5*e).toISOString().slice(0,-5)+(0<=e?" +"+e:" "+e)},o.time=function(e){return null==e?o.now():new Date(e)/1e3|0},o.random=function(e,t){return Math.floor(Math.random()*(t-e))+e},o.nonce=function(e){let t,i;switch(e=e||8){case 8:i=Buffer.allocUnsafe(8),t=o.random(0,4294967296),i.writeUInt32LE(t,0,!0),t=o.random(0,4294967296),i.writeUInt32LE(t,4,!0);break;case 4:i=Buffer.allocUnsafe(4),t=o.random(0,4294967296),i.writeUInt32LE(t,0,!0);break;default:r(!1,"Bad nonce size.")}return i},o.strcmp=function(e,t){var i=Math.min(e.length,t.length);for(let r=0;r<i;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.length<t.length?-1:t.length<e.length?1:0},o.mb=function(e){return Math.floor(e/1024/1024)},o.indexOf=function(e,t){r(Array.isArray(e)),r(Buffer.isBuffer(t));for(let s=0;s<e.length;s++){var i=e[s];if(r(Buffer.isBuffer(i)),i.equals(t))return s}return-1},o.pad8=function(e){switch(r("number"==typeof e),r(0<=e),(e=e.toString(10)).length){case 1:return"00"+e;case 2:return"0"+e;case 3:return e}throw new Error("Number too big.")},o.pad32=function(e){switch(r("number"==typeof e),r(0<=e),(e=e.toString(10)).length){case 1:return"000000000"+e;case 2:return"00000000"+e;case 3:return"0000000"+e;case 4:return"000000"+e;case 5:return"00000"+e;case 6:return"0000"+e;case 7:return"000"+e;case 8:return"00"+e;case 9:return"0"+e;case 10:return e}throw new Error("Number too big.")},o.hex8=function(e){switch(r("number"==typeof e),r(0<=e),(e=e.toString(16)).length){case 1:return"0"+e;case 2:return e}throw new Error("Number too big.")},o.hex32=function(e){switch(r("number"==typeof e),r(0<=e),(e=e.toString(16)).length){case 1:return"0000000"+e;case 2:return"000000"+e;case 3:return"00000"+e;case 4:return"0000"+e;case 5:return"000"+e;case 6:return"00"+e;case 7:return"0"+e;case 8:return e}throw new Error("Number too big.")},o.revHex=function(e){r("string"==typeof e),r(0<e.length),r(e.length%2==0);let t="";for(let i=0;i<e.length;i+=2)t=e.slice(i,i+2)+t;return t},o.reverse=function(e){var t,i={};for(t of Object.keys(e))i[e[t]]=t;return i},o.binarySearch=function(e,t,i,r){let s=0,a=e.length-1;for(;s<=a;){var n=s+a>>>1,o=i(e[n],t);if(0===o)return n;o<0?s=1+n:a=n-1}return r?s:-1},o.binaryInsert=function(e,t,i,r){var s=o.binarySearch(e,t,i,!0);return r&&s<e.length&&0===i(e[s],t)?-1:(0===s?e.unshift(t):s===e.length?e.push(t):e.splice(s,0,t),s)},o.binaryRemove=function(e,t,i){return-1!==(t=o.binarySearch(e,t,i,!1))&&(e.splice(t,1),!0)},o.isUpperCase=function(e){return r("string"==typeof e),0!==e.length&&0==(32&e.charCodeAt(0))},o.startsWith=function(e,t){return r("string"==typeof e),e.startsWith?e.startsWith(t):0===e.indexOf(t)},o.memoryUsage=function(){var e;return process.memoryUsage?(e=process.memoryUsage(),{total:o.mb(e.rss),jsHeap:o.mb(e.heapUsed),jsHeapTotal:o.mb(e.heapTotal),nativeHeap:o.mb(e.rss-e.heapTotal),external:o.mb(e.external)}):{total:0,jsHeap:0,jsHeapTotal:0,nativeHeap:0,external:0}},o.toFixed=function(e,t){r("number"==typeof e),r(Number.isSafeInteger(e),"Invalid integer value.");let i="";e<0&&(e=-e,i="-");var s=h(t);let a=e%s,n=(e-a)/s;for(a=a.toString(10),n=n.toString(10);a.length<t;)a="0"+a;return a=a.replace(/0+$/,""),r(a.length<=t,"Invalid integer value."),0===a.length&&(a="0"),0===t?""+i+n:""+i+n+"."+a},o.fromFixed=function(e,t){r("string"==typeof e),r(e.length<=32,"Fixed number string too large.");let i=1,s=(0<e.length&&"-"===e[0]&&(e=e.substring(1),i=-1),e),a="0";for(-1!==(n=e.indexOf("."))&&(s=e.substring(0,n),a=e.substring(n+1)),s=s.replace(/^0+/,""),a=a.replace(/0+$/,""),r(s.length<=16-t,"Fixed number string exceeds 2^53-1."),r(a.length<=t,"Too many decimal places in fixed number string."),0===s.length&&(s="0");a.length<t;)a+="0";0===a.length&&(a="0"),r(/^\d+$/.test(s)&&/^\d+$/.test(a),"Non-numeric characters in fixed number string."),s=parseInt(s,10),a=parseInt(a,10);var n=(e=>{switch(e){case 1:return 0;case 10:return 1;case 100:return 91;case 1e3:case 1e4:return 991;case 1e5:return 40991;case 1e6:return 740991;case 1e7:return 4740991;case 1e8:return 54740991}throw new Error("Exponent is too large.")})(e=h(t)),o=(e=>{switch(e){case 1:return 9007199254740991;case 10:return 900719925474099;case 100:return 90071992547409;case 1e3:return 9007199254740;case 1e4:return 900719925474;case 1e5:return 90071992547;case 1e6:return 9007199254;case 1e7:return 900719925;case 1e8:return 90071992}throw new Error("Exponent is too large.")})(e);return r(s<o||s===o&&a<=n,"Fixed number string exceeds 2^53-1."),i*(s*e+a)},o.toFloat=function(e,t){return Number(o.toFixed(e,t))},o.checkNum=function(e){return/^[1-9]+[0-9]*]*$/.test(e)},o.fromFloat=function(e,t){return r("number"==typeof e&&isFinite(e)),r(Number.isSafeInteger(t)),o.fromFixed(e.toFixed(t),t)}},function(e,t,i){
/*!
* encoding.js - encoding utils for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
*/
let{U64:r,I64:s}=i(110),a=r.UINT64_MAX.shrn(7),n=Number.MAX_SAFE_INTEGER,o=t;function c(e,t){return e<0&&(e=~e,0===t)&&(e+=1),0==(4292870144&e)}function h(e,t,i,r){let s=!1,a=(t<0&&(t=-t,s=!0),t*(1/4294967296)|0),n=0|t;return s&&(0===n?a=1+~a|0:(a=~a,n=1+~n)),r?(i=e.writeInt32BE(a,i,!0),e.writeInt32BE(n,i,!0)):(i=e.writeInt32LE(n,i,!0),e.writeInt32LE(a,i,!0))}function u(e,t){this.size=e,this.value=t}function l(e,t){if(!e)throw new o.EncodingError(t,"Out of bounds read",l)}function p(e,t,i){if(!e)throw new o.EncodingError(t,i,p)}o.SEED_SALT=Buffer.from("Bitcoin seed","ascii"),o.MNEMONIC_SALT="bookmansoft",o.DUMMY=Buffer.from([0]),o.ONE_HASH=Buffer.from("0100000000000000000000000000000000000000000000000000000000000000","hex"),o.RANDOM_HASH=Buffer.from("0101110000000001010000010000000001100000000000100000000000010000","hex"),o.DefaultChainCode=Buffer.from("1111111111111111111111111111111111111111111111111111111111111111","hex"),o.ZERO_HASH=Buffer.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),o.MAX_HASH=Buffer.from("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","hex"),o.ZERO_CID="000000000000000000000000000000000000000000000000000000000000000000000000",o.MAX_CID="ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",o.ZERO_CID_BUF=Buffer.from("000000000000000000000000000000000000000000000000000000000000000000000000","hex"),o.MAX_CID_BUF=Buffer.from("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","hex"),o.ZERO_OID="000000000000000000000000000000000000",o.MAX_OID="zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz",o.NULL_HASH="0000000000000000000000000000000000000000000000000000000000000000",o.HIGH_HASH="ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",o.ZERO_HASH160=Buffer.from("0000000000000000000000000000000000000000","hex"),o.MAX_HASH160=Buffer.from("ffffffffffffffffffffffffffffffffffffffff","hex"),o.ZERO_HASH160_HEX="0000000000000000000000000000000000000000",o.MAX_HASH160_HEX="ffffffffffffffffffffffffffffffffffffffff",o.ZERO_KEY=Buffer.from("000000000000000000000000000000000000000000000000000000000000000000","hex"),o.ZERO_KEY_HEX="000000000000000000000000000000000000000000000000000000000000000000",o.MAX_KEY=Buffer.from("111111111111111111111111111111111111111111111111111111111111111111","hex"),o.MAX_KEY_HEX="111111111111111111111111111111111111111111111111111111111111111111",o.ZERO_SIG=Buffer.from("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","hex"),o.ZERO_SIG64=Buffer.from("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","hex"),o.ZERO_U32=Buffer.from("00000000","hex"),o.MAX_U32=Buffer.from("ffffffff","hex"),o.ZERO_U32_NUM=0,o.MAX_U32_NUM=4294967295,o.ZERO_U64=Buffer.from("0000000000000000","hex"),o.MAX_U64=Buffer.from("ffffffffffffffff","hex"),o.readU64=function(e,t){var i=e.readUInt32LE(t+4,!0);e=e.readUInt32LE(t,!0);return p(0==(4292870144&i),t,"Number exceeds 2^53-1"),4294967296*i+e},o.readU64BE=function(e,t){var i=e.readUInt32BE(t,!0);e=e.readUInt32BE(t+4,!0);return p(0==(4292870144&i),t,"Number exceeds 2^53-1"),4294967296*i+e},o.readI64=function(e,t){var i=e.readInt32LE(t+4,!0);return p(c(i,e=e.readUInt32LE(t,!0)),"Number exceeds 2^53-1"),4294967296*i+e},o.readI64BE=function(e,t){var i=e.readInt32BE(t,!0);return p(c(i,e=e.readUInt32BE(t+4,!0)),"Number exceeds 2^53-1"),4294967296*i+e},o.writeU64=function(e,t,i){return h(e,t,i,!1)},o.writeU64BE=function(e,t,i){return h(e,t,i,!0)},o.writeI64=function(e,t,i){return h(e,t,i,!1)},o.writeI64BE=function(e,t,i){return h(e,t,i,!0)},o.readU64N=function(e,t){return r.readLE(e,t)},o.readU64BEN=function(e,t){return r.readBE(e,t)},o.readI64N=function(e,t){return s.readLE(e,t)},o.readI64BEN=function(e,t){return s.readBE(e,t)},o.writeU64N=function(e,t,i){return p(!t.sign,i,"Signed"),t.writeLE(e,i)},o.writeU64BEN=function(e,t,i){return p(!t.sign,i,"Signed"),t.writeBE(e,i)},o.writeI64N=function(e,t,i){return p(t.sign,i,"Not signed"),t.writeLE(e,i)},o.writeI64BEN=function(e,t,i){return p(t.sign,i,"Not signed"),t.writeBE(e,i)},o.readVarint=function(e,t){let i,r;switch(l(t<e.length,t),e[t]){case 255:l(t+(r=9)<=e.length,t),p(4294967295<(i=o.readU64(e,t+1)),t,"Non-canonical varint");break;case 254:l(t+(r=5)<=e.length,t),p(65535<(i=e.readUInt32LE(t+1,!0)),t,"Non-canonical varint");break;case 253:l(t+(r=3)<=e.length,t),p(253<=(i=e[t+1]|e[t+2]<<8),t,"Non-canonical varint");break;default:r=1,i=e[t]}return new u(r,i)},o.writeVarint=function(e,t,i){return t<253?e[i++]=255&t:t<=65535?(e[i++]=253,e[i++]=255&t,e[i++]=t>>8&255):t<=4294967295?(e[i++]=254,e[i++]=255&t,e[i++]=t>>8&255,e[i++]=t>>16&255,e[i++]=t>>>24):(e[i++]=255,i=o.writeU64(e,t,i)),i},o.sizeVarint=function(e){return e<253?1:e<=65535?3:e<=4294967295?5:9},o.readVarintN=function(e,t){if(l(t<e.length,t),255===e[t]){l(t+9<=e.length,t);let i=o.readU64N(e,t+1);return p(0!==i.hi,t,"Non-canonical varint"),new u(9,i)}let{size:i,value:s}=o.readVarint(e,t);return new u(i,r.fromInt(s))},o.writeVarintN=function(e,t,i){return p(!t.sign,i,"Signed"),0!==t.hi?(e[i++]=255,o.writeU64N(e,t,i)):o.writeVarint(e,t.toInt(),i)},o.sizeVarintN=function(e){return p(!e.sign,0,"Signed"),0!==e.hi?9:o.sizeVarint(e.toInt())},o.readVarint2=function(e,t){let i=0,r=0;for(;;){l(t<e.length,t);var s=e[t++];if(r++,p(i<=70368744177663-(127&s),t,"Number exceeds 2^53-1"),i=128*i+(127&s),0==(128&s))break;p(i!==n,t,"Number exceeds 2^53-1"),i++}return new u(r,i)},o.writeVarint2=function(e,t,i){var r=[];let s=0;for(;r[s]=127&t|(s?128:0),!(t<=127);)t=(t-t%128)/128-1,s++;for(l(i+s+1<=e.length,i);e[i++]=r[s],s--;);return i},o.sizeVarint2=function(e){let t=0;for(;t++,!(e<=127);)e=(e-e%128)/128-1;return t},o.readVarint2N=function(e,t){var i=new r;let s=0;for(;;){l(t<e.length,t);var n=e[t++];if(s++,p(i.lte(a),t,"Number exceeds 2^64-1"),i.ishln(7).iorn(127&n),0==(128&n))break;p(!i.eq(r.UINT64_MAX),t,"Number exceeds 2^64-1"),i.iaddn(1)}return new u(s,i)},o.writeVarint2N=function(e,t,i){if(p(!t.sign,i,"Signed"),0===t.hi)return o.writeVarint2(e,t.toInt(),i);t=t.clone();var r=[];let s=0;for(;r[s]=t.andln(127)|(s?128:0),!t.lten(127);)t.ishrn(7).isubn(1),s++;for(p(i+s+1<=e.length,i,"Out of bounds write");e[i++]=r[s],s--;);return i},o.sizeVarint2N=function(e){if(p(!e.sign,0,"Signed"),0===e.hi)return o.sizeVarint2(e.toInt());e=e.clone();let t=0;for(;t++,!e.lten(127);)e.ishrn(7).isubn(1);return t},o.U8=function(e){var t=Buffer.allocUnsafe(1);return t[0]=e>>>0,t},o.U32=function(e){var t=Buffer.allocUnsafe(4);return t.writeUInt32LE(e,0,!0),t},o.U32BE=function(e){var t=Buffer.allocUnsafe(4);return t.writeUInt32BE(e,0,!0),t},o.sizeVarBytes=function(e){return o.sizeVarint(e.length)+e.length},o.sizeVarlen=function(e){return o.sizeVarint(e)+e},o.sizeVarString=function(e,t){return"string"!=typeof e?o.sizeVarBytes(e):(e=Buffer.byteLength(e,t),o.sizeVarint(e)+e)},o.EncodingError=function e(t,i,r){if(!(this instanceof e))return new e(t,i,r);Error.call(this),this.type="EncodingError",this.message=i+` (offset=${t}).`,Error.captureStackTrace&&Error.captureStackTrace(this,r||e)},Object.setPrototypeOf(o.EncodingError.prototype,Error.prototype)},function(e,t,i){
/*!
* staticwriter.js - buffer writer for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
*/
let r=i(0),s=i(3),a=i(6),n=Buffer.alloc(0),o=null;function c(e){if(!(this instanceof c))return new c(e);this.data=e?Buffer.allocUnsafe(e):n,this.offset=0}c.pool=function(e){var t;return e<=102400?(o=o||Buffer.allocUnsafeSlow(102400),(t=new c(0)).data=o.slice(0,e),t):new c(e)},c.prototype.render=function(e=!0){var t=this.data;return e&&r(this.offset===t.length),this.destroy(),t},c.prototype.getSize=function(){return this.offset},c.prototype.seek=function(e){this.offset+=e},c.prototype.destroy=function(){this.data=n,this.offset=0},c.prototype.writeU8=function(e){this.offset=this.data.writeUInt8(e>>>=0,this.offset,!0)},c.prototype.writeU16=function(e){this.offset=this.data.writeUInt16LE(e>>>=0,this.offset,!0)},c.prototype.writeU16BE=function(e){this.offset=this.data.writeUInt16BE(e>>>=0,this.offset,!0)},c.prototype.writeU32=function(e){this.offset=this.data.writeUInt32LE(e>>>=0,this.offset,!0)},c.prototype.writeU32BE=function(e){this.offset=this.data.writeUInt32BE(e>>>=0,this.offset,!0)},c.prototype.writeU64=function(e){this.offset=s.writeU64(this.data,e,this.offset)},c.prototype.writeU64BE=function(e){this.offset=s.writeU64BE(this.data,e,this.offset)},c.prototype.writeU64N=function(e){this.offset=s.writeU64N(this.data,e,this.offset)},c.prototype.writeU64BEN=function(e){this.offset=s.writeU64BEN(this.data,e,this.offset)},c.prototype.writeI8=function(e){this.offset=this.data.writeInt8(e,this.offset,!0)},c.prototype.writeI16=function(e){this.offset=this.data.writeInt16LE(e,this.offset,!0)},c.prototype.writeI16BE=function(e){this.offset=this.data.writeInt16BE(e,this.offset,!0)},c.prototype.writeI32=function(e){this.offset=this.data.writeInt32LE(e,this.offset,!0)},c.prototype.writeI32BE=function(e){this.offset=this.data.writeInt32BE(e,this.offset,!0)},c.prototype.writeI64=function(e){this.offset=s.writeI64(this.data,e,this.offset)},c.prototype.writeI64BE=function(e){this.offset=s.writeI64BE(this.data,e,this.offset)},c.prototype.writeI64N=function(e){this.offset=s.writeI64N(this.data,e,this.offset)},c.prototype.writeI64BEN=function(e){this.offset=s.writeI64BEN(this.data,e,this.offset)},c.prototype.writeFloat=function(e){this.offset=this.data.writeFloatLE(e,this.offset,!0)},c.prototype.writeFloatBE=function(e){this.offset=this.data.writeFloatBE(e,this.offset,!0)},c.prototype.writeDouble=function(e){this.offset=this.data.writeDoubleLE(e,this.offset,!0)},c.prototype.writeDoubleBE=function(e){this.offset=this.data.writeDoubleBE(e,this.offset,!0)},c.prototype.writeVarint=function(e){this.offset=s.writeVarint(this.data,e,this.offset)},c.prototype.writeVarintN=function(e){this.offset=s.writeVarintN(this.data,e,this.offset)},c.prototype.writeVarint2=function(e){this.offset=s.writeVarint2(this.data,e,this.offset)},c.prototype.writeVarint2N=function(e){this.offset=s.writeVarint2N(this.data,e,this.offset)},c.prototype.writeBytes=function(e){0!==e.length&&(e.copy(this.data,this.offset),this.offset+=e.length)},c.prototype.writeVarBytes=function(e){this.writeVarint(e.length),this.writeBytes(e)},c.prototype.copy=function(e,t,i){var r=i-t;0!=r&&(e.copy(this.data,this.offset,t,i),this.offset+=r)},c.prototype.writeString=function(e,t){var i;0!==e.length&&(i=Buffer.byteLength(e,t),this.data.write(e,this.offset,t),this.offset+=i)},c.prototype.writeHash=function(e){"string"!=typeof e?(r(32===e.length),this.writeBytes(e)):(r(64===e.length),this.data.write(e,this.offset,"hex"),this.offset+=32)},c.prototype.writeVarString=function(e,t){var i;0===e.length?this.writeVarint(0):(i=Buffer.byteLength(e,t),this.writeVarint(i),this.data.write(e,this.offset,t),this.offset+=i)},c.prototype.writeNullString=function(e,t){this.writeString(e,t),this.writeU8(0)},c.prototype.writeChecksum=function(){var e=this.data.slice(0,this.offset);a.hash256(e).copy(this.data,this.offset,0,4),this.offset+=4},c.prototype.fill=function(e,t){r(0<=t),0!==t&&(this.data.fill(e,this.offset,this.offset+t),this.offset+=t)},e.exports=c},function(e,t,i){let r=i(2).revHex,s={propSale:"sale",coinbase:"coinbase",notify:"notify",scRegister:"scRegister",scUpdate:"scUpdate",scState:"scState",cpRegister:"cpRegister",cpChange:"cpChange",contractCreate:"contractCreate",contractExecute:"contractExecute",contractPromise:"contractPromise",propCreate:"new",propExchange:"exchange",propFound:"found",htlcSuggest:"htlc1",htlcAssent:"htlc2",attach:"attach",comment:"comment",vote:"vote",scRun:"scrun",scNotify:"scnotify",erIssue:"erIssue",erAbolish:"erAbolish",enchanceCp:"enchanceCp"};var a=Object.keys(s).reduce((e,t)=>(s[t]!=s.propCreate&&s[t]!=s.propExchange&&s[t]!=s.propFound&&s[t]!=s.htlcSuggest&&s[t]!=s.htlcAssent&&s[t]!=s.contractPromise&&(e[t]=s[t]),e),{});let n=i(403);t.NotifyMsg=class e{constructor(e,t,i,r){this.oper=e,this.sn=t,this.h=i,this.body=r}static fromRaw(t){try{var i=JSON.parse(t.toString());return new e(i.oper,i.sn,i.h,i.body)}catch(t){}return null}toRaw(){return Buffer.from(JSON.stringify({oper:this.oper,sn:this.sn,h:this.h,body:this.body}))}},t.PropStatus={Sale:2,Borrow:3,Delete:4,Ready:9},t.HtlcStatus={Init:0,Sent:1,Assent:2,Deal:3,Finished:4,Cancel:9},t.ContractStatus={None:0,CreatedOnMem:2,Obsolete:3,Promised:4,Expired:5,Confirmed:6,Exchanged:7,Backed:8},t.ContractType=s,t.ContractTypeExecutable=a,t.ContractEnvType={Wallet:2,Mempool:3,Block:5},t.BlockFinalType={Final:0,Waiting:1,Expired:2},t.VerifyCode={Failed:0,Success:1,StockOffering:1001,StockCooling:1002,WrongPrice:1003,WrongFee:1004,WrongPublisher:1005,WrongSum:1006,WrongBonus:1007,SnapNull:1008,SignFailed:1009,WrongHeight:1010,WrongFormat:1011,StockAccountNotExist:1012,StockAccountNotEnoughSum:1013,StockOfferExpired:1014,FundNotEnough:1015,StockCircledependence:1016,AccountSequenceWrong:1017,NotExistCp:1018,NotExistER:1019,SignatureNotMatch:1020,DuplicateEr:1021,IssueError:1022,CreditError:1023,AbolishTimeError:1025,AbolishRootError:1026},t.getVerifyMsg=function(e){return n[e]},t.Transform=class{constructor(e){this.content=e.replace(/(\/\*(\n|.)*?\*\/)/g,"").replace(/(\n)|(\r)/g," ")}replace(e){let t=this.content;for(var i of Object.keys(e))if("string"==typeof e[i]&&0==e[i].indexOf("0x")){var s=(e[i].length-2)/2;let a=s.toString(16);a.length%2!=0&&(a="0"+a),a=r(a),s<=75?t=t.replace(new RegExp("var_"+i,"g"),`0x${a} `+e[i]):s<=255?t=t.replace(new RegExp("var_"+i,"g"),`0x4c 0x${a} `+e[i]):s<=65535?t=t.replace(new RegExp("var_"+i,"g"),`0x4d 0x${a} `+e[i]):s<=4294967295&&(t=t.replace(new RegExp("var_"+i,"g"),`0x4e 0x${a} `+e[i]))}else t=t.replace(new RegExp("var_"+i,"g"),e[i]);return t}},t.ContractState={Normal:1,Frozen:2,Destroy:3}},function(e,t,i){
/*!
* digest.js - hash functions for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
* https://github.com/bookmansoft/gamegold
*/
let r=i(0),s=i(8);i=i(55).binding;let a=Buffer.allocUnsafe(64);t.hash=function(e,t){return s.createHash(e).update(t).digest()},t.ripemd160=function(e){return t.hash("ripemd160",e)},t.sha1=function(e){return t.hash("sha1",e)},t.sha256=function(e){return t.hash("sha256",e)},t.hash160=function(e){return t.ripemd160(t.sha256(e))},t.hash256=function(e){return t.sha256(t.sha256(e))},t.root256=function(e,i){var s=a;return r(32===e.length),r(32===i.length),e.copy(s,0),i.copy(s,32),t.hash256(s)},t.hmac=function(e,t,i){return s.createHmac(e,i).update(t).digest()},i&&(t.hash=i.hash,t.hmac=i.hmac,t.ripemd160=i.ripemd160,t.sha1=i.sha1,t.sha256=i.sha256,t.hash160=i.hash160,t.hash256=i.hash256,t.root256=i.root256)},function(e,t,i){
/*!
* consensus.js - consensus constants and helpers for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
* https://github.com/bookmansoft/gamegold
*/
let r=i(0),s=i(47);t.ROOT="xxxxxxxx-vallnet-root-xxxxxxxxxxxxxx",t.COIN=1e8,t.BASE_REWARD=50*t.COIN,t.VALLNET_HEARTBEAT=600,t.BLOCK_DAY=144,t.retargetInterval=14*t.BLOCK_DAY,t.targetTimespan=t.VALLNET_HEARTBEAT*t.retargetInterval,t.MAX_MONEY=21e6*t.COIN,t.ORIGINAL=t.MAX_MONEY/10,t.GRAM=100,t.MINPROPVALUE=100*t.GRAM,t.registerFee=t.COIN,t.contractConfirmation=1,t.TRANSACTION_PERIOD=10,t.HTLC_CANCEL_PERIOD=72,t.SmartContractMnemonic={phrase:"legal winner thank year wave sausage worth useful legal winner thank yellow",language:"english",passphrase:"bookmansoft"},t.getRealValue=function(e,t){return e*Math.pow(t,.5)},t.getVoteZone=function(e){return 1+(e/t.retargetInterval|0)},t.getRealValues=function(e,i){let r=0;for(var s of e){var a=s.getDepth(i);a<1||s.getReturnType(106)||(r+=t.getRealValue(s.value,a))}return r},t.HALF_REWARD=Math.floor(t.BASE_REWARD/2),t.MAX_BLOCK_SIZE=1e7,t.MAX_RAW_BLOCK_SIZE=4e7,t.MAX_BLOCK_WEIGHT=4e7,t.MAX_PACKING_SIZE=16,t.MAX_BLOCK_SIGOPS=2e5,t.MAX_BLOCK_SIGOPS_COST=8e5,t.VERSION_TOP_BITS=536870912,t.VERSION_TOP_MASK=3758096384,t.COINBASE_MATURITY=100,t.STOCK_ORIENT=5e6,t.STOCK_MAX_PRICE=5e6,t.STOCK_ADDED_SINGLE=1e6,t.STOCK_ADDED=1e7,t.STOCK_TRADE_SINGLE=100,t.STOCK_MAX_TRADE_SINGLE=1e4,t.STOCK_OFFER_PERIOD=14,t.STOCK_OFFER_CD=28,t.WITNESS_SCALE_FACTOR=4,t.LOCKTIME_THRESHOLD=5e8,t.SEQUENCE_DISABLE_FLAG=1<<31>>>0,t.SEQUENCE_TYPE_FLAG=1<<22,t.SEQUENCE_GRANULARITY=9,t.SEQUENCE_MASK=65535,t.MAX_SCRIPT_SIZE=1e4,t.MAX_SCRIPT_STACK=1e3,t.MAX_SCRIPT_PUSH=520,t.MAX_SCRIPT_OPS=201,t.MAX_MULTISIG_PUBKEYS=20,t.MAX_CACHE_REORGAN_TX=2e5,t.compact2BN=function(e){if(0===e)return new s(0);var t=e>>>24,i=e>>>23&1;let r,a=8388607&e;return t<=3?(a>>>=8*(3-t),r=new s(a)):(r=new s(a)).iushln(8*(t-3)),i&&r.ineg(),r},t.bn2Compact=function(e){if(e.isZero())return 0;let t,i=e.byteLength(),r=(i<=3?(t=e.toNumber(),t<<=8*(3-i)):t=e.ushrn(8*(i-3)).toNumber(),8388608&t&&(t>>=8,i++),i<<24|t);return e.isNeg()&&(r|=8388608),r>>>0},t.verifyPOW=function(e,i){return!(i=t.compact2BN(i)).isNeg()&&!i.isZero()&&!new s(e,"le").gt(i)},t.getReward=function(e,i){return r(0<=e,"Bad height for reward."),33<=(e=Math.floor(e/i))?0:0===e?t.BASE_REWARD:t.HALF_REWARD>>>e-1},t.hasBit=function(e,i){return(e&t.VERSION_TOP_MASK)>>>0===t.VERSION_TOP_BITS&&0!=(e&1<<i)}},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("util")},function(e,t,i){var r=i(0),s=i(38).Stream,a=i(9),n=/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;function o(e){return e.charAt(0).toUpperCase()+e.slice(1)}function c(e,t,i,s,n){throw new r.AssertionError({message:a.format("%s (%s) is required",e,t),actual:void 0===n?typeof s:n(s),expected:t,operator:i||"===",stackStartFunction:c.caller})}function h(e){return Object.prototype.toString.call(e).slice(8,-1)}function u(){}var l={bool:{check:function(e){return"boolean"==typeof e}},func:{check:function(e){return"function"==typeof e}},string:{check:function(e){return"string"==typeof e}},object:{check:function(e){return"object"==typeof e&&null!==e}},number:{check:function(e){return"number"==typeof e&&!isNaN(e)}},finite:{check:function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}},buffer:{check:function(e){return Buffer.isBuffer(e)},operator:"Buffer.isBuffer"},array:{check:function(e){return Array.isArray(e)},operator:"Array.isArray"},stream:{check:function(e){return e instanceof s},operator:"instanceof",actual:h},date:{check:function(e){return e instanceof Date},operator:"instanceof",actual:h},regexp:{check:function(e){return e instanceof RegExp},operator:"instanceof",actual:h},uuid:{check:function(e){return"string"==typeof e&&n.test(e)},operator:"isUUID"}};e.exports=function e(t){var i=Object.keys(l),s=process.env.NODE_NDEBUG?u:function(e,t){e||c(t,"true",e)};return i.forEach((function(e){var i;t?s[e]=u:(i=l[e],s[e]=function(t,r){i.check(t)||c(r,e,i.operator,t,i.actual)})})),i.forEach((function(e){var i,r="optional"+o(e);t?s[r]=u:(i=l[e],s[r]=function(t,r){null==t||i.check(t)||c(r,e,i.operator,t,i.actual)})})),i.forEach((function(e){var i,r,a="arrayOf"+o(e);t?s[a]=u:(i=l[e],r="["+e+"]",s[a]=function(e,t){var s;for(Array.isArray(e)||c(t,r,i.operator,e,i.actual),s=0;s<e.length;s++)i.check(e[s])||c(t,r,i.operator,e,i.actual)})})),i.forEach((function(e){var i,r,a="optionalArrayOf"+o(e);t?s[a]=u:(i=l[e],r="["+e+"]",s[a]=function(e,t){var s;if(null!=e)for(Array.isArray(e)||c(t,r,i.operator,e,i.actual),s=0;s<e.length;s++)i.check(e[s])||c(t,r,i.operator,e,i.actual)})})),Object.keys(r).forEach((function(e){s[e]="AssertionError"!==e&&t?u:r[e]})),s._setExports=e,s}(process.env.NODE_NDEBUG)},function(e,t,i){var r,s=i(79),a="undefined"==typeof navigator,n={e:{}},o="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null;function c(){try{var e=r;return r=null,e.apply(this,arguments)}catch(e){return n.e=e,n}}function h(e){return null==e||!0===e||!1===e||"string"==typeof e||"number"==typeof e}function u(e,t,i){return h(e)||s.defineProperty(e,t,{value:i,configurable:!0,enumerable:!1,writable:!0}),e}var l=(()=>{function e(e){for(var t=0;t<r.length;++t)if(r[t]===e)return 1}var t,i,r=[Array.prototype,Object.prototype,Function.prototype];return s.isES5?(t=Object.getOwnPropertyNames,function(i){for(var r,a=[],n=Object.create(null);null!=i&&!e(i);){try{r=t(i)}catch(i){return a}for(var o=0;o<r.length;++o){var c,h=r[o];n[h]||(n[h]=!0,null!=(c=Object.getOwnPropertyDescriptor(i,h))&&null==c.get&&null==c.set&&a.push(h))}i=s.getPrototypeOf(i)}return a}):(i={}.hasOwnProperty,function(t){if(e(t))return[];var s=[];e:for(var a in t){if(!i.call(t,a))for(var n=0;n<r.length;++n)if(i.call(r[n],a))continue e;s.push(a)}return s})})(),p=/this\s*\.\s*\S+\s*=/;var d=/^[a-z$_][a-z$_0-9]*$/i;function f(e){try{return e+""}catch(e){return"[no string representation]"}}function m(e){return e instanceof Error||null!==e&&"object"==typeof e&&"string"==typeof e.message&&"string"==typeof e.name}function g(e){return m(e)&&s.propertyIsWritable(e,"stack")}var y="stack"in new Error?function(e){return g(e)?e:new Error(f(e))}:function(e){if(g(e))return e;try{throw new Error(f(e))}catch(e){return e}};function v(e){return{}.toString.call(e)}var w,b,k=function(e){return s.isArray(e)?e:null},x=("undefined"!=typeof Symbol&&Symbol.iterator&&(w="function"==typeof Array.from?function(e){return Array.from(e)}:function(e){for(var t,i=[],r=e[Symbol.iterator]();!(t=r.next()).done;)i.push(t.value);return i},k=function(e){return s.isArray(e)?e:null!=e&&"function"==typeof e[Symbol.iterator]?w(e):null}),"undefined"!=typeof process&&"[object process]"===v(process).toLowerCase()),S="undefined"!=typeof process&&void 0!==process.env;var _={setReflectHandler:function(e){b=e},isClass:function(e){try{if("function"==typeof e){var t=s.names(e.prototype),i=s.isES5&&1<t.length,r=0<t.length&&!(1===t.length&&"constructor"===t[0]),a=p.test(e+"")&&0<s.names(e).length;if(i||r||a)return!0}return!1}catch(e){return!1}},isIdentifier:function(e){return d.test(e)},inheritedDataKeys:l,getDataPropertyOrDefault:function(e,t,i){var r;return s.isES5?null!=(r=Object.getOwnPropertyDescriptor(e,t))?null==r.get&&null==r.set?r.value:i:void 0:{}.hasOwnProperty.call(e,t)?e[t]:void 0},thrower:function(e){throw e},isArray:s.isArray,asArray:k,notEnumerableProp:u,isPrimitive:h,isObject:function(e){return"function"==typeof e||"object"==typeof e&&null!==e},isError:m,canEvaluate:a,errorObj:n,tryCatch:function(e){return r=e,c},inherits:function(e,t){var i={}.hasOwnProperty;function r(){for(var r in this.constructor=e,(this.constructor$=t).prototype)i.call(t.prototype,r)&&"$"!==r.charAt(r.length-1)&&(this[r+"$"]=t.prototype[r])}return r.prototype=t.prototype,e.prototype=new r,e.prototype},withAppended:function(e,t){for(var i=e.length,r=new Array(i+1),s=0;s<i;++s)r[s]=e[s];return r[s]=t,r},maybeWrapAsError:function(e){return h(e)?new Error(f(e)):e},toFastProperties:function(e){function t(){}t.prototype=e;var i=new t;function r(){i.foo}return r(),r(),e},filledRange:function(e,t,i){for(var r=new Array(e),s=0;s<e;++s)r[s]=t+s+i;return r},toString:f,canAttachTrace:g,ensureErrorObject:y,originatesFromRejection:function(e){return null!=e&&(e instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===e.isOperational)},markAsOriginatingFromRejection:function(e){try{u(e,"isOperational",!0)}catch(e){}},classString:v,copyDescriptors:function(e,t,i){for(var r=s.names(e),a=0;a<r.length;++a){var n=r[a];if(i(n))try{s.defineProperty(t,n,s.getDescriptor(e,n))}catch(e){}}},isNode:x,hasEnvVariables:S,env:function(e){return S?process.env[e]:void 0},global:o,getNativePromise:function(){if("function"==typeof Promise)try{if("[object Promise]"===v(new Promise((function(){}))))return Promise}catch(e){}},contextBind:function(e,t){var i,r;return null!==e&&"function"==typeof t&&t!==b&&(null!==e.domain&&(t=e.domain.bind(t)),null!==(i=e.async))&&(r=t,t=function(){for(var e=arguments.length+2,t=new Array(e),s=2;s<e;++s)t[s]=arguments[s-2];return t[0]=r,t[1]=this,i.runInAsyncScope.apply(i,t)}),t}};_.isRecentNode=_.isNode&&(()=>{var e;return process.versions&&process.versions.node?e=process.versions.node.split(".").map(Number):process.version&&(e=process.version.split(".").map(Number)),0===e[0]&&10<e[1]||0<e[0]})(),_.nodeSupportsAsyncResource=_.isNode&&(()=>{var e=!1;try{e="function"==typeof i(266).AsyncResource.prototype.runInAsyncScope}catch(t){e=!1}return e})(),_.isNode&&_.toFastProperties(process);try{throw new Error}catch(e){_.lastLineError=e}e.exports=_},function(e,t,i){var r,s=i(85),a=s.Buffer,n={};for(r in s)s.hasOwnProperty(r)&&"SlowBuffer"!==r&&"Buffer"!==r&&(n[r]=s[r]);var o=n.Buffer={};for(r in a)a.hasOwnProperty(r)&&"allocUnsafe"!==r&&"allocUnsafeSlow"!==r&&(o[r]=a[r]);if(n.Buffer.prototype=a.prototype,o.from&&o.from!==Uint8Array.from||(o.from=function(e,t,i){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return a(e,t,i)}),o.alloc||(o.alloc=function(e,t,i){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||2*(1<<30)<=e)throw new RangeError('The value "'+e+'" is invalid for option "size"');return e=a(e),t&&0!==t.length?"string"==typeof i?e.fill(t,i):e.fill(t):e.fill(0),e}),!n.kStringMaxLength)try{n.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(e){}n.constants||(n.constants={MAX_LENGTH:n.kMaxLength},n.kStringMaxLength&&(n.constants.MAX_STRING_LENGTH=n.kStringMaxLength)),e.exports=n},function(e,t,i){
/*!
* address.js - address object for vallnet
* Copyright (c) 2019-2022, Bookman Software (MIT License).
*/
let r=i(0),s=i(15),a=i(3),n=i(2),o=i(6),c=i(1),h=i(4),u=i(70),l=i(242);class p{constructor(e){this.hash=a.ZERO_HASH160,this.type=p.types.PUBKEYHASH,this.version=-1,this.network=s.primary,e&&this.fromOptions(e)}fromOptions(e){return"string"==typeof e?this.fromString(e):this.fromHash(e.hash,e.type,e.version,e.network)}static fromOptions(e){return(new p).fromOptions(e)}getHash(e){return"hex"===e?this.hash.toString(e):this.hash}isNull(){if(20===this.hash.length)return this.hash.equals(a.ZERO_HASH160);if(32===this.hash.length)return this.hash.equals(a.ZERO_HASH);for(let e=0;e<this.hash.length;e++)if(0!==this.hash[e])return!1;return!0}equals(e){return r(e instanceof p),this.network===e.network&&this.type===e.type&&this.version===e.version&&this.hash.equals(e.hash)}getType(){return p.typesByVal[this.type].toLowerCase()}getPrefix(e){e=e||this.network;var t=(e=s.get(e)).addressPrefix;switch(this.type){case p.types.PUBKEYHASH:return t.pubkeyhash;case p.types.SCRIPTHASH:return t.scripthash;case p.types.WITNESS:if(20===this.hash.length)return t.witnesspubkeyhash;if(32===this.hash.length)return t.witnessscripthash}return-1}getSize(){let e=5+this.hash.length;return-1!==this.version&&(e+=2),e}toRaw(e){var t=this.getSize();t=new h(t),e=this.getPrefix(e);return r(-1!==e,"Not a valid address prefix."),t.writeU8(e),-1!==this.version&&(t.writeU8(this.version),t.writeU8(0)),t.writeBytes(this.hash),t.writeChecksum(),t.render()}toBase58(e){return u.encode(this.toRaw(e))}toBech32(e){var t=this.version,i=this.hash;r(-1!==t,"Cannot convert non-program address to bech32."),e=e||this.network,e=(e=s.get(e)).addressPrefix.bech32;return l.encode(e,t,i)}fromString(e,t){if(r("string"==typeof e),r(0<e.length),r(e.length<=100),(e=>{let t=!1,i=!1;for(let a=0;a<e.length;a++){var s=e.charCodeAt(a);if(!(48<=s&&s<=57)&&(32&s?(r(97<=s&&s<=122),t=!0):(r(65<=s&&s<=90),i=!0),t&&i))return 1}})(e))return this.fromBase58(e,t);try{return this.fromBech32(e,t)}catch(i){return this.fromBase58(e,t)}}static fromString(e,t){return(new p).fromString(e,t)}toString(e){return-1!==this.version?this.toBech32(e):this.toBase58(e)}fromBase58(e,t){if(r("string"==typeof e),55<e.length)throw new Error("Address is too long.");return this.fromRaw(u.decode(e),t)}fromBech32(e,t){r("string"==typeof e);var i=p.types.WITNESS;e=l.decode(e);return t=s.fromBech32(e.hrp,t),this.fromHash(e.hash,i,e.version,t)}static fromBech32(e,t){return(new p).fromBech32(e,t)}static fromBase58(e,t){return(new p).fromBase58(e,t)}inspect(){return"<Address: type="+this.getType()+" version="+this.version+" str="+this.toString()+">"}fromRaw(e,t){var i=new c(e,!0);if(40<e.length)throw new Error("Address is too long.");var r=i.readU8();t=s.fromAddress(r,t),r=p.getType(r,t);let a=-1;if(25<e.length&&(a=i.readU8(),0!==i.readU8()))throw new Error("Address version padding is non-zero.");return e=i.readBytes(i.left()-4),i.verifyChecksum(),this.fromHash(e,r,a,t)}static fromRaw(e,t){return(new p).fromRaw(e,t)}fromScript(e){var t=e.getPubkey();return t?(this.hash=o.hash160(t),this.type=p.types.PUBKEYHASH,this.version=-1,this):(t=e.getPubkeyhash())?(this.hash=t,this.type=p.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthash())?(this.hash=t,this.type=p.types.SCRIPTHASH,this.version=-1,this):(t=e.getProgram())&&!t.isMalformed()?(this.hash=t.data,this.type=p.types.WITNESS,this.version=t.version,this):e.isMultisig()?(this.hash=e.hash160(),this.type=p.types.SCRIPTHASH,this.version=-1,this):null}static fromScript(e){return(new p).fromScript(e)}fromWitness(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=p.types.WITNESS,this.version=0,this):(t=e.getScripthashInput())?(this.hash=o.sha256(t),this.type=p.types.WITNESS,this.version=0,this):null}fromInputScript(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=p.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthashInput())?(this.hash=o.hash160(t),this.type=p.types.SCRIPTHASH,this.version=-1,this):null}static fromWitness(e){return(new p).fromWitness(e)}static fromInputScript(e){return(new p).fromInputScript(e)}fromHash(e,t,i,a){return"string"==typeof e&&(e=Buffer.from(e,"hex")),"string"==typeof t&&(t=p.types[t.toUpperCase()],r(null!=t,"Not a valid address type.")),null==t&&(t=p.types.PUBKEYHASH),null==i&&(i=-1),a=s.get(a),r(Buffer.isBuffer(e)),r(n.isU8(t)),r(n.isI8(i)),r(t>=p.types.PUBKEYHASH&&t<=p.types.WITNESS,"Not a valid address type."),-1===i?(r(t!==p.types.WITNESS,"Wrong version (witness)"),r(20===e.length,"Hash is the wrong size.")):(r(t===p.types.WITNESS,"Wrong version (non-witness)."),r(0<=i&&i<=16,"Bad program version."),0===i&&t===p.types.WITNESS&&r(20===e.length||32===e.length,"Witness program hash is the wrong size."),r(2<=e.length&&e.length<=40,"Hash is the wrong size.")),this.hash=e,this.type=t,this.version=i,this.network=a,this}static fromHash(e,t,i,r){return(new p).fromHash(e,t,i,r)}fromPubkeyhash(e,t){var i=p.types.PUBKEYHASH;return r(20===e.length,"P2PKH must be 20 bytes."),this.fromHash(e,i,-1,t)}static fromPubkeyhash(e,t){return(new p).fromPubkeyhash(e,t)}fromScripthash(e,t){var i=p.types.SCRIPTHASH;return r(e&&20===e.length,"P2SH must be 20 bytes."),this.fromHash(e,i,-1,t)}static fromScripthash(e,t){return(new p).fromScripthash(e,t)}fromWitnessPubkeyhash(e,t){var i=p.types.WITNESS;return r(e&&20===e.length,"P2WPKH must be 20 bytes."),this.fromHash(e,i,0,t)}static fromWitnessPubkeyhash(e,t){return(new p).fromWitnessPubkeyhash(e,t)}fromWitnessScripthash(e,t){var i=p.types.WITNESS;return r(e&&32===e.length,"P2WPKH must be 32 bytes."),this.fromHash(e,i,0,t)}static fromWitnessScripthash(e,t){return(new p).fromWitnessScripthash(e,t)}fromProgram(e,t,i){var s=p.types.WITNESS;return r(0<=e,"Bad version for witness program."),"string"==typeof t&&(t=Buffer.from(t,"hex")),this.fromHash(t,s,e,i)}static fromProgram(e,t,i){return(new p).fromProgram(e,t,i)}isPubkeyhash(){return this.type===p.types.PUBKEYHASH}isScripthash(){return this.type===p.types.SCRIPTHASH}isWitnessPubkeyhash(){return 0===this.version&&20===this.hash.length}isWitnessScripthash(){return 0===this.version&&32===this.hash.length}isWitnessMasthash(){return 1===this.version&&32===this.hash.length}isProgram(){return-1!==this.version}isUnknown(){return-1!==this.version&&(0<this.version||20!==this.hash.length&&32!==this.hash.length)}static getHash(e,t,i){if(!e)throw new Error("Object