UNPKG

@defichain/jellyfish

Version:

A collection of TypeScript + JavaScript tools and libraries for DeFi Blockchain developers to build decentralized finance for Bitcoin

1 lines 117 kB
var e={};function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(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 n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=a(e);if(t){var i=a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}function o(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):r}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=e&&e.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},s=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0});var c=(Gr=void 0,e.defaultOptions=Gr);e.JsonRpcClient=c;var l={};function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}function p(e){var t=g();return function(){var r,n=y(e);if(t){var i=y(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return v(this,r)}}function v(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return m(e,arguments,y(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),b(n,e)})(e)}function m(e,t,r){return(m=g()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&b(i,r.prototype),i}).apply(null,arguments)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var x=l&&l.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),R=l&&l.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),k=l&&l.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||x(t,e,r)},E=l&&l.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&x(t,e,r);return R(t,e),t};Object.defineProperty(l,"__esModule",{value:!0});var O=(ar=void 0,ur=l.blockchain=ar,sr=l.mining=ur,cr=l.net=sr,lr=l.rawtx=cr,fr=l.wallet=lr,hr=l.poolpair=fr,pr=l.token=hr,vr=l.account=pr,dr=l.oracle=vr,mr=l.server=dr,gr=l.masternode=mr,br=l.governance=gr,yr=l.spv=br,wr=l.icxorderbook=yr,xr=l.misc=wr,Rr=l.loan=xr,Er=l.ApiClient=Rr,Or=l.ApiError=Er,l.ClientApiError=Or);l.RpcApiError=O;var _={};function A(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)}}var T=_&&_.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(_,"__esModule",{value:!0});var N=void 0;_.Blockchain=N,N=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"getBlockchainInfo",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getblockchaininfo",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getBlockHash",value:function(e){return T(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.client.call("getblockhash",[e],"number");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getBlockCount",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getblockcount",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getBlock",value:function(e,t){return T(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getblock",[e,t],2===t?{tx:{vout:{value:"bignumber"}}}:"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getBlockHeader",value:function(e,t){return T(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getblockheader",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getChainTips",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getchaintips",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getDifficulty",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getdifficulty",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getTxOut",value:function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return T(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.client.call("gettxout",[e,t,r],{value:"bignumber"});case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getRawMempool",value:function(e){return T(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.client.call("getrawmempool",[e],"bignumber");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getBlockStats",value:function(e,t){return T(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getblockstats",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getBestBlockHash",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getbestblockhash",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getMempoolInfo",value:function(){return T(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getmempoolinfo",[],{mempoolminfee:"bignumber",minrelaytxfee:"bignumber"});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}}])&&A(t.prototype,r),n&&A(t,n),e}(),_.Blockchain=N;var P,S={};function C(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)}}var L=S&&S.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(S,"__esModule",{value:!0});var I,M,D=(P=void 0,S.EstimateMode=P);S.Mining=D,(M=I=S.EstimateMode||(P={},S.EstimateMode=P)).UNSET="UNSET",M.ECONOMICAL="ECONOMICAL",M.CONSERVATIVE="CONSERVATIVE",D=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"getNetworkHashPerSecond",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:120,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return L(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getnetworkhashps",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getMiningInfo",value:function(){return L(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getmininginfo",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"estimateSmartFee",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:I.CONSERVATIVE;return L(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("estimatesmartfee",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}}])&&C(t.prototype,r),n&&C(t,n),e}(),S.Mining=D;var j={};function B(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)}}var U=j&&j.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(j,"__esModule",{value:!0});var H=void 0;j.Net=H,H=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"getConnectionCount",value:function(){return U(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getconnectioncount",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getNetworkInfo",value:function(){return U(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getnetworkinfo",[],"number");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}}])&&B(t.prototype,r),n&&B(t,n),e}(),j.Net=H;var F,V={};function G(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)}}var X=V&&V.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))},Y=V&&V.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(V,"__esModule",{value:!0});var q=(F=void 0,V.SigHashType=F);V.RawTx=q;var W={};!function(e){var t,r=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,o="[BigNumber Error] ",a=o+"Number primitive has more than 15 significant digits: ",u=1e14,s=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],c=1e9;function l(e){var t=0|e;return e>0||e===t?t:t-1}function f(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(r=14-(t=e[n++]+"").length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function h(e,t){var r,n,i=e.c,o=t.c,a=e.s,u=t.s,s=e.e,c=t.e;if(!a||!u)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-u:a;if(a!=u)return a;if(r=a<0,n=s==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return s>c^r?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return s==c?0:s>c^r?1:-1}function p(e,t,r,n){if(e<t||e>r||e!==i(e))throw Error(o+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var t=e.c.length-1;return l(e.e/14)==t&&e.c[t]%2!=0}function d(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function m(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}(t=function e(t){var g,b,y,w,x,R,k,E,O,_=U.prototype={constructor:U,toString:null,valueOf:null},A=new U(1),T=20,N=4,P=-7,S=21,C=-1e7,L=1e7,I=!1,M=1,D=0,j={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},B="0123456789abcdefghijklmnopqrstuvwxyz";function U(e,t){var n,o,u,s,c,l,f,h,v=this;if(!(v instanceof U))return new U(e,t);if(null==t){if(e&&!0===e._isBigNumber)return v.s=e.s,void(!e.c||e.e>L?v.c=v.e=null:e.e<C?v.c=[v.e=0]:(v.e=e.e,v.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(v.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>L?v.c=v.e=null:(v.e=s,v.c=[e]))}h=String(e)}else{if(!r.test(h=String(e)))return y(v,h,l);v.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(s=h.indexOf("."))>-1&&(h=h.replace(".","")),(c=h.search(/e/i))>0?(s<0&&(s=c),s+=+h.slice(c+1),h=h.substring(0,c)):s<0&&(s=h.length)}else{if(p(t,2,B.length,"Base"),10==t)return G(v=new U(e),T+v.e+1,N);if(h=String(e),l="number"==typeof e){if(0*e!=0)return y(v,h,l,t);if(v.s=1/e<0?(h=h.slice(1),-1):1,U.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else v.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(n=B.slice(0,t),s=c=0,f=h.length;c<f;c++)if(n.indexOf(o=h.charAt(c))<0){if("."==o){if(c>s){s=f;continue}}else if(!u&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){u=!0,c=-1,s=0;continue}return y(v,String(e),l,t)}l=!1,(s=(h=b(h,t,10,v.s)).indexOf("."))>-1?h=h.replace(".",""):s=h.length}for(c=0;48===h.charCodeAt(c);c++);for(f=h.length;48===h.charCodeAt(--f););if(h=h.slice(c,++f)){if(f-=c,l&&U.DEBUG&&f>15&&(e>9007199254740991||e!==i(e)))throw Error(a+v.s*e);if((s=s-c-1)>L)v.c=v.e=null;else if(s<C)v.c=[v.e=0];else{if(v.e=s,v.c=[],c=(s+1)%14,s<0&&(c+=14),c<f){for(c&&v.c.push(+h.slice(0,c)),f-=14;c<f;)v.c.push(+h.slice(c,c+=14));c=14-(h=h.slice(c)).length}else c-=f;for(;c--;h+="0");v.c.push(+h)}}else v.c=[v.e=0]}function H(e,t,r,n){var i,o,a,u,s;if(null==r?r=N:p(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)s=f(e.c),s=1==n||2==n&&(a<=P||a>=S)?d(s,a):m(s,a,"0");else if(o=(e=G(new U(e),t,r)).e,u=(s=f(e.c)).length,1==n||2==n&&(t<=o||o<=P)){for(;u<t;s+="0",u++);s=d(s,o)}else if(t-=a,s=m(s,o,"0"),o+1>u){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=o-u)>0)for(o+1==u&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function F(e,t){for(var r,n=1,i=new U(e[0]);n<e.length;n++){if(!(r=new U(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function V(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+14*r-1)>L?e.c=e.e=null:r<C?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,o){var a,c,l,f,h,p,v,d=e.c,m=s;if(d){e:{for(a=1,f=d[0];f>=10;f/=10,a++);if((c=t-a)<0)c+=14,l=t,v=(h=d[p=0])/m[a-l-1]%10|0;else if((p=n((c+1)/14))>=d.length){if(!o)break e;for(;d.length<=p;d.push(0));h=v=0,a=1,l=(c%=14)-14+1}else{for(h=f=d[p],a=1;f>=10;f/=10,a++);v=(l=(c%=14)-14+a)<0?0:h/m[a-l-1]%10|0}if(o=o||t<0||null!=d[p+1]||(l<0?h:h%m[a-l-1]),o=r<4?(v||o)&&(0==r||r==(e.s<0?3:2)):v>5||5==v&&(4==r||o||6==r&&(c>0?l>0?h/m[a-l]:0:d[p-1])%10&1||r==(e.s<0?8:7)),t<1||!d[0])return d.length=0,o?(t-=e.e+1,d[0]=m[(14-t%14)%14],e.e=-t||0):d[0]=e.e=0,e;if(0==c?(d.length=p,f=1,p--):(d.length=p+1,f=m[14-c],d[p]=l>0?i(h/m[a-l]%m[l])*f:0),o)for(;;){if(0==p){for(c=1,l=d[0];l>=10;l/=10,c++);for(l=d[0]+=f,f=1;l>=10;l/=10,f++);c!=f&&(e.e++,d[0]==u&&(d[0]=1));break}if(d[p]+=f,d[p]!=u)break;d[p--]=0,f=1}for(c=d.length;0===d[--c];d.pop());}e.e>L?e.c=e.e=null:e.e<C&&(e.c=[e.e=0])}return e}function X(e){var t,r=e.e;return null===r?e.toString():(t=f(e.c),t=r<=P||r>=S?d(t,r):m(t,r,"0"),e.s<0?"-"+t:t)}return U.clone=e,U.ROUND_UP=0,U.ROUND_DOWN=1,U.ROUND_CEIL=2,U.ROUND_FLOOR=3,U.ROUND_HALF_UP=4,U.ROUND_HALF_DOWN=5,U.ROUND_HALF_EVEN=6,U.ROUND_HALF_CEIL=7,U.ROUND_HALF_FLOOR=8,U.EUCLID=9,U.config=U.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(o+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(p(r=e[t],0,c,t),T=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(p(r=e[t],0,8,t),N=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(p(r[0],-c,0,t),p(r[1],0,c,t),P=r[0],S=r[1]):(p(r,-c,c,t),P=-(S=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)p(r[0],-c,-1,t),p(r[1],1,c,t),C=r[0],L=r[1];else{if(p(r,-c,c,t),!r)throw Error(o+t+" cannot be zero: "+r);C=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(o+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw I=!r,Error(o+"crypto unavailable");I=r}else I=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(p(r=e[t],0,9,t),M=r),e.hasOwnProperty(t="POW_PRECISION")&&(p(r=e[t],0,c,t),D=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(o+t+" not an object: "+r);j=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(o+t+" invalid: "+r);B=r}}return{DECIMAL_PLACES:T,ROUNDING_MODE:N,EXPONENTIAL_AT:[P,S],RANGE:[C,L],CRYPTO:I,MODULO_MODE:M,POW_PRECISION:D,FORMAT:j,ALPHABET:B}},U.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!U.DEBUG)return!0;var t,r,n=e.c,a=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&a>=-c&&a<=c&&a===i(a)){if(0===n[0]){if(0===a&&1===n.length)return!0;break e}if((t=(a+1)%14)<1&&(t+=14),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=u||r!==i(r))break e;if(0!==r)return!0}}}else if(null===n&&null===a&&(null===s||1===s||-1===s))return!0;throw Error(o+"Invalid BigNumber: "+e)},U.maximum=U.max=function(){return F(arguments,_.lt)},U.minimum=U.min=function(){return F(arguments,_.gt)},U.random=(w=9007199254740992*Math.random()&2097151?function(){return i(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,a,u,l,f=0,h=[],v=new U(A);if(null==e?e=T:p(e,0,c),u=n(e/14),I)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(u*=2));f<u;)(l=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(h.push(l%1e14),f+=2);f=u/2}else{if(!crypto.randomBytes)throw I=!1,Error(o+"crypto unavailable");for(t=crypto.randomBytes(u*=7);f<u;)(l=281474976710656*(31&t[f])+1099511627776*t[f+1]+4294967296*t[f+2]+16777216*t[f+3]+(t[f+4]<<16)+(t[f+5]<<8)+t[f+6])>=9e15?crypto.randomBytes(7).copy(t,f):(h.push(l%1e14),f+=7);f=u/7}if(!I)for(;f<u;)(l=w())<9e15&&(h[f++]=l%1e14);for(e%=14,(u=h[--f])&&e&&(l=s[14-e],h[f]=i(u/l)*l);0===h[f];h.pop(),f--);if(f<0)h=[a=0];else{for(a=-1;0===h[0];h.splice(0,1),a-=14);for(f=1,l=h[0];l>=10;l/=10,f++);f<14&&(a-=14-f)}return v.e=a,v.c=h,v}),U.sum=function(){for(var e=1,t=arguments,r=new U(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b=function(){function e(e,t,r,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(t,r,n,i,o){var a,u,s,c,l,h,p,v,d=t.indexOf("."),b=T,y=N;for(d>=0&&(c=D,D=0,t=t.replace(".",""),h=(v=new U(r)).pow(t.length-d),D=c,v.c=e(m(f(h.c),h.e,"0"),10,n,"0123456789"),v.e=v.c.length),s=c=(p=e(t,r,n,o?(a=B,"0123456789"):(a="0123456789",B))).length;0==p[--c];p.pop());if(!p[0])return a.charAt(0);if(d<0?--s:(h.c=p,h.e=s,h.s=i,p=(h=g(h,v,b,y,n)).c,l=h.r,s=h.e),d=p[u=s+b+1],c=n/2,l=l||u<0||null!=p[u+1],l=y<4?(null!=d||l)&&(0==y||y==(h.s<0?3:2)):d>c||d==c&&(4==y||l||6==y&&1&p[u-1]||y==(h.s<0?8:7)),u<1||!p[0])t=l?m(a.charAt(1),-b,a.charAt(0)):a.charAt(0);else{if(p.length=u,l)for(--n;++p[--u]>n;)p[u]=0,u||(++s,p=[1].concat(p));for(c=p.length;!p[--c];);for(d=0,t="";d<=c;t+=a.charAt(p[d++]));t=m(t,s,a.charAt(0))}return t}}(),g=function(){function e(e,t,r){var n,i,o,a,u=0,s=e.length,c=t%1e7,l=t/1e7|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%1e7)+(n=l*o+(a=e[s]/1e7|0)*c)%1e7*1e7+u)/r|0)+(n/1e7|0)+l*a,e[s]=i%r;return u&&(e=[u].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,o,a,s,c){var f,h,p,v,d,m,g,b,y,w,x,R,k,E,O,_,A,T=n.s==o.s?1:-1,N=n.c,P=o.c;if(!(N&&N[0]&&P&&P[0]))return new U(n.s&&o.s&&(N?!P||N[0]!=P[0]:P)?N&&0==N[0]||!P?0*T:T/0:NaN);for(y=(b=new U(T)).c=[],T=a+(h=n.e-o.e)+1,c||(c=u,h=l(n.e/14)-l(o.e/14),T=T/14|0),p=0;P[p]==(N[p]||0);p++);if(P[p]>(N[p]||0)&&h--,T<0)y.push(1),v=!0;else{for(E=N.length,_=P.length,p=0,T+=2,(d=i(c/(P[0]+1)))>1&&(P=e(P,d,c),N=e(N,d,c),_=P.length,E=N.length),k=_,x=(w=N.slice(0,_)).length;x<_;w[x++]=0);A=P.slice(),A=[0].concat(A),O=P[0],P[1]>=c/2&&O++;do{if(d=0,(f=t(P,w,_,x))<0){if(R=w[0],_!=x&&(R=R*c+(w[1]||0)),(d=i(R/O))>1)for(d>=c&&(d=c-1),g=(m=e(P,d,c)).length,x=w.length;1==t(m,w,g,x);)d--,r(m,_<g?A:P,g,c),g=m.length,f=1;else 0==d&&(f=d=1),g=(m=P.slice()).length;if(g<x&&(m=[0].concat(m)),r(w,m,x,c),x=w.length,-1==f)for(;t(P,w,_,x)<1;)d++,r(w,_<x?A:P,x,c),x=w.length}else 0===f&&(d++,w=[0]);y[p++]=d,w[0]?w[x++]=N[k]||0:(w=[N[k]],x=1)}while((k++<E||null!=w[0])&&T--);v=null!=w[0],y[0]||y.splice(0,1)}if(c==u){for(p=1,T=y[0];T>=10;T/=10,p++);G(b,a+(b.e=p+14*h-1)+1,s,v)}else b.e=h,b.r=+v;return b}}(),x=/^(-?)0([xbo])(?=\w[\w.]*$)/i,R=/^([^.]+)\.$/,k=/^\.([^.]+)$/,E=/^-?(Infinity|NaN)$/,O=/^\s*\+(?=[\w.])|^\s+|\s+$/g,y=function(e,t,r,n){var i,a=r?t:t.replace(O,"");if(E.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(x,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(R,"$1").replace(k,"0.$1")),t!=a))return new U(a,i);if(U.DEBUG)throw Error(o+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},_.absoluteValue=_.abs=function(){var e=new U(this);return e.s<0&&(e.s=1),e},_.comparedTo=function(e,t){return h(this,new U(e,t))},_.decimalPlaces=_.dp=function(e,t){var r,n,i,o=this;if(null!=e)return p(e,0,c),null==t?t=N:p(t,0,8),G(new U(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=14*((i=r.length-1)-l(this.e/14)),i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},_.dividedBy=_.div=function(e,t){return g(this,new U(e,t),T,N)},_.dividedToIntegerBy=_.idiv=function(e,t){return g(this,new U(e,t),0,1)},_.exponentiatedBy=_.pow=function(e,t){var r,a,u,s,c,l,f,h,p=this;if((e=new U(e)).c&&!e.isInteger())throw Error(o+"Exponent not an integer: "+X(e));if(null!=t&&(t=new U(t)),c=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return h=new U(Math.pow(+X(p),c?2-v(e):+X(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new U(NaN);(a=!l&&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||c&&p.c[1]>=24e7:p.c[0]<8e13||c&&p.c[0]<=9999975e7)))return s=p.s<0&&v(e)?-0:0,p.e>-1&&(s=1/s),new U(l?1/s:s);D&&(s=n(D/14+2))}for(c?(r=new U(.5),l&&(e.s=1),f=v(e)):f=(u=Math.abs(+X(e)))%2,h=new U(A);;){if(f){if(!(h=h.times(p)).c)break;s?h.c.length>s&&(h.c.length=s):a&&(h=h.mod(t))}if(u){if(0===(u=i(u/2)))break;f=u%2}else if(G(e=e.times(r),e.e+1,1),e.e>14)f=v(e);else{if(0===(u=+X(e)))break;f=u%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):a&&(p=p.mod(t))}return a?h:(l&&(h=A.div(h)),t?h.mod(t):s?G(h,D,N,void 0):h)},_.integerValue=function(e){var t=new U(this);return null==e?e=N:p(e,0,8),G(t,t.e+1,e)},_.isEqualTo=_.eq=function(e,t){return 0===h(this,new U(e,t))},_.isFinite=function(){return!!this.c},_.isGreaterThan=_.gt=function(e,t){return h(this,new U(e,t))>0},_.isGreaterThanOrEqualTo=_.gte=function(e,t){return 1===(t=h(this,new U(e,t)))||0===t},_.isInteger=function(){return!!this.c&&l(this.e/14)>this.c.length-2},_.isLessThan=_.lt=function(e,t){return h(this,new U(e,t))<0},_.isLessThanOrEqualTo=_.lte=function(e,t){return-1===(t=h(this,new U(e,t)))||0===t},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&0==this.c[0]},_.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new U(e,t)).s,!s||!t)return new U(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/14,f=e.e/14,h=a.c,p=e.c;if(!c||!f){if(!h||!p)return h?(e.s=-t,e):new U(p?a:NaN);if(!h[0]||!p[0])return p[0]?(e.s=-t,e):new U(h[0]?a:3==N?-0:0)}if(c=l(c),f=l(f),h=h.slice(),s=c-f){for((o=s<0)?(s=-s,i=h):(f=c,i=p),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=h.length)<(t=p.length))?s:t,s=t=0;t<n;t++)if(h[t]!=p[t]){o=h[t]<p[t];break}if(o&&(i=h,h=p,p=i,e.s=-e.s),(t=(n=p.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=u-1;n>s;){if(h[--n]<p[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=u}h[n]-=p[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?V(e,h,f):(e.s=3==N?-1:1,e.c=[e.e=0],e)},_.modulo=_.mod=function(e,t){var r,n,i=this;return e=new U(e,t),!i.c||!e.s||e.c&&!e.c[0]?new U(NaN):!e.c||i.c&&!i.c[0]?new U(i):(9==M?(n=e.s,e.s=1,r=g(i,e,0,3),e.s=n,r.s*=n):r=g(i,e,0,M),(e=i.minus(r.times(e))).c[0]||1!=M||(e.s=i.s),e)},_.multipliedBy=_.times=function(e,t){var r,n,i,o,a,s,c,f,h,p,v,d,m,g,b=this,y=b.c,w=(e=new U(e,t)).c;if(!(y&&w&&y[0]&&w[0]))return!b.s||!e.s||y&&!y[0]&&!w||w&&!w[0]&&!y?e.c=e.e=e.s=null:(e.s*=b.s,y&&w?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=l(b.e/14)+l(e.e/14),e.s*=b.s,(c=y.length)<(p=w.length)&&(m=y,y=w,w=m,i=c,c=p,p=i),i=c+p,m=[];i--;m.push(0));for(g=u,1e7,i=p;--i>=0;){for(r=0,v=w[i]%1e7,d=w[i]/1e7|0,o=i+(a=c);o>i;)r=((f=v*(f=y[--a]%1e7)+(s=d*f+(h=y[a]/1e7|0)*v)%1e7*1e7+m[o]+r)/g|0)+(s/1e7|0)+d*h,m[o--]=f%g;m[o]=r}return r?++n:m.splice(0,1),V(e,m,n)},_.negated=function(){var e=new U(this);return e.s=-e.s||null,e},_.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new U(e,t)).s,!i||!t)return new U(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/14,a=e.e/14,s=n.c,c=e.c;if(!o||!a){if(!s||!c)return new U(i/0);if(!s[0]||!c[0])return c[0]?e:new U(s[0]?n:0*i)}if(o=l(o),a=l(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=c):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=c.length)<0&&(r=c,c=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/u|0,s[t]=u===s[t]?0:s[t]%u;return i&&(s=[i].concat(s),++a),V(e,s,a)},_.precision=_.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return p(e,1,c),null==t?t=N:p(t,0,8),G(new U(o),e,t);if(!(r=o.c))return null;if(n=14*(i=r.length-1)+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},_.shiftedBy=function(e){return p(e,-9007199254740991,9007199254740991),this.times("1e"+e)},_.squareRoot=_.sqrt=function(){var e,t,r,n,i,o=this,a=o.c,u=o.s,s=o.e,c=T+4,h=new U("0.5");if(1!==u||!a||!a[0])return new U(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+X(o)))||u==1/0?(((t=f(a)).length+s)%2==0&&(t+="0"),u=Math.sqrt(+t),s=l((s+1)/2)-(s<0||s%2),r=new U(t=u==1/0?"5e"+s:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+s)):r=new U(u+""),r.c[0])for((u=(s=r.e)+c)<3&&(u=0);;)if(i=r,r=h.times(i.plus(g(o,i,c,1))),f(i.c).slice(0,u)===(t=f(r.c)).slice(0,u)){if(r.e<s&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(r,r.e+T+2,1),e=!r.times(r).eq(o));break}if(!n&&(G(i,i.e+T+2,0),i.times(i).eq(o))){r=i;break}c+=4,u+=4,n=1}return G(r,r.e+T+1,N,e)},_.toExponential=function(e,t){return null!=e&&(p(e,0,c),e++),H(this,e,t,1)},_.toFixed=function(e,t){return null!=e&&(p(e,0,c),e=e+this.e+1),H(this,e,t)},_.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=j;else if("object"!=typeof r)throw Error(o+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var a,u=n.split("."),s=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",f=u[0],h=u[1],p=i.s<0,v=p?f.slice(1):f,d=v.length;if(c&&(a=s,s=c,c=a,d-=a),s>0&&d>0){for(a=d%s||s,f=v.substr(0,a);a<d;a+=s)f+=l+v.substr(a,s);c>0&&(f+=l+v.slice(a)),p&&(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||"")},_.toFraction=function(e){var t,r,n,i,a,u,c,l,h,p,v,d,m=this,b=m.c;if(null!=e&&(!(c=new U(e)).isInteger()&&(c.c||1!==c.s)||c.lt(A)))throw Error(o+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!b)return new U(m);for(t=new U(A),h=r=new U(A),n=l=new U(A),d=f(b),a=t.e=d.length-m.e-1,t.c[0]=s[(u=a%14)<0?14+u:u],e=!e||c.comparedTo(t)>0?a>0?t:h:c,u=L,L=1/0,c=new U(d),l.c[0]=0;p=g(c,t,0,1),1!=(i=r.plus(p.times(n))).comparedTo(e);)r=n,n=i,h=l.plus(p.times(i=h)),l=i,t=c.minus(p.times(i=t)),c=i;return i=g(e.minus(r),n,0,1),l=l.plus(i.times(h)),r=r.plus(i.times(n)),l.s=h.s=m.s,v=g(h,n,a*=2,N).minus(m).abs().comparedTo(g(l,r,a,N).minus(m).abs())<1?[h,n]:[l,r],L=u,v},_.toNumber=function(){return+X(this)},_.toPrecision=function(e,t){return null!=e&&p(e,1,c),H(this,e,t,2)},_.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<=P||i>=S?d(f(r.c),i):m(f(r.c),i,"0"):10===e?t=m(f((r=G(new U(r),T+i+1,N)).c),r.e,"0"):(p(e,2,B.length,"Base"),t=b(m(f(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},_.valueOf=_.toJSON=function(){return X(this)},_._isBigNumber=!0,null!=t&&U.set(t),U}()).default=t.BigNumber=t,W?W=t:(e||(e="undefined"!=typeof self&&self?self:window),e.BigNumber=t)}(W);var J,K,$=Y(W);(K=J=V.SigHashType||(F={},V.SigHashType=F)).ALL="ALL",K.NONE="NONE",K.SINGLE="SINGLE",K.ALL_ANYONECANPAY="ALL|ANYONECANPAY",K.NONE_ANYONECANPAY="NONE|ANYONECANPAY",K.SINGLE_ANYONECANPAY="SINGLE|ANYONECANPAY",q=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"createRawTransaction",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return X(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.locktime,o=void 0===i?0:i,a=r.replaceable,u=void 0!==a&&a,n.next=3,this.client.call("createrawtransaction",[e,t,o,u],"number");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"signRawTransactionWithKey",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return X(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.prevTxs,o=void 0===i?[]:i,a=r.sigHashType,u=void 0===a?J.ALL:a,n.next=3,this.client.call("signrawtransactionwithkey",[e,t,o,u],"number");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"testMempoolAccept",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new $.default("0");return X(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("testmempoolaccept",[[e],t],"number");case 2:return n=r.sent,r.abrupt("return",n[0]);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"sendRawTransaction",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new $.default("0");return X(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("sendrawtransaction",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getRawTransaction",value:function(e,t,r){return X(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.client.call("getrawtransaction",[e,t,r],"number");case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}}])&&G(t.prototype,r),n&&G(t,n),e}(),V.RawTx=q;var z,Q,Z,ee,te,re,ne={};function ie(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)}}var oe=ne&&ne.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(ne,"__esModule",{value:!0});var ae,ue,se,ce,le,fe,he,pe=(z=void 0,Q=ne.Mode=z,Z=ne.AddressType=Q,ee=ne.ScriptType=Z,te=ne.WalletFlag=ee,re=ne.BIP125=te,ne.InWalletTransactionCategory=re);ne.Wallet=pe,(ue=ae=ne.Mode||(z={},ne.Mode=z)).UNSET="UNSET",ue.ECONOMICAL="ECONOMICAL",ue.CONSERVATIVE="CONSERVATIVE",(ce=se=ne.AddressType||(Q={},ne.AddressType=Q)).LEGACY="legacy",ce.P2SH_SEGWIT="p2sh-segwit",ce.BECH32="bech32",(le=ne.ScriptType||(Z={},ne.ScriptType=Z)).NONSTANDARD="nonstandard",le.PUBKEY="pubkey",le.PUBKEYHASH="pubkeyhash",le.SCRIPTHASH="scripthash",le.MULTISIG="multisig",le.NULLDATA="nulldata",le.WITNESS_V0_KEYHASH="witness_v0_keyhash",le.WITNESS_UNKNOWN="witness_unknown",(ne.WalletFlag||(ee={},ne.WalletFlag=ee)).AVOID_REUSE="avoid_reuse",(fe=ne.BIP125||(te={},ne.BIP125=te)).YES="yes",fe.NO="no",fe.UNKNOWN="unknown",(he=ne.InWalletTransactionCategory||(re={},ne.InWalletTransactionCategory=re)).SEND="send",he.RECEIVE="receive",he.GENERATE="generate",he.IMMATURE="immature",he.ORPHAN="orphan",pe=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"getBalance",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return oe(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getbalance",["*",e,t],"bignumber");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getUnconfirmedBalance",value:function(){return oe(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getunconfirmedbalance",[!1],"bignumber");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getBalances",value:function(){return oe(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getbalances",[!1],"bignumber");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"listUnspent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9999999,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return oe(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u,s,c;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.addresses,o=void 0===i?[]:i,a=r.includeUnsafe,u=void 0===a||a,s=r.queryOptions,c=void 0===s?{}:s,n.next=3,this.client.call("listunspent",[e,t,o,u,c],{amount:"bignumber"});case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"createWallet",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return oe(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u,s,c;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.blank,o=void 0!==i&&i,a=r.passphrase,u=void 0===a?"":a,s=r.avoidReuse,c=void 0!==s&&s,n.next=3,this.client.call("createwallet",[e,t,o,u,c],"number");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getWalletInfo",value:function(){return oe(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("getwalletinfo",[],{balance:"bignumber",unconfirmed_balance:"bignumber",immature_balance:"bignumber",paytxfee:"bignumber"});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"setWalletFlag",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return oe(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("setwalletflag",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"getNewAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:se.BECH32;return oe(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("getnewaddress",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"validateAddress",value:function(e){return oe(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.client.call("validateaddress",[e],"number");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"getAddressInfo",value:function(e){return oe(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.client.call("getaddressinfo",[e],"number");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"sendToAddress",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return oe(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u,s,c,l,f,h,p,v,d,m,g;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.comment,o=void 0===i?"":i,a=r.commentTo,u=void 0===a?"":a,s=r.subtractFeeFromAmount,c=void 0!==s&&s,l=r.replaceable,f=void 0!==l&&l,h=r.confTarget,p=void 0===h?6:h,v=r.estimateMode,d=void 0===v?ae.UNSET:v,m=r.avoidReuse,g=void 0!==m&&m,n.next=3,this.client.call("sendtoaddress",[e,t,o,u,c,f,p,d,g],"bignumber");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"listAddressGroupings",value:function(){return oe(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.client.call("listaddressgroupings",[],"bignumber");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"sendMany",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return oe(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o,a,u,s,c,l,f;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.comment,o=void 0===i?"":i,a=r.replaceable,u=void 0!==a&&a,s=r.confTarget,c=void 0===s?6:s,l=r.estimateMode,f=void 0===l?ae.UNSET:l,n.next=5,this.client.call("sendmany",["",e,0,o,t,u,c,f],"bignumber");case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"dumpPrivKey",value:function(e){return oe(this,void 0,void 0,regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.client.call("dumpprivkey",[e],"number");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"importPrivKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return oe(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.client.call("importprivkey",[e,t,r],"number");case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getTransaction",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return oe(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("gettransaction",[e,t],{amount:"bignumber"});case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}}])&&ie(t.prototype,r),n&&ie(t,n),e}(),ne.Wallet=pe;var ve,de,me,ge={};function be(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)}}var ye=ge&&ge.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function u(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,u)}s((n=n.apply(e,t||[])).next())}))};Object.defineProperty(ge,"__esModule",{value:!0});var we,xe,Re,ke,Ee,Oe=(ve=void 0,de=ge.OwnerType=ve,me=ge.DfTxType=de,ge.SelectionModeType=me);ge.Account=Oe,(xe=we=ge.OwnerType||(ve={},ge.OwnerType=ve)).MINE="mine",xe.ALL="all",(Re=ge.DfTxType||(de={},ge.DfTxType=de)).MINT_TOKEN="M",Re.POOL_SWAP="s",Re.ADD_POOL_LIQUIDITY="l",Re.REMOVE_POOL_LIQUIDITY="r",Re.UTXOS_TO_ACCOUNT="U",Re.ACCOUNT_TO_UTXOS="b",Re.ACCOUNT_TO_ACCOUNT="B",Re.ANY_ACCOUNTS_TO_ACCOUNTS="a",Re.CREATE_MASTERNODE="C",Re.RESIGN_MASTERNODE="R",Re.CREATE_TOKEN="T",Re.UPDATE_TOKEN="N",Re.UPDATE_TOKEN_ANY="n",Re.CREATE_POOL_PAIR="p",Re.UPDATE_POOL_PAIR="u",Re.SET_GOV_VARIABLE="G",Re.AUTO_AUTH_PREP="A",Re.NONE="0",(Ee=ke=ge.SelectionModeType||(me={},ge.SelectionModeType=me)).PIE="pie",Ee.CRUMBS="crumbs",Ee.FORWARD="forward",Oe=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.client=t}var t,r,n;return t=e,(r=[{key:"listAccounts",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{limit:100},t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{indexedAmounts:!1,isMineOnly:!1};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.indexedAmounts,o=r.isMineOnly,n.next=3,this.client.call("listaccounts",[e,t,i,o],"bignumber");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getAccount",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:100},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{indexedAmounts:!1};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i,o;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.indexedAmounts,o=void 0!==i&&i,n.next=3,this.client.call("getaccount",[e,t,o],"number");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"getTokenBalances",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{limit:100},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{symbolLookup:!1};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){var i;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r.symbolLookup,n.next=3,this.client.call("gettokenbalances",[e,t,i],"bignumber");case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n,this)})))}},{key:"utxosToAccount",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return ye(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("utxostoaccount",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"accountToAccount",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{utxos:[]};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.client.call("accounttoaccount",[e,t,r.utxos],"number");case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"accountToUtxos",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{utxos:[]};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.client.call("accounttoutxos",[e,t,r.utxos],"number");case 2:return n.abrupt("return",n.sent);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"listAccountHistory",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:we.MINE,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:100};return ye(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("listaccounthistory",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"historyCount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:we.MINE,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ye(this,void 0,void 0,regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.client.call("accounthistorycount",[e,t],"number");case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))}},{key:"sendTokensToAddress",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{selectionMode:ke.PIE};return ye(this,void 0,void 0,regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function