UNPKG

gamegold

Version:
49 lines 1.57 MB
const path = require('path');var gpath = path.join(__dirname, '../../../', 'node_modules'); module.exports=(e=>{var t={};function i(r){var a;return(t[r]||(a=t[r]={i:r,l:!1,exports:{}},e[r].call(a.exports,a,a.exports,i),a.l=!0,a)).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 a in e)i.d(r,a,function(t){return e[t]}.bind(null,a));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=637)})([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),a=i(3),s=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 a.EncodingError(this.offset,"Out of bounds read",e)},o.prototype.enforce=function e(t,i){if(!t)throw new a.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,a=i-t,s=this.data;return a===s.length?s:this.zeroCopy||e?s.slice(t,i):(e=Buffer.allocUnsafe(a),s.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=a.readU64(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BE=function(){this.assert(this.offset+8<=this.data.length);var e=a.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=a.readI64(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BE=function(){this.assert(this.offset+8<=this.data.length);var e=a.readI64BE(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64N=function(){this.assert(this.offset+8<=this.data.length);var e=a.readU64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readU64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=a.readU64BEN(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64N=function(){this.assert(this.offset+8<=this.data.length);var e=a.readI64N(this.data,this.offset);return this.offset+=8,e},o.prototype.readI64BEN=function(){this.assert(this.offset+8<=this.data.length);var e=a.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}=a.readVarint(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarintN=function(){var{size:e,value:t}=a.readVarintN(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2=function(){var{size:e,value:t}=a.readVarint2(this.data,this.offset);return this.offset+=e,t},o.prototype.readVarint2N=function(){var{size:e,value:t}=a.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 s.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),a=i(281),s=i(48),n=i(102),o=t,p={showHidden:!1,depth:20,colors:!1,customInspect:!0,showProxy:!1,maxArrayLength:1/0,breakLength:60};function d(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,a=0,s=arguments[a++],n=[];s;){if(t=/^[^\x25]+/.exec(s))n.push(t[0]);else if(t=/^\x25{2}/.exec(s))n.push("%");else{if(!(t=/^\x25(?:(\d+)\$)?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(s)))throw"Huh ?!";if(null==(e=arguments[t[1]||a++])||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))}s=s.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 a=n.encipher(i,e,t),s=(a=Buffer.from(a,"binary"),Buffer.alloc(2*a.length));for(let e=0;e<a.length;e++)s[2*e]=97+(a[e]>>4),s[2*e+1]=97+(15&a[e]);return s.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 a=Buffer.alloc(i.length/2);for(let e=0;e<a.length;e++)a[e]=i[2*e]-97<<4|i[2*e+1]-97;return n.decipher(a,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 a.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,a,s,n;return r(0<=e),r(0<=t),e<=0xfffffffffffff&&t<=0xfffffffffffff||(e=((i=e*(1/4294967296)|0)+(a=t*(1/4294967296)|0)|0)+(1&((s=(e|=0)>>31)&(n=(t|=0)>>31)|~((e+t|0)>>31)&(s^n)))|0,a>>>=0,!((e>>>=0)<(i>>>=0)||e<a)&&0==(4292870144&e))},o.inspectify=function(e,t){return"string"==typeof e?e:(p.colors=!1!==t,s.inspect(e,p))},o.fmt=s.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 a=0;a<e.length;a++){var i=e[a];if(r(Buffer.isBuffer(i)),i.equals(t))return a}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 a=0,s=e.length-1;for(;a<=s;){var n=a+s>>>1,o=i(e[n],t);if(0===o)return n;o<0?a=1+n:s=n-1}return r?a:-1},o.binaryInsert=function(e,t,i,r){var a=o.binarySearch(e,t,i,!0);return r&&a<e.length&&0===i(e[a],t)?-1:(0===a?e.unshift(t):a===e.length?e.push(t):e.splice(a,0,t),a)},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 a=d(t);let s=e%a,n=(e-s)/a;for(s=s.toString(10),n=n.toString(10);s.length<t;)s="0"+s;return s=s.replace(/0+$/,""),r(s.length<=t,"Invalid integer value."),0===s.length&&(s="0"),0===t?""+i+n:""+i+n+"."+s},o.fromFixed=function(e,t){r("string"==typeof e),r(e.length<=32,"Fixed number string too large.");let i=1,a=(0<e.length&&"-"===e[0]&&(e=e.substring(1),i=-1),e),s="0";for(-1!==(n=e.indexOf("."))&&(a=e.substring(0,n),s=e.substring(n+1)),a=a.replace(/^0+/,""),s=s.replace(/0+$/,""),r(a.length<=16-t,"Fixed number string exceeds 2^53-1."),r(s.length<=t,"Too many decimal places in fixed number string."),0===a.length&&(a="0");s.length<t;)s+="0";0===s.length&&(s="0"),r(/^\d+$/.test(a)&&/^\d+$/.test(s),"Non-numeric characters in fixed number string."),a=parseInt(a,10),s=parseInt(s,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=d(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(a<o||a===o&&s<=n,"Fixed number string exceeds 2^53-1."),i*(a*e+s)},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:a}=i(91),s=r.UINT64_MAX.shrn(7),n=Number.MAX_SAFE_INTEGER,o=t;function p(e,t){return e<0&&(e=~e,0===t)&&(e+=1),0==(4292870144&e)}function d(e,t,i,r){let a=!1,s=(t<0&&(t=-t,a=!0),t*(1/4294967296)|0),n=0|t;return a&&(0===n?s=1+~s|0:(s=~s,n=1+~n)),r?(i=e.writeInt32BE(s,i,!0),e.writeInt32BE(n,i,!0)):(i=e.writeInt32LE(n,i,!0),e.writeInt32LE(s,i,!0))}function h(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 c(e,t,i){if(!e)throw new o.EncodingError(t,i,c)}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 c(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 c(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 c(p(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 c(p(i,e=e.readUInt32BE(t+4,!0)),"Number exceeds 2^53-1"),4294967296*i+e},o.writeU64=function(e,t,i){return d(e,t,i,!1)},o.writeU64BE=function(e,t,i){return d(e,t,i,!0)},o.writeI64=function(e,t,i){return d(e,t,i,!1)},o.writeI64BE=function(e,t,i){return d(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 a.readLE(e,t)},o.readI64BEN=function(e,t){return a.readBE(e,t)},o.writeU64N=function(e,t,i){return c(!t.sign,i,"Signed"),t.writeLE(e,i)},o.writeU64BEN=function(e,t,i){return c(!t.sign,i,"Signed"),t.writeBE(e,i)},o.writeI64N=function(e,t,i){return c(t.sign,i,"Not signed"),t.writeLE(e,i)},o.writeI64BEN=function(e,t,i){return c(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),c(4294967295<(i=o.readU64(e,t+1)),t,"Non-canonical varint");break;case 254:l(t+(r=5)<=e.length,t),c(65535<(i=e.readUInt32LE(t+1,!0)),t,"Non-canonical varint");break;case 253:l(t+(r=3)<=e.length,t),c(253<=(i=e[t+1]|e[t+2]<<8),t,"Non-canonical varint");break;default:r=1,i=e[t]}return new h(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 c(0!==i.hi,t,"Non-canonical varint"),new h(9,i)}let{size:i,value:a}=o.readVarint(e,t);return new h(i,r.fromInt(a))},o.writeVarintN=function(e,t,i){return c(!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 c(!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 a=e[t++];if(r++,c(i<=70368744177663-(127&a),t,"Number exceeds 2^53-1"),i=128*i+(127&a),0==(128&a))break;c(i!==n,t,"Number exceeds 2^53-1"),i++}return new h(r,i)},o.writeVarint2=function(e,t,i){var r=[];let a=0;for(;r[a]=127&t|(a?128:0),!(t<=127);)t=(t-t%128)/128-1,a++;for(l(i+a+1<=e.length,i);e[i++]=r[a],a--;);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 a=0;for(;;){l(t<e.length,t);var n=e[t++];if(a++,c(i.lte(s),t,"Number exceeds 2^64-1"),i.ishln(7).iorn(127&n),0==(128&n))break;c(!i.eq(r.UINT64_MAX),t,"Number exceeds 2^64-1"),i.iaddn(1)}return new h(a,i)},o.writeVarint2N=function(e,t,i){if(c(!t.sign,i,"Signed"),0===t.hi)return o.writeVarint2(e,t.toInt(),i);t=t.clone();var r=[];let a=0;for(;r[a]=t.andln(127)|(a?128:0),!t.lten(127);)t.ishrn(7).isubn(1),a++;for(c(i+a+1<=e.length,i,"Out of bounds write");e[i++]=r[a],a--;);return i},o.sizeVarint2N=function(e){if(c(!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),a=i(3),s=i(6),n=Buffer.alloc(0),o=null;function p(e){if(!(this instanceof p))return new p(e);this.data=e?Buffer.allocUnsafe(e):n,this.offset=0}p.pool=function(e){var t;return e<=102400?(o=o||Buffer.allocUnsafeSlow(102400),(t=new p(0)).data=o.slice(0,e),t):new p(e)},p.prototype.render=function(e=!0){var t=this.data;return e&&r(this.offset===t.length),this.destroy(),t},p.prototype.getSize=function(){return this.offset},p.prototype.seek=function(e){this.offset+=e},p.prototype.destroy=function(){this.data=n,this.offset=0},p.prototype.writeU8=function(e){this.offset=this.data.writeUInt8(e>>>=0,this.offset,!0)},p.prototype.writeU16=function(e){this.offset=this.data.writeUInt16LE(e>>>=0,this.offset,!0)},p.prototype.writeU16BE=function(e){this.offset=this.data.writeUInt16BE(e>>>=0,this.offset,!0)},p.prototype.writeU32=function(e){this.offset=this.data.writeUInt32LE(e>>>=0,this.offset,!0)},p.prototype.writeU32BE=function(e){this.offset=this.data.writeUInt32BE(e>>>=0,this.offset,!0)},p.prototype.writeU64=function(e){this.offset=a.writeU64(this.data,e,this.offset)},p.prototype.writeU64BE=function(e){this.offset=a.writeU64BE(this.data,e,this.offset)},p.prototype.writeU64N=function(e){this.offset=a.writeU64N(this.data,e,this.offset)},p.prototype.writeU64BEN=function(e){this.offset=a.writeU64BEN(this.data,e,this.offset)},p.prototype.writeI8=function(e){this.offset=this.data.writeInt8(e,this.offset,!0)},p.prototype.writeI16=function(e){this.offset=this.data.writeInt16LE(e,this.offset,!0)},p.prototype.writeI16BE=function(e){this.offset=this.data.writeInt16BE(e,this.offset,!0)},p.prototype.writeI32=function(e){this.offset=this.data.writeInt32LE(e,this.offset,!0)},p.prototype.writeI32BE=function(e){this.offset=this.data.writeInt32BE(e,this.offset,!0)},p.prototype.writeI64=function(e){this.offset=a.writeI64(this.data,e,this.offset)},p.prototype.writeI64BE=function(e){this.offset=a.writeI64BE(this.data,e,this.offset)},p.prototype.writeI64N=function(e){this.offset=a.writeI64N(this.data,e,this.offset)},p.prototype.writeI64BEN=function(e){this.offset=a.writeI64BEN(this.data,e,this.offset)},p.prototype.writeFloat=function(e){this.offset=this.data.writeFloatLE(e,this.offset,!0)},p.prototype.writeFloatBE=function(e){this.offset=this.data.writeFloatBE(e,this.offset,!0)},p.prototype.writeDouble=function(e){this.offset=this.data.writeDoubleLE(e,this.offset,!0)},p.prototype.writeDoubleBE=function(e){this.offset=this.data.writeDoubleBE(e,this.offset,!0)},p.prototype.writeVarint=function(e){this.offset=a.writeVarint(this.data,e,this.offset)},p.prototype.writeVarintN=function(e){this.offset=a.writeVarintN(this.data,e,this.offset)},p.prototype.writeVarint2=function(e){this.offset=a.writeVarint2(this.data,e,this.offset)},p.prototype.writeVarint2N=function(e){this.offset=a.writeVarint2N(this.data,e,this.offset)},p.prototype.writeBytes=function(e){0!==e.length&&(e.copy(this.data,this.offset),this.offset+=e.length)},p.prototype.writeVarBytes=function(e){this.writeVarint(e.length),this.writeBytes(e)},p.prototype.copy=function(e,t,i){var r=i-t;0!=r&&(e.copy(this.data,this.offset,t,i),this.offset+=r)},p.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)},p.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)},p.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)},p.prototype.writeNullString=function(e,t){this.writeString(e,t),this.writeU8(0)},p.prototype.writeChecksum=function(){var e=this.data.slice(0,this.offset);s.hash256(e).copy(this.data,this.offset,0,4),this.offset+=4},p.prototype.fill=function(e,t){r(0<=t),0!==t&&(this.data.fill(e,this.offset,this.offset+t),this.offset+=t)},e.exports=p},function(e,t,i){let r=i(2).revHex,a={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 s=Object.keys(a).reduce((e,t)=>(a[t]!=a.propCreate&&a[t]!=a.propExchange&&a[t]!=a.propFound&&a[t]!=a.htlcSuggest&&a[t]!=a.htlcAssent&&a[t]!=a.contractPromise&&(e[t]=a[t]),e),{});let n=i(318);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=a,t.ContractTypeExecutable=s,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 a=(e[i].length-2)/2;let s=a.toString(16);s.length%2!=0&&(s="0"+s),s=r(s),a<=75?t=t.replace(new RegExp("var_"+i,"g"),`0x${s} `+e[i]):a<=255?t=t.replace(new RegExp("var_"+i,"g"),`0x4c 0x${s} `+e[i]):a<=65535?t=t.replace(new RegExp("var_"+i,"g"),`0x4d 0x${s} `+e[i]):a<=4294967295&&(t=t.replace(new RegExp("var_"+i,"g"),`0x4e 0x${s} `+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),a=i(27);i=i(47).binding;let s=Buffer.allocUnsafe(64);t.hash=function(e,t){return a.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 a=s;return r(32===e.length),r(32===i.length),e.copy(a,0),i.copy(a,32),t.hash256(a)},t.hmac=function(e,t,i){return a.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),a=i(38),s=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,r){if(i.deployments&&i.deployments.fastblock){if((i=i.deployments.fastblock).force)return t.FASTBLOCK_HEARTBEAT;if(void 0!==r)return r===s.ACTIVE?t.FASTBLOCK_HEARTBEAT:t.VALLNET_HEARTBEAT;(r=Date.now()/1e3)<i.startTime||i.timeout}return t.VALLNET_HEARTBEAT},t.getBaseReward=function(e,i,r){return(t.getHeartbeat(e,i,r)/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 r=0;for(var a of e){var s=a.getDepth(i);s<1||a.getReturnType(106)||(r+=t.getRealValue(a.value,s))}return r},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 a(0);var t=e>>>24,i=e>>>23&1;let r,s=8388607&e;return t<=3?(s>>>=8*(3-t),r=new a(s)):(r=new a(s)).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 a(e,"le").gt(i)},t.getReward=function(e,i,a,s){return r(0<=e,"Bad height for reward."),i=Math.floor(e/i),e=t.getBaseReward(e,a,s),a=Math.floor(e/2),33<=i?0:0===i?e:a>>>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 r=i(0),a=i(10),s=i(3),n=i(2),o=i(6),p=i(1),d=i(4),h=i(57),l=i(198);class c{constructor(e){this.hash=s.ZERO_HASH160,this.type=c.types.PUBKEYHASH,this.version=-1,this.network=a.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 c).fromOptions(e)}getHash(e){return"hex"===e?this.hash.toString(e):this.hash}isNull(){if(20===this.hash.length)return this.hash.equals(s.ZERO_HASH160);if(32===this.hash.length)return this.hash.equals(s.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 c),this.network===e.network&&this.type===e.type&&this.version===e.version&&this.hash.equals(e.hash)}getType(){return c.typesByVal[this.type].toLowerCase()}getPrefix(e){e=e||this.network;var t=(e=a.get(e)).addressPrefix;switch(this.type){case c.types.PUBKEYHASH:return t.pubkeyhash;case c.types.SCRIPTHASH:return t.scripthash;case c.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 d(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 h.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=a.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 s=0;s<e.length;s++){var a=e.charCodeAt(s);if(!(48<=a&&a<=57)&&(32&a?(r(97<=a&&a<=122),t=!0):(r(65<=a&&a<=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 c).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(h.decode(e),t)}fromBech32(e,t){r("string"==typeof e);var i=c.types.WITNESS;e=l.decode(e);return t=a.fromBech32(e.hrp,t),this.fromHash(e.hash,i,e.version,t)}static fromBech32(e,t){return(new c).fromBech32(e,t)}static fromBase58(e,t){return(new c).fromBase58(e,t)}inspect(){return"<Address: type="+this.getType()+" version="+this.version+" str="+this.toString()+">"}fromRaw(e,t){var i=new p(e,!0);if(40<e.length)throw new Error("Address is too long.");var r=i.readU8();t=a.fromAddress(r,t),r=c.getType(r,t);let s=-1;if(25<e.length&&(s=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,s,t)}static fromRaw(e,t){return(new c).fromRaw(e,t)}fromScript(e){var t=e.getPubkey();return t?(this.hash=o.hash160(t),this.type=c.types.PUBKEYHASH,this.version=-1,this):(t=e.getPubkeyhash())?(this.hash=t,this.type=c.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthash())?(this.hash=t,this.type=c.types.SCRIPTHASH,this.version=-1,this):(t=e.getProgram())&&!t.isMalformed()?(this.hash=t.data,this.type=c.types.WITNESS,this.version=t.version,this):e.isMultisig()?(this.hash=e.hash160(),this.type=c.types.SCRIPTHASH,this.version=-1,this):null}static fromScript(e){return(new c).fromScript(e)}fromWitness(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=c.types.WITNESS,this.version=0,this):(t=e.getScripthashInput())?(this.hash=o.sha256(t),this.type=c.types.WITNESS,this.version=0,this):null}fromInputScript(e){var[,t]=e.getPubkeyhashInput();return t?(this.hash=o.hash160(t),this.type=c.types.PUBKEYHASH,this.version=-1,this):(t=e.getScripthashInput())?(this.hash=o.hash160(t),this.type=c.types.SCRIPTHASH,this.version=-1,this):null}static fromWitness(e){return(new c).fromWitness(e)}static fromInputScript(e){return(new c).fromInputScript(e)}fromHash(e,t,i,s){return"string"==typeof e&&(e=Buffer.from(e,"hex")),"string"==typeof t&&(t=c.types[t.toUpperCase()],r(null!=t,"Not a valid address type.")),null==t&&(t=c.types.PUBKEYHASH),null==i&&(i=-1),s=a.get(s),r(Buffer.isBuffer(e)),r(n.isU8(t)),r(n.isI8(i)),r(t>=c.types.PUBKEYHASH&&t<=c.types.WITNESS,"Not a valid address type."),-1===i?(r(t!==c.types.WITNESS,"Wrong version (witness)"),r(20===e.length,"Hash is the wrong size.")):(r(t===c.types.WITNESS,"Wrong version (non-witness)."),r(0<=i&&i<=16,"Bad program version."),0===i&&t===c.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=s,this}static fromHash(e,t,i,r){return(new c).fromHash(e,t,i,r)}fromPubkeyhash(e,t){var i=c.types.PUBKEYHASH;return r(20===e.length,"P2PKH must be 20 bytes."),this.fromHash(e,i,-1,t)}static fromPubkeyhash(e,t){return(new c).fromPubkeyhash(e,t)}fromScripthash(e,t){var i=c.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 c).fromScripthash(e,t)}fromWitnessPubkeyhash(e,t){var i=c.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 c).fromWitnessPubkeyhash(e,t)}fromWitnessScripthash(e,t){var i=c.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 c).fromWitnessScripthash(e,t)}fromProgram(e,t,i){var a=c.types.WITNESS;return r(0<=e,"Bad version for witness program."),"string"==typeof t&&(t=Buffer.from(t,"hex")),this.fromHash(t,a,e,i)}static fromProgram(e,t,i){return(new c).fromProgram(e,t,i)}isPubkeyhash(){return this.type===c.types.PUBKEYHASH}isScripthash(){return this.type===c.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 r;if("string"==typeof e){if(40===e.length||64===e.length)return"hex"===t?e:Buffer.from(e,"hex");r=c.fromString(e,i).hash}else if(Buffer.isBuffer(e)){if(20!==e.length&&32!==e.length)throw new Error("Object is not an address.");r=e}else{if(!(e instanceof c))throw new Error("Object is not an address.");if(r=e.hash,i&&(i=a.get(i),e.network!==i))throw new Error("Network mismatch for address.")}return"hex"===t?r.toString("hex"):r}static getType(e,t){switch(t=t.addressPrefix,e){case t.pubkeyhash:return c.types.PUBKEYHASH;case t.scripthash:return c.types.SCRIPTHASH;case t.witnesspubkeyhash:case t.witnessscripthash:return c.types.WITNESS;default:throw new Error("Unknown address prefix.")}}}c.types={PUBKEYHASH:2,SCRIPTHASH:3,WITNESS:4},c.typesByVal=n.reverse(c.types),e.exports=c},function(e,t,i){let r=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 r.Final}get oper(){return this.data&&this.data.oper||"unknown"}isPreVerify(){return!1}async checkFees(){return r.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 r=i(0),a=i(2),s=i(103),n=i(7),o=i(197);class p{constructor(e){r(!p[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 r=this.checkpointMap[i];i=Number(i);this.checkpoints.push({hash:r,height:i})}this.checkpoints.sort(h)}byBit(e){return-1===(e=a.binarySearch(this.deploys,e,d))?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=s[e]),r(e,"Unknown network."),p[e.type]||(e=new p(e),p[e.type]=e,p.primary||(p.primary=e),e)}static set(e){return r("string"==typeof e,"Bad network."),p.primary=p.get(e),p.type=e,p.primary}static get(e){if(!e)return r(p.primary,"No default network."),p.primary;if(e instanceof p)return e;if("string"==typeof e)return p.create(e);throw new Error("Unknown network.")}static ensure(e){if(e){if(e instanceof p)return e;if("string"==typeof e&&s[e])return p.create(e)}return r(p.primary,"No default network."),p.primary}static by(e,t,i,r){if(i){if(t(i=p.get(i),e))return i;throw new Error(`Network mismatch for ${r}.`)}for(var a of s.types)if(t(i=s[a],e))return p.get(a);throw new Error(`Network not found for ${r}.`)}static fromMagic(e,t){return p.by(e,l,t,"magic number")}static fromWIF(e,t){return p.by(e,c,t,"WIF")}static fromPublic(e,t){return p.by(e,u,t,"xpubkey")}static fromPrivate(e,t){return p.by(e,f,t,"xprivkey")}static fromPublic58(e,t){return p.by(e,m,t,"xpubkey")}static fromPrivate58(e,t){return p.by(e,g,t,"xprivkey")}static fromAddress(e,t){return p.by(e,w,t,"base58 address")}static fromBech32(e,t){return p.by(e,v,t,"bech32 address")}static isNetwork(e){return e instanceof p}}function d(e,t){return e.bit-t}function h(e,t){return e.height-t.height}function l(e,t){return e.magic===t}function c(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 w(e,t){switch(e=e.addressPrefix,t){case e.pubkeyhash:case e.scripthash:case e.witnesspubkeyhash:case e.witnessscripthash:return!0}return!1}function v(e,t){return e.addressPrefix.bech32===t}p.primary=null,p.type=null,p.main=null,p.testnet=null,p.regtest=null,p.simnet=null,p.set("testnet"),e.exports=p},function(e,t,i){ /*! * script.js - script interpreter for vallnet * Copyright (c) 2019-2022, Bookman Software (MIT License). */ let r=Buffer.alloc(0),a=i(0),s=i(199),n=i(140),o=i(106),p=i(92),d=i(85),h=i(14),l=h.opcodes,c=h.types,u=h.outputLockType,f=i(7),m=i(20),g=i(6),w=i(120),v=i(18),y=i(3),b=i(247),x=i(2),S=i(17),_=i(1),E=i(4),k=i(8),{ContractType:R,ContractStatus:A}=i(5),I=i(141),C={199:{len:11,list:[6,8]},197:{len:22,list:[9,18]},198:{len:19,list:[6,15]}},O=2;class N{constructor(e){this.raw=r,this.code=[],this.indicator=b.inst(0),e&&this.fromOptions(e)}createScript(e,t=c.PUBKEYHASH){switch(this.clear(),t){case c.PUBKEY:this.$fromPubkey(e);break;case c.PUBKEYHASH:this.$fromPubkeyhash(e);break;case c.PROPEXTEND:this.$fromPkhExtend(e);break;case c.MULTISIG:var[i,r,a]=e;this.$fromMultisig(i,r,a);break;case c.SCRIPTHASH:this.$fromScripthash(e);break;case c.NULLDATA:this.$fromNulldata(e);break;case c.WITNESS:var[i,r,a]=e;this.$fromProgram(i,r,a)}return 0<this.code.length&&this.compile(),this}static createScript(e,t=c.PUBKEYHASH){return(new N).createScript(e,t)}$fromNulldata(e){a(Buffer.isBuffer(e)),a(e.length<=m.MAX_OP_RETURN,"Nulldata too large."),this.pushOp(l.OP_RETURN),this.pushData(e)}$fromPubkey(e){a(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){a(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){a(Buffer.isBuffer(e.info)&&e.info.length<=m.MAX_OP_INFO),a(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 r of(a(x.isU8(e)&&x.isU8(t)),a(Array.isArray(i)),a(i.length===t,"`n` keys are required for multisig."),a(1<=e&&e<=t),a(1<=t&&t<=15),this.clear(),this.pushSmall(e),i.slice().sort((e,t)=>e.compare(t))))this.pushData(r);this.pushSmall(t),this.pushOp(l.OP_CHECKMULTISIG)}$fromScripthash(e){a(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 r;a(x.isU8(e)&&0<=e&&e<=16),a(Buffer.isBuffer(t)&&2<=t.length&&t.length<=40),i&&(r=Buffer.from(JSON.stringify(i)),a(Buffer.isBuffer(r)&&r.length<=m.MAX_OP_INFO),h.OperCodeFromType[i.oper])&&(this.code.push(n.fromOp(h.OperCodeFromType[i.oper])),this.code.push(n.fromPush(