Comparing version 1.1.3 to 1.1.4
@@ -66,8 +66,7 @@ "use strict"; | ||
} | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(utils_1.ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
if (attributes.reward == undefined) { | ||
let length = (typeof attributes.data == 'string' && attributes.data.length > 0) ? attributes.data.length : 0; | ||
attributes.reward = await this.transactions.getPrice(length); | ||
attributes.reward = await this.transactions.getPrice(encrypted.byteLength); | ||
} | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(utils_1.ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
attributes.data = utils_1.ArweaveUtils.bufferTob64Url(encrypted); | ||
@@ -74,0 +73,0 @@ const transaction = new transaction_1.Transaction(attributes); |
@@ -1,2 +0,2 @@ | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t,r){"use strict";var n=r(4),i=r(18),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,i=arguments.length;n<i;n++)c(arguments[n],r);return t},extend:function(e,t,r){return c(t,function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38);class i{static concatBuffers(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r].byteLength;let r=new Uint8Array(t),n=0;r.set(new Uint8Array(e[0]),n),n+=e[0].byteLength;for(let t=1;t<e.length;t++)r.set(new Uint8Array(e[t]),n),n+=e[t].byteLength;return r}static b64UrlToString(e){let t=i.b64UrlToBuffer(e);if("undefined"==typeof TextDecoder){return new(0,r(3).TextDecoder)("utf-8",{fatal:!0}).decode(t)}return new TextDecoder("utf-8",{fatal:!0}).decode(t)}static bufferToString(e){if("undefined"==typeof TextDecoder){return new(0,r(3).TextDecoder)("utf-8",{fatal:!0}).decode(e)}return new TextDecoder("utf-8",{fatal:!0}).decode(e)}static stringToBuffer(e){if("undefined"==typeof TextEncoder){return(new(0,r(3).TextEncoder)).encode(e)}return(new TextEncoder).encode(e)}static stringToB64Url(e){return i.bufferTob64Url(i.stringToBuffer(e))}static b64UrlToBuffer(e){return new Uint8Array(n.toByteArray(i.b64UrlDecode(e)))}static bufferTob64(e){return n.fromByteArray(new Uint8Array(e))}static bufferTob64Url(e){return i.b64UrlEncode(i.bufferTob64(e))}static b64UrlEncode(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static b64UrlDecode(e){let t;return t=(e=e.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-e.length%4,e.concat("=".repeat(t))}}t.ArweaveUtils=i},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(20),o={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:("undefined"!=typeof XMLHttpRequest?a=r(6):void 0!==t&&(a=r(6)),a),transformRequest:[function(e,t){return i(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],function(e){u.headers[e]={}}),n.forEach(["post","put","patch"],function(e){u.headers[e]=n.merge(o)}),e.exports=u}).call(this,r(5))},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!w(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,s=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r<o;u=n[++r])g(u)||!b(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(m(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;return function(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}};var o,s={};function a(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&S(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return w(i)||(i=f(e,i,n)),i}var o=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(w(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(r);if(0===s.length){if(S(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return l(r)}var c,b="",E=!1,x=["{","}"];(h(r)&&(E=!0,x=["[","]"]),S(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(b=" "+RegExp.prototype.toString.call(r)),A(r)&&(b=" "+Date.prototype.toUTCString.call(r)),T(r)&&(b=" "+l(r)),0!==s.length||E&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=E?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)U(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))}),o}(e,r,n,a,s):s.map(function(t){return p(e,r,n,a,t,E)}),e.seen.pop(),function(e,t,r){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,b,x)):x[0]+b+x[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),U(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(r)?f(e,u.value,null):f(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),m(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function h(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function w(e){return"string"==typeof e}function m(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function A(e){return b(e)&&"[object Date]"===E(e)}function T(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(m(o)&&(o=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=w,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=v,t.isObject=b,t.isDate=A,t.isError=T,t.isFunction=S,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(40);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function U(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":"),[e.getDate(),O[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(41),t._extend=function(e,t){if(!t||!b(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(39),r(5))},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&h())}function h(){if(!f){var e=a(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0),i=r(21),o=r(23),s=r(24),a=r(25),u=r(7),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(26);e.exports=function(e){return new Promise(function(t,f){var l=e.data,p=e.headers;n.isFormData(l)&&delete p["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",g=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||a(e.url)||(h=new window.XDomainRequest,d="onload",g=!0,h.onprogress=function(){},h.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";p.Authorization="Basic "+c(y+":"+w)}if(h.open(e.method.toUpperCase(),o(e.url,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,h[d]=function(){if(h&&(4===h.readyState||g)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?h.response:h.responseText,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:r,config:e,request:h};i(t,f,n),h=null}},h.onerror=function(){f(u("Network Error",e,null,h)),h=null},h.ontimeout=function(){f(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",h)),h=null},n.isStandardBrowserEnv()){var m=r(27),v=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;v&&(p[e.xsrfHeaderName]=v)}if("setRequestHeader"in h&&n.forEach(p,function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)}),e.withCredentials&&(h.withCredentials=!0),e.responseType)try{h.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){h&&(h.abort(),f(e),h=null)}),void 0===l&&(l=null),h.send(l)})}},function(e,t,r){"use strict";var n=r(22);e.exports=function(e,t,r,i,o){var s=new Error(e);return n(s,t,r,i,o)}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1);class i{get(e,t){if(!Object.getOwnPropertyNames(this).includes(e))throw new Error(`Field "${e}" is not a property of the Arweave Transaction class.`);return t&&1==t.decode?t&&t.string?n.ArweaveUtils.b64UrlToString(this[e]):n.ArweaveUtils.b64UrlToBuffer(this[e]):this[e]}}class o extends i{constructor(e,t,r=!1){super(),this.name=e,this.value=t}}t.Tag=o;t.Transaction=class extends i{constructor(e){super(),this.last_tx="",this.owner="",this.tags=[],this.target="",this.quantity="0",this.data="",this.reward="0",this.signature="",Object.assign(this,e),e.tags&&(this.tags=e.tags.map(e=>new o(e.name,e.value)))}addTag(e,t){this.tags.push(new o(n.ArweaveUtils.stringToB64Url(e),n.ArweaveUtils.stringToB64Url(t)))}toJSON(){return{id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:this.data,reward:this.reward,signature:this.signature}}setSignature({signature:e,id:t}){this.signature=e,this.id=t}getSignatureData(){let e=this.tags.reduce((e,t)=>e+t.get("name",{decode:!0,string:!0})+t.get("value",{decode:!0,string:!0}),"");return n.ArweaveUtils.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),n.ArweaveUtils.stringToBuffer(this.quantity),n.ArweaveUtils.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),n.ArweaveUtils.stringToBuffer(e)])}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(12),i=r(44);window.Arweave={init:e=>new n.Arweave({api:e,crypto:new i.WebCryptoDriver})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(13),i=r(15),o=r(35),s=r(36),a=r(42),u=r(10),c=r(1),f=r(43);t.Arweave=class{constructor(e){this.crypto=e.crypto,this.api=new i.Api(e.api),this.wallets=new a.Wallets(this.api,e.crypto),this.transactions=new s.Transactions(this.api,e.crypto),this.silo=new f.Silo(this.api,this.crypto,this.transactions),this.network=new o.Network(this.api),this.ar=new n.Ar,this.utils=c.ArweaveUtils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(e,t){if(!(e.data||e.target&&e.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");let r=await this.wallets.jwkToAddress(t);if(null==e.owner&&(e.owner=t.n),null==e.last_tx&&(e.last_tx=await this.wallets.getLastTransactionID(r)),null==e.reward){let t="string"==typeof e.data&&e.data.length>0?e.data.length:0,r="string"==typeof e.target&&e.target.length>0?e.target:null;e.reward=await this.transactions.getPrice(t,r)}return e.data&&(e.data=c.ArweaveUtils.stringToB64Url(e.data)),new u.Transaction(e)}async createSiloTransaction(e,t,r){if(!e.data)throw new Error("Silo transactions must have a 'data' value");if(!r)throw new Error("No Silo URI specified.");if(e.target||e.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");let n=await this.wallets.jwkToAddress(t);if(null==e.owner&&(e.owner=t.n),null==e.last_tx&&(e.last_tx=await this.wallets.getLastTransactionID(n)),null==e.reward){let t="string"==typeof e.data&&e.data.length>0?e.data.length:0;e.reward=await this.transactions.getPrice(t)}const i=await this.silo.parseUri(r),o=await this.crypto.encrypt(c.ArweaveUtils.stringToBuffer(e.data),i.getEncryptionKey());e.data=c.ArweaveUtils.bufferTob64Url(o);const s=new u.Transaction(e);return s.addTag("Silo-Name",i.getAccessKey()),s.addTag("Silo-Version","0.1.0"),s}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(14);t.Ar=class{constructor(){this.BigNum=((e,t)=>new(n.BigNumber.clone({DECIMAL_PLACES:t}))(e))}winstonToAr(e,{formatted:t=!1,decimals:r=12,trim:n=!0}={}){let i=this.stringToBigNum(e,r).shiftedBy(-12);return t?i.toFormat(r):i.toFixed(r)}arToWinston(e,{formatted:t=!1}={}){let r=this.stringToBigNum(e).shiftedBy(12);return t?r.toFormat():r.toFixed(0)}compare(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.comparedTo(n)}isEqual(e,t){return 0===this.compare(e,t)}isLessThan(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.isLessThan(n)}isGreaterThan(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.isGreaterThan(n)}add(e,t){let r=this.stringToBigNum(e);return this.stringToBigNum(t),r.plus(t).toFixed(0)}sub(e,t){let r=this.stringToBigNum(e);return this.stringToBigNum(t),r.minus(t).toFixed(0)}stringToBigNum(e,t=12){return this.BigNum(e,t)}}},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,p=14,h=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function w(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=p-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,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(e,t,r,n){if(e<t||e>r||e!==(e<0?a(e):u(e)))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function A(e){var t=e.c.length-1;return w(e.e/p)==t&&e.c[t]%2!=0}function T(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(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}(o=function e(t){var r,n,i,o,E,x,O,U,N,B=K.prototype={constructor:K,toString:null,valueOf:null},C=new K(1),j=20,_=4,R=-7,D=21,P=-1e7,L=1e7,I=!1,q=1,k=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},F="0123456789abcdefghijklmnopqrstuvwxyz";function K(e,t){var r,o,a,c,l,d,g,y,w=this;if(!(w instanceof K))return new K(e,t);if(null==t){if(e instanceof K)return w.s=e.s,w.e=e.e,void(w.c=(e=e.c)?e.slice():e);if((d="number"==typeof e)&&0*e==0){if(w.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return w.e=c,void(w.c=[e])}y=String(e)}else{if(y=String(e),!s.test(y))return i(w,y,d);w.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(c=y.indexOf("."))>-1&&(y=y.replace(".","")),(l=y.search(/e/i))>0?(c<0&&(c=l),c+=+y.slice(l+1),y=y.substring(0,l)):c<0&&(c=y.length)}else{if(b(t,2,F.length,"Base"),y=String(e),10==t)return G(w=new K(e instanceof K?e:y),j+w.e+1,_);if(d="number"==typeof e){if(0*e!=0)return i(w,y,d,t);if(w.s=1/e<0?(y=y.slice(1),-1):1,K.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);d=!1}else w.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(r=F.slice(0,t),c=l=0,g=y.length;l<g;l++)if(r.indexOf(o=y.charAt(l))<0){if("."==o){if(l>c){c=g;continue}}else if(!a&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){a=!0,l=-1,c=0;continue}return i(w,String(e),d,t)}(c=(y=n(y,t,10,w.s)).indexOf("."))>-1?y=y.replace(".",""):c=y.length}for(l=0;48===y.charCodeAt(l);l++);for(g=y.length;48===y.charCodeAt(--g););if(y=y.slice(l,++g)){if(g-=l,d&&K.DEBUG&&g>15&&(e>h||e!==u(e)))throw Error(f+w.s*e);if((c=c-l-1)>L)w.c=w.e=null;else if(c<P)w.c=[w.e=0];else{if(w.e=c,w.c=[],l=(c+1)%p,c<0&&(l+=p),l<g){for(l&&w.c.push(+y.slice(0,l)),g-=p;l<g;)w.c.push(+y.slice(l,l+=p));y=y.slice(l),l=p-y.length}else l-=g;for(;l--;y+="0");w.c.push(+y)}}else w.c=[w.e=0]}function z(e,t,r,n){var i,o,s,a,u;if(null==r?r=_:b(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=m(e.c),u=1==n||2==n&&s<=R?T(u,s):S(u,s,"0");else if(o=(e=G(new K(e),t,r)).e,a=(u=m(e.c)).length,1==n||2==n&&(t<=o||o<=R)){for(;a<t;u+="0",a++);u=T(u,o)}else if(t-=s,u=S(u,o,"0"),o+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-a)>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function $(e,t){for(var r,n=1,i=new K(e[0]);n<e.length;n++){if(!(r=new K(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function H(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*p-1)>L?e.c=e.e=null:r<P?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var i,o,s,c,f,h,g,y=e.c,w=d;if(y){e:{for(i=1,c=y[0];c>=10;c/=10,i++);if((o=t-i)<0)o+=p,s=t,g=(f=y[h=0])/w[i-s-1]%10|0;else if((h=a((o+1)/p))>=y.length){if(!n)break e;for(;y.length<=h;y.push(0));f=g=0,i=1,s=(o%=p)-p+1}else{for(f=c=y[h],i=1;c>=10;c/=10,i++);g=(s=(o%=p)-p+i)<0?0:f/w[i-s-1]%10|0}if(n=n||t<0||null!=y[h+1]||(s<0?f:f%w[i-s-1]),n=r<4?(g||n)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||n||6==r&&(o>0?s>0?f/w[i-s]:0:y[h-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,n?(t-=e.e+1,y[0]=w[(p-t%p)%p],e.e=-t||0):y[0]=e.e=0,e;if(0==o?(y.length=h,c=1,h--):(y.length=h+1,c=w[p-o],y[h]=s>0?u(f/w[i-s]%w[s])*c:0),n)for(;;){if(0==h){for(o=1,s=y[0];s>=10;s/=10,o++);for(s=y[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,y[0]==l&&(y[0]=1));break}if(y[h]+=c,y[h]!=l)break;y[h--]=0,c=1}for(o=y.length;0===y[--o];y.pop());}e.e>L?e.c=e.e=null:e.e<P&&(e.c=[e.e=0])}return e}function V(e){var t,r=e.e;return null===r?e.toString():(t=m(e.c),t=r<=R||r>=D?T(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return K.clone=e,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,y,t),j=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),_=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-y,0,t),b(r[1],0,y,t),R=r[0],D=r[1]):(b(r,-y,y,t),R=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-y,-1,t),b(r[1],1,y,t),P=r[0],L=r[1];else{if(b(r,-y,y,t),!r)throw Error(c+t+" cannot be zero: "+r);P=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw I=!r,Error(c+"crypto unavailable");I=r}else I=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),q=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,y,t),k=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);M=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);F=r}}return{DECIMAL_PLACES:j,ROUNDING_MODE:_,EXPONENTIAL_AT:[R,D],RANGE:[P,L],CRYPTO:I,MODULO_MODE:q,POW_PRECISION:k,FORMAT:M,ALPHABET:F}},K.isBigNumber=function(e){return e instanceof K||e&&!0===e._isBigNumber||!1},K.maximum=K.max=function(){return $(arguments,B.lt)},K.minimum=K.min=function(){return $(arguments,B.gt)},K.random=(o=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,f=0,l=[],h=new K(C);if(null==e?e=j:b(e,0,y),i=a(e/p),I)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(s=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw I=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(s=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):(l.push(s%1e14),f+=7);f=i/7}if(!I)for(;f<i;)(s=o())<9e15&&(l[f++]=s%1e14);for(i=l[--f],e%=p,i&&e&&(s=d[p-e],l[f]=u(i/s)*s);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=p);for(f=1,s=l[0];s>=10;s/=10,f++);f<p&&(n-=p-f)}return h.e=n,h.c=l,h}),K.sum=function(){for(var e=1,t=arguments,r=new K(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,o,s=[0],a=0,u=e.length;a<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,n,i,o,s){var a,u,c,f,l,p,h,d,g=t.indexOf("."),y=j,w=_;for(g>=0&&(f=k,k=0,t=t.replace(".",""),p=(d=new K(n)).pow(t.length-g),k=f,d.c=e(S(m(p.c),p.e,"0"),10,i,"0123456789"),d.e=d.c.length),c=f=(h=e(t,n,i,s?(a=F,"0123456789"):(a="0123456789",F))).length;0==h[--f];h.pop());if(!h[0])return a.charAt(0);if(g<0?--c:(p.c=h,p.e=c,p.s=o,h=(p=r(p,d,y,w,i)).c,l=p.r,c=p.e),g=h[u=c+y+1],f=i/2,l=l||u<0||null!=h[u+1],l=w<4?(null!=g||l)&&(0==w||w==(p.s<0?3:2)):g>f||g==f&&(4==w||l||6==w&&1&h[u-1]||w==(p.s<0?8:7)),u<1||!h[0])t=l?S(a.charAt(1),-y,a.charAt(0)):a.charAt(0);else{if(h.length=u,l)for(--i;++h[--u]>i;)h[u]=0,u||(++c,h=[1].concat(h));for(f=h.length;!h[--f];);for(g=0,t="";g<=f;t+=a.charAt(h[g++]));t=S(t,c,a.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,u=e.length,c=t%g,f=t/g|0;for(e=e.slice();u--;)a=((i=c*(o=e[u]%g)+(n=f*o+(s=e[u]/g|0)*c)%g*g+a)/r|0)+(n/g|0)+f*s,e[u]=i%r;return a&&(e=[a].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,o,s,a){var c,f,h,d,g,y,m,v,b,A,T,S,E,x,O,U,N,B=n.s==i.s?1:-1,C=n.c,j=i.c;if(!(C&&C[0]&&j&&j[0]))return new K(n.s&&i.s&&(C?!j||C[0]!=j[0]:j)?C&&0==C[0]||!j?0*B:B/0:NaN);for(b=(v=new K(B)).c=[],B=o+(f=n.e-i.e)+1,a||(a=l,f=w(n.e/p)-w(i.e/p),B=B/p|0),h=0;j[h]==(C[h]||0);h++);if(j[h]>(C[h]||0)&&f--,B<0)b.push(1),d=!0;else{for(x=C.length,U=j.length,h=0,B+=2,(g=u(a/(j[0]+1)))>1&&(j=e(j,g,a),C=e(C,g,a),U=j.length,x=C.length),E=U,T=(A=C.slice(0,U)).length;T<U;A[T++]=0);N=j.slice(),N=[0].concat(N),O=j[0],j[1]>=a/2&&O++;do{if(g=0,(c=t(j,A,U,T))<0){if(S=A[0],U!=T&&(S=S*a+(A[1]||0)),(g=u(S/O))>1)for(g>=a&&(g=a-1),m=(y=e(j,g,a)).length,T=A.length;1==t(y,A,m,T);)g--,r(y,U<m?N:j,m,a),m=y.length,c=1;else 0==g&&(c=g=1),m=(y=j.slice()).length;if(m<T&&(y=[0].concat(y)),r(A,y,T,a),T=A.length,-1==c)for(;t(j,A,U,T)<1;)g++,r(A,U<T?N:j,T,a),T=A.length}else 0===c&&(g++,A=[0]);b[h++]=g,A[0]?A[T++]=C[E]||0:(A=[C[E]],T=1)}while((E++<x||null!=A[0])&&B--);d=null!=A[0],b[0]||b.splice(0,1)}if(a==l){for(h=1,B=b[0];B>=10;B/=10,h++);G(v,o+(v.e=h+f*p-1)+1,s,d)}else v.e=f,v.r=+d;return v}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,O=/^\.([^.]+)$/,U=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(N,"");if(U.test(o))e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null;else{if(!r&&(o=o.replace(E,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(x,"$1").replace(O,"0.$1")),t!=o))return new K(o,i);if(K.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.c=e.e=e.s=null}},B.absoluteValue=B.abs=function(){var e=new K(this);return e.s<0&&(e.s=1),e},B.comparedTo=function(e,t){return v(this,new K(e,t))},B.decimalPlaces=B.dp=function(e,t){var r,n,i,o=this;if(null!=e)return b(e,0,y),null==t?t=_:b(t,0,8),G(new K(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-w(this.e/p))*p,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},B.dividedBy=B.div=function(e,t){return r(this,new K(e,t),j,_)},B.dividedToIntegerBy=B.idiv=function(e,t){return r(this,new K(e,t),0,1)},B.exponentiatedBy=B.pow=function(e,t){var r,n,i,o,s,f,l,h,d=this;if((e=new K(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+V(e));if(null!=t&&(t=new K(t)),s=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return h=new K(Math.pow(+V(d),s?2-A(e):+V(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new K(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||s&&d.c[1]>=24e7:d.c[0]<8e13||s&&d.c[0]<=9999975e7)))return o=d.s<0&&A(e)?-0:0,d.e>-1&&(o=1/o),new K(f?1/o:o);k&&(o=a(k/p+2))}for(s?(r=new K(.5),f&&(e.s=1),l=A(e)):l=(i=Math.abs(+V(e)))%2,h=new K(C);;){if(l){if(!(h=h.times(d)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(G(e=e.times(r),e.e+1,1),e.e>14)l=A(e);else{if(0==(i=+V(e)))break;l=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}return n?h:(f&&(h=C.div(h)),t?h.mod(t):o?G(h,k,_,void 0):h)},B.integerValue=function(e){var t=new K(this);return null==e?e=_:b(e,0,8),G(t,t.e+1,e)},B.isEqualTo=B.eq=function(e,t){return 0===v(this,new K(e,t))},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(e,t){return v(this,new K(e,t))>0},B.isGreaterThanOrEqualTo=B.gte=function(e,t){return 1===(t=v(this,new K(e,t)))||0===t},B.isInteger=function(){return!!this.c&&w(this.e/p)>this.c.length-2},B.isLessThan=B.lt=function(e,t){return v(this,new K(e,t))<0},B.isLessThanOrEqualTo=B.lte=function(e,t){return-1===(t=v(this,new K(e,t)))||0===t},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&0==this.c[0]},B.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new K(e,t)).s,!a||!t)return new K(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,c=e.e/p,f=s.c,h=e.c;if(!u||!c){if(!f||!h)return f?(e.s=-t,e):new K(h?s:NaN);if(!f[0]||!h[0])return h[0]?(e.s=-t,e):new K(f[0]?s:3==_?-0:0)}if(u=w(u),c=w(c),f=f.slice(),a=u-c){for((o=a<0)?(a=-a,i=f):(c=u,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=h.length))?a:t,a=t=0;t<n;t++)if(f[t]!=h[t]){o=f[t]<h[t];break}if(o&&(i=f,f=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]<h[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=h[n]}for(;0==f[0];f.splice(0,1),--c);return f[0]?H(e,f,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},B.modulo=B.mod=function(e,t){var n,i,o=this;return e=new K(e,t),!o.c||!e.s||e.c&&!e.c[0]?new K(NaN):!e.c||o.c&&!o.c[0]?new K(o):(9==q?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,q),(e=o.minus(n.times(e))).c[0]||1!=q||(e.s=o.s),e)},B.multipliedBy=B.times=function(e,t){var r,n,i,o,s,a,u,c,f,h,d,y,m,v,b,A=this,T=A.c,S=(e=new K(e,t)).c;if(!(T&&S&&T[0]&&S[0]))return!A.s||!e.s||T&&!T[0]&&!S||S&&!S[0]&&!T?e.c=e.e=e.s=null:(e.s*=A.s,T&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=w(A.e/p)+w(e.e/p),e.s*=A.s,(u=T.length)<(h=S.length)&&(m=T,T=S,S=m,i=u,u=h,h=i),i=u+h,m=[];i--;m.push(0));for(v=l,b=g,i=h;--i>=0;){for(r=0,d=S[i]%b,y=S[i]/b|0,o=i+(s=u);o>i;)r=((c=d*(c=T[--s]%b)+(a=y*c+(f=T[s]/b|0)*d)%b*b+m[o]+r)/v|0)+(a/b|0)+y*f,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),H(e,m,n)},B.negated=function(){var e=new K(this);return e.s=-e.s||null,e},B.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new K(e,t)).s,!i||!t)return new K(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/p,s=e.e/p,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new K(i/0);if(!a[0]||!u[0])return u[0]?e:new K(a[0]?n:0*i)}if(o=w(o),s=w(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=u.length)<0&&(r=u,u=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),H(e,a,s)},B.precision=B.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return b(e,1,y),null==t?t=_:b(t,0,8),G(new K(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*p+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},B.shiftedBy=function(e){return b(e,-h,h),this.times("1e"+e)},B.squareRoot=B.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=j+4,l=new K("0.5");if(1!==u||!a||!a[0])return new K(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+V(s)))||u==1/0?(((t=m(a)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=w((c+1)/2)-(c<0||c%2),n=new K(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new K(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),m(o.c).slice(0,u)===(t=m(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(n,n.e+j+2,1),e=!n.times(n).eq(s));break}if(!i&&(G(o,o.e+j+2,0),o.times(o).eq(s))){n=o;break}f+=4,u+=4,i=1}return G(n,n.e+j+1,_,e)},B.toExponential=function(e,t){return null!=e&&(b(e,0,y),e++),z(this,e,t,1)},B.toFixed=function(e,t){return null!=e&&(b(e,0,y),e=e+this.e+1),z(this,e,t)},B.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=M;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=s[0],p=s[1],h=i.s<0,d=h?l.slice(1):l,g=d.length;if(u&&(o=a,a=u,u=o,g-=o),a>0&&g>0){for(o=g%a||a,l=d.substr(0,o);o<g;o+=a)l+=f+d.substr(o,a);u>0&&(l+=f+d.slice(o)),h&&(l="-"+l)}n=p?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):l}return(r.prefix||"")+n+(r.suffix||"")},B.toFraction=function(e){var t,n,i,o,s,a,u,f,l,h,g,y,w=this,v=w.c;if(null!=e&&(!(u=new K(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+V(u));if(!v)return new K(w);for(t=new K(C),l=n=new K(C),i=f=new K(C),y=m(v),s=t.e=y.length-w.e-1,t.c[0]=d[(a=s%p)<0?p+a:a],e=!e||u.comparedTo(t)>0?s>0?t:l:u,a=L,L=1/0,u=new K(y),f.c[0]=0;h=r(u,t,0,1),1!=(o=n.plus(h.times(i))).comparedTo(e);)n=i,i=o,l=f.plus(h.times(o=l)),f=o,t=u.minus(h.times(o=t)),u=o;return o=r(e.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=w.s,g=r(l,i,s*=2,_).minus(w).abs().comparedTo(r(f,n,s,_).minus(w).abs())<1?[l,i]:[f,n],L=a,g},B.toNumber=function(){return+V(this)},B.toPrecision=function(e,t){return null!=e&&b(e,1,y),z(this,e,t,2)},B.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(t=m(r.c),null==e?t=o<=R||o>=D?T(t,o):S(t,o,"0"):(b(e,2,F.length,"Base"),t=n(S(t,o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},B.valueOf=B.toJSON=function(){return V(this)},B._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(B[Symbol.toStringTag]="BigNumber",B[Symbol.for("nodejs.util.inspect.custom")]=B.valueOf),null!=t&&K.set(t),K}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(16);t.Api=class{constructor(e){this.METHOD_GET="GET",this.METHOD_POST="POST",this.applyConfig(e)}applyConfig(e){this.config=this.mergeDefaults(e)}getConfig(){return this.config}mergeDefaults(e){return{host:e.host,protocol:e.protocol||"http",port:e.port||1984,timeout:e.timeout||2e4,logging:e.logging||!1}}async get(e,t){try{return await this.request().get(e,t)}catch(e){if(e.response&&e.response.status)return e.response;throw e}}async post(e,t,r){try{return await this.request().post(e,t,r)}catch(e){if(e.response&&e.response.status)return e.response;throw e}}request(){let e=n.default.create({baseURL:`${this.config.protocol}://${this.config.host}:${this.config.port}`,timeout:1e3});return this.config.logging&&(e.interceptors.request.use(e=>(console.log(`Requesting: ${e.baseURL}/${e.url}`),e)),e.interceptors.response.use(e=>(console.log(`Response: ${e.config.url} - ${e.status}`),e))),e}}},function(e,t,r){e.exports=r(17)},function(e,t,r){"use strict";var n=r(0),i=r(4),o=r(19),s=r(2);function a(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var u=a(s);u.Axios=o,u.create=function(e){return a(n.merge(s,e))},u.Cancel=r(9),u.CancelToken=r(33),u.isCancel=r(8),u.all=function(e){return Promise.all(e)},u.spread=r(34),e.exports=u,e.exports.default=u},function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} | ||
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t,r){"use strict";var n=r(4),i=r(18),o=Object.prototype.toString;function s(e){return"[object Array]"===o.call(e)}function a(e){return null!==e&&"object"==typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}e.exports={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:i,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:u,isStream:function(e){return a(e)&&u(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function e(){var t={};function r(r,n){"object"==typeof t[n]&&"object"==typeof r?t[n]=e(t[n],r):t[n]=r}for(var n=0,i=arguments.length;n<i;n++)c(arguments[n],r);return t},extend:function(e,t,r){return c(t,function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(38);class i{static concatBuffers(e){let t=0;for(let r=0;r<e.length;r++)t+=e[r].byteLength;let r=new Uint8Array(t),n=0;r.set(new Uint8Array(e[0]),n),n+=e[0].byteLength;for(let t=1;t<e.length;t++)r.set(new Uint8Array(e[t]),n),n+=e[t].byteLength;return r}static b64UrlToString(e){let t=i.b64UrlToBuffer(e);if("undefined"==typeof TextDecoder){return new(0,r(3).TextDecoder)("utf-8",{fatal:!0}).decode(t)}return new TextDecoder("utf-8",{fatal:!0}).decode(t)}static bufferToString(e){if("undefined"==typeof TextDecoder){return new(0,r(3).TextDecoder)("utf-8",{fatal:!0}).decode(e)}return new TextDecoder("utf-8",{fatal:!0}).decode(e)}static stringToBuffer(e){if("undefined"==typeof TextEncoder){return(new(0,r(3).TextEncoder)).encode(e)}return(new TextEncoder).encode(e)}static stringToB64Url(e){return i.bufferTob64Url(i.stringToBuffer(e))}static b64UrlToBuffer(e){return new Uint8Array(n.toByteArray(i.b64UrlDecode(e)))}static bufferTob64(e){return n.fromByteArray(new Uint8Array(e))}static bufferTob64Url(e){return i.b64UrlEncode(i.bufferTob64(e))}static b64UrlEncode(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static b64UrlDecode(e){let t;return t=(e=e.replace(/\-/g,"+").replace(/\_/g,"/")).length%4==0?0:4-e.length%4,e.concat("=".repeat(t))}}t.ArweaveUtils=i},function(e,t,r){"use strict";(function(t){var n=r(0),i=r(20),o={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var a,u={adapter:("undefined"!=typeof XMLHttpRequest?a=r(6):void 0!==t&&(a=r(6)),a),transformRequest:[function(e,t){return i(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e)?e:n.isArrayBufferView(e)?e.buffer:n.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):n.isObject(e)?(s(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],function(e){u.headers[e]={}}),n.forEach(["post","put","patch"],function(e){u.headers[e]=n.merge(o)}),e.exports=u}).call(this,r(5))},function(e,t,r){(function(e,n){var i=/%[sdj%]/g;t.format=function(e){if(!w(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(a(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,o=n.length,s=String(e).replace(i,function(e){if("%%"===e)return"%";if(r>=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),u=n[r];r<o;u=n[++r])g(u)||!b(u)?s+=" "+u:s+=" "+a(u);return s},t.deprecate=function(r,i){if(m(e.process))return function(){return t.deprecate(r,i).apply(this,arguments)};if(!0===n.noDeprecation)return r;var o=!1;return function(){if(!o){if(n.throwDeprecation)throw new Error(i);n.traceDeprecation?console.trace(i):console.error(i),o=!0}return r.apply(this,arguments)}};var o,s={};function a(e,r){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(r)?n.showHidden=r:r&&t._extend(n,r),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),f(n,e,n.depth)}function u(e,t){var r=a.styles[t];return r?"["+a.colors[r][0]+"m"+e+"["+a.colors[r][1]+"m":e}function c(e,t){return e}function f(e,r,n){if(e.customInspect&&r&&S(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return w(i)||(i=f(e,i,n)),i}var o=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(w(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),T(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(r);if(0===s.length){if(S(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(v(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(A(r))return e.stylize(Date.prototype.toString.call(r),"date");if(T(r))return l(r)}var c,b="",E=!1,x=["{","}"];(h(r)&&(E=!0,x=["[","]"]),S(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return v(r)&&(b=" "+RegExp.prototype.toString.call(r)),A(r)&&(b=" "+Date.prototype.toUTCString.call(r)),T(r)&&(b=" "+l(r)),0!==s.length||E&&0!=r.length?n<0?v(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),c=E?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)U(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))}),o}(e,r,n,a,s):s.map(function(t){return p(e,r,n,a,t,E)}),e.seen.pop(),function(e,t,r){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,b,x)):x[0]+b+x[1]}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),U(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=g(r)?f(e,u.value,null):f(e,u.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),m(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function h(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function w(e){return"string"==typeof e}function m(e){return void 0===e}function v(e){return b(e)&&"[object RegExp]"===E(e)}function b(e){return"object"==typeof e&&null!==e}function A(e){return b(e)&&"[object Date]"===E(e)}function T(e){return b(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function E(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(m(o)&&(o=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!s[e])if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=w,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=v,t.isObject=b,t.isDate=A,t.isError=T,t.isFunction=S,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(40);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function U(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(e=new Date,r=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":"),[e.getDate(),O[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(41),t._extend=function(e,t){if(!t||!b(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,r(39),r(5))},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}}},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,c=[],f=!1,l=-1;function p(){f&&u&&(f=!1,u.length?c=u.concat(c):l=-1,c.length&&h())}function h(){if(!f){var e=a(p);f=!0;for(var t=c.length;t;){for(u=c,c=[];++l<t;)u&&u[l].run();l=-1,t=c.length}u=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new d(e,t)),1!==c.length||f||a(h)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(0),i=r(21),o=r(23),s=r(24),a=r(25),u=r(7),c="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||r(26);e.exports=function(e){return new Promise(function(t,f){var l=e.data,p=e.headers;n.isFormData(l)&&delete p["Content-Type"];var h=new XMLHttpRequest,d="onreadystatechange",g=!1;if("undefined"==typeof window||!window.XDomainRequest||"withCredentials"in h||a(e.url)||(h=new window.XDomainRequest,d="onload",g=!0,h.onprogress=function(){},h.ontimeout=function(){}),e.auth){var y=e.auth.username||"",w=e.auth.password||"";p.Authorization="Basic "+c(y+":"+w)}if(h.open(e.method.toUpperCase(),o(e.url,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,h[d]=function(){if(h&&(4===h.readyState||g)&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?h.response:h.responseText,status:1223===h.status?204:h.status,statusText:1223===h.status?"No Content":h.statusText,headers:r,config:e,request:h};i(t,f,n),h=null}},h.onerror=function(){f(u("Network Error",e,null,h)),h=null},h.ontimeout=function(){f(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",h)),h=null},n.isStandardBrowserEnv()){var m=r(27),v=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;v&&(p[e.xsrfHeaderName]=v)}if("setRequestHeader"in h&&n.forEach(p,function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)}),e.withCredentials&&(h.withCredentials=!0),e.responseType)try{h.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){h&&(h.abort(),f(e),h=null)}),void 0===l&&(l=null),h.send(l)})}},function(e,t,r){"use strict";var n=r(22);e.exports=function(e,t,r,i,o){var s=new Error(e);return n(s,t,r,i,o)}},function(e,t,r){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(1);class i{get(e,t){if(!Object.getOwnPropertyNames(this).includes(e))throw new Error(`Field "${e}" is not a property of the Arweave Transaction class.`);return t&&1==t.decode?t&&t.string?n.ArweaveUtils.b64UrlToString(this[e]):n.ArweaveUtils.b64UrlToBuffer(this[e]):this[e]}}class o extends i{constructor(e,t,r=!1){super(),this.name=e,this.value=t}}t.Tag=o;t.Transaction=class extends i{constructor(e){super(),this.last_tx="",this.owner="",this.tags=[],this.target="",this.quantity="0",this.data="",this.reward="0",this.signature="",Object.assign(this,e),e.tags&&(this.tags=e.tags.map(e=>new o(e.name,e.value)))}addTag(e,t){this.tags.push(new o(n.ArweaveUtils.stringToB64Url(e),n.ArweaveUtils.stringToB64Url(t)))}toJSON(){return{id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:this.data,reward:this.reward,signature:this.signature}}setSignature({signature:e,id:t}){this.signature=e,this.id=t}getSignatureData(){let e=this.tags.reduce((e,t)=>e+t.get("name",{decode:!0,string:!0})+t.get("value",{decode:!0,string:!0}),"");return n.ArweaveUtils.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),n.ArweaveUtils.stringToBuffer(this.quantity),n.ArweaveUtils.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),n.ArweaveUtils.stringToBuffer(e)])}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(12),i=r(44);window.Arweave={init:e=>new n.Arweave({api:e,crypto:new i.WebCryptoDriver})}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(13),i=r(15),o=r(35),s=r(36),a=r(42),u=r(10),c=r(1),f=r(43);t.Arweave=class{constructor(e){this.crypto=e.crypto,this.api=new i.Api(e.api),this.wallets=new a.Wallets(this.api,e.crypto),this.transactions=new s.Transactions(this.api,e.crypto),this.silo=new f.Silo(this.api,this.crypto,this.transactions),this.network=new o.Network(this.api),this.ar=new n.Ar,this.utils=c.ArweaveUtils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(e,t){if(!(e.data||e.target&&e.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");let r=await this.wallets.jwkToAddress(t);if(null==e.owner&&(e.owner=t.n),null==e.last_tx&&(e.last_tx=await this.wallets.getLastTransactionID(r)),null==e.reward){let t="string"==typeof e.data&&e.data.length>0?e.data.length:0,r="string"==typeof e.target&&e.target.length>0?e.target:null;e.reward=await this.transactions.getPrice(t,r)}return e.data&&(e.data=c.ArweaveUtils.stringToB64Url(e.data)),new u.Transaction(e)}async createSiloTransaction(e,t,r){if(!e.data)throw new Error("Silo transactions must have a 'data' value");if(!r)throw new Error("No Silo URI specified.");if(e.target||e.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");let n=await this.wallets.jwkToAddress(t);null==e.owner&&(e.owner=t.n),null==e.last_tx&&(e.last_tx=await this.wallets.getLastTransactionID(n));const i=await this.silo.parseUri(r),o=await this.crypto.encrypt(c.ArweaveUtils.stringToBuffer(e.data),i.getEncryptionKey());null==e.reward&&(e.reward=await this.transactions.getPrice(o.byteLength)),e.data=c.ArweaveUtils.bufferTob64Url(o);const s=new u.Transaction(e);return s.addTag("Silo-Name",i.getAccessKey()),s.addTag("Silo-Version","0.1.0"),s}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(14);t.Ar=class{constructor(){this.BigNum=((e,t)=>new(n.BigNumber.clone({DECIMAL_PLACES:t}))(e))}winstonToAr(e,{formatted:t=!1,decimals:r=12,trim:n=!0}={}){let i=this.stringToBigNum(e,r).shiftedBy(-12);return t?i.toFormat(r):i.toFixed(r)}arToWinston(e,{formatted:t=!1}={}){let r=this.stringToBigNum(e).shiftedBy(12);return t?r.toFormat():r.toFixed(0)}compare(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.comparedTo(n)}isEqual(e,t){return 0===this.compare(e,t)}isLessThan(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.isLessThan(n)}isGreaterThan(e,t){let r=this.stringToBigNum(e),n=this.stringToBigNum(t);return r.isGreaterThan(n)}add(e,t){let r=this.stringToBigNum(e);return this.stringToBigNum(t),r.plus(t).toFixed(0)}sub(e,t){let r=this.stringToBigNum(e);return this.stringToBigNum(t),r.minus(t).toFixed(0)}stringToBigNum(e,t=12){return this.BigNum(e,t)}}},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,c="[BigNumber Error] ",f=c+"Number primitive has more than 15 significant digits: ",l=1e14,p=14,h=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function w(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=p-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,s=e.s,a=t.s,u=e.e,c=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(a=(u=i.length)<(c=o.length)?u:c,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==c?0:u>c^r?1:-1}function b(e,t,r,n){if(e<t||e>r||e!==(e<0?a(e):u(e)))throw Error(c+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function A(e){var t=e.c.length-1;return w(e.e/p)==t&&e.c[t]%2!=0}function T(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(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}(o=function e(t){var r,n,i,o,E,x,O,U,N,B=K.prototype={constructor:K,toString:null,valueOf:null},C=new K(1),j=20,_=4,R=-7,D=21,P=-1e7,L=1e7,I=!1,q=1,k=0,M={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},F="0123456789abcdefghijklmnopqrstuvwxyz";function K(e,t){var r,o,a,c,l,d,g,y,w=this;if(!(w instanceof K))return new K(e,t);if(null==t){if(e instanceof K)return w.s=e.s,w.e=e.e,void(w.c=(e=e.c)?e.slice():e);if((d="number"==typeof e)&&0*e==0){if(w.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,l=e;l>=10;l/=10,c++);return w.e=c,void(w.c=[e])}y=String(e)}else{if(y=String(e),!s.test(y))return i(w,y,d);w.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(c=y.indexOf("."))>-1&&(y=y.replace(".","")),(l=y.search(/e/i))>0?(c<0&&(c=l),c+=+y.slice(l+1),y=y.substring(0,l)):c<0&&(c=y.length)}else{if(b(t,2,F.length,"Base"),y=String(e),10==t)return G(w=new K(e instanceof K?e:y),j+w.e+1,_);if(d="number"==typeof e){if(0*e!=0)return i(w,y,d,t);if(w.s=1/e<0?(y=y.slice(1),-1):1,K.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(f+e);d=!1}else w.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(r=F.slice(0,t),c=l=0,g=y.length;l<g;l++)if(r.indexOf(o=y.charAt(l))<0){if("."==o){if(l>c){c=g;continue}}else if(!a&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){a=!0,l=-1,c=0;continue}return i(w,String(e),d,t)}(c=(y=n(y,t,10,w.s)).indexOf("."))>-1?y=y.replace(".",""):c=y.length}for(l=0;48===y.charCodeAt(l);l++);for(g=y.length;48===y.charCodeAt(--g););if(y=y.slice(l,++g)){if(g-=l,d&&K.DEBUG&&g>15&&(e>h||e!==u(e)))throw Error(f+w.s*e);if((c=c-l-1)>L)w.c=w.e=null;else if(c<P)w.c=[w.e=0];else{if(w.e=c,w.c=[],l=(c+1)%p,c<0&&(l+=p),l<g){for(l&&w.c.push(+y.slice(0,l)),g-=p;l<g;)w.c.push(+y.slice(l,l+=p));y=y.slice(l),l=p-y.length}else l-=g;for(;l--;y+="0");w.c.push(+y)}}else w.c=[w.e=0]}function z(e,t,r,n){var i,o,s,a,u;if(null==r?r=_:b(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=m(e.c),u=1==n||2==n&&s<=R?T(u,s):S(u,s,"0");else if(o=(e=G(new K(e),t,r)).e,a=(u=m(e.c)).length,1==n||2==n&&(t<=o||o<=R)){for(;a<t;u+="0",a++);u=T(u,o)}else if(t-=s,u=S(u,o,"0"),o+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=o-a)>0)for(o+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function $(e,t){for(var r,n=1,i=new K(e[0]);n<e.length;n++){if(!(r=new K(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function H(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*p-1)>L?e.c=e.e=null:r<P?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var i,o,s,c,f,h,g,y=e.c,w=d;if(y){e:{for(i=1,c=y[0];c>=10;c/=10,i++);if((o=t-i)<0)o+=p,s=t,g=(f=y[h=0])/w[i-s-1]%10|0;else if((h=a((o+1)/p))>=y.length){if(!n)break e;for(;y.length<=h;y.push(0));f=g=0,i=1,s=(o%=p)-p+1}else{for(f=c=y[h],i=1;c>=10;c/=10,i++);g=(s=(o%=p)-p+i)<0?0:f/w[i-s-1]%10|0}if(n=n||t<0||null!=y[h+1]||(s<0?f:f%w[i-s-1]),n=r<4?(g||n)&&(0==r||r==(e.s<0?3:2)):g>5||5==g&&(4==r||n||6==r&&(o>0?s>0?f/w[i-s]:0:y[h-1])%10&1||r==(e.s<0?8:7)),t<1||!y[0])return y.length=0,n?(t-=e.e+1,y[0]=w[(p-t%p)%p],e.e=-t||0):y[0]=e.e=0,e;if(0==o?(y.length=h,c=1,h--):(y.length=h+1,c=w[p-o],y[h]=s>0?u(f/w[i-s]%w[s])*c:0),n)for(;;){if(0==h){for(o=1,s=y[0];s>=10;s/=10,o++);for(s=y[0]+=c,c=1;s>=10;s/=10,c++);o!=c&&(e.e++,y[0]==l&&(y[0]=1));break}if(y[h]+=c,y[h]!=l)break;y[h--]=0,c=1}for(o=y.length;0===y[--o];y.pop());}e.e>L?e.c=e.e=null:e.e<P&&(e.c=[e.e=0])}return e}function V(e){var t,r=e.e;return null===r?e.toString():(t=m(e.c),t=r<=R||r>=D?T(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return K.clone=e,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,y,t),j=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),_=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-y,0,t),b(r[1],0,y,t),R=r[0],D=r[1]):(b(r,-y,y,t),R=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-y,-1,t),b(r[1],1,y,t),P=r[0],L=r[1];else{if(b(r,-y,y,t),!r)throw Error(c+t+" cannot be zero: "+r);P=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw I=!r,Error(c+"crypto unavailable");I=r}else I=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),q=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,y,t),k=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);M=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);F=r}}return{DECIMAL_PLACES:j,ROUNDING_MODE:_,EXPONENTIAL_AT:[R,D],RANGE:[P,L],CRYPTO:I,MODULO_MODE:q,POW_PRECISION:k,FORMAT:M,ALPHABET:F}},K.isBigNumber=function(e){return e instanceof K||e&&!0===e._isBigNumber||!1},K.maximum=K.max=function(){return $(arguments,B.lt)},K.minimum=K.min=function(){return $(arguments,B.gt)},K.random=(o=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,s,f=0,l=[],h=new K(C);if(null==e?e=j:b(e,0,y),i=a(e/p),I)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));f<i;)(s=131072*t[f]+(t[f+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[f]=r[0],t[f+1]=r[1]):(l.push(s%1e14),f+=2);f=i/2}else{if(!crypto.randomBytes)throw I=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);f<i;)(s=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):(l.push(s%1e14),f+=7);f=i/7}if(!I)for(;f<i;)(s=o())<9e15&&(l[f++]=s%1e14);for(i=l[--f],e%=p,i&&e&&(s=d[p-e],l[f]=u(i/s)*s);0===l[f];l.pop(),f--);if(f<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=p);for(f=1,s=l[0];s>=10;s/=10,f++);f<p&&(n-=p-f)}return h.e=n,h.c=l,h}),K.sum=function(){for(var e=1,t=arguments,r=new K(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){function e(e,t,r,n){for(var i,o,s=[0],a=0,u=e.length;a<u;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(t,n,i,o,s){var a,u,c,f,l,p,h,d,g=t.indexOf("."),y=j,w=_;for(g>=0&&(f=k,k=0,t=t.replace(".",""),p=(d=new K(n)).pow(t.length-g),k=f,d.c=e(S(m(p.c),p.e,"0"),10,i,"0123456789"),d.e=d.c.length),c=f=(h=e(t,n,i,s?(a=F,"0123456789"):(a="0123456789",F))).length;0==h[--f];h.pop());if(!h[0])return a.charAt(0);if(g<0?--c:(p.c=h,p.e=c,p.s=o,h=(p=r(p,d,y,w,i)).c,l=p.r,c=p.e),g=h[u=c+y+1],f=i/2,l=l||u<0||null!=h[u+1],l=w<4?(null!=g||l)&&(0==w||w==(p.s<0?3:2)):g>f||g==f&&(4==w||l||6==w&&1&h[u-1]||w==(p.s<0?8:7)),u<1||!h[0])t=l?S(a.charAt(1),-y,a.charAt(0)):a.charAt(0);else{if(h.length=u,l)for(--i;++h[--u]>i;)h[u]=0,u||(++c,h=[1].concat(h));for(f=h.length;!h[--f];);for(g=0,t="";g<=f;t+=a.charAt(h[g++]));t=S(t,c,a.charAt(0))}return t}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,u=e.length,c=t%g,f=t/g|0;for(e=e.slice();u--;)a=((i=c*(o=e[u]%g)+(n=f*o+(s=e[u]/g|0)*c)%g*g+a)/r|0)+(n/g|0)+f*s,e[u]=i%r;return a&&(e=[a].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,o,s,a){var c,f,h,d,g,y,m,v,b,A,T,S,E,x,O,U,N,B=n.s==i.s?1:-1,C=n.c,j=i.c;if(!(C&&C[0]&&j&&j[0]))return new K(n.s&&i.s&&(C?!j||C[0]!=j[0]:j)?C&&0==C[0]||!j?0*B:B/0:NaN);for(b=(v=new K(B)).c=[],B=o+(f=n.e-i.e)+1,a||(a=l,f=w(n.e/p)-w(i.e/p),B=B/p|0),h=0;j[h]==(C[h]||0);h++);if(j[h]>(C[h]||0)&&f--,B<0)b.push(1),d=!0;else{for(x=C.length,U=j.length,h=0,B+=2,(g=u(a/(j[0]+1)))>1&&(j=e(j,g,a),C=e(C,g,a),U=j.length,x=C.length),E=U,T=(A=C.slice(0,U)).length;T<U;A[T++]=0);N=j.slice(),N=[0].concat(N),O=j[0],j[1]>=a/2&&O++;do{if(g=0,(c=t(j,A,U,T))<0){if(S=A[0],U!=T&&(S=S*a+(A[1]||0)),(g=u(S/O))>1)for(g>=a&&(g=a-1),m=(y=e(j,g,a)).length,T=A.length;1==t(y,A,m,T);)g--,r(y,U<m?N:j,m,a),m=y.length,c=1;else 0==g&&(c=g=1),m=(y=j.slice()).length;if(m<T&&(y=[0].concat(y)),r(A,y,T,a),T=A.length,-1==c)for(;t(j,A,U,T)<1;)g++,r(A,U<T?N:j,T,a),T=A.length}else 0===c&&(g++,A=[0]);b[h++]=g,A[0]?A[T++]=C[E]||0:(A=[C[E]],T=1)}while((E++<x||null!=A[0])&&B--);d=null!=A[0],b[0]||b.splice(0,1)}if(a==l){for(h=1,B=b[0];B>=10;B/=10,h++);G(v,o+(v.e=h+f*p-1)+1,s,d)}else v.e=f,v.r=+d;return v}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,O=/^\.([^.]+)$/,U=/^-?(Infinity|NaN)$/,N=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(N,"");if(U.test(o))e.s=isNaN(o)?null:o<0?-1:1,e.c=e.e=null;else{if(!r&&(o=o.replace(E,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(x,"$1").replace(O,"0.$1")),t!=o))return new K(o,i);if(K.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.c=e.e=e.s=null}},B.absoluteValue=B.abs=function(){var e=new K(this);return e.s<0&&(e.s=1),e},B.comparedTo=function(e,t){return v(this,new K(e,t))},B.decimalPlaces=B.dp=function(e,t){var r,n,i,o=this;if(null!=e)return b(e,0,y),null==t?t=_:b(t,0,8),G(new K(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-w(this.e/p))*p,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},B.dividedBy=B.div=function(e,t){return r(this,new K(e,t),j,_)},B.dividedToIntegerBy=B.idiv=function(e,t){return r(this,new K(e,t),0,1)},B.exponentiatedBy=B.pow=function(e,t){var r,n,i,o,s,f,l,h,d=this;if((e=new K(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+V(e));if(null!=t&&(t=new K(t)),s=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return h=new K(Math.pow(+V(d),s?2-A(e):+V(e))),t?h.mod(t):h;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new K(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||s&&d.c[1]>=24e7:d.c[0]<8e13||s&&d.c[0]<=9999975e7)))return o=d.s<0&&A(e)?-0:0,d.e>-1&&(o=1/o),new K(f?1/o:o);k&&(o=a(k/p+2))}for(s?(r=new K(.5),f&&(e.s=1),l=A(e)):l=(i=Math.abs(+V(e)))%2,h=new K(C);;){if(l){if(!(h=h.times(d)).c)break;o?h.c.length>o&&(h.c.length=o):n&&(h=h.mod(t))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(G(e=e.times(r),e.e+1,1),e.e>14)l=A(e);else{if(0==(i=+V(e)))break;l=i%2}d=d.times(d),o?d.c&&d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}return n?h:(f&&(h=C.div(h)),t?h.mod(t):o?G(h,k,_,void 0):h)},B.integerValue=function(e){var t=new K(this);return null==e?e=_:b(e,0,8),G(t,t.e+1,e)},B.isEqualTo=B.eq=function(e,t){return 0===v(this,new K(e,t))},B.isFinite=function(){return!!this.c},B.isGreaterThan=B.gt=function(e,t){return v(this,new K(e,t))>0},B.isGreaterThanOrEqualTo=B.gte=function(e,t){return 1===(t=v(this,new K(e,t)))||0===t},B.isInteger=function(){return!!this.c&&w(this.e/p)>this.c.length-2},B.isLessThan=B.lt=function(e,t){return v(this,new K(e,t))<0},B.isLessThanOrEqualTo=B.lte=function(e,t){return-1===(t=v(this,new K(e,t)))||0===t},B.isNaN=function(){return!this.s},B.isNegative=function(){return this.s<0},B.isPositive=function(){return this.s>0},B.isZero=function(){return!!this.c&&0==this.c[0]},B.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new K(e,t)).s,!a||!t)return new K(NaN);if(a!=t)return e.s=-t,s.plus(e);var u=s.e/p,c=e.e/p,f=s.c,h=e.c;if(!u||!c){if(!f||!h)return f?(e.s=-t,e):new K(h?s:NaN);if(!f[0]||!h[0])return h[0]?(e.s=-t,e):new K(f[0]?s:3==_?-0:0)}if(u=w(u),c=w(c),f=f.slice(),a=u-c){for((o=a<0)?(a=-a,i=f):(c=u,i=h),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=h.length))?a:t,a=t=0;t<n;t++)if(f[t]!=h[t]){o=f[t]<h[t];break}if(o&&(i=f,f=h,h=i,e.s=-e.s),(t=(n=h.length)-(r=f.length))>0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]<h[n]){for(r=n;r&&!f[--r];f[r]=t);--f[r],f[n]+=l}f[n]-=h[n]}for(;0==f[0];f.splice(0,1),--c);return f[0]?H(e,f,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},B.modulo=B.mod=function(e,t){var n,i,o=this;return e=new K(e,t),!o.c||!e.s||e.c&&!e.c[0]?new K(NaN):!e.c||o.c&&!o.c[0]?new K(o):(9==q?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,q),(e=o.minus(n.times(e))).c[0]||1!=q||(e.s=o.s),e)},B.multipliedBy=B.times=function(e,t){var r,n,i,o,s,a,u,c,f,h,d,y,m,v,b,A=this,T=A.c,S=(e=new K(e,t)).c;if(!(T&&S&&T[0]&&S[0]))return!A.s||!e.s||T&&!T[0]&&!S||S&&!S[0]&&!T?e.c=e.e=e.s=null:(e.s*=A.s,T&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=w(A.e/p)+w(e.e/p),e.s*=A.s,(u=T.length)<(h=S.length)&&(m=T,T=S,S=m,i=u,u=h,h=i),i=u+h,m=[];i--;m.push(0));for(v=l,b=g,i=h;--i>=0;){for(r=0,d=S[i]%b,y=S[i]/b|0,o=i+(s=u);o>i;)r=((c=d*(c=T[--s]%b)+(a=y*c+(f=T[s]/b|0)*d)%b*b+m[o]+r)/v|0)+(a/b|0)+y*f,m[o--]=c%v;m[o]=r}return r?++n:m.splice(0,1),H(e,m,n)},B.negated=function(){var e=new K(this);return e.s=-e.s||null,e},B.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new K(e,t)).s,!i||!t)return new K(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/p,s=e.e/p,a=n.c,u=e.c;if(!o||!s){if(!a||!u)return new K(i/0);if(!a[0]||!u[0])return u[0]?e:new K(a[0]?n:0*i)}if(o=w(o),s=w(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=u):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=u.length)<0&&(r=u,u=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),H(e,a,s)},B.precision=B.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return b(e,1,y),null==t?t=_:b(t,0,8),G(new K(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*p+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},B.shiftedBy=function(e){return b(e,-h,h),this.times("1e"+e)},B.squareRoot=B.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,u=s.s,c=s.e,f=j+4,l=new K("0.5");if(1!==u||!a||!a[0])return new K(!u||u<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(u=Math.sqrt(+V(s)))||u==1/0?(((t=m(a)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=w((c+1)/2)-(c<0||c%2),n=new K(t=u==1/0?"1e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new K(u+""),n.c[0])for((u=(c=n.e)+f)<3&&(u=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),m(o.c).slice(0,u)===(t=m(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(n,n.e+j+2,1),e=!n.times(n).eq(s));break}if(!i&&(G(o,o.e+j+2,0),o.times(o).eq(s))){n=o;break}f+=4,u+=4,i=1}return G(n,n.e+j+1,_,e)},B.toExponential=function(e,t){return null!=e&&(b(e,0,y),e++),z(this,e,t,1)},B.toFixed=function(e,t){return null!=e&&(b(e,0,y),e=e+this.e+1),z(this,e,t)},B.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=M;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,u=+r.secondaryGroupSize,f=r.groupSeparator||"",l=s[0],p=s[1],h=i.s<0,d=h?l.slice(1):l,g=d.length;if(u&&(o=a,a=u,u=o,g-=o),a>0&&g>0){for(o=g%a||a,l=d.substr(0,o);o<g;o+=a)l+=f+d.substr(o,a);u>0&&(l+=f+d.slice(o)),h&&(l="-"+l)}n=p?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):l}return(r.prefix||"")+n+(r.suffix||"")},B.toFraction=function(e){var t,n,i,o,s,a,u,f,l,h,g,y,w=this,v=w.c;if(null!=e&&(!(u=new K(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+V(u));if(!v)return new K(w);for(t=new K(C),l=n=new K(C),i=f=new K(C),y=m(v),s=t.e=y.length-w.e-1,t.c[0]=d[(a=s%p)<0?p+a:a],e=!e||u.comparedTo(t)>0?s>0?t:l:u,a=L,L=1/0,u=new K(y),f.c[0]=0;h=r(u,t,0,1),1!=(o=n.plus(h.times(i))).comparedTo(e);)n=i,i=o,l=f.plus(h.times(o=l)),f=o,t=u.minus(h.times(o=t)),u=o;return o=r(e.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=w.s,g=r(l,i,s*=2,_).minus(w).abs().comparedTo(r(f,n,s,_).minus(w).abs())<1?[l,i]:[f,n],L=a,g},B.toNumber=function(){return+V(this)},B.toPrecision=function(e,t){return null!=e&&b(e,1,y),z(this,e,t,2)},B.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(t=m(r.c),null==e?t=o<=R||o>=D?T(t,o):S(t,o,"0"):(b(e,2,F.length,"Base"),t=n(S(t,o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},B.valueOf=B.toJSON=function(){return V(this)},B._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(B[Symbol.toStringTag]="BigNumber",B[Symbol.for("nodejs.util.inspect.custom")]=B.valueOf),null!=t&&K.set(t),K}()).default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(16);t.Api=class{constructor(e){this.METHOD_GET="GET",this.METHOD_POST="POST",this.applyConfig(e)}applyConfig(e){this.config=this.mergeDefaults(e)}getConfig(){return this.config}mergeDefaults(e){return{host:e.host,protocol:e.protocol||"http",port:e.port||1984,timeout:e.timeout||2e4,logging:e.logging||!1}}async get(e,t){try{return await this.request().get(e,t)}catch(e){if(e.response&&e.response.status)return e.response;throw e}}async post(e,t,r){try{return await this.request().post(e,t,r)}catch(e){if(e.response&&e.response.status)return e.response;throw e}}request(){let e=n.default.create({baseURL:`${this.config.protocol}://${this.config.host}:${this.config.port}`,timeout:1e3});return this.config.logging&&(e.interceptors.request.use(e=>(console.log(`Requesting: ${e.baseURL}/${e.url}`),e)),e.interceptors.response.use(e=>(console.log(`Response: ${e.config.url} - ${e.status}`),e))),e}}},function(e,t,r){e.exports=r(17)},function(e,t,r){"use strict";var n=r(0),i=r(4),o=r(19),s=r(2);function a(e){var t=new o(e),r=i(o.prototype.request,t);return n.extend(r,o.prototype,t),n.extend(r,t),r}var u=a(s);u.Axios=o,u.create=function(e){return a(n.merge(s,e))},u.Cancel=r(9),u.CancelToken=r(33),u.isCancel=r(8),u.all=function(e){return Promise.all(e)},u.spread=r(34),e.exports=u,e.exports.default=u},function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)} | ||
/*! | ||
@@ -3,0 +3,0 @@ * Determine if an object is a Buffer |
@@ -64,8 +64,7 @@ import { Ar } from "./ar"; | ||
} | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
if (attributes.reward == undefined) { | ||
let length = (typeof attributes.data == 'string' && attributes.data.length > 0) ? attributes.data.length : 0; | ||
attributes.reward = await this.transactions.getPrice(length); | ||
attributes.reward = await this.transactions.getPrice(encrypted.byteLength); | ||
} | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
attributes.data = ArweaveUtils.bufferTob64Url(encrypted); | ||
@@ -72,0 +71,0 @@ const transaction = new Transaction(attributes); |
{ | ||
"name": "arweave", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Arweave JS client library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -115,13 +115,11 @@ import { Ar } from "./ar"; | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
if (attributes.reward == undefined) { | ||
let length = (typeof attributes.data == 'string' && attributes.data.length > 0) ? attributes.data.length : 0; | ||
attributes.reward = await this.transactions.getPrice(length); | ||
attributes.reward = await this.transactions.getPrice(encrypted.byteLength); | ||
} | ||
const siloResource = await this.silo.parseUri(siloUri); | ||
const encrypted = await this.crypto.encrypt(ArweaveUtils.stringToBuffer(attributes.data), siloResource.getEncryptionKey()); | ||
attributes.data = ArweaveUtils.bufferTob64Url(encrypted); | ||
@@ -128,0 +126,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
3513446
40744