@burstjs/contracts
Advanced tools
Comparing version 0.5.0-alpha.0 to 0.5.0-alpha.1
@@ -30,3 +30,4 @@ module.exports = { | ||
'convertHexEndianess', | ||
'convertHexStringToByteArray' | ||
'convertHexStringToByteArray', | ||
'convertByteArrayToHexString' | ||
] | ||
@@ -33,0 +34,0 @@ }, |
@@ -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 s=[0,0,0,0];for(let e=u.base32Length-1;e>=0;e--){const t=r[e]^s[3];s[3]=s[2]^u.gmult(30,t),s[2]=s[1]^u.gmult(6,t),s[1]=s[0]^u.gmult(9,t),s[0]=u.gmult(17,t)}r[13]=s[0],r[14]=s[1],r[15]=s[2],r[16]=s[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 s=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertBurstTimeToEpochTime=(e=>1e3*(u.GenesisBlockTime+e))});r(s);s.convertBurstTimeToEpochTime;var c=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertBurstTimeToDate=(e=>new Date(s.convertBurstTimeToEpochTime(e)))});r(c);c.convertBurstTimeToDate;var a=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertDateToBurstTime=(e=>Math.round(e.getTime()/1e3)-u.GenesisBlockTime)});r(a);a.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="",s=0;do{o=0,s=0;for(let e=0;e<n;e++)(s=32*s+i[e])>=10?(i[o]=Math.floor(s/10),s%=10,o+=1):o>0&&(i[o]=0,o+=1);n=o,l+=s}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 S=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(S);S.convertHexEndianess;var T=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(s),r(c),r(a),r(h),r(f),r(g),r(p),r(d),r(v),r(w),r(m),r(y),r(b),r(S)});r(T);T.convertNumberToNQTString,T.convertNQTStringToNumber;var A=T.convertHexStringToDecString,N=T.convertHexStringToString,O=T.convertHexEndianess,E=T.convertHexStringToByteArray;function _(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 B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(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 I(e,t,r){return t&&x(e.prototype,t),r&&x(e,r),e}function P(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 D=function(){function e(t){B(this,e),this._contract=t}return I(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 A(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 _(this._contract,t,n)}}]),e}();D.VARIABLE_LENGTH=16;var M=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: ",s=1e14,c=14,a=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,s=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=s==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return s>c^r?1:-1;for(l=(s=i.length)<(c=o.length)?s:c,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^r?1:-1;return s==c?0:s>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,S,T,A,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,s,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(s=0,f=e;f>=10;f/=10,s++);return void(s>L?d.c=d.e=null:(d.e=s,d.c=[e]))}p=String(e)}else{if(!n.test(p=String(e)))return T(d,p,h);d.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(s=p.indexOf("."))>-1&&(p=p.replace(".","")),(f=p.search(/e/i))>0?(s<0&&(s=f),s+=+p.slice(f+1),p=p.substring(0,f)):s<0&&(s=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 T(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),s=f=0,g=p.length;f<g;f++)if(r.indexOf(i=p.charAt(f))<0){if("."==i){if(f>s){s=g;continue}}else if(!u&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){u=!0,f=-1,s=0;continue}return T(d,String(e),h,t)}h=!1,(s=(p=S(p,t,10,d.s)).indexOf("."))>-1?p=p.replace(".",""):s=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>a||e!==o(e)))throw Error(l+d.s*e);if((s=s-f-1)>L)d.c=d.e=null;else if(s<C)d.c=[d.e=0];else{if(d.e=s,d.c=[],f=(s+1)%c,s<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,s;if(null==r?r=D:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],u=e.e,null==t)s=d(e.c),s=1==n||2==n&&(u<=M||u>=U)?y(s,u):b(s,u,"0");else if(o=(e=Q(new V(e),t,r)).e,l=(s=d(e.c)).length,1==n||2==n&&(t<=o||o<=M)){for(;l<t;s+="0",l++);s=y(s,o)}else if(t-=u,s=b(s,o,"0"),o+1>l){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=o-l)>0)for(o+1==l&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}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,a,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,a=t,d=(g=v[p=0])/w[u-a-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,a=(l%=c)-c+1}else{for(g=h=v[p],u=1;h>=10;h/=10,u++);d=(a=(l%=c)-c+u)<0?0:g/w[u-a-1]%10|0}if(n=n||t<0||null!=v[p+1]||(a<0?g:g%w[u-a-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?a>0?g/w[u-a]: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]=a>0?o(g/w[u-a]%w[a])*h:0),n)for(;;){if(0==p){for(l=1,a=v[0];a>=10;a/=10,l++);for(a=v[0]+=h,h=1;a>=10;a/=10,h++);l!=h&&(e.e++,v[0]==s&&(v[0]=1));break}if(v[p]+=h,v[p]!=s)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>=s||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=(A=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,s,a=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));a<l;)(s=131072*t[a]+(t[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(h.push(s%1e14),a+=2);a=l/2}else{if(!crypto.randomBytes)throw j=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(l*=7);a<l;)(s=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])>=9e15?crypto.randomBytes(7).copy(t,a):(h.push(s%1e14),a+=7);a=l/7}if(!j)for(;a<l;)(s=A())<9e15&&(h[a++]=s%1e14);for(l=h[--a],e%=c,l&&e&&(s=f[c-e],h[a]=o(l/s)*s);0===h[a];h.pop(),a--);if(a<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=c);for(a=1,s=h[0];s>=10;s/=10,a++);a<c&&(n-=c-a)}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},S=function(){function e(e,t,r,n){for(var i,o,u=[0],l=0,s=e.length;l<s;){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,s,c,a,f,h,g,p,v=t.indexOf("."),w=P,m=D;for(v>=0&&(a=R,R=0,t=t.replace(".",""),h=(p=new V(n)).pow(t.length-v),R=a,p.c=e(b(d(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),c=a=(g=e(t,n,i,u?(l=G,"0123456789"):(l="0123456789",G))).length;0==g[--a];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[s=c+w+1],a=i/2,f=f||s<0||null!=g[s+1],f=m<4?(null!=v||f)&&(0==m||m==(h.s<0?3:2)):v>a||v==a&&(4==m||f||6==m&&1&g[s-1]||m==(h.s<0?8:7)),s<1||!g[0])t=f?b(l.charAt(1),-w,l.charAt(0)):l.charAt(0);else{if(g.length=s,f)for(--i;++g[--s]>i;)g[s]=0,s||(++c,g=[1].concat(g));for(a=g.length;!g[--a];);for(v=0,t="";v<=a;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,s=e.length,c=t%h,a=t/h|0;for(e=e.slice();s--;)l=((i=c*(o=e[s]%h)+(n=a*o+(u=e[s]/h|0)*c)%h*h+l)/r|0)+(n/h|0)+a*u,e[s]=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,a){var f,h,g,d,v,w,m,y,b,S,T,A,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,a||(a=s,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(a/(P[0]+1)))>1&&(P=e(P,v,a),I=e(I,v,a),_=P.length,O=I.length),N=_,T=(S=I.slice(0,_)).length;T<_;S[T++]=0);B=P.slice(),B=[0].concat(B),E=P[0],P[1]>=a/2&&E++;do{if(v=0,(f=t(P,S,_,T))<0){if(A=S[0],_!=T&&(A=A*a+(S[1]||0)),(v=o(A/E))>1)for(v>=a&&(v=a-1),m=(w=e(P,v,a)).length,T=S.length;1==t(w,S,m,T);)v--,r(w,_<m?B:P,m,a),m=w.length,f=1;else 0==v&&(f=v=1),m=(w=P.slice()).length;if(m<T&&(w=[0].concat(w)),r(S,w,T,a),T=S.length,-1==f)for(;t(P,S,_,T)<1;)v++,r(S,_<T?B:P,T,a),T=S.length}else 0===f&&(v++,S=[0]);b[g++]=v,S[0]?S[T++]=I[N]||0:(S=[I[N]],T=1)}while((N++<O||null!=S[0])&&x--);d=null!=S[0],b[0]||b.splice(0,1)}if(a==s){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,T=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,s,a,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)),a=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),a?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||a&&p.c[1]>=24e7:p.c[0]<8e13||a&&p.c[0]<=9999975e7)))return s=p.s<0&&m(e)?-0:0,p.e>-1&&(s=1/s),new V(f?1/s:s);R&&(s=i(R/c+2))}for(a?(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;s?g.c.length>s&&(g.c.length=s):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),s?p.c&&p.c.length>s&&(p.c.length=s):n&&(p=p.mod(t))}return n?g:(f&&(g=I.div(g)),t?g.mod(t):s?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 a=u.e/c,f=e.e/c,h=u.c,g=e.c;if(!a||!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(a=p(a),f=p(f),h=h.slice(),l=a-f){for((o=l<0)?(l=-l,i=h):(f=a,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=s-1;n>l;){if(h[--n]<g[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=s}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,a,f,g,d,v,w,m,y,b,S=this,T=S.c,A=(e=new V(e,t)).c;if(!(T&&A&&T[0]&&A[0]))return!S.s||!e.s||T&&!T[0]&&!A||A&&!A[0]&&!T?e.c=e.e=e.s=null:(e.s*=S.s,T&&A?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(S.e/c)+p(e.e/c),e.s*=S.s,(a=T.length)<(d=A.length)&&(m=T,T=A,A=m,i=a,a=d,d=i),i=a+d,m=[];i--;m.push(0));for(y=s,b=h,i=d;--i>=0;){for(r=0,v=A[i]%b,w=A[i]/b|0,o=i+(u=a);o>i;)r=((f=v*(f=T[--u]%b)+(l=w*f+(g=T[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,a=e.c;if(!o||!u){if(!l||!a)return new V(i/0);if(!l[0]||!a[0])return a[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=a):(i=-i,r=l),r.reverse();i--;r.push(0));r.reverse()}for((i=l.length)-(t=a.length)<0&&(r=a,a=l,l=r,t=i),i=0;t;)i=(l[--t]=l[t]+a[t]+i)/s|0,l[t]=s===l[t]?0:l[t]%s;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,-a,a),this.times("1e"+e)},x.squareRoot=x.sqrt=function(){var e,t,n,i,o,u=this,l=u.c,s=u.s,c=u.e,a=P+4,f=new V("0.5");if(1!==s||!l||!l[0])return new V(!s||s<0&&(!l||l[0])?NaN:l?u:1/0);if(0==(s=Math.sqrt(+z(u)))||s==1/0?(((t=d(l)).length+c)%2==0&&(t+="0"),s=Math.sqrt(+t),c=p((c+1)/2)-(c<0||c%2),n=new V(t=s==1/0?"1e"+c:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new V(s+""),n.c[0])for((s=(c=n.e)+a)<3&&(s=0);;)if(o=n,n=f.times(o.plus(r(u,o,a,1))),d(o.c).slice(0,s)===(t=d(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(t=t.slice(s-3,s+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}a+=4,s+=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("."),s=+r.groupSize,c=+r.secondaryGroupSize,a=r.groupSeparator||"",f=l[0],h=l[1],g=i.s<0,p=g?f.slice(1):f,d=p.length;if(c&&(o=s,s=c,c=o,d-=o),s>0&&d>0){for(o=d%s||s,f=p.substr(0,o);o<d;o+=s)f+=a+p.substr(o,s);c>0&&(f+=a+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,s,a,h,g,p,v,w,m=this,y=m.c;if(null!=e&&(!(a=new V(e)).isInteger()&&(a.c||1!==a.s)||a.lt(I)))throw Error(u+"Argument "+(a.isInteger()?"out of range: ":"not an integer: ")+z(a));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[(s=l%c)<0?c+s:s],e=!e||a.comparedTo(t)>0?l>0?t:g:a,s=L,L=1/0,a=new V(w),h.c[0]=0;p=r(a,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=a.minus(p.times(o=t)),a=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=s,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=S(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 U=new M("18446744073709551615");function C(e,t,r){if(!(t<=e&&e<=r))throw Error("Out of range (".concat(t,", ").concat(r,"): ").concat(e))}var L=function(){function e(t,r){B(this,e),this.littleEndian=r,this.offset=0,this.view=new DataView(new ArrayBuffer(t))}return I(e,[{key:"putByte",value:function(e){C(e,-128,255),this.view.setInt8(this.offset,e),this.offset+=1}},{key:"putShort",value:function(e){C(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){C(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 M?e:new M(e);if(t.lt(0)||t.gt(U))throw Error("Out of range (0, ".concat(U,")"));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}(),j=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 M(r+t,2).plus(1)},H=function(e){return"boolean"==typeof e?e?"1":"0":"number"==typeof e?"".concat(e):e};return e.ContractDataView=D,e.generateContract=function(e){!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 s=function(e,t,r){256*e<=256?r.putByte(t):256*e<=32767?r.putShort(t):r.putUInt32(t)},c=new L(l+=0,!0);c.putShort(1),c.putShort(0),c.putShort(u),c.putShort(1),c.putShort(1),c.putShort(1),c.putUInt64(new M(t)),s(u,o,c),c.putBytes(E(i)),s(1,0,c),c.getBytes()}(e);return""},e.generateMethodCall=function(e){var t=e.methodArgs?[e.methodHash].concat(P(e.methodArgs)):[e.methodHash];if(t.length>4)throw new Error("At maximum ".concat(3," are supported"));return t.map(H).map(function(e){return function(e){var t=new M(e);t.lt(0)&&(t=j(t));var r=t.toString(16);return r.length%2?"0"+r:r}(e).padStart(16,"0")}).map(O).join("")},e.getContractDatablock=_,e}({}); | ||
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}({}); | ||
//# sourceMappingURL=burstjs.contracts.min.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const generateContractBytes_1 = require("./internal/generateContractBytes"); | ||
const util_1 = require("@burstjs/util"); | ||
exports.generateContract = (args) => { | ||
const bytes = generateContractBytes_1.generateContractBytes(args); | ||
return ''; | ||
return util_1.convertByteArrayToHexString(new Uint8Array(bytes)); | ||
}; | ||
//# sourceMappingURL=generateContract.js.map |
{ | ||
"name": "@burstjs/contracts", | ||
"version": "0.5.0-alpha.0", | ||
"version": "0.5.0-alpha.1", | ||
"description": "Smart Contracts package for BURST", | ||
@@ -48,3 +48,3 @@ "contributors": [ | ||
"dependencies": { | ||
"@burstjs/util": "^0.5.0-alpha.0", | ||
"@burstjs/util": "^0.5.0-alpha.1", | ||
"bignumber.js": "^9.0.0" | ||
@@ -57,3 +57,3 @@ }, | ||
}, | ||
"gitHead": "f5fe985b69814f55d7df5dc3fd5417eb69262e9c", | ||
"gitHead": "8853d6b9a52451b091a349d8dd60e3287c59e66d", | ||
"publishConfig": { | ||
@@ -60,0 +60,0 @@ "access": "public" |
@@ -16,5 +16,3 @@ /** @module contracts */ | ||
const bytes = generateContractBytes(args); | ||
// return convertByteArrayToHexString(new Uint8Array(bytes)); | ||
// TODO: return correct value | ||
return ''; | ||
return convertByteArrayToHexString(new Uint8Array(bytes)); | ||
}; |
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
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
415072
4312
Updated@burstjs/util@^0.5.0-alpha.1