UNPKG

gamegold

Version:
49 lines 2.65 MB
const path = require('path');var gpath = path.join(__dirname, '../../../', 'node_modules'); module.exports=(e=>{var t={};function i(s){var r;return(t[s]||(r=t[s]={i:s,l:!1,exports:{}},e[s].call(r.exports,r,r.exports,i),r.l=!0,r)).exports}return i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},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 s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(s,r,function(t){return e[t]}.bind(null,r));return s},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=523)})([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 s=i(0),r=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)),s(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 r.EncodingError(this.offset,"Out of bounds read",e)},o.prototype.enforce=function e(t,i){if(!t)throw new r.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(){s(0<this.stack.length);var e=this.stack.pop();return this.offset-e},o.prototype.endData=function(e){s(0<this.stack.length);var t=this.stack.pop(),i=this.offset,r=i-t,a=this.data;return r===a.length?a:this.zeroCopy||e?a.slice(t,i):(e=Buffer.allocUnsafe(r),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=r.readU64(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BE=function(){this.assert(this.offset+8<=this.data.length);var e=r.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=r.readI64(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BE=function(){this.assert(this.offset+8<=this.data.length);var e=r.readI64BE(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64N=function(){this.assert(this.offset+8<=this.data.length);var e=r.readU64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=r.readU64BEN(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64N=function(){this.assert(this.offset+8<=this.data.length);var e=r.readI64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=r.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}=r.readVarint(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarintN=function(){var{size:e,value:t}=r.readVarintN(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2=function(){var{size:e,value:t}=r.readVarint2(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2N=function(){var{size:e,value:t}=r.readVarint2N(this.data,this.offset);return this.offset+=e,t},o.prototype.readBytes=function(e,t){let i;return s(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 s(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 s=i(0),r=i(281),a=i(48),n=i(102),o=t,h={showHidden:!1,depth:20,colors:!1,customInspect:!0,showProxy:!1,maxArrayLength:1/0,breakLength:60};function c(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,s,r=0,a=arguments[r++],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]||r++])||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):" ",s=t[5]-String(e).length-"".length,i=t[5]?((e,t)=>{for(var i=[];0<t;i[--t]=e);return i.join("")})(i,s):"",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)||(s("string"==typeof e),e=Buffer.from(e,"binary")),Buffer.isBuffer(t)||(s("string"==typeof t),t=Buffer.from(t,"binary")),Buffer.isBuffer(i)||(s("string"==typeof i),i=Buffer.from(i,"binary"));var r=n.encipher(i,e,t),a=(r=Buffer.from(r,"binary"),Buffer.alloc(2*r.length));for(let e=0;e<r.length;e++)a[2*e]=97+(r[e]>>4),a[2*e+1]=97+(15&r[e]);return a.toString("binary")},o.decrypt=function(e,t,i){Buffer.isBuffer(e)||(s("string"==typeof e),e=Buffer.from(e,"binary")),Buffer.isBuffer(t)||(s("string"==typeof t),t=Buffer.from(t,"binary")),Buffer.isBuffer(i)||(s("string"==typeof i),i=Buffer.from(i,"binary"));var r=Buffer.alloc(i.length/2);for(let e=0;e<r.length;e++)r[e]=i[2*e]-97<<4|i[2*e+1]-97;return n.decipher(r,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(s=>{t&&t.includes[s]||e[s]&&(i+=s+o.stringify(e[s]))}),i}},o.parseJson=function(e,t){try{return JSON.parse(e)}catch(e){return t||null}},o.hashInt=function(e){return r.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,r,a,n;return s(0<=e),s(0<=t),e<=0xfffffffffffff&&t<=0xfffffffffffff||(e=((i=e*(1/4294967296)|0)+(r=t*(1/4294967296)|0)|0)+(1&((a=(e|=0)>>31)&(n=(t|=0)>>31)|~((e+t|0)>>31)&(a^n)))|0,r>>>=0,!((e>>>=0)<(i>>>=0)||e<r)&&0==(4292870144&e))},o.inspectify=function(e,t){return"string"==typeof e?e:(h.colors=!1!==t,a.inspect(e,h))},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:s(!1,"Bad nonce size.")}return i},o.strcmp=function(e,t){var i=Math.min(e.length,t.length);for(let s=0;s<i;s++){if(e[s]<t[s])return-1;if(e[s]>t[s])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){s(Array.isArray(e)),s(Buffer.isBuffer(t));for(let r=0;r<e.length;r++){var i=e[r];if(s(Buffer.isBuffer(i)),i.equals(t))return r}return-1},o.pad8=function(e){switch(s("number"==typeof e),s(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(s("number"==typeof e),s(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(s("number"==typeof e),s(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(s("number"==typeof e),s(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){s("string"==typeof e),s(0<e.length),s(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,s){let r=0,a=e.length-1;for(;r<=a;){var n=r+a>>>1,o=i(e[n],t);if(0===o)return n;o<0?r=1+n:a=n-1}return s?r:-1},o.binaryInsert=function(e,t,i,s){var r=o.binarySearch(e,t,i,!0);return s&&r<e.length&&0===i(e[r],t)?-1:(0===r?e.unshift(t):r===e.length?e.push(t):e.splice(r,0,t),r)},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 s("string"==typeof e),0!==e.length&&0==(32&e.charCodeAt(0))},o.startsWith=function(e,t){return s("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){s("number"==typeof e),s(Number.isSafeInteger(e),"Invalid integer value.");let i="";e<0&&(e=-e,i="-");var r=c(t);let a=e%r,n=(e-a)/r;for(a=a.toString(10),n=n.toString(10);a.length<t;)a="0"+a;return a=a.replace(/0+$/,""),s(a.length<=t,"Invalid integer value."),0===a.length&&(a="0"),0===t?""+i+n:""+i+n+"."+a},o.fromFixed=function(e,t){s("string"==typeof e),s(e.length<=32,"Fixed number string too large.");let i=1,r=(0<e.length&&"-"===e[0]&&(e=e.substring(1),i=-1),e),a="0";for(-1!==(n=e.indexOf("."))&&(r=e.substring(0,n),a=e.substring(n+1)),r=r.replace(/^0+/,""),a=a.replace(/0+$/,""),s(r.length<=16-t,"Fixed number string exceeds 2^53-1."),s(a.length<=t,"Too many decimal places in fixed number string."),0===r.length&&(r="0");a.length<t;)a+="0";0===a.length&&(a="0"),s(/^\d+$/.test(r)&&/^\d+$/.test(a),"Non-numeric characters in fixed number string."),r=parseInt(r,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=c(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 s(r<o||r===o&&a<=n,"Fixed number string exceeds 2^53-1."),i*(r*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 s("number"==typeof e&&isFinite(e)),s(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:s,I64:r}=i(91),a=s.UINT64_MAX.shrn(7),n=Number.MAX_SAFE_INTEGER,o=t;function h(e,t){return e<0&&(e=~e,0===t)&&(e+=1),0==(4292870144&e)}function c(e,t,i,s){let r=!1,a=(t<0&&(t=-t,r=!0),t*(1/4294967296)|0),n=0|t;return r&&(0===n?a=1+~a|0:(a=~a,n=1+~n)),s?(i=e.writeInt32BE(a,i,!0),e.writeInt32BE(n,i,!0)):(i=e.writeInt32LE(n,i,!0),e.writeInt32LE(a,i,!0))}function p(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 d(e,t,i){if(!e)throw new o.EncodingError(t,i,d)}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 d(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 d(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 d(h(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 d(h(i,e=e.readUInt32BE(t+4,!0)),"Number exceeds 2^53-1"),4294967296*i+e},o.writeU64=function(e,t,i){return c(e,t,i,!1)},o.writeU64BE=function(e,t,i){return c(e,t,i,!0)},o.writeI64=function(e,t,i){return c(e,t,i,!1)},o.writeI64BE=function(e,t,i){return c(e,t,i,!0)},o.readU64N=function(e,t){return s.readLE(e,t)},o.readU64BEN=function(e,t){return s.readBE(e,t)},o.readI64N=function(e,t){return r.readLE(e,t)},o.readI64BEN=function(e,t){return r.readBE(e,t)},o.writeU64N=function(e,t,i){return d(!t.sign,i,"Signed"),t.writeLE(e,i)},o.writeU64BEN=function(e,t,i){return d(!t.sign,i,"Signed"),t.writeBE(e,i)},o.writeI64N=function(e,t,i){return d(t.sign,i,"Not signed"),t.writeLE(e,i)},o.writeI64BEN=function(e,t,i){return d(t.sign,i,"Not signed"),t.writeBE(e,i)},o.readVarint=function(e,t){let i,s;switch(l(t<e.length,t),e[t]){case 255:l(t+(s=9)<=e.length,t),d(4294967295<(i=o.readU64(e,t+1)),t,"Non-canonical varint");break;case 254:l(t+(s=5)<=e.length,t),d(65535<(i=e.readUInt32LE(t+1,!0)),t,"Non-canonical varint");break;case 253:l(t+(s=3)<=e.length,t),d(253<=(i=e[t+1]|e[t+2]<<8),t,"Non-canonical varint");break;default:s=1,i=e[t]}return new p(s,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 d(0!==i.hi,t,"Non-canonical varint"),new p(9,i)}let{size:i,value:r}=o.readVarint(e,t);return new p(i,s.fromInt(r))},o.writeVarintN=function(e,t,i){return d(!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 d(!e.sign,0,"Signed"),0!==e.hi?9:o.sizeVarint(e.toInt())},o.readVarint2=function(e,t){let i=0,s=0;for(;;){l(t<e.length,t);var r=e[t++];if(s++,d(i<=70368744177663-(127&r),t,"Number exceeds 2^53-1"),i=128*i+(127&r),0==(128&r))break;d(i!==n,t,"Number exceeds 2^53-1"),i++}return new p(s,i)},o.writeVarint2=function(e,t,i){var s=[];let r=0;for(;s[r]=127&t|(r?128:0),!(t<=127);)t=(t-t%128)/128-1,r++;for(l(i+r+1<=e.length,i);e[i++]=s[r],r--;);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 s;let r=0;for(;;){l(t<e.length,t);var n=e[t++];if(r++,d(i.lte(a),t,"Number exceeds 2^64-1"),i.ishln(7).iorn(127&n),0==(128&n))break;d(!i.eq(s.UINT64_MAX),t,"Number exceeds 2^64-1"),i.iaddn(1)}return new p(r,i)},o.writeVarint2N=function(e,t,i){if(d(!t.sign,i,"Signed"),0===t.hi)return o.writeVarint2(e,t.toInt(),i);t=t.clone();var s=[];let r=0;for(;s[r]=t.andln(127)|(r?128:0),!t.lten(127);)t.ishrn(7).isubn(1),r++;for(d(i+r+1<=e.length,i,"Out of bounds write");e[i++]=s[r],r--;);return i},o.sizeVarint2N=function(e){if(d(!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,s){if(!(this instanceof e))return new e(t,i,s);Error.call(this),this.type="EncodingError",this.message=i+` (offset=${t}).`,Error.captureStackTrace&&Error.captureStackTrace(this,s||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 s=i(0),r=i(3),a=i(6),n=Buffer.alloc(0),o=null;function h(e){if(!(this instanceof h))return new h(e);this.data=e?Buffer.allocUnsafe(e):n,this.offset=0}h.pool=function(e){var t;return e<=102400?(o=o||Buffer.allocUnsafeSlow(102400),(t=new h(0)).data=o.slice(0,e),t):new h(e)},h.prototype.render=function(e=!0){var t=this.data;return e&&s(this.offset===t.length),this.destroy(),t},h.prototype.getSize=function(){return this.offset},h.prototype.seek=function(e){this.offset+=e},h.prototype.destroy=function(){this.data=n,this.offset=0},h.prototype.writeU8=function(e){this.offset=this.data.writeUInt8(e>>>=0,this.offset,!0)},h.prototype.writeU16=function(e){this.offset=this.data.writeUInt16LE(e>>>=0,this.offset,!0)},h.prototype.writeU16BE=function(e){this.offset=this.data.writeUInt16BE(e>>>=0,this.offset,!0)},h.prototype.writeU32=function(e){this.offset=this.data.writeUInt32LE(e>>>=0,this.offset,!0)},h.prototype.writeU32BE=function(e){this.offset=this.data.writeUInt32BE(e>>>=0,this.offset,!0)},h.prototype.writeU64=function(e){this.offset=r.writeU64(this.data,e,this.offset)},h.prototype.writeU64BE=function(e){this.offset=r.writeU64BE(this.data,e,this.offset)},h.prototype.writeU64N=function(e){this.offset=r.writeU64N(this.data,e,this.offset)},h.prototype.writeU64BEN=function(e){this.offset=r.writeU64BEN(this.data,e,this.offset)},h.prototype.writeI8=function(e){this.offset=this.data.writeInt8(e,this.offset,!0)},h.prototype.writeI16=function(e){this.offset=this.data.writeInt16LE(e,this.offset,!0)},h.prototype.writeI16BE=function(e){this.offset=this.data.writeInt16BE(e,this.offset,!0)},h.prototype.writeI32=function(e){this.offset=this.data.writeInt32LE(e,this.offset,!0)},h.prototype.writeI32BE=function(e){this.offset=this.data.writeInt32BE(e,this.offset,!0)},h.prototype.writeI64=function(e){this.offset=r.writeI64(this.data,e,this.offset)},h.prototype.writeI64BE=function(e){this.offset=r.writeI64BE(this.data,e,this.offset)},h.prototype.writeI64N=function(e){this.offset=r.writeI64N(this.data,e,this.offset)},h.prototype.writeI64BEN=function(e){this.offset=r.writeI64BEN(this.data,e,this.offset)},h.prototype.writeFloat=function(e){this.offset=this.data.writeFloatLE(e,this.offset,!0)},h.prototype.writeFloatBE=function(e){this.offset=this.data.writeFloatBE(e,this.offset,!0)},h.prototype.writeDouble=function(e){this.offset=this.data.writeDoubleLE(e,this.offset,!0)},h.prototype.writeDoubleBE=function(e){this.offset=this.data.writeDoubleBE(e,this.offset,!0)},h.prototype.writeVarint=function(e){this.offset=r.writeVarint(this.data,e,this.offset)},h.prototype.writeVarintN=function(e){this.offset=r.writeVarintN(this.data,e,this.offset)},h.prototype.writeVarint2=function(e){this.offset=r.writeVarint2(this.data,e,this.offset)},h.prototype.writeVarint2N=function(e){this.offset=r.writeVarint2N(this.data,e,this.offset)},h.prototype.writeBytes=function(e){0!==e.length&&(e.copy(this.data,this.offset),this.offset+=e.length)},h.prototype.writeVarBytes=function(e){this.writeVarint(e.length),this.writeBytes(e)},h.prototype.copy=function(e,t,i){var s=i-t;0!=s&&(e.copy(this.data,this.offset,t,i),this.offset+=s)},h.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)},h.prototype.writeHash=function(e){"string"!=typeof e?(s(32===e.length),this.writeBytes(e)):(s(64===e.length),this.data.write(e,this.offset,"hex"),this.offset+=32)},h.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)},h.prototype.writeNullString=function(e,t){this.writeString(e,t),this.writeU8(0)},h.prototype.writeChecksum=function(){var e=this.data.slice(0,this.offset);a.hash256(e).copy(this.data,this.offset,0,4),this.offset+=4},h.prototype.fill=function(e,t){s(0<=t),0!==t&&(this.data.fill(e,this.offset,this.offset+t),this.offset+=t)},e.exports=h},function(e,t,i){let s=i(2).revHex,r={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(r).reduce((e,t)=>(r[t]!=r.propCreate&&r[t]!=r.propExchange&&r[t]!=r.propFound&&r[t]!=r.htlcSuggest&&r[t]!=r.htlcAssent&&r[t]!=r.contractPromise&&(e[t]=r[t]),e),{});let n=i(318);t.NotifyMsg=class e{constructor(e,t,i,s){this.oper=e,this.sn=t,this.h=i,this.body=s}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=r,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 r=(e[i].length-2)/2;let a=r.toString(16);a.length%2!=0&&(a="0"+a),a=s(a),r<=75?t=t.replace(new RegExp("var_"+i,"g"),`0x${a} `+e[i]):r<=255?t=t.replace(new RegExp("var_"+i,"g"),`0x4c 0x${a} `+e[i]):r<=65535?t=t.replace(new RegExp("var_"+i,"g"),`0x4d 0x${a} `+e[i]):r<=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 s=i(0),r=i(27);i=i(47).binding;let a=Buffer.allocUnsafe(64);t.hash=function(e,t){return r.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 r=a;return s(32===e.length),s(32===i.length),e.copy(r,0),i.copy(r,32),t.hash256(r)},t.hmac=function(e,t,i){return r.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 s=i(0),r=i(38),a=i(76).thresholdStates;t.ROOT="xxxxxxxx-vallnet-root-xxxxxxxxxxxxxx",t.COIN=1e8,t.VALLNET_HEARTBEAT=600,t.FASTBLOCK_HEARTBEAT=60,t.getHeartbeat=function(e,i,s){if(i.deployments&&i.deployments.fastblock){if((i=i.deployments.fastblock).force)return t.FASTBLOCK_HEARTBEAT;if(void 0!==s)return s===a.ACTIVE?t.FASTBLOCK_HEARTBEAT:t.VALLNET_HEARTBEAT;(s=Date.now()/1e3)<i.startTime||i.timeout}return t.VALLNET_HEARTBEAT},t.getBaseReward=function(e,i,s){return(t.getHeartbeat(e,i,s)/12|0)*t.COIN},t.BASE_REWARD=(t.VALLNET_HEARTBEAT/12|0)*t.COIN,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 s=0;for(var r of e){var a=r.getDepth(i);a<1||r.getReturnType(106)||(s+=t.getRealValue(r.value,a))}return s},t.HALF_REWARD=Math.floor(t.BASE_REWARD/2),t.MAX_BLOCK_SIZE=1e7,t.MAX_RAW_BLOCK_SIZE=4*t.MAX_BLOCK_SIZE,t.MAX_BLOCK_WEIGHT=4*t.MAX_BLOCK_SIZE,t.MAX_PACKING_SIZE=16,t.MAX_BLOCK_SIGOPS=t.MAX_BLOCK_SIZE/50,t.MAX_BLOCK_SIGOPS_COST=4*t.MAX_BLOCK_SIGOPS,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 r(0);var t=e>>>24,i=e>>>23&1;let s,a=8388607&e;return t<=3?(a>>>=8*(3-t),s=new r(a)):(s=new r(a)).iushln(8*(t-3)),i&&s.ineg(),s},t.bn2Compact=function(e){if(e.isZero())return 0;let t,i=e.byteLength(),s=(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()&&(s|=8388608),s>>>0},t.verifyPOW=function(e,i){return!(i=t.compact2BN(i)).isNeg()&&!i.isZero()&&!new r(e,"le").gt(i)},t.getReward=function(e,i,r,a){return s(0<=e,"Bad height for reward."),i=Math.floor(e/i),e=t.getBaseReward(e,r,a),r=Math.floor(e/2),33<=i?0:0===i?e:r>>>i-1},t.hasBit=function(e,i){return(e&t.VERSION_TOP_MASK)>>>0===t.VERSION_TOP_BITS&&0!=(e&1<<i)}},function(e,t,i){ /*! * address.js - address object for vallnet * Copyright (c) 2019-2022, Bookman Software (MIT License). */ let s=i(0),r=i(10),a=i(3),n=i(2),o=i(6),h=i(1),c=i(4),p=i(57),l=i(198);class d{constructor(e){this.hash=a.ZERO_HASH160,this.type=d.types.PUBKEYHASH,this.version=-1,this.network=r.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 d).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 s(e instanceof d),this.network===e.network&&this.type===e.type&&this.version===e.version&&this.hash.equals(e.hash)}getType(){return d.typesByVal[this.type].toLowerCase()}getPrefix(e){e=e||this.network;var t=(e=r.get(e)).addressPrefix;switch(this.type){case d.types.PUBKEYHASH:return t.pubkeyhash;case d.types.SCRIPTHASH:return t.scripthash;case d.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 c(t),e=this.getPrefix(e);return s(-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 p.encode(this.toRaw(e))}toBech32(e){var t=this.version,i=this.hash;s(-1!==t,"Cannot convert non-program address to bech32."),e=e||this.network,e=(e=r.get(e)).addressPrefix.bech32;return l.encode(e,t,i)}fromString(e,t){if(s("string"==typeof e),s(0<e.length),s(e.length<=100),(e=>{let t=!1,i=!1;for(let a=0;a<e.length;a++){var r=e.charCodeAt(a);if(!(48<=r&&r<=57)&&(32&r?(s(97<=r&&r<=122),t=!0):(s(65<=r&&r<=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 d).fromString(e,t)}toString(e){return-1!==this.version?this.toBech32(e):this.toBase58(e)}fromBase58(e,t){if(s("string"==typeof e),55<e.length)throw new Error("Address is too long.");return this.fromRaw(p.decode(e),t)}fromBech32(e,t){s("string"==typeof e);var i=d.types.WITNESS;e=l.decode(e);return t=r.fromBech32(e.hrp,t),this.fromHash(e.hash,i,e.version,t)}static fromBech32(e,t){return(new d).fromBech32(e,t)}static fromBase58(e,t){return(new d).fromBase58(e,t)}inspect(){return"<Address: type="+this.getType()+" version="+this.version+" str="+this.toString()+">"}fromRaw(e,t){var i=new h(e,!0);if(40<e.length)throw new Error("Address is too long.");var s=i.readU8();t=r.fromAddress(s,t),s=d.getType(s,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,s,a,t)}static fromRaw(e,t){return(new d).fromRaw(e,t)}fromScript(e){var t=e.getPubkey();return t?(this.hash=o.hash160(t),this.type=d.types.PUBKEYHASH,this.version=-1,this):(t=e.getPubkeyhash())?(this.hash=t,this.type=d.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthash())?(this.hash=t,this.type=d.types.SCRIPTHASH,this.version=-1,this):(t=e.getProgram())&&!t.isMalformed()?(this.hash=t.data,this.type=d.types.WITNESS,this.version=t.version,this):e.isMultisig()?(this.hash=e.hash160(),this.type=d.types.SCRIPTHASH,this.version=-1,this):null}static fromScript(e){return(new d).fromScript(e)}fromWitness(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=d.types.WITNESS,this.version=0,this):(t=e.getScripthashInput())?(this.hash=o.sha256(t),this.type=d.types.WITNESS,this.version=0,this):null}fromInputScript(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=d.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthashInput())?(this.hash=o.hash160(t),this.type=d.types.SCRIPTHASH,this.version=-1,this):null}static fromWitness(e){return(new d).fromWitness(e)}static fromInputScript(e){return(new d).fromInputScript(e)}fromHash(e,t,i,a){return"string"==typeof e&&(e=Buffer.from(e,"hex")),"string"==typeof t&&(t=d.types[t.toUpperCase()],s(null!=t,"Not a valid address type.")),null==t&&(t=d.types.PUBKEYHASH),null==i&&(i=-1),a=r.get(a),s(Buffer.isBuffer(e)),s(n.isU8(t)),s(n.isI8(i)),s(t>=d.types.PUBKEYHASH&&t<=d.types.WITNESS,"Not a valid address type."),-1===i?(s(t!==d.types.WITNESS,"Wrong version (witness)"),s(20===e.length,"Hash is the wrong size.")):(s(t===d.types.WITNESS,"Wrong version (non-witness)."),s(0<=i&&i<=16,"Bad program version."),0===i&&t===d.types.WITNESS&&s(20===e.length||32===e.length,"Witness program hash is the wrong size."),s(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,s){return(new d).fromHash(e,t,i,s)}fromPubkeyhash(e,t){var i=d.types.PUBKEYHASH;return s(20===e.length,"P2PKH must be 20 bytes."),this.fromHash(e,i,-1,t)}static fromPubkeyhash(e,t){return(new d).fromPubkeyhash(e,t)}fromScripthash(e,t){var i=d.types.SCRIPTHASH;return s(e&&20===e.length,"P2SH must be 20 bytes."),this.fromHash(e,i,-1,t)}static fromScripthash(e,t){return(new d).fromScripthash(e,t)}fromWitnessPubkeyhash(e,t){var i=d.types.WITNESS;return s(e&&20===e.length,"P2WPKH must be 20 bytes."),this.fromHash(e,i,0,t)}static fromWitnessPubkeyhash(e,t){return(new d).fromWitnessPubkeyhash(e,t)}fromWitnessScripthash(e,t){var i=d.types.WITNESS;return s(e&&32===e.length,"P2WPKH must be 32 bytes."),this.fromHash(e,i,0,t)}static fromWitnessScripthash(e,t){return(new d).fromWitnessScripthash(e,t)}fromProgram(e,t,i){var r=d.types.WITNESS;return s(0<=e,"Bad version for witness program."),"string"==typeof t&&(t=Buffer.from(t,"hex")),this.fromHash(t,r,e,i)}static fromProgram(e,t,i){return(new d).fromProgram(e,t,i)}isPubkeyhash(){return this.type===d.types.PUBKEYHASH}isScripthash(){return this.type===d.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 is not an address.");let s;if("string"==typeof e){if(40===e.length||64===e.length)return"hex"===t?e:Buffer.from(e,"hex");s=d.fromString(e,i).hash}else if(Buffer.isBuffer(e)){if(20!==e.length&&32!==e.length)throw new Error("Object is not an address.");s=e}else{if(!(e instanceof d))throw new Error("Object is not an address.");if(s=e.hash,i&&(i=r.get(i),e.network!==i))throw new Error("Network mismatch for address.")}return"hex"===t?s.toString("hex"):s}static getType(e,t){switch(t=t.addressPrefix,e){case t.pubkeyhash:return d.types.PUBKEYHASH;case t.scripthash:return d.types.SCRIPTHASH;case t.witnesspubkeyhash:case t.witnessscripthash:return d.types.WITNESS;default:throw new Error("Unknown address prefix.")}}}d.types={PUBKEYHASH:2,SCRIPTHASH:3,WITNESS:4},d.typesByVal=n.reverse(d.types),e.exports=d},function(e,t,i){let s=i(5).BlockFinalType;e.exports=class{constructor(e,t){this.data=e,(this.options=t).env&&(this.mode=t.env.mode)}async insert(){}async confirm(){}async unconfirm(){}async erase(){}async verify(){}async onPacking(){return{derive:[]}}isBlockFinal(){return s.Final}get oper(){return this.data&&this.data.oper||"unknown"}isPreVerify(){return!1}async checkFees(){return s.Final!=await this.isBlockFinal()}}},function(e,t,i){ /*! * network.js - network object for vallnet * Copyright (c) 2019-2022, Bookman Software (MIT License). * https://github.com/bookmansoft/gamegold */ let s=i(0),r=i(2),a=i(103),n=i(7),o=i(197);class h{constructor(e){s(!h[e.type],"Cannot create two networks."),this.type=e.type,this.typeId=e.typeId,this.seeds=e.seeds,this.txcheckpoint=e.txcheckpoint,this.txchecktime=e.txchecktime,this.magic=e.magic,this.port=e.port,this.wsport=e.wsport,this.publicPort=e.publicPort,this.checkpointMap=e.checkpointMap,this.lastCheckpoint=e.lastCheckpoint,this.checkpoints=[],this.halvingInterval=e.halvingInterval,this.genesis=e.genesis,this.pow=e.pow,this.pos=e.pos,this.block=e.block,this.activationThreshold=e.activationThreshold,this.minerWindow=e.minerWindow,this.deployments=e.deployments,this.deploys=e.deploys,this.keyPrefix=e.keyPrefix,this.addressPrefix=e.addressPrefix,this.requireStandard=e.requireStandard,this.httpPort=e.httpPort,this.minRelay=e.minRelay,this.feeRate=e.feeRate,this.maxFeeRate=e.maxFeeRate,this.selfConnect=e.selfConnect,this.requestMempool=e.requestMempool,this.genesisId=e.genesisId,this.tokenFix=e.tokenFix,this.tokenReg=e.tokenReg,this.stratumHost=e.stratumHost,this.stratumPort=e.stratumPort,this.stratumPublicHost=e.stratumPublicHost,this.stratumPublicPort=e.stratumPublicPort,this.stratumMaxInbound=e.stratumMaxInbound,this.stratumDifficulty=e.stratumDifficulty,this.stratumDynamic=e.stratumDynamic,this.stratumPassword=e.stratumPassword,this.unknownBits=~n.VERSION_TOP_MASK,this.time=new o,this._init()}_init(){let e=0;for(var t of this.deploys)e|=1<<t.bit;for(var i of(e|=n.VERSION_TOP_MASK,this.unknownBits=~e,Object.keys(this.checkpointMap))){var s=this.checkpointMap[i];i=Number(i);this.checkpoints.push({hash:s,height:i})}this.checkpoints.sort(p)}byBit(e){return-1===(e=r.binarySearch(this.deploys,e,c))?null:this.deploys[e]}now(){return this.time.now()}ms(){return this.time.ms()}toString(){return this.type}inspect(){return`<Network: ${this.type}>`}static create(e){return"string"==typeof e&&(e=a[e]),s(e,"Unknown network."),h[e.type]||(e=new h(e),h[e.type]=e,h.primary||(h.primary=e),e)}static set(e){return s("string"==typeof e,"Bad network."),h.primary=h.get(e),h.type=e,h.primary}static get(e){if(!e)return s(h.primary,"No default network."),h.primary;if(e instanceof h)return e;if("string"==typeof e)return h.create(e);throw new Error("Unknown network.")}static ensure(e){if(e){if(e instanceof h)return e;if("string"==typeof e&&a[e])return h.create(e)}return s(h.primary,"No default network."),h.primary}static by(e,t,i,s){if(i){if(t(i=h.get(i),e))return i;throw new Error(`Network mismatch for ${s}.`)}for(var r of a.types)if(t(i=a[r],e))return h.get(r);throw new Error(`Network not found for ${s}.`)}static fromMagic(e,t){return h.by(e,l,t,"magic number")}static fromWIF(e,t){return h.by(e,d,t,"WIF")}static fromPublic(e,t){return h.by(e,u,t,"xpubkey")}static fromPrivate(e,t){return h.by(e,f,t,"xprivkey")}static fromPublic58(e,t){return h.by(e,m,t,"xpubkey")}static fromPrivate58(e,t){return h.by(e,g,t,"xprivkey")}static fromAddress(e,t){return h.by(e,v,t,"base58 address")}static fromBech32(e,t){return h.by(e,w,t,"bech32 address")}static isNetwork(e){return e instanceof h}}function c(e,t){return e.bit-t}function p(e,t){return e.height-t.height}function l(e,t){return e.magic===t}function d(e,t){return e.keyPrefix.privkey===t}function u(e,t){return e.keyPrefix.xpubkey===t}function f(e,t){return e.keyPrefix.xprivkey===t}function m(e,t){return e.keyPrefix.xpubkey58===t}function g(e,t){return e.keyPrefix.xprivkey58===t}function v(e,t){switch(e=e.addressPrefix,t){case e.pubkeyhash:case e.scripthash:case e.witnesspubkeyhash:case e.witnessscripthash:return!0}return!1}function w(e,t){return e.addressPrefix.bech32===t}h.primary=null,h.type=null,h.main=null,h.testnet=null,h.regtest=null,h.simnet=null,h.set("testnet"),e.exports=h},function(e,t,i){ /*! * script.js - script interpreter for vallnet * Copyright (c) 2019-2022, Bookman Software (MIT License). */ let s=Buffer.alloc(0),r=i(0),a=i(199),n=i(140),o=i(106),h=i(92),c=i(85),p=i(14),l=p.opcodes,d=p.types,u=p.outputLockType,f=i(7),m=i(20),g=i(6),v=i(120),w=i(18),y=i(3),b=i(247),x=i(2),k=i(17),S=i(1),_=i(4),E=i(8),{ContractType:R,ContractStatus:A}=i(5),C=i(141),O={199:{len:11,list:[6,8]},197:{len:22,list:[9,18]},198:{len:19,list:[6,15]}},I=2;class T{constructor(e){this.raw=s,this.code=[],this.indicator=b.inst(0),e&&this.fromOptions(e)}createScript(e,t=d.PUBKEYHASH){switch(this.clear(),t){case d.PUBKEY:this.$fromPubkey(e);break;case d.PUBKEYHASH:this.$fromPubkeyhash(e);break;case d.PROPEXTEND:this.$fromPkhExtend(e);break;case d.MULTISIG:var[i,s,r]=e;this.$fromMultisig(i,s,r);break;case d.SCRIPTHASH:this.$fromScripthash(e);break;case d.NULLDATA:this.$fromNulldata(e);break;case d.WITNESS:var[i,s,r]=e;this.$fromProgram(i,s,r)}return 0<this.code.length&&this.compile(),this}static createScript(e,t=d.PUBKEYHASH){return(new T).createScript(e,t)}$fromNulldata(e){r(Buffer.isBuffer(e)),r(e.length<=m.MAX_OP_RETURN,"Nulldata too large."),this.pushOp(l.OP_RETURN),this.pushData(e)}$fromPubkey(e){r(Buffer.isBuffer(e)&&(33===e.length||65===e.length)),this.code.push(n.fromPush(e)),this.code.push(n.fromOp(l.OP_CHECKSIG))}$fromPubkeyhash(e){r(Buffer.isBuffer(e)&&20===e.length),this.code.push(n.fromOp(l.OP_DUP)),this.code.push(n.fromOp(l.OP_HASH160)),this.code.push(n.fromPush(e)),this.code.push(n.fromOp(l.OP_EQUALVERIFY)),this.code.push(n.fromOp(l.OP_CHECKSIG))}$fromPkhExtend(e){r(Buffer.isBuffer(e.info)&&e.info.length<=m.MAX_OP_INFO),r(Buffer.isBuffer(e.hash)&&20===e.hash.length),this.code.push(n.fromOp(e.opcode)),this.code.push(n.fromPush(e.info)),this.code.push(n.fromOp(l.OP_DROP)),this.code.push(n.fromOp(l.OP_DUP)),this.code.push(n.fromOp(l.OP_HASH160)),this.code.push(n.fromPush(e.hash)),this.code.push(n.fromOp(l.OP_EQUALVERIFY)),this.code.push(n.fromOp(l.OP_CHECKSIG))}$fromMultisig(e,t,i){for(var s of(r(x.isU8(e)&&x.isU8(t)),r(Array.isArray(i)),r(i.length===t,"`n` keys are required for multisig."),r(1<=e&&e<=t),r(1<=t&&t<=15),this.clear(),this.pushSmall(e),i.slice().sort((e,t)=>e.compare(t))))this.pushData(s);this.pushSmall(t),this.pushOp(l.OP_CHECKMULTISIG)}$fromScripthash(e){r(Buffer.isBuffer(e)&&20===e.length),this.code.push(n.fromOp(l.OP_HASH160)),this.code.push(n.fromPush(e)),this.code.push(n.fromOp(l.OP_EQUAL))}$fromProgram(e,t,i){var s;r(x.isU8(e)&&0<=e&&e<=16),r(Buffer.isBuffer(t)&&2<=t.length&&t.length<=40),i&&(s=Buffer.from(JSON.stringify(i)),r(Buffer.isBuffer(s)&&s.length<=m.MAX_OP_INFO),p.OperCodeFromType[i.oper])&&(this.code.push(n.fromOp(p.OperCodeFromType[i.oper])),this.code.push(n.fromPush(