@burstjs/contracts
Advanced tools
Comparing version 0.5.0-alpha.1 to 0.5.0-alpha.2
@@ -1,2 +0,2 @@ | ||
var b$contracts=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return e(t={exports:{}},t.exports),t.exports}var i=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertNumberToNQTString=(e=>{if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")})});r(i);i.convertNumberToNQTString;var o=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertNQTStringToNumber=(e=>{if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8})});r(o);o.convertNQTStringToNumber;var u=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.GenesisBlockTime=Date.UTC(2014,7,11,2,0,0,0)/1e3,t.initialCodeword=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t.gexp=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],t.glog=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],t.cwmap=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],t.alphabet="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),t.base32Length=13,t.ginv=(e=>t.gexp[31-t.glog[e]]),t.gmult=((e,r)=>{if(0===e||0===r)return 0;const n=(t.glog[e]+t.glog[r])%31;return t.gexp[n]})});r(u);u.GenesisBlockTime,u.initialCodeword,u.gexp,u.glog,u.cwmap,u.alphabet,u.base32Length,u.ginv,u.gmult;var l=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertNumericIdToAddress=(e=>{if(null==e||0===e.trim().length)return;const t=[],r=u.initialCodeword.slice();let n=0,i=e.length;for(let r=0;r<i;r++)t[r]=e.charCodeAt(r)-"0".charCodeAt(0);let o=0,l=0;do{o=0,l=0;for(let e=0;e<i;e++)(o=10*o+t[e])>=32?(t[l]=o>>5,o&=31,l++):l>0&&(t[l]=0,l++);i=l,r[n]=o,n++}while(i>0);const a=[0,0,0,0];for(let e=u.base32Length-1;e>=0;e--){const t=r[e]^a[3];a[3]=a[2]^u.gmult(30,t),a[2]=a[1]^u.gmult(6,t),a[1]=a[0]^u.gmult(9,t),a[0]=u.gmult(17,t)}r[13]=a[0],r[14]=a[1],r[15]=a[2],r[16]=a[3];let c="BURST-";for(let e=0;e<17;e++)c+=u.alphabet[r[u.cwmap[e]]],3==(3&e)&&e<13&&(c+="-");return c})});r(l);l.convertNumericIdToAddress;var a=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertBurstTimeToEpochTime=(e=>1e3*(u.GenesisBlockTime+e))});r(a);a.convertBurstTimeToEpochTime;var c=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertBurstTimeToDate=(e=>new Date(a.convertBurstTimeToEpochTime(e)))});r(c);c.convertBurstTimeToDate;var s=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertDateToBurstTime=(e=>Math.round(e.getTime()/1e3)-u.GenesisBlockTime)});r(s);s.convertDateToBurstTime;var f=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isValid=(e=>{0===e.indexOf("BURST-")&&(e=e.substr(6));const t=u.initialCodeword.slice();let r=0;for(let n=0;n<e.length;n++){const i=u.alphabet.indexOf(e.charAt(n));if(!(i<=-1||i>u.alphabet.length)){if(r>16)return!1;t[u.cwmap[r]]=i,r++}}if(17!==r)return!1;let n=0;for(let e=1;e<5;e++){let r=0;for(let n=0;n<31;n++){if(n>12&&n<27)continue;let i=n;n>26&&(i-=14),r^=u.gmult(t[i],u.gexp[e*n%31])}n|=r}return 0===n}),t.isBurstAddress=(e=>/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(e)&&t.isValid(e))});r(f);f.isValid,f.isBurstAddress;var h=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertAddressToNumericId=(e=>{if(null==e||0===e.trim().length)return;if(0!==e.indexOf("BURST-"))return;e=e.substr(6);const t=u.initialCodeword.slice();let r=0;for(let n=0;n<e.length;n++){const i=u.alphabet.indexOf(e.charAt(n));if(!(i<=-1||i>u.alphabet.length)){if(r>16)return;t[u.cwmap[r]]=i,r++}}if(!f.isValid(e))return;let n=u.base32Length;const i=[];for(let e=0;e<n;e++)i[e]=t[n-e-1];let o,l="",a=0;do{o=0,a=0;for(let e=0;e<n;e++)(a=32*a+i[e])>=10?(i[o]=Math.floor(a/10),a%=10,o+=1):o>0&&(i[o]=0,o+=1);n=o,l+=a}while(n>0);return l.split("").reverse().join("")})});r(h);h.convertAddressToNumericId;var g=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.sumNQTStringToNumber=function(...e){return e.reduce((e,t)=>e+o.convertNQTStringToNumber(t),0)}});r(g);g.sumNQTStringToNumber;var p=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertByteArrayToString=((e,t=0,r=null)=>{if(0===r)return"";let n=e;if(0!==t){const i=null===r?e.length-t:r;!function(e,t,r=0){if(r<0)throw new Error("Start index should not be negative");if(e.length<r+t)throw new Error("Need at least "+t+" bytes to convert to an integer")}(n,i,t),n=e.slice(t,t+i)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))})});r(p);p.convertByteArrayToString;var d=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertByteArrayToHexString=((e,t=!1)=>{const r=[];for(let t=0;t<e.length;t++)r.push((e[t]>>>4).toString(16)),r.push((15&e[t]).toString(16));return t?r.join("").toUpperCase():r.join("")})});r(d);d.convertByteArrayToHexString;var v=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertHexStringToByteArray=(e=>{if(e.length%2)throw new Error(`Invalid Hex String: ${e}`);const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){const n=parseInt(e.substr(r,2),16);if(Number.isNaN(n))throw new Error(`Invalid Hex String: ${e}`);t[r/2]=n}return t})});r(v);v.convertHexStringToByteArray;var w=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertHexStringToDecString=(e=>{const t=[0];let r,n,i;for(r=0;r<e.length;r+=1){for(i=parseInt(e.charAt(r),16),n=0;n<t.length;n+=1)t[n]=16*t[n]+i,i=t[n]/10|0,t[n]%=10;for(;i>0;)t.push(i%10),i=i/10|0}return t.reverse().join("")})});r(w);w.convertHexStringToDecString;var m=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertHexStringToString=(e=>p.convertByteArrayToString(v.convertHexStringToByteArray(e)))});r(m);m.convertHexStringToString;var y=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStringToByteArray=(e=>{const t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);for(let e=0;e<t.length;++e)r[e]=t.charCodeAt(e);return r})});r(y);y.convertStringToByteArray;var b=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertStringToHexString=(e=>d.convertByteArrayToHexString(y.convertStringToByteArray(e)))});r(b);b.convertStringToHexString;var A=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertHexEndianess=(e=>{let t="";const r=e;for(let e=r.length-1;e>=0;e-=2)t+=r[e-1]+r[e];return t})});r(A);A.convertHexEndianess;var S=n(function(e,t){function r(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),r(i),r(o),r(l),r(a),r(c),r(s),r(h),r(f),r(g),r(p),r(d),r(v),r(w),r(m),r(y),r(b),r(A)});r(S);S.convertNumberToNQTString,S.convertNQTStringToNumber;var T=S.convertHexStringToDecString,N=S.convertHexStringToString,O=S.convertHexEndianess,E=S.convertHexStringToByteArray,_=S.convertByteArrayToHexString;function B(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,n=16*t,i=n+r;if(i>e.machineData.length)throw new Error("Insufficient length for variable at position: ".concat(n," (and given length: ").concat(r,")"));if(i%2!=0)throw new Error("Invalid position: ".concat(n," (or given length: ").concat(r,") - must be at least multiple of 2"));return O(e.machineData.substr(n,r))}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function P(e,t,r){return t&&I(e.prototype,t),r&&I(e,r),e}function D(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var M=function(){function e(t){x(this,e),this._contract=t}return P(e,[{key:"getContract",value:function(){return this._contract}},{key:"getVariableAsString",value:function(t){var r=this.getHexDataAt(t,e.VARIABLE_LENGTH);return N(r.replace(/00/g,""))}},{key:"getDataBlocksAsString",value:function(t,r){var n=this.getHexDataAt(t,r*e.VARIABLE_LENGTH);return N(n.replace(/00/g,""))}},{key:"getVariableAsDecimal",value:function(e){return T(this.getVariable(e))}},{key:"getVariable",value:function(t){return this.getHexDataAt(t,e.VARIABLE_LENGTH)}},{key:"getHexDataAt",value:function(t,r){var n=r||this._contract.machineData.length-e.VARIABLE_LENGTH*t;return B(this._contract,t,n)}}]),e}();M.VARIABLE_LENGTH=16;var U=n(function(e){!function(t){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",a=1e14,c=14,s=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,g=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function d(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=c-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(e,t){var r,n,i=e.c,o=t.c,u=e.s,l=t.s,a=e.e,c=t.e;if(!u||!l)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-l:u;if(u!=l)return u;if(r=u<0,n=a==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return a>c^r?1:-1;for(l=(a=i.length)<(c=o.length)?a:c,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^r?1:-1;return a==c?0:a>c^r?1:-1}function w(e,t,r,n){if(e<t||e>r||e!==o(e))throw Error(u+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function m(e){var t=e.c.length-1;return p(e.e/c)==t&&e.c[t]%2!=0}function y(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function b(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(r=function e(t){var r,A,S,T,N,O,E,_,B,x=V.prototype={constructor:V,toString:null,valueOf:null},I=new V(1),P=20,D=4,M=-7,U=21,C=-1e7,L=1e7,j=!1,H=1,R=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz";function V(e,t){var r,i,u,a,f,h,g,p,d=this;if(!(d instanceof V))return new V(e,t);if(null==t){if(e&&!0===e._isBigNumber)return d.s=e.s,void(!e.c||e.e>L?d.c=d.e=null:e.e<C?d.c=[d.e=0]:(d.e=e.e,d.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(d.s=1/e<0?(e=-e,-1):1,e===~~e){for(a=0,f=e;f>=10;f/=10,a++);return void(a>L?d.c=d.e=null:(d.e=a,d.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return S(d,p,h);d.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(a=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(a<0&&(a=f),a+=+p.slice(f+1),p=p.substring(0,f)):a<0&&(a=p.length)}else{if(w(t,2,G.length,"Base"),10==t)return Q(d=new V(e),P+d.e+1,D);if(p=String(e),h="number"==typeof e){if(0*e!=0)return S(d,p,h,t);if(d.s=1/e<0?(p=p.slice(1),-1):1,V.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else d.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=G.slice(0,t),a=f=0,g=p.length;f<g;f++)if(r.indexOf(i=p.charAt(f))<0){if("."==i){if(f>a){a=g;continue}}else if(!u&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){u=!0,f=-1,a=0;continue}return S(d,String(e),h,t)}h=!1,(a=(p=A(p,t,10,d.s)).indexOf("."))>-1?p=p.replace(".",""):a=p.length}for(f=0;48===p.charCodeAt(f);f++);for(g=p.length;48===p.charCodeAt(--g););if(p=p.slice(f,++g)){if(g-=f,h&&V.DEBUG&&g>15&&(e>s||e!==o(e)))throw Error(l+d.s*e);if((a=a-f-1)>L)d.c=d.e=null;else if(a<C)d.c=[d.e=0];else{if(d.e=a,d.c=[],f=(a+1)%c,a<0&&(f+=c),f<g){for(f&&d.c.push(+p.slice(0,f)),g-=c;f<g;)d.c.push(+p.slice(f,f+=c));f=c-(p=p.slice(f)).length}else f-=g;for(;f--;p+="0");d.c.push(+p)}}else d.c=[d.e=0]}function F(e,t,r,n){var i,o,u,l,a;if(null==r?r=D:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==t)a=d(e.c),a=1==n||2==n&&(u<=M||u>=U)?y(a,u):b(a,u,"0");else if(o=(e=Q(new V(e),t,r)).e,l=(a=d(e.c)).length,1==n||2==n&&(t<=o||o<=M)){for(;l<t;a+="0",l++);a=y(a,o)}else if(t-=u,a=b(a,o,"0"),o+1>l){if(--t>0)for(a+=".";t--;a+="0");}else if((t+=o-l)>0)for(o+1==l&&(a+=".");t--;a+="0");return e.s<0&&i?"-"+a:a}function $(e,t){for(var r,n=1,i=new V(e[0]);n<e.length;n++){if(!(r=new V(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function q(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*c-1)>L?e.c=e.e=null:r<C?e.c=[e.e=0]:(e.e=r,e.c=t),e}function Q(e,t,r,n){var u,l,s,h,g,p,d,v=e.c,w=f;if(v){e:{for(u=1,h=v[0];h>=10;h/=10,u++);if((l=t-u)<0)l+=c,s=t,d=(g=v[p=0])/w[u-s-1]%10|0;else if((p=i((l+1)/c))>=v.length){if(!n)break e;for(;v.length<=p;v.push(0));g=d=0,u=1,s=(l%=c)-c+1}else{for(g=h=v[p],u=1;h>=10;h/=10,u++);d=(s=(l%=c)-c+u)<0?0:g/w[u-s-1]%10|0}if(n=n||t<0||null!=v[p+1]||(s<0?g:g%w[u-s-1]),n=r<4?(d||n)&&(0==r||r==(e.s<0?3:2)):d>5||5==d&&(4==r||n||6==r&&(l>0?s>0?g/w[u-s]:0:v[p-1])%10&1||r==(e.s<0?8:7)),t<1||!v[0])return v.length=0,n?(t-=e.e+1,v[0]=w[(c-t%c)%c],e.e=-t||0):v[0]=e.e=0,e;if(0==l?(v.length=p,h=1,p--):(v.length=p+1,h=w[c-l],v[p]=s>0?o(g/w[u-s]%w[s])*h:0),n)for(;;){if(0==p){for(l=1,s=v[0];s>=10;s/=10,l++);for(s=v[0]+=h,h=1;s>=10;s/=10,h++);l!=h&&(e.e++,v[0]==a&&(v[0]=1));break}if(v[p]+=h,v[p]!=a)break;v[p--]=0,h=1}for(l=v.length;0===v[--l];v.pop());}e.e>L?e.c=e.e=null:e.e<C&&(e.c=[e.e=0])}return e}function z(e){var t,r=e.e;return null===r?e.toString():(t=d(e.c),t=r<=M||r>=U?y(t,r):b(t,r,"0"),e.s<0?"-"+t:t)}return V.clone=e,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(r=e[t],0,g,t),P=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),D=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-g,0,t),w(r[1],0,g,t),M=r[0],U=r[1]):(w(r,-g,g,t),M=-(U=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)w(r[0],-g,-1,t),w(r[1],1,g,t),C=r[0],L=r[1];else{if(w(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);C=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw j=!r,Error(u+"crypto unavailable");j=r}else j=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),H=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,g,t),R=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);k=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);G=r}}return{DECIMAL_PLACES:P,ROUNDING_MODE:D,EXPONENTIAL_AT:[M,U],RANGE:[C,L],CRYPTO:j,MODULO_MODE:H,POW_PRECISION:R,FORMAT:k,ALPHABET:G}},V.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!V.DEBUG)return!0;var t,r,n=e.c,i=e.e,l=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===l||-1===l)&&i>=-g&&i<=g&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%c)<1&&(t+=c),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=a||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===l||1===l||-1===l))return!0;throw Error(u+"Invalid BigNumber: "+e)},V.maximum=V.max=function(){return $(arguments,x.lt)},V.minimum=V.min=function(){return $(arguments,x.gt)},V.random=(T=9007199254740992*Math.random()&2097151?function(){return o(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,l,a,s=0,h=[],p=new V(I);if(null==e?e=P:w(e,0,g),l=i(e/c),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(l*=2));s<l;)(a=131072*t[s]+(t[s+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(h.push(a%1e14),s+=2);s=l/2}else{if(!crypto.randomBytes)throw j=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(l*=7);s<l;)(a=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])>=9e15?crypto.randomBytes(7).copy(t,s):(h.push(a%1e14),s+=7);s=l/7}if(!j)for(;s<l;)(a=T())<9e15&&(h[s++]=a%1e14);for(l=h[--s],e%=c,l&&e&&(a=f[c-e],h[s]=o(l/a)*a);0===h[s];h.pop(),s--);if(s<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=c);for(s=1,a=h[0];a>=10;a/=10,s++);s<c&&(n-=c-s)}return p.e=n,p.c=h,p}),V.sum=function(){for(var e=1,t=arguments,r=new V(t[0]);e<t.length;)r=r.plus(t[e++]);return r},A=function(){function e(e,t,r,n){for(var i,o,u=[0],l=0,a=e.length;l<a;){for(o=u.length;o--;u[o]*=t);for(u[0]+=n.indexOf(e.charAt(l++)),i=0;i<u.length;i++)u[i]>r-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/r|0,u[i]%=r)}return u.reverse()}return function(t,n,i,o,u){var l,a,c,s,f,h,g,p,v=t.indexOf("."),w=P,m=D;for(v>=0&&(s=R,R=0,t=t.replace(".",""),h=(p=new V(n)).pow(t.length-v),R=s,p.c=e(b(d(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),c=s=(g=e(t,n,i,u?(l=G,"0123456789"):(l="0123456789",G))).length;0==g[--s];g.pop());if(!g[0])return l.charAt(0);if(v<0?--c:(h.c=g,h.e=c,h.s=o,g=(h=r(h,p,w,m,i)).c,f=h.r,c=h.e),v=g[a=c+w+1],s=i/2,f=f||a<0||null!=g[a+1],f=m<4?(null!=v||f)&&(0==m||m==(h.s<0?3:2)):v>s||v==s&&(4==m||f||6==m&&1&g[a-1]||m==(h.s<0?8:7)),a<1||!g[0])t=f?b(l.charAt(1),-w,l.charAt(0)):l.charAt(0);else{if(g.length=a,f)for(--i;++g[--a]>i;)g[a]=0,a||(++c,g=[1].concat(g));for(s=g.length;!g[--s];);for(v=0,t="";v<=s;t+=l.charAt(g[v++]));t=b(t,c,l.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,o,u,l=0,a=e.length,c=t%h,s=t/h|0;for(e=e.slice();a--;)l=((i=c*(o=e[a]%h)+(n=s*o+(u=e[a]/h|0)*c)%h*h+l)/r|0)+(n/h|0)+s*u,e[a]=i%r;return l&&(e=[l].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,u,l,s){var f,h,g,d,v,w,m,y,b,A,S,T,N,O,E,_,B,x=n.s==i.s?1:-1,I=n.c,P=i.c;if(!(I&&I[0]&&P&&P[0]))return new V(n.s&&i.s&&(I?!P||I[0]!=P[0]:P)?I&&0==I[0]||!P?0*x:x/0:NaN);for(b=(y=new V(x)).c=[],x=u+(h=n.e-i.e)+1,s||(s=a,h=p(n.e/c)-p(i.e/c),x=x/c|0),g=0;P[g]==(I[g]||0);g++);if(P[g]>(I[g]||0)&&h--,x<0)b.push(1),d=!0;else{for(O=I.length,_=P.length,g=0,x+=2,(v=o(s/(P[0]+1)))>1&&(P=e(P,v,s),I=e(I,v,s),_=P.length,O=I.length),N=_,S=(A=I.slice(0,_)).length;S<_;A[S++]=0);B=P.slice(),B=[0].concat(B),E=P[0],P[1]>=s/2&&E++;do{if(v=0,(f=t(P,A,_,S))<0){if(T=A[0],_!=S&&(T=T*s+(A[1]||0)),(v=o(T/E))>1)for(v>=s&&(v=s-1),m=(w=e(P,v,s)).length,S=A.length;1==t(w,A,m,S);)v--,r(w,_<m?B:P,m,s),m=w.length,f=1;else 0==v&&(f=v=1),m=(w=P.slice()).length;if(m<S&&(w=[0].concat(w)),r(A,w,S,s),S=A.length,-1==f)for(;t(P,A,_,S)<1;)v++,r(A,_<S?B:P,S,s),S=A.length}else 0===f&&(v++,A=[0]);b[g++]=v,A[0]?A[S++]=I[N]||0:(A=[I[N]],S=1)}while((N++<O||null!=A[0])&&x--);d=null!=A[0],b[0]||b.splice(0,1)}if(s==a){for(g=1,x=b[0];x>=10;x/=10,g++);Q(y,u+(y.e=g+h*c-1)+1,l,d)}else y.e=h,y.r=+d;return y}}(),N=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,E=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,S=function(e,t,r,n){var i,o=r?t:t.replace(B,"");if(_.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(N,function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t}),n&&(i=n,o=o.replace(O,"$1").replace(E,"0.$1")),t!=o))return new V(o,i);if(V.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},x.absoluteValue=x.abs=function(){var e=new V(this);return e.s<0&&(e.s=1),e},x.comparedTo=function(e,t){return v(this,new V(e,t))},x.decimalPlaces=x.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=D:w(t,0,8),Q(new V(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-p(this.e/c))*c,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},x.dividedBy=x.div=function(e,t){return r(this,new V(e,t),P,D)},x.dividedToIntegerBy=x.idiv=function(e,t){return r(this,new V(e,t),0,1)},x.exponentiatedBy=x.pow=function(e,t){var r,n,l,a,s,f,h,g,p=this;if((e=new V(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+z(e));if(null!=t&&(t=new V(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return g=new V(Math.pow(+z(p),s?2-m(e):+z(e))),t?g.mod(t):g;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new V(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return a=p.s<0&&m(e)?-0:0,p.e>-1&&(a=1/a),new V(f?1/a:a);R&&(a=i(R/c+2))}for(s?(r=new V(.5),f&&(e.s=1),h=m(e)):h=(l=Math.abs(+z(e)))%2,g=new V(I);;){if(h){if(!(g=g.times(p)).c)break;a?g.c.length>a&&(g.c.length=a):n&&(g=g.mod(t))}if(l){if(0===(l=o(l/2)))break;h=l%2}else if(Q(e=e.times(r),e.e+1,1),e.e>14)h=m(e);else{if(0==(l=+z(e)))break;h=l%2}p=p.times(p),a?p.c&&p.c.length>a&&(p.c.length=a):n&&(p=p.mod(t))}return n?g:(f&&(g=I.div(g)),t?g.mod(t):a?Q(g,R,D,void 0):g)},x.integerValue=function(e){var t=new V(this);return null==e?e=D:w(e,0,8),Q(t,t.e+1,e)},x.isEqualTo=x.eq=function(e,t){return 0===v(this,new V(e,t))},x.isFinite=function(){return!!this.c},x.isGreaterThan=x.gt=function(e,t){return v(this,new V(e,t))>0},x.isGreaterThanOrEqualTo=x.gte=function(e,t){return 1===(t=v(this,new V(e,t)))||0===t},x.isInteger=function(){return!!this.c&&p(this.e/c)>this.c.length-2},x.isLessThan=x.lt=function(e,t){return v(this,new V(e,t))<0},x.isLessThanOrEqualTo=x.lte=function(e,t){return-1===(t=v(this,new V(e,t)))||0===t},x.isNaN=function(){return!this.s},x.isNegative=function(){return this.s<0},x.isPositive=function(){return this.s>0},x.isZero=function(){return!!this.c&&0==this.c[0]},x.minus=function(e,t){var r,n,i,o,u=this,l=u.s;if(t=(e=new V(e,t)).s,!l||!t)return new V(NaN);if(l!=t)return e.s=-t,u.plus(e);var s=u.e/c,f=e.e/c,h=u.c,g=e.c;if(!s||!f){if(!h||!g)return h?(e.s=-t,e):new V(g?u:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-t,e):new V(h[0]?u:3==D?-0:0)}if(s=p(s),f=p(f),h=h.slice(),l=s-f){for((o=l<0)?(l=-l,i=h):(f=s,i=g),i.reverse(),t=l;t--;i.push(0));i.reverse()}else for(n=(o=(l=h.length)<(t=g.length))?l:t,l=t=0;t<n;t++)if(h[t]!=g[t]){o=h[t]<g[t];break}if(o&&(i=h,h=g,g=i,e.s=-e.s),(t=(n=g.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=a-1;n>l;){if(h[--n]<g[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=a}h[n]-=g[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?q(e,h,f):(e.s=3==D?-1:1,e.c=[e.e=0],e)},x.modulo=x.mod=function(e,t){var n,i,o=this;return e=new V(e,t),!o.c||!e.s||e.c&&!e.c[0]?new V(NaN):!e.c||o.c&&!o.c[0]?new V(o):(9==H?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,H),(e=o.minus(n.times(e))).c[0]||1!=H||(e.s=o.s),e)},x.multipliedBy=x.times=function(e,t){var r,n,i,o,u,l,s,f,g,d,v,w,m,y,b,A=this,S=A.c,T=(e=new V(e,t)).c;if(!(S&&T&&S[0]&&T[0]))return!A.s||!e.s||S&&!S[0]&&!T||T&&!T[0]&&!S?e.c=e.e=e.s=null:(e.s*=A.s,S&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(A.e/c)+p(e.e/c),e.s*=A.s,(s=S.length)<(d=T.length)&&(m=S,S=T,T=m,i=s,s=d,d=i),i=s+d,m=[];i--;m.push(0));for(y=a,b=h,i=d;--i>=0;){for(r=0,v=T[i]%b,w=T[i]/b|0,o=i+(u=s);o>i;)r=((f=v*(f=S[--u]%b)+(l=w*f+(g=S[u]/b|0)*v)%b*b+m[o]+r)/y|0)+(l/b|0)+w*g,m[o--]=f%y;m[o]=r}return r?++n:m.splice(0,1),q(e,m,n)},x.negated=function(){var e=new V(this);return e.s=-e.s||null,e},x.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new V(e,t)).s,!i||!t)return new V(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/c,u=e.e/c,l=n.c,s=e.c;if(!o||!u){if(!l||!s)return new V(i/0);if(!l[0]||!s[0])return s[0]?e:new V(l[0]?n:0*i)}if(o=p(o),u=p(u),l=l.slice(),i=o-u){for(i>0?(u=o,r=s):(i=-i,r=l),r.reverse();i--;r.push(0));r.reverse()}for((i=l.length)-(t=s.length)<0&&(r=s,s=l,l=r,t=i),i=0;t;)i=(l[--t]=l[t]+s[t]+i)/a|0,l[t]=a===l[t]?0:l[t]%a;return i&&(l=[i].concat(l),++u),q(e,l,u)},x.precision=x.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=D:w(t,0,8),Q(new V(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*c+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},x.shiftedBy=function(e){return w(e,-s,s),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,u=this,l=u.c,a=u.s,c=u.e,s=P+4,f=new V("0.5");if(1!==a||!l||!l[0])return new V(!a||a<0&&(!l||l[0])?NaN:l?u:1/0);if(0==(a=Math.sqrt(+z(u)))||a==1/0?(((t=d(l)).length+c)%2==0&&(t+="0"),a=Math.sqrt(+t),c=p((c+1)/2)-(c<0||c%2),n=new V(t=a==1/0?"1e"+c:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new V(a+""),n.c[0])for((a=(c=n.e)+s)<3&&(a=0);;)if(o=n,n=f.times(o.plus(r(u,o,s,1))),d(o.c).slice(0,a)===(t=d(n.c)).slice(0,a)){if(n.e<c&&--a,"9999"!=(t=t.slice(a-3,a+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Q(n,n.e+P+2,1),e=!n.times(n).eq(u));break}if(!i&&(Q(o,o.e+P+2,0),o.times(o).eq(u))){n=o;break}s+=4,a+=4,i=1}return Q(n,n.e+P+1,D,e)},x.toExponential=function(e,t){return null!=e&&(w(e,0,g),e++),F(this,e,t,1)},x.toFixed=function(e,t){return null!=e&&(w(e,0,g),e=e+this.e+1),F(this,e,t)},x.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=k;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,l=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,s=r.groupSeparator||"",f=l[0],h=l[1],g=i.s<0,p=g?f.slice(1):f,d=p.length;if(c&&(o=a,a=c,c=o,d-=o),a>0&&d>0){for(o=d%a||a,f=p.substr(0,o);o<d;o+=a)f+=s+p.substr(o,a);c>0&&(f+=s+p.slice(o)),g&&(f="-"+f)}n=h?f+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):f}return(r.prefix||"")+n+(r.suffix||"")},x.toFraction=function(e){var t,n,i,o,l,a,s,h,g,p,v,w,m=this,y=m.c;if(null!=e&&(!(s=new V(e)).isInteger()&&(s.c||1!==s.s)||s.lt(I)))throw Error(u+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+z(s));if(!y)return new V(m);for(t=new V(I),g=n=new V(I),i=h=new V(I),w=d(y),l=t.e=w.length-m.e-1,t.c[0]=f[(a=l%c)<0?c+a:a],e=!e||s.comparedTo(t)>0?l>0?t:g:s,a=L,L=1/0,s=new V(w),h.c[0]=0;p=r(s,t,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,g=h.plus(p.times(o=g)),h=o,t=s.minus(p.times(o=t)),s=o;return o=r(e.minus(n),i,0,1),h=h.plus(o.times(g)),n=n.plus(o.times(i)),h.s=g.s=m.s,v=r(g,i,l*=2,D).minus(m).abs().comparedTo(r(h,n,l,D).minus(m).abs())<1?[g,i]:[h,n],L=a,v},x.toNumber=function(){return+z(this)},x.toPrecision=function(e,t){return null!=e&&w(e,1,g),F(this,e,t,2)},x.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=M||i>=U?y(d(r.c),i):b(d(r.c),i,"0"):10===e?t=b(d((r=Q(new V(r),P+i+1,D)).c),r.e,"0"):(w(e,2,G.length,"Base"),t=A(b(d(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},x.valueOf=x.toJSON=function(){return z(this)},x._isBigNumber=!0,null!=t&&V.set(t),V}()).default=r.BigNumber=r,e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=r)}(t)});String.prototype.padStart||(String.prototype.padStart=function(e,t){return e>>=0,t=String(void 0!==t?t:" "),this.length>=e?String(this):((e-=this.length)>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+String(this))});var C=new U("18446744073709551615");function L(e,t,r){if(!(t<=e&&e<=r))throw Error("Out of range (".concat(t,", ").concat(r,"): ").concat(e))}var j=function(){function e(t,r){x(this,e),this.littleEndian=r,this.offset=0,this.view=new DataView(new ArrayBuffer(t))}return P(e,[{key:"putByte",value:function(e){L(e,-128,255),this.view.setInt8(this.offset,e),this.offset+=1}},{key:"putShort",value:function(e){L(e,-Math.pow(2,15)-1,Math.pow(2,16)-1),this.view.setInt16(this.offset,e,this.littleEndian),this.offset+=2}},{key:"putUInt32",value:function(e){L(e,0,Math.pow(2,32)-1),this.view.setUint32(this.offset,e,this.littleEndian),this.offset+=4}},{key:"putUInt64",value:function(e){var t=e instanceof U?e:new U(e);if(t.lt(0)||t.gt(C))throw Error("Out of range (0, ".concat(C,")"));var r=t.toString(16).padStart(16,"0"),n=parseInt(r.slice(0,8),16),i=parseInt(r.slice(8),16);this.littleEndian?(this.putUInt32(i),this.putUInt32(n)):(this.putUInt32(n),this.putUInt32(i))}},{key:"putBytes",value:function(e){var t=e.length;if(this.littleEndian)for(var r=t-1;r>=0;--r)this.putByte(e[r]);else for(var n=0;n<t;++n)this.putByte(e[n])}},{key:"getBytes",value:function(){return this.view.buffer}}]),e}(),H=function(e){for(var t=e.multipliedBy(-1).toString(2);t.length%8;)t="0"+t;var r="1"===t[0]&&-1!==t.slice(1).indexOf("1")?"11111111":"";return t=t.split("").map(function(e){return"0"===e?"1":"0"}).join(""),new U(r+t,2).plus(1)},R=function(e){return"boolean"==typeof e?e?"1":"0":"number"==typeof e?"".concat(e):e};return e.ContractDataView=M,e.generateContract=function(e){var t=function(e){var t=e.activationFeePlanck,r=e.hexCode,n=e.isLittleEndian,i=void 0===n||n?O(r):r,o=i.length/2,u=(o/256>>0)+(o%256!=0?1:0),l=4;l+=8,l+=8,l+=256*u<=256?1:256*u<=32767?2:4,l+=o,l+=1;var a=function(e,t,r){256*e<=256?r.putByte(t):256*e<=32767?r.putShort(t):r.putUInt32(t)},c=new j(l+=0,!0);return c.putShort(1),c.putShort(0),c.putShort(u),c.putShort(1),c.putShort(1),c.putShort(1),c.putUInt64(new U(t)),a(u,o,c),c.putBytes(E(i)),a(1,0,c),c.getBytes()}(e);return _(new Uint8Array(t))},e.generateMethodCall=function(e){var t=e.methodArgs?[e.methodHash].concat(D(e.methodArgs)):[e.methodHash];if(t.length>4)throw new Error("At maximum ".concat(3," are supported"));return t.map(R).map(function(e){return function(e){var t=new U(e);t.lt(0)&&(t=H(t));var r=t.toString(16);return r.length%2?"0"+r:r}(e).padStart(16,"0")}).map(O).join("")},e.getContractDatablock=B,e}({}); | ||
var b$contracts=function(e){"use strict";var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,r){return e(r={exports:{}},r.exports),r.exports}var i=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertNumberToNQTString=(e=>{if(null==e)throw new Error("Invalid argument");return parseFloat(e.toString()).toFixed(8).replace(".","")})});t(i);i.convertNumberToNQTString;var o=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertNQTStringToNumber=(e=>{if(null==e||""===e)throw new Error("Invalid argument");return parseFloat(e)/1e8})});t(o);o.convertNQTStringToNumber;var u=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.GenesisBlockTime=Date.UTC(2014,7,11,2,0,0,0)/1e3,r.initialCodeword=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r.gexp=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],r.glog=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],r.cwmap=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11],r.alphabet="23456789ABCDEFGHJKLMNPQRSTUVWXYZ".split(""),r.base32Length=13,r.ginv=(e=>r.gexp[31-r.glog[e]]),r.gmult=((e,t)=>{if(0===e||0===t)return 0;const n=(r.glog[e]+r.glog[t])%31;return r.gexp[n]})});t(u);u.GenesisBlockTime,u.initialCodeword,u.gexp,u.glog,u.cwmap,u.alphabet,u.base32Length,u.ginv,u.gmult;var l=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertNumericIdToAddress=(e=>{if(null==e||0===e.trim().length)return;const r=[],t=u.initialCodeword.slice();let n=0,i=e.length;for(let t=0;t<i;t++)r[t]=e.charCodeAt(t)-"0".charCodeAt(0);let o=0,l=0;do{o=0,l=0;for(let e=0;e<i;e++)(o=10*o+r[e])>=32?(r[l]=o>>5,o&=31,l++):l>0&&(r[l]=0,l++);i=l,t[n]=o,n++}while(i>0);const c=[0,0,0,0];for(let e=u.base32Length-1;e>=0;e--){const r=t[e]^c[3];c[3]=c[2]^u.gmult(30,r),c[2]=c[1]^u.gmult(6,r),c[1]=c[0]^u.gmult(9,r),c[0]=u.gmult(17,r)}t[13]=c[0],t[14]=c[1],t[15]=c[2],t[16]=c[3];let a="BURST-";for(let e=0;e<17;e++)a+=u.alphabet[t[u.cwmap[e]]],3==(3&e)&&e<13&&(a+="-");return a})});t(l);l.convertNumericIdToAddress;var c=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertBurstTimeToEpochTime=(e=>1e3*(u.GenesisBlockTime+e))});t(c);c.convertBurstTimeToEpochTime;var a=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertBurstTimeToDate=(e=>new Date(c.convertBurstTimeToEpochTime(e)))});t(a);a.convertBurstTimeToDate;var s=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertDateToBurstTime=(e=>Math.round(e.getTime()/1e3)-u.GenesisBlockTime)});t(s);s.convertDateToBurstTime;var f=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.isValid=(e=>{0===e.indexOf("BURST-")&&(e=e.substr(6));const r=u.initialCodeword.slice();let t=0;for(let n=0;n<e.length;n++){const i=u.alphabet.indexOf(e.charAt(n));if(!(i<=-1||i>u.alphabet.length)){if(t>16)return!1;r[u.cwmap[t]]=i,t++}}if(17!==t)return!1;let n=0;for(let e=1;e<5;e++){let t=0;for(let n=0;n<31;n++){if(n>12&&n<27)continue;let i=n;n>26&&(i-=14),t^=u.gmult(r[i],u.gexp[e*n%31])}n|=t}return 0===n}),r.isBurstAddress=(e=>/^BURST\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{4}\-[A-Z0-9]{5}/i.test(e)&&r.isValid(e))});t(f);f.isValid,f.isBurstAddress;var h=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertAddressToNumericId=(e=>{if(null==e||0===e.trim().length)return;if(0!==e.indexOf("BURST-"))return;e=e.substr(6);const r=u.initialCodeword.slice();let t=0;for(let n=0;n<e.length;n++){const i=u.alphabet.indexOf(e.charAt(n));if(!(i<=-1||i>u.alphabet.length)){if(t>16)return;r[u.cwmap[t]]=i,t++}}if(!f.isValid(e))return;let n=u.base32Length;const i=[];for(let e=0;e<n;e++)i[e]=r[n-e-1];let o,l="",c=0;do{o=0,c=0;for(let e=0;e<n;e++)(c=32*c+i[e])>=10?(i[o]=Math.floor(c/10),c%=10,o+=1):o>0&&(i[o]=0,o+=1);n=o,l+=c}while(n>0);return l.split("").reverse().join("")})});t(h);h.convertAddressToNumericId;var g=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.sumNQTStringToNumber=function(...e){return e.reduce((e,r)=>e+o.convertNQTStringToNumber(r),0)}});t(g);g.sumNQTStringToNumber;var p=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertByteArrayToString=((e,r=0,t=null)=>{if(0===t)return"";let n=e;if(0!==r){const i=null===t?e.length-r:t;!function(e,r,t=0){if(t<0)throw new Error("Start index should not be negative");if(e.length<t+r)throw new Error("Need at least "+r+" bytes to convert to an integer")}(n,i,r),n=e.slice(r,r+i)}return decodeURIComponent(escape(String.fromCharCode.apply(null,Array.from(n))))})});t(p);p.convertByteArrayToString;var d=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertByteArrayToHexString=((e,r=!1)=>{const t=[];for(let r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((15&e[r]).toString(16));return r?t.join("").toUpperCase():t.join("")})});t(d);d.convertByteArrayToHexString;var v=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertHexStringToByteArray=(e=>{if(e.length%2)throw new Error(`Invalid Hex String: ${e}`);const r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const n=parseInt(e.substr(t,2),16);if(Number.isNaN(n))throw new Error(`Invalid Hex String: ${e}`);r[t/2]=n}return r})});t(v);v.convertHexStringToByteArray;var m=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertHexStringToDecString=(e=>{const r=[0];let t,n,i;for(t=0;t<e.length;t+=1){for(i=parseInt(e.charAt(t),16),n=0;n<r.length;n+=1)r[n]=16*r[n]+i,i=r[n]/10|0,r[n]%=10;for(;i>0;)r.push(i%10),i=i/10|0}return r.reverse().join("")})});t(m);m.convertHexStringToDecString;var w=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertHexStringToString=(e=>p.convertByteArrayToString(v.convertHexStringToByteArray(e)))});t(w);w.convertHexStringToString;var y=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertStringToByteArray=(e=>{const r=unescape(encodeURIComponent(e)),t=new Uint8Array(r.length);for(let e=0;e<r.length;++e)t[e]=r.charCodeAt(e);return t})});t(y);y.convertStringToByteArray;var b=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertStringToHexString=(e=>d.convertByteArrayToHexString(y.convertStringToByteArray(e)))});t(b);b.convertStringToHexString;var T=n(function(e,r){Object.defineProperty(r,"__esModule",{value:!0}),r.convertHexEndianess=(e=>{let r="";const t=e;for(let e=t.length-1;e>=0;e-=2)r+=t[e-1]+t[e];return r})});t(T);T.convertHexEndianess;var A=n(function(e,r){function t(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0}),t(i),t(o),t(l),t(c),t(a),t(s),t(h),t(f),t(g),t(p),t(d),t(v),t(m),t(w),t(y),t(b),t(T)});t(A);var S=A.convertNumberToNQTString,N=(A.convertNQTStringToNumber,A.convertHexStringToDecString),O=A.convertHexStringToString,E=A.convertHexEndianess;A.convertHexStringToByteArray,A.convertByteArrayToHexString;function _(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,n=16*r,i=n+t;if(i>e.machineData.length)throw new Error("Insufficient length for variable at position: ".concat(n," (and given length: ").concat(t,")"));if(i%2!=0)throw new Error("Invalid position: ".concat(n," (or given length: ").concat(t,") - must be at least multiple of 2"));return E(e.machineData.substr(n,t))}function x(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function B(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var P=256,D=function(){function e(r){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,e),this._contract=r}var r,t,n;return r=e,(t=[{key:"getContract",value:function(){return this._contract}},{key:"countCodePages",value:function(){return this._contract.machineCode.length/2/P}},{key:"getVariableAsString",value:function(r){var t=this.getHexDataAt(r,e.VARIABLE_LENGTH);return O(t.replace(/00/g,""))}},{key:"getDataBlocksAsString",value:function(r,t){var n=this.getHexDataAt(r,t*e.VARIABLE_LENGTH);return O(n.replace(/00/g,""))}},{key:"getVariableAsDecimal",value:function(e){return N(this.getVariable(e))}},{key:"getVariable",value:function(r){return this.getHexDataAt(r,e.VARIABLE_LENGTH)}},{key:"getHexDataAt",value:function(r,t){var n=t||this._contract.machineData.length-e.VARIABLE_LENGTH*r;return _(this._contract,r,n)}}])&&x(r.prototype,t),n&&x(r,n),e}();function C(e){return Math.ceil(e.length/2/P)}D.VARIABLE_LENGTH=16,String.prototype.padStart||(String.prototype.padStart=function(e,r){return e>>=0,r=String(void 0!==r?r:" "),this.length>=e?String(this):((e-=this.length)>r.length&&(r+=r.repeat(e/r.length)),r.slice(0,e)+String(this))});var M=n(function(e){!function(r){var t,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",c=1e14,a=14,s=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,g=1e9;function p(e){var r=0|e;return e>0||e===r?r:r-1}function d(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=a-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(e,r){var t,n,i=e.c,o=r.c,u=e.s,l=r.s,c=e.e,a=r.e;if(!u||!l)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-l:u;if(u!=l)return u;if(t=u<0,n=c==a,!i||!o)return n?0:!i^t?1:-1;if(!n)return c>a^t?1:-1;for(l=(c=i.length)<(a=o.length)?c:a,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return c==a?0:c>a^t?1:-1}function m(e,r,t,n){if(e<r||e>t||e!==o(e))throw Error(u+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var r=e.c.length-1;return p(e.e/a)==r&&e.c[r]%2!=0}function y(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function b(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}(t=function e(r){var t,T,A,S,N,O,E,_,x,B=V.prototype={constructor:V,toString:null,valueOf:null},P=new V(1),D=20,C=4,M=-7,I=21,j=-1e7,H=1e7,L=!1,R=1,U=0,k={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},G="0123456789abcdefghijklmnopqrstuvwxyz";function V(e,r){var t,i,u,c,f,h,g,p,d=this;if(!(d instanceof V))return new V(e,r);if(null==r){if(e&&!0===e._isBigNumber)return d.s=e.s,void(!e.c||e.e>H?d.c=d.e=null:e.e<j?d.c=[d.e=0]:(d.e=e.e,d.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(d.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,f=e;f>=10;f/=10,c++);return void(c>H?d.c=d.e=null:(d.e=c,d.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return A(d,p,h);d.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(c=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(c<0&&(c=f),c+=+p.slice(f+1),p=p.substring(0,f)):c<0&&(c=p.length)}else{if(m(r,2,G.length,"Base"),10==r)return Q(d=new V(e),D+d.e+1,C);if(p=String(e),h="number"==typeof e){if(0*e!=0)return A(d,p,h,r);if(d.s=1/e<0?(p=p.slice(1),-1):1,V.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else d.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(t=G.slice(0,r),c=f=0,g=p.length;f<g;f++)if(t.indexOf(i=p.charAt(f))<0){if("."==i){if(f>c){c=g;continue}}else if(!u&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){u=!0,f=-1,c=0;continue}return A(d,String(e),h,r)}h=!1,(c=(p=T(p,r,10,d.s)).indexOf("."))>-1?p=p.replace(".",""):c=p.length}for(f=0;48===p.charCodeAt(f);f++);for(g=p.length;48===p.charCodeAt(--g););if(p=p.slice(f,++g)){if(g-=f,h&&V.DEBUG&&g>15&&(e>s||e!==o(e)))throw Error(l+d.s*e);if((c=c-f-1)>H)d.c=d.e=null;else if(c<j)d.c=[d.e=0];else{if(d.e=c,d.c=[],f=(c+1)%a,c<0&&(f+=a),f<g){for(f&&d.c.push(+p.slice(0,f)),g-=a;f<g;)d.c.push(+p.slice(f,f+=a));f=a-(p=p.slice(f)).length}else f-=g;for(;f--;p+="0");d.c.push(+p)}}else d.c=[d.e=0]}function F(e,r,t,n){var i,o,u,l,c;if(null==t?t=C:m(t,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==r)c=d(e.c),c=1==n||2==n&&(u<=M||u>=I)?y(c,u):b(c,u,"0");else if(o=(e=Q(new V(e),r,t)).e,l=(c=d(e.c)).length,1==n||2==n&&(r<=o||o<=M)){for(;l<r;c+="0",l++);c=y(c,o)}else if(r-=u,c=b(c,o,"0"),o+1>l){if(--r>0)for(c+=".";r--;c+="0");}else if((r+=o-l)>0)for(o+1==l&&(c+=".");r--;c+="0");return e.s<0&&i?"-"+c:c}function $(e,r){for(var t,n=1,i=new V(e[0]);n<e.length;n++){if(!(t=new V(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function q(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*a-1)>H?e.c=e.e=null:t<j?e.c=[e.e=0]:(e.e=t,e.c=r),e}function Q(e,r,t,n){var u,l,s,h,g,p,d,v=e.c,m=f;if(v){e:{for(u=1,h=v[0];h>=10;h/=10,u++);if((l=r-u)<0)l+=a,s=r,d=(g=v[p=0])/m[u-s-1]%10|0;else if((p=i((l+1)/a))>=v.length){if(!n)break e;for(;v.length<=p;v.push(0));g=d=0,u=1,s=(l%=a)-a+1}else{for(g=h=v[p],u=1;h>=10;h/=10,u++);d=(s=(l%=a)-a+u)<0?0:g/m[u-s-1]%10|0}if(n=n||r<0||null!=v[p+1]||(s<0?g:g%m[u-s-1]),n=t<4?(d||n)&&(0==t||t==(e.s<0?3:2)):d>5||5==d&&(4==t||n||6==t&&(l>0?s>0?g/m[u-s]:0:v[p-1])%10&1||t==(e.s<0?8:7)),r<1||!v[0])return v.length=0,n?(r-=e.e+1,v[0]=m[(a-r%a)%a],e.e=-r||0):v[0]=e.e=0,e;if(0==l?(v.length=p,h=1,p--):(v.length=p+1,h=m[a-l],v[p]=s>0?o(g/m[u-s]%m[s])*h:0),n)for(;;){if(0==p){for(l=1,s=v[0];s>=10;s/=10,l++);for(s=v[0]+=h,h=1;s>=10;s/=10,h++);l!=h&&(e.e++,v[0]==c&&(v[0]=1));break}if(v[p]+=h,v[p]!=c)break;v[p--]=0,h=1}for(l=v.length;0===v[--l];v.pop());}e.e>H?e.c=e.e=null:e.e<j&&(e.c=[e.e=0])}return e}function z(e){var r,t=e.e;return null===t?e.toString():(r=d(e.c),r=t<=M||t>=I?y(r,t):b(r,t,"0"),e.s<0?"-"+r:r)}return V.clone=e,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(e){var r,t;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(m(t=e[r],0,g,r),D=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(m(t=e[r],0,8,r),C=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(m(t[0],-g,0,r),m(t[1],0,g,r),M=t[0],I=t[1]):(m(t,-g,g,r),M=-(I=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)m(t[0],-g,-1,r),m(t[1],1,g,r),j=t[0],H=t[1];else{if(m(t,-g,g,r),!t)throw Error(u+r+" cannot be zero: "+t);j=-(H=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(u+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!t,Error(u+"crypto unavailable");L=t}else L=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(m(t=e[r],0,9,r),R=t),e.hasOwnProperty(r="POW_PRECISION")&&(m(t=e[r],0,g,r),U=t),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(t=e[r]))throw Error(u+r+" not an object: "+t);k=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.$|[+-.\s]|(.).*\1/.test(t))throw Error(u+r+" invalid: "+t);G=t}}return{DECIMAL_PLACES:D,ROUNDING_MODE:C,EXPONENTIAL_AT:[M,I],RANGE:[j,H],CRYPTO:L,MODULO_MODE:R,POW_PRECISION:U,FORMAT:k,ALPHABET:G}},V.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!V.DEBUG)return!0;var r,t,n=e.c,i=e.e,l=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===l||-1===l)&&i>=-g&&i<=g&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%a)<1&&(r+=a),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=c||t!==o(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===l||1===l||-1===l))return!0;throw Error(u+"Invalid BigNumber: "+e)},V.maximum=V.max=function(){return $(arguments,B.lt)},V.minimum=V.min=function(){return $(arguments,B.gt)},V.random=(S=9007199254740992*Math.random()&2097151?function(){return o(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,l,c,s=0,h=[],p=new V(P);if(null==e?e=D:m(e,0,g),l=i(e/a),L)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(l*=2));s<l;)(c=131072*r[s]+(r[s+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[s]=t[0],r[s+1]=t[1]):(h.push(c%1e14),s+=2);s=l/2}else{if(!crypto.randomBytes)throw L=!1,Error(u+"crypto unavailable");for(r=crypto.randomBytes(l*=7);s<l;)(c=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6])>=9e15?crypto.randomBytes(7).copy(r,s):(h.push(c%1e14),s+=7);s=l/7}if(!L)for(;s<l;)(c=S())<9e15&&(h[s++]=c%1e14);for(l=h[--s],e%=a,l&&e&&(c=f[a-e],h[s]=o(l/c)*c);0===h[s];h.pop(),s--);if(s<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=a);for(s=1,c=h[0];c>=10;c/=10,s++);s<a&&(n-=a-s)}return p.e=n,p.c=h,p}),V.sum=function(){for(var e=1,r=arguments,t=new V(r[0]);e<r.length;)t=t.plus(r[e++]);return t},T=function(){function e(e,r,t,n){for(var i,o,u=[0],l=0,c=e.length;l<c;){for(o=u.length;o--;u[o]*=r);for(u[0]+=n.indexOf(e.charAt(l++)),i=0;i<u.length;i++)u[i]>t-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/t|0,u[i]%=t)}return u.reverse()}return function(r,n,i,o,u){var l,c,a,s,f,h,g,p,v=r.indexOf("."),m=D,w=C;for(v>=0&&(s=U,U=0,r=r.replace(".",""),h=(p=new V(n)).pow(r.length-v),U=s,p.c=e(b(d(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),a=s=(g=e(r,n,i,u?(l=G,"0123456789"):(l="0123456789",G))).length;0==g[--s];g.pop());if(!g[0])return l.charAt(0);if(v<0?--a:(h.c=g,h.e=a,h.s=o,g=(h=t(h,p,m,w,i)).c,f=h.r,a=h.e),v=g[c=a+m+1],s=i/2,f=f||c<0||null!=g[c+1],f=w<4?(null!=v||f)&&(0==w||w==(h.s<0?3:2)):v>s||v==s&&(4==w||f||6==w&&1&g[c-1]||w==(h.s<0?8:7)),c<1||!g[0])r=f?b(l.charAt(1),-m,l.charAt(0)):l.charAt(0);else{if(g.length=c,f)for(--i;++g[--c]>i;)g[c]=0,c||(++a,g=[1].concat(g));for(s=g.length;!g[--s];);for(v=0,r="";v<=s;r+=l.charAt(g[v++]));r=b(r,a,l.charAt(0))}return r}}(),t=function(){function e(e,r,t){var n,i,o,u,l=0,c=e.length,a=r%h,s=r/h|0;for(e=e.slice();c--;)l=((i=a*(o=e[c]%h)+(n=s*o+(u=e[c]/h|0)*a)%h*h+l)/t|0)+(n/h|0)+s*u,e[c]=i%t;return l&&(e=[l].concat(e)),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,u,l,s){var f,h,g,d,v,m,w,y,b,T,A,S,N,O,E,_,x,B=n.s==i.s?1:-1,P=n.c,D=i.c;if(!(P&&P[0]&&D&&D[0]))return new V(n.s&&i.s&&(P?!D||P[0]!=D[0]:D)?P&&0==P[0]||!D?0*B:B/0:NaN);for(b=(y=new V(B)).c=[],B=u+(h=n.e-i.e)+1,s||(s=c,h=p(n.e/a)-p(i.e/a),B=B/a|0),g=0;D[g]==(P[g]||0);g++);if(D[g]>(P[g]||0)&&h--,B<0)b.push(1),d=!0;else{for(O=P.length,_=D.length,g=0,B+=2,(v=o(s/(D[0]+1)))>1&&(D=e(D,v,s),P=e(P,v,s),_=D.length,O=P.length),N=_,A=(T=P.slice(0,_)).length;A<_;T[A++]=0);x=D.slice(),x=[0].concat(x),E=D[0],D[1]>=s/2&&E++;do{if(v=0,(f=r(D,T,_,A))<0){if(S=T[0],_!=A&&(S=S*s+(T[1]||0)),(v=o(S/E))>1)for(v>=s&&(v=s-1),w=(m=e(D,v,s)).length,A=T.length;1==r(m,T,w,A);)v--,t(m,_<w?x:D,w,s),w=m.length,f=1;else 0==v&&(f=v=1),w=(m=D.slice()).length;if(w<A&&(m=[0].concat(m)),t(T,m,A,s),A=T.length,-1==f)for(;r(D,T,_,A)<1;)v++,t(T,_<A?x:D,A,s),A=T.length}else 0===f&&(v++,T=[0]);b[g++]=v,T[0]?T[A++]=P[N]||0:(T=[P[N]],A=1)}while((N++<O||null!=T[0])&&B--);d=null!=T[0],b[0]||b.splice(0,1)}if(s==c){for(g=1,B=b[0];B>=10;B/=10,g++);Q(y,u+(y.e=g+h*a-1)+1,l,d)}else y.e=h,y.r=+d;return y}}(),N=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,E=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,A=function(e,r,t,n){var i,o=t?r:r.replace(x,"");if(_.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(N,function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r}),n&&(i=n,o=o.replace(O,"$1").replace(E,"0.$1")),r!=o))return new V(o,i);if(V.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},B.absoluteValue=B.abs=function(){var e=new V(this);return e.s<0&&(e.s=1),e},B.comparedTo=function(e,r){return v(this,new V(e,r))},B.decimalPlaces=B.dp=function(e,r){var t,n,i,o=this;if(null!=e)return m(e,0,g),null==r?r=C:m(r,0,8),Q(new V(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-p(this.e/a))*a,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},B.dividedBy=B.div=function(e,r){return t(this,new V(e,r),D,C)},B.dividedToIntegerBy=B.idiv=function(e,r){return t(this,new V(e,r),0,1)},B.exponentiatedBy=B.pow=function(e,r){var t,n,l,c,s,f,h,g,p=this;if((e=new V(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+z(e));if(null!=r&&(r=new V(r)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return g=new V(Math.pow(+z(p),s?2-w(e):+z(e))),r?g.mod(r):g;if(f=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new V(NaN);(n=!f&&p.isInteger()&&r.isInteger())&&(p=p.mod(r))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return c=p.s<0&&w(e)?-0:0,p.e>-1&&(c=1/c),new V(f?1/c:c);U&&(c=i(U/a+2))}for(s?(t=new V(.5),f&&(e.s=1),h=w(e)):h=(l=Math.abs(+z(e)))%2,g=new V(P);;){if(h){if(!(g=g.times(p)).c)break;c?g.c.length>c&&(g.c.length=c):n&&(g=g.mod(r))}if(l){if(0===(l=o(l/2)))break;h=l%2}else if(Q(e=e.times(t),e.e+1,1),e.e>14)h=w(e);else{if(0==(l=+z(e)))break;h=l%2}p=p.times(p),c?p.c&&p.c.length>c&&(p.c.length=c):n&&(p=p.mod(r))}return n?g:(f&&(g=P.div(g)),r?g.mod(r):c?Q(g,U,C,void 0):g)},B.integerValue=function(e){var r=new V(this);return null==e?e=C:m(e,0,8),Q(r,r.e+1,e)},B.isEqualTo=B.eq=function(e,r){return 0===v(this,new V(e,r))},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(e,r){return v(this,new V(e,r))>0},B.isGreaterThanOrEqualTo=B.gte=function(e,r){return 1===(r=v(this,new V(e,r)))||0===r},B.isInteger=function(){return!!this.c&&p(this.e/a)>this.c.length-2},B.isLessThan=B.lt=function(e,r){return v(this,new V(e,r))<0},B.isLessThanOrEqualTo=B.lte=function(e,r){return-1===(r=v(this,new V(e,r)))||0===r},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&0==this.c[0]},B.minus=function(e,r){var t,n,i,o,u=this,l=u.s;if(r=(e=new V(e,r)).s,!l||!r)return new V(NaN);if(l!=r)return e.s=-r,u.plus(e);var s=u.e/a,f=e.e/a,h=u.c,g=e.c;if(!s||!f){if(!h||!g)return h?(e.s=-r,e):new V(g?u:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-r,e):new V(h[0]?u:3==C?-0:0)}if(s=p(s),f=p(f),h=h.slice(),l=s-f){for((o=l<0)?(l=-l,i=h):(f=s,i=g),i.reverse(),r=l;r--;i.push(0));i.reverse()}else for(n=(o=(l=h.length)<(r=g.length))?l:r,l=r=0;r<n;r++)if(h[r]!=g[r]){o=h[r]<g[r];break}if(o&&(i=h,h=g,g=i,e.s=-e.s),(r=(n=g.length)-(t=h.length))>0)for(;r--;h[t++]=0);for(r=c-1;n>l;){if(h[--n]<g[n]){for(t=n;t&&!h[--t];h[t]=r);--h[t],h[n]+=c}h[n]-=g[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?q(e,h,f):(e.s=3==C?-1:1,e.c=[e.e=0],e)},B.modulo=B.mod=function(e,r){var n,i,o=this;return e=new V(e,r),!o.c||!e.s||e.c&&!e.c[0]?new V(NaN):!e.c||o.c&&!o.c[0]?new V(o):(9==R?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,R),(e=o.minus(n.times(e))).c[0]||1!=R||(e.s=o.s),e)},B.multipliedBy=B.times=function(e,r){var t,n,i,o,u,l,s,f,g,d,v,m,w,y,b,T=this,A=T.c,S=(e=new V(e,r)).c;if(!(A&&S&&A[0]&&S[0]))return!T.s||!e.s||A&&!A[0]&&!S||S&&!S[0]&&!A?e.c=e.e=e.s=null:(e.s*=T.s,A&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(T.e/a)+p(e.e/a),e.s*=T.s,(s=A.length)<(d=S.length)&&(w=A,A=S,S=w,i=s,s=d,d=i),i=s+d,w=[];i--;w.push(0));for(y=c,b=h,i=d;--i>=0;){for(t=0,v=S[i]%b,m=S[i]/b|0,o=i+(u=s);o>i;)t=((f=v*(f=A[--u]%b)+(l=m*f+(g=A[u]/b|0)*v)%b*b+w[o]+t)/y|0)+(l/b|0)+m*g,w[o--]=f%y;w[o]=t}return t?++n:w.splice(0,1),q(e,w,n)},B.negated=function(){var e=new V(this);return e.s=-e.s||null,e},B.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new V(e,r)).s,!i||!r)return new V(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/a,u=e.e/a,l=n.c,s=e.c;if(!o||!u){if(!l||!s)return new V(i/0);if(!l[0]||!s[0])return s[0]?e:new V(l[0]?n:0*i)}if(o=p(o),u=p(u),l=l.slice(),i=o-u){for(i>0?(u=o,t=s):(i=-i,t=l),t.reverse();i--;t.push(0));t.reverse()}for((i=l.length)-(r=s.length)<0&&(t=s,s=l,l=t,r=i),i=0;r;)i=(l[--r]=l[r]+s[r]+i)/c|0,l[r]=c===l[r]?0:l[r]%c;return i&&(l=[i].concat(l),++u),q(e,l,u)},B.precision=B.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return m(e,1,g),null==r?r=C:m(r,0,8),Q(new V(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*a+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},B.shiftedBy=function(e){return m(e,-s,s),this.times("1e"+e)},B.squareRoot=B.sqrt=function(){var e,r,n,i,o,u=this,l=u.c,c=u.s,a=u.e,s=D+4,f=new V("0.5");if(1!==c||!l||!l[0])return new V(!c||c<0&&(!l||l[0])?NaN:l?u:1/0);if(0==(c=Math.sqrt(+z(u)))||c==1/0?(((r=d(l)).length+a)%2==0&&(r+="0"),c=Math.sqrt(+r),a=p((a+1)/2)-(a<0||a%2),n=new V(r=c==1/0?"1e"+a:(r=c.toExponential()).slice(0,r.indexOf("e")+1)+a)):n=new V(c+""),n.c[0])for((c=(a=n.e)+s)<3&&(c=0);;)if(o=n,n=f.times(o.plus(t(u,o,s,1))),d(o.c).slice(0,c)===(r=d(n.c)).slice(0,c)){if(n.e<a&&--c,"9999"!=(r=r.slice(c-3,c+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Q(n,n.e+D+2,1),e=!n.times(n).eq(u));break}if(!i&&(Q(o,o.e+D+2,0),o.times(o).eq(u))){n=o;break}s+=4,c+=4,i=1}return Q(n,n.e+D+1,C,e)},B.toExponential=function(e,r){return null!=e&&(m(e,0,g),e++),F(this,e,r,1)},B.toFixed=function(e,r){return null!=e&&(m(e,0,g),e=e+this.e+1),F(this,e,r)},B.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==typeof r?(t=r,r=null):e&&"object"==typeof e?(t=e,e=r=null):t=k;else if("object"!=typeof t)throw Error(u+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,l=n.split("."),c=+t.groupSize,a=+t.secondaryGroupSize,s=t.groupSeparator||"",f=l[0],h=l[1],g=i.s<0,p=g?f.slice(1):f,d=p.length;if(a&&(o=c,c=a,a=o,d-=o),c>0&&d>0){for(o=d%c||c,f=p.substr(0,o);o<d;o+=c)f+=s+p.substr(o,c);a>0&&(f+=s+p.slice(o)),g&&(f="-"+f)}n=h?f+(t.decimalSeparator||"")+((a=+t.fractionGroupSize)?h.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):h):f}return(t.prefix||"")+n+(t.suffix||"")},B.toFraction=function(e){var r,n,i,o,l,c,s,h,g,p,v,m,w=this,y=w.c;if(null!=e&&(!(s=new V(e)).isInteger()&&(s.c||1!==s.s)||s.lt(P)))throw Error(u+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+z(s));if(!y)return new V(w);for(r=new V(P),g=n=new V(P),i=h=new V(P),m=d(y),l=r.e=m.length-w.e-1,r.c[0]=f[(c=l%a)<0?a+c:c],e=!e||s.comparedTo(r)>0?l>0?r:g:s,c=H,H=1/0,s=new V(m),h.c[0]=0;p=t(s,r,0,1),1!=(o=n.plus(p.times(i))).comparedTo(e);)n=i,i=o,g=h.plus(p.times(o=g)),h=o,r=s.minus(p.times(o=r)),s=o;return o=t(e.minus(n),i,0,1),h=h.plus(o.times(g)),n=n.plus(o.times(i)),h.s=g.s=w.s,v=t(g,i,l*=2,C).minus(w).abs().comparedTo(t(h,n,l,C).minus(w).abs())<1?[g,i]:[h,n],H=c,v},B.toNumber=function(){return+z(this)},B.toPrecision=function(e,r){return null!=e&&m(e,1,g),F(this,e,r,2)},B.toString=function(e){var r,t=this,n=t.s,i=t.e;return null===i?n?(r="Infinity",n<0&&(r="-"+r)):r="NaN":(null==e?r=i<=M||i>=I?y(d(t.c),i):b(d(t.c),i,"0"):10===e?r=b(d((t=Q(new V(t),D+i+1,C)).c),t.e,"0"):(m(e,2,G.length,"Base"),r=T(b(d(t.c),i,"0"),10,e,n,!0)),n<0&&t.c[0]&&(r="-"+r)),r},B.valueOf=B.toJSON=function(){return z(this)},B._isBigNumber=!0,null!=r&&V.set(r),V}()).default=t.BigNumber=t,e.exports?e.exports=t:(r||(r="undefined"!=typeof self&&self?self:window),r.BigNumber=t)}(r)}),I=function(e){for(var r=e.multipliedBy(-1).toString(2);r.length%8;)r="0"+r;var t="1"===r[0]&&-1!==r.slice(1).indexOf("1")?"11111111":"";return r=r.split("").map(function(e){return"0"===e?"1":"0"}).join(""),new M(t+r,2).plus(1)},j=function(e){return"boolean"==typeof e?e?"1":"0":"number"==typeof e?"".concat(e):e};return e.CodePageSize=P,e.ContractDataView=D,e.calculateMinimumCreationFee=function(e){return S(2+C(e)+1)},e.countCodePages=C,e.generateMethodCall=function(e){var r=e.methodArgs?[e.methodHash].concat(B(e.methodArgs)):[e.methodHash];if(r.length>4)throw new Error("At maximum ".concat(3," are supported"));return r.map(j).map(function(e){return function(e){var r=new M(e);r.lt(0)&&(r=I(r));var t=r.toString(16);return t.length%2?"0"+t:t}(e).padStart(16,"0")}).map(E).join("")},e.getContractDatablock=_,e}({}); | ||
//# sourceMappingURL=burstjs.contracts.min.js.map |
@@ -7,2 +7,3 @@ import { Contract } from './typings/contract'; | ||
getContract(): Contract; | ||
countCodePages(): number; | ||
getVariableAsString(index: number): string; | ||
@@ -9,0 +10,0 @@ getDataBlocksAsString(index: number, count?: number): string; |
export * from './getContractDatablock'; | ||
export * from './ContractDataView'; | ||
export * from './generateContract'; | ||
export * from './constants'; | ||
export * from './countCodePages'; | ||
export * from './calculateMinimumCreationFee'; | ||
export * from './generateMethodCall'; |
@@ -7,2 +7,3 @@ import { Contract } from './typings/contract'; | ||
getContract(): Contract; | ||
countCodePages(): number; | ||
getVariableAsString(index: number): string; | ||
@@ -9,0 +10,0 @@ getDataBlocksAsString(index: number, count?: number): string; |
@@ -5,2 +5,3 @@ "use strict"; | ||
const getContractDatablock_1 = require("./getContractDatablock"); | ||
const constants_1 = require("./constants"); | ||
class ContractDataView { | ||
@@ -13,2 +14,5 @@ constructor(_contract) { | ||
} | ||
countCodePages() { | ||
return (this._contract.machineCode.length / 2) / constants_1.CodePageSize; | ||
} | ||
getVariableAsString(index) { | ||
@@ -15,0 +19,0 @@ const hexData = this.getHexDataAt(index, ContractDataView.VARIABLE_LENGTH); |
export * from './getContractDatablock'; | ||
export * from './ContractDataView'; | ||
export * from './generateContract'; | ||
export * from './constants'; | ||
export * from './countCodePages'; | ||
export * from './calculateMinimumCreationFee'; | ||
export * from './generateMethodCall'; |
@@ -8,4 +8,6 @@ "use strict"; | ||
__export(require("./ContractDataView")); | ||
__export(require("./generateContract")); | ||
__export(require("./constants")); | ||
__export(require("./countCodePages")); | ||
__export(require("./calculateMinimumCreationFee")); | ||
__export(require("./generateMethodCall")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@burstjs/contracts", | ||
"version": "0.5.0-alpha.1", | ||
"version": "0.5.0-alpha.2", | ||
"description": "Smart Contracts package for BURST", | ||
@@ -48,3 +48,3 @@ "contributors": [ | ||
"dependencies": { | ||
"@burstjs/util": "^0.5.0-alpha.1", | ||
"@burstjs/util": "^0.5.0-alpha.2", | ||
"bignumber.js": "^9.0.0" | ||
@@ -57,3 +57,3 @@ }, | ||
}, | ||
"gitHead": "8853d6b9a52451b091a349d8dd60e3287c59e66d", | ||
"gitHead": "50ee74a37a7964ce327930d7a4264ee5d9adc2e2", | ||
"publishConfig": { | ||
@@ -60,0 +60,0 @@ "access": "public" |
@@ -10,2 +10,3 @@ /** @module contracts */ | ||
import {getContractDatablock} from './getContractDatablock'; | ||
import {CodePageSize} from './constants'; | ||
@@ -34,2 +35,9 @@ /** | ||
/** | ||
* @return The number of code pages | ||
*/ | ||
countCodePages() { | ||
return (this._contract.machineCode.length / 2) / CodePageSize | ||
} | ||
/** | ||
* Get a variable as string | ||
@@ -36,0 +44,0 @@ * @param index The index of variable (starting at 0) |
/** @module contracts */ | ||
export * from './getContractDatablock'; | ||
export * from './ContractDataView'; | ||
export * from './generateContract'; | ||
export * from './constants'; | ||
export * from './countCodePages'; | ||
export * from './calculateMinimumCreationFee'; | ||
export * from './generateMethodCall'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92
408325
4281
Updated@burstjs/util@^0.5.0-alpha.2