Socket
Socket
Sign inDemoInstall

xumm-sdk

Package Overview
Dependencies
Maintainers
4
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xumm-sdk - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

2

dist/browser.min.js

@@ -1,1 +0,1 @@

require=function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,(function(e){return o(t[s][1][e]||e)}),l,l.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Meta=void 0;const i=e("debug"),s=o(e("fetch-ponyfill")),{fetch:a,Request:u,Response:c,Headers:l}=s.default(),d=e("os-browserify"),f=e("./utils"),h=e("./index"),p=i.debug("xumm-sdk:meta");r.Meta=class{constructor(e,r){this.isBrowser=!1,this.jwtFlow=!1,this.injected=!1,this.endpoint="https://xumm.app",p("Constructed");const n=new RegExp("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"),o={split:r.split(":"),uuidv4:""};if(3===o.split.length&&"xApp:OneTimeToken"===o.split.slice(0,2).join(":")?(o.uuidv4=o.split[2],this.jwtFlow=!0):o.split.length>1&&"RAWJWT"===o.split[0]?(this.jwtFlow=!0,this.jwt=o.split.slice(1).join(":")):o.uuidv4=r,!n.test(e)||!n.test(o.uuidv4)){if(!this.jwtFlow)throw new Error("Invalid API Key and/or API Secret. Use dotenv or constructor params.");if(!this.jwt)throw new Error("Invalid API Key and/or OTT (One Time Token). Provide OTT param (2nd param) or make sure `xAppToken` query param is present (Browser)")}return void 0!==t&&Object.keys(t).indexOf("window")<0?p("Running in node"):(console.log("XUMM SDK: Running in browser"),this.isBrowser=!0),this.apiKey=e,this.apiSecret=o.uuidv4,this.jwtFlow&&!this.jwt&&Promise.resolve().then((()=>this.authorize())).catch((e=>{p("Authorize error:",e.message),(null==this?void 0:this.invoker)&&this.invoker.caught(e)})),this}setEndpoint(e){return!!e.match(/^http/)&&(this.endpoint=e.trim(),!0)}authorize(){var e,t,r,o;return n(this,void 0,void 0,(function*(){let n;p("JWT Authorize",this.apiSecret),(null==this?void 0:this.invoker)&&this.invoker.constructor===h.XummSdkJwt&&(n=this.invoker._jwtStore(this,(e=>this.jwt=e)));const i=(null==n?void 0:n.get(this.apiSecret))||(yield this.call("authorize"));if(null===(t=null===(e=i)||void 0===e?void 0:e.error)||void 0===t?void 0:t.code)p("Could not resolve API Key & OTT to JWT (already fetched? Unauthorized?)"),(null==this?void 0:this.invoker)&&this.invoker.constructor===h.XummSdkJwt&&(null===(r=null==this?void 0:this.invoker)||void 0===r?void 0:r.fatalHandler)?this.invoker.fatalHandler(new Error(i.error.reference)):f.throwIfError(i);else{if(!(null===(o=i)||void 0===o?void 0:o.jwt))throw new Error("Unexpected response for xApp JWT authorize request");{const e=i;null==n||n.set(this.apiSecret,e)}}}))}call(e,t="GET",r){var o;return n(this,void 0,void 0,(function*(){const n=t.toUpperCase();try{let t;void 0!==r&&("object"==typeof r&&null!==r&&(t=JSON.stringify(r)),"string"==typeof r&&(t=r));const o={"Content-Type":"application/json"};this.isBrowser||Object.assign(o,{"User-Agent":`xumm-sdk/node (${d.hostname()}) node-fetch`}),this.jwtFlow?"authorize"===e?Object.assign(o,{"x-api-key":this.apiKey,"x-api-ott":this.apiSecret}):Object.assign(o,{Authorization:"Bearer "+this.jwt}):Object.assign(o,{"x-api-key":this.apiKey,"x-api-secret":this.apiSecret});const i=["authorize","ping","curated-assets","rates","payload","userdata"],s=this.jwtFlow&&i.indexOf(e.split("/")[0])>-1?"jwt":"platform",u=yield a(this.endpoint+"/api/v1/"+s+"/"+e,{method:n,body:t,headers:o});return yield u.json()}catch(t){const r=new Error(`Unexpected response from XUMM API [${n}:${e}]`);throw r.stack=(null===(o=t)||void 0===o?void 0:o.stack)||void 0,r}}))}ping(){var e,t;return n(this,void 0,void 0,(function*(){const r=yield this.call("ping");if(f.throwIfError(r),void 0!==r.auth)return r.auth;if(void 0!==(null===(e=r)||void 0===e?void 0:e.ott_uuidv4))return{application:{uuidv4:r.app_uuidv4,name:r.app_name},jwtData:r};if(void 0!==(null===(t=r)||void 0===t?void 0:t.usertoken_uuidv4))return{application:{uuidv4:r.client_id,name:r.app_name},jwtData:r};throw new Error("Unexpected response for ping request")}))}getCuratedAssets(){return n(this,void 0,void 0,(function*(){return yield this.call("curated-assets")}))}getRates(e){return n(this,void 0,void 0,(function*(){return yield this.call("rates/"+e.trim().toUpperCase())}))}getKycStatus(e){return n(this,void 0,void 0,(function*(){if(e.trim().match(/^r/)){const t=yield this.call("kyc-status/"+e.trim());return(null==t?void 0:t.kycApproved)?"SUCCESSFUL":"NONE"}{const t=yield this.call("kyc-status","POST",{user_token:e});return(null==t?void 0:t.kycStatus)||"NONE"}}))}getTransaction(e){return n(this,void 0,void 0,(function*(){return yield this.call("xrpl-tx/"+e.trim())}))}verifyUserTokens(e){return n(this,void 0,void 0,(function*(){return(yield this.call("user-tokens","POST",{tokens:Array.isArray(e)?e:[e]})).tokens}))}_inject(e){if(this.injected)throw new Error("Cannot `_inject` twice");this.invoker=e}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./index":"xumm-sdk","./utils":4,debug:8,"fetch-ponyfill":12,"os-browserify":14}],2:[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.Payload=void 0;const o=e("debug"),i=e("websocket"),s=e("./utils"),a=o.debug("xumm-sdk:payload"),u=o.debug("xumm-sdk:payload:websocket");r.Payload=class{constructor(e){a("Constructed"),this.Meta=e}resolvePayload(e){var t,r,o;return n(this,void 0,void 0,(function*(){if("string"==typeof e)return yield this.get(e,!0);if(void 0!==(null===(t=e)||void 0===t?void 0:t.uuid))return yield this.get(e.uuid,!0);if(void 0!==(null===(o=null===(r=e)||void 0===r?void 0:r.meta)||void 0===o?void 0:o.uuid))return e;throw new Error("Could not resolve payload (not found)")}))}create(e,t=!1){var r;return n(this,void 0,void 0,(function*(){const n=void 0!==e.TransactionType&&void 0===e.txjson,o=yield this.Meta.call("payload","POST",n?{txjson:e}:e);t&&s.throwIfError(o);return void 0!==(null===(r=o)||void 0===r?void 0:r.next)?o:null}))}get(e,t=!1){var r,o;return n(this,void 0,void 0,(function*(){const n="string"==typeof e?e:null==e?void 0:e.uuid,i=yield this.Meta.call("payload/"+n,"GET");t&&s.throwIfError(i);return void 0!==(null===(o=null===(r=i)||void 0===r?void 0:r.meta)||void 0===o?void 0:o.uuid)?i:null}))}subscribe(e,r){var o,a;return n(this,void 0,void 0,(function*(){const c=new s.DeferredPromise,l=yield this.resolvePayload(e);if(l){const e=void 0!==(null===(o=t)||void 0===o?void 0:o.MockedWebSocket)&&"undefined"!=typeof jest?new(null===(a=t)||void 0===a?void 0:a.MockedWebSocket)("ws://xumm.local"):new i.w3cwebsocket(this.Meta.endpoint.replace(/^http/,"ws")+"/sign/"+l.meta.uuid);return c.promise.then((()=>{e.close()})),e.onopen=()=>{u(`Payload ${l.meta.uuid}: Subscription active (WebSocket opened)`)},e.onmessage=e=>n(this,void 0,void 0,(function*(){const t=e.data;let o;try{o=JSON.parse(t.toString())}catch(e){u(`Payload ${l.meta.uuid}: Received message, unable to parse as JSON`,e)}if(o&&r&&void 0===o.devapp_fetched)try{const e=yield r({uuid:l.meta.uuid,data:o,resolve(e){return n(this,void 0,void 0,(function*(){yield c.resolve(e||void 0)}))},payload:l});void 0!==e&&c.resolve(e)}catch(e){u(`Payload ${l.meta.uuid}: Callback exception`,e)}})),e.onclose=e=>{u(`Payload ${l.meta.uuid}: Subscription ended (WebSocket closed)`)},{payload:l,resolve(e){c.resolve(e||void 0)},resolved:c.promise,websocket:e}}throw s.throwIfError(l),Error("Couldn't subscribe: couldn't fetch payload")}))}cancel(e,t=!1){var r,o,i;return n(this,void 0,void 0,(function*(){const n=yield this.resolvePayload(e),a=yield this.Meta.call("payload/"+(null===(r=null==n?void 0:n.meta)||void 0===r?void 0:r.uuid),"DELETE");t&&s.throwIfError(a);return void 0!==(null===(i=null===(o=a)||void 0===o?void 0:o.meta)||void 0===i?void 0:i.uuid)?a:null}))}createAndSubscribe(e,t){return n(this,void 0,void 0,(function*(){const r=yield this.create(e,!0);if(r){const e=yield this.subscribe(r,t);return Object.assign({created:r},e)}throw new Error("Error creating payload or subscribing to created payload")}))}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":4,debug:8,websocket:17}],3:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.Storage=void 0;const o=e("debug"),i=e("./utils"),s=o.debug("xumm-sdk:storage");r.Storage=class{constructor(e){s("Constructed"),this.Meta=e}get(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("app-storage","GET");return i.throwIfError(e),e.data}))}set(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("app-storage","POST",e);return i.throwIfError(t),t.stored}))}delete(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("app-storage","DELETE");return i.throwIfError(e),e.stored}))}}},{"./utils":4,debug:8}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DeferredPromise=r.throwIfError=void 0,r.throwIfError=function(e){var t,r,n,o,i,s;if(void 0!==e.message)throw new Error(e.message);if(void 0===e.next&&void 0===(null===(r=null===(t=e)||void 0===t?void 0:t.meta)||void 0===r?void 0:r.uuid)&&void 0===(null===(o=null===(n=e)||void 0===n?void 0:n.application)||void 0===o?void 0:o.uuidv4)&&void 0!==(null===(s=null===(i=e)||void 0===i?void 0:i.error)||void 0===s?void 0:s.code)){const t=e.error;throw new Error(`Error code ${t.code}, see XUMM Dev Console, reference: ${t.reference}`)}};r.DeferredPromise=class{constructor(){this.resolveFn=e=>{},this.rejectFn=e=>{},this.promise=new Promise(((e,t)=>{this.resolveFn=e,this.rejectFn=t}))}resolve(e){return this.resolveFn(e),this.promise}reject(e){return this.rejectFn(e),this.promise}}},{}],5:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.xApp=void 0;const o=e("debug"),i=e("./xAppUserdata"),s=e("./utils"),a=o.debug("xumm-sdk:xapp");r.xApp=class{constructor(e){a("Constructed"),this.Meta=e,this.userdata=new i.xAppUserdata(this.Meta)}get(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/ott/"+e,"GET");return s.throwIfError(t),t}))}event(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/event","POST",e);return s.throwIfError(t),t}))}push(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/push","POST",e);return s.throwIfError(t),t}))}}},{"./utils":4,"./xAppUserdata":6,debug:8}],6:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.xAppUserdata=void 0;const o=e("debug"),i=e("./utils"),s=o.debug("xumm-sdk:xapp:userdata");r.xAppUserdata=class{constructor(e){s("Constructed"),this.Meta=e}list(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("userdata","GET");return i.throwIfError(e),e.keys}))}get(e){var t;return n(this,void 0,void 0,(function*(){const r=Array.isArray(e)?e.join(","):e,n=yield this.Meta.call("userdata/"+r,"GET");return i.throwIfError(n),r.split(",").length>1?n.data:(null===(t=n.data)||void 0===t?void 0:t[r])||{}}))}delete(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("userdata/"+e,"DELETE");return i.throwIfError(t),t.persisted}))}set(e,t){return n(this,void 0,void 0,(function*(){const r=yield this.Meta.call("userdata/"+e,"POST",t);return i.throwIfError(r),r.persisted}))}}},{"./utils":4,debug:8}],7:[function(e,t,r){},{}],8:[function(e,t,r){(function(n){(function(){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG);return e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:o}=t.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":9,_process:16}],9:[function(e,t,r){t.exports=function(t){function r(e){let t,o=null;function i(...e){if(!i.enabled)return;const n=i,o=Number(new Date),s=o-(t||o);n.diff=s,n.prev=t,n.curr=o,t=o,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,o)=>{if("%%"===t)return"%";a++;const i=r.formatters[o];if("function"==typeof i){const r=e[a];t=i.call(n,r),e.splice(a,1),a--}return t})),r.formatArgs.call(n,e);(n.log||r.log).apply(n,e)}return i.namespace=e,i.useColors=r.useColors(),i.color=r.selectColor(e),i.extend=n,i.destroy=r.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?r.enabled(e):o,set:e=>{o=e}}),"function"==typeof r.init&&r.init(i),i}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},r.disable=function(){const e=[...r.names.map(o),...r.skips.map(o).map((e=>"-"+e))].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:13}],10:[function(e,t,r){(function(r){(function(){const n=e("fs"),o=e("path");function i(e){console.log(`[dotenv][DEBUG] ${e}`)}const s=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/,a=/\\n/g,u=/\n|\r|\r\n/;function c(e,t){const r=Boolean(t&&t.debug),n={};return e.toString().split(u).forEach((function(e,t){const o=e.match(s);if(null!=o){const e=o[1];let t=o[2]||"";const r=t.length-1,i='"'===t[0]&&'"'===t[r];"'"===t[0]&&"'"===t[r]||i?(t=t.substring(1,r),i&&(t=t.replace(a,"\n"))):t=t.trim(),n[e]=t}else r&&i(`did not match key and value when parsing line ${t+1}: ${e}`)})),n}t.exports.config=function(e){let t=o.resolve(r.cwd(),".env"),s="utf8",a=!1;e&&(null!=e.path&&(t=e.path),null!=e.encoding&&(s=e.encoding),null!=e.debug&&(a=!0));try{const e=c(n.readFileSync(t,{encoding:s}),{debug:a});return Object.keys(e).forEach((function(t){Object.prototype.hasOwnProperty.call(r.env,t)?a&&i(`"${t}" is already defined in \`process.env\` and will not be overwritten`):r.env[t]=e[t]})),{parsed:e}}catch(e){return{error:e}}},t.exports.parse=c}).call(this)}).call(this,e("_process"))},{_process:16,fs:7,path:15}],11:[function(e,t,r){var n=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return n()}try{return __global__||n()}finally{delete Object.prototype.__global__}}()},{}],12:[function(e,t,r){(function(e){(function(){!function(e){"use strict";function n(n){var o=n&&n.Promise||e.Promise,i=n&&n.XMLHttpRequest||e.XMLHttpRequest;return function(){var n=Object.create(e,{fetch:{value:void 0,writable:!0}});return function(e,n){"object"==typeof r&&void 0!==t?n(r):"function"==typeof define&&define.amd?define(["exports"],n):n(e.WHATWGFetch={})}(this,(function(e){var t=void 0!==n&&n||"undefined"!=typeof self&&self||void 0!==t&&t,r="URLSearchParams"in t,s="Symbol"in t&&"iterator"in Symbol,a="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),u="FormData"in t,c="ArrayBuffer"in t;if(c)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function v(e){this.map={},e instanceof v?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function y(e){if(e.bodyUsed)return o.reject(new TypeError("Already read"));e.bodyUsed=!0}function g(e){return new o((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function w(e){var t=new FileReader,r=g(t);return t.readAsArrayBuffer(e),r}function m(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=m(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||d(e))?this._bodyArrayBuffer=m(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=y(this);if(e)return e;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=y(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}return this.blob().then(w)}),this.text=function(){var e,t,r,n=y(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=g(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return o.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},u&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}v.prototype.append=function(e,t){e=f(e),t=h(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},v.prototype.delete=function(e){delete this.map[f(e)]},v.prototype.get=function(e){return e=f(e),this.has(e)?this.map[e]:null},v.prototype.has=function(e){return this.map.hasOwnProperty(f(e))},v.prototype.set=function(e,t){this.map[f(e)]=h(t)},v.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},v.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),p(e)},v.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},v.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),p(e)},s&&(v.prototype[Symbol.iterator]=v.prototype.entries);var C=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new v(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new v(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),C.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function x(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function T(e,t){if(!(this instanceof T))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"",this.headers=new v(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},b.call(E.prototype),b.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},T.error=function(){var e=new T(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];T.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new T(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function _(r,n){return new o((function(o,s){var u=new E(r,n);if(u.signal&&u.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var l=new i;function d(){l.abort()}l.onload=function(){var e,t,r={status:l.status,statusText:l.statusText,headers:(e=l.getAllResponseHeaders()||"",t=new v,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in l?l.responseURL:r.headers.get("X-Request-URL");var n="response"in l?l.response:l.responseText;setTimeout((function(){o(new T(n,r))}),0)},l.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},l.onabort=function(){setTimeout((function(){s(new e.DOMException("Aborted","AbortError"))}),0)},l.open(u.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?l.withCredentials=!0:"omit"===u.credentials&&(l.withCredentials=!1),"responseType"in l&&(a?l.responseType="blob":c&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(l.responseType="arraybuffer")),!n||"object"!=typeof n.headers||n.headers instanceof v?u.headers.forEach((function(e,t){l.setRequestHeader(t,e)})):Object.getOwnPropertyNames(n.headers).forEach((function(e){l.setRequestHeader(e,h(n.headers[e]))})),u.signal&&(u.signal.addEventListener("abort",d),l.onreadystatechange=function(){4===l.readyState&&u.signal.removeEventListener("abort",d)}),l.send(void 0===u._bodyInit?null:u._bodyInit)}))}_.polyfill=!0,t.fetch||(t.fetch=_,t.Headers=v,t.Request=E,t.Response=T),e.Headers=v,e.Request=E,e.Response=T,e.fetch=_,Object.defineProperty(e,"__esModule",{value:!0})})),{fetch:n.fetch,Headers:n.Headers,Request:n.Request,Response:n.Response,DOMException:n.DOMException}}()}"function"==typeof define&&define.amd?define((function(){return n})):"object"==typeof r?t.exports=n:e.fetchPonyfill=n}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==e?e:this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],13:[function(e,t,r){var n=1e3,o=60*n,i=60*o,s=24*i,a=7*s,u=365.25*s;function c(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*u;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*o;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return c(e,t,s,"day");if(t>=i)return c(e,t,i,"hour");if(t>=o)return c(e,t,o,"minute");if(t>=n)return c(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=o)return Math.round(e/o)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],14:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],15:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var r,n="",o=0,i=-1,s=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else{if(47===r)break;r=47}if(47===r){if(i===a-1||1===s);else if(i!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var u=n.lastIndexOf("/");if(u!==n.length-1){-1===u?(n="",o=0):o=(n=n.slice(0,u)).length-1-n.lastIndexOf("/"),i=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=a,s=0;continue}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),o=a-i-1;i=a,s=0}else 46===r&&-1!==s?++s:s=-1}return n}var o={resolve:function(){for(var t,o="",i=!1,s=arguments.length-1;s>=-1&&!i;s--){var a;s>=0?a=arguments[s]:(void 0===t&&(t=e.cwd()),a=t),r(a),0!==a.length&&(o=a+"/"+o,i=47===a.charCodeAt(0))}return o=n(o,!i),i?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];r(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var i=e.length,s=i-n,a=1;a<t.length&&47===t.charCodeAt(a);++a);for(var u=t.length-a,c=s<u?s:u,l=-1,d=0;d<=c;++d){if(d===c){if(u>c){if(47===t.charCodeAt(a+d))return t.slice(a+d+1);if(0===d)return t.slice(a+d)}else s>c&&(47===e.charCodeAt(n+d)?l=d:0===d&&(l=0));break}var f=e.charCodeAt(n+d);if(f!==t.charCodeAt(a+d))break;47===f&&(l=d)}var h="";for(d=n+l+1;d<=i;++d)d!==i&&47!==e.charCodeAt(d)||(0===h.length?h+="..":h+="/..");return h.length>0?h+t.slice(a+l):(a+=l,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,o=-1,i=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!i){o=s;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var n,o=0,i=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,u=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!s){o=n+1;break}}else-1===u&&(s=!1,u=n+1),a>=0&&(c===t.charCodeAt(a)?-1==--a&&(i=n):(a=-1,i=u))}return o===i?i=u:-1===i&&(i=e.length),e.slice(o,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){o=n+1;break}}else-1===i&&(s=!1,i=n+1);return-1===i?"":e.slice(o,i)},extname:function(e){r(e);for(var t=-1,n=0,o=-1,i=!0,s=0,a=e.length-1;a>=0;--a){var u=e.charCodeAt(a);if(47!==u)-1===o&&(i=!1,o=a+1),46===u?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!i){n=a+1;break}}return-1===t||-1===o||0===s||1===s&&t===o-1&&t===n+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,o=e.charCodeAt(0),i=47===o;i?(t.root="/",n=1):n=0;for(var s=-1,a=0,u=-1,c=!0,l=e.length-1,d=0;l>=n;--l)if(47!==(o=e.charCodeAt(l)))-1===u&&(c=!1,u=l+1),46===o?-1===s?s=l:1!==d&&(d=1):-1!==s&&(d=-1);else if(!c){a=l+1;break}return-1===s||-1===u||0===d||1===d&&s===u-1&&s===a+1?-1!==u&&(t.base=t.name=0===a&&i?e.slice(1,u):e.slice(a,u)):(0===a&&i?(t.name=e.slice(1,s),t.base=e.slice(1,u)):(t.name=e.slice(a,s),t.base=e.slice(a,u)),t.ext=e.slice(s,u)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}).call(this)}).call(this,e("_process"))},{_process:16}],16:[function(e,t,r){var n,o,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,l=[],d=!1,f=-1;function h(){d&&c&&(d=!1,c.length?l=c.concat(l):f=-1,l.length&&p())}function p(){if(!d){var e=u(h);d=!0;for(var t=l.length;t;){for(c=l,l=[];++f<t;)c&&c[f].run();f=-1,t=l.length}c=null,d=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function y(){}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];l.push(new v(e,t)),1!==l.length||d||u(p)},v.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=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,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}},{}],17:[function(e,t,r){var n;if("object"==typeof globalThis)n=globalThis;else try{n=e("es5-ext/global")}catch(e){}finally{if(n||"undefined"==typeof window||(n=window),!n)throw new Error("Could not determine global this")}var o=n.WebSocket||n.MozWebSocket,i=e("./version");function s(e,t){return t?new o(e,t):new o(e)}o&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(s,e,{get:function(){return o[e]}})})),t.exports={w3cwebsocket:o?s:null,version:i}},{"./version":18,"es5-ext/global":11}],18:[function(e,t,r){t.exports=e("../package.json").version},{"../package.json":19}],19:[function(e,t,r){t.exports={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)",contributors:["Iñaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"}},{}],"xumm-sdk":[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__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]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.XummSdkJwt=r.XummSdk=void 0;const a=e("debug"),u=i(e("dotenv")),c=e("./Meta"),l=e("./Storage"),d=e("./Payload"),f=e("./xApp"),h=a.debug("xumm-sdk");class p{constructor(e,t){return h("Constructed"),this.Meta=new c.Meta(e||this.getEnv("XUMM_APIKEY"),t||this.getEnv("XUMM_APISECRET")),this.storage=new l.Storage(this.Meta),this.payload=new d.Payload(this.Meta),this.xApp=new f.xApp(this.Meta),this.Meta._inject(this),this}getEnv(e){let r="";try{r="undefined"!=typeof Deno&&Deno.env.get(e)||"",u.config(),r=(null==t?void 0:t.env[e])||""}catch(e){}return r}ping(){return this.Meta.ping()}getCuratedAssets(){return this.Meta.getCuratedAssets()}getRates(e){return this.Meta.getRates(e)}getKycStatus(e){return this.Meta.getKycStatus(e)}getTransaction(e){return this.Meta.getTransaction(e)}verifyUserTokens(e){return this.Meta.verifyUserTokens(e)}verifyUserToken(e){return s(this,void 0,void 0,(function*(){const t=yield this.Meta.verifyUserTokens([e]);return Array.isArray(t)&&1===t.length?t[0]:null}))}setEndpoint(e){return this.Meta.setEndpoint(e)}caught(e){throw e}}r.XummSdk=p;r.XummSdkJwt=class extends p{constructor(e,t,r){var n,o,i;let s=String(t||"").trim().toLowerCase();const a=36!==e.length;if(!a&&void 0===t&&"undefined"!=typeof window&&void 0!==window.URLSearchParams){const e=new window.URLSearchParams((null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.search)||"");for(const t of e.entries())"xAppToken"===t[0]&&(s=t[1].toLowerCase().trim())}super(e,a||""===s?"RAWJWT:"+e:"xApp:OneTimeToken:"+s),this.resolve=e=>{h("OTT data resolved",e)},this.reject=e=>{h("OTT data rejected",e.message)},this.ottResolved=a?Promise.resolve():new Promise(((e,t)=>{this.resolve=e,this.reject=t})),(null==r?void 0:r.fatalHandler)&&(this.fatalHandler=r.fatalHandler),this.store={get(e){var t;if(h("[JwtStore] » Builtin JWT store GET"),"undefined"!=typeof window&&void 0!==window.localStorage&&"string"==typeof window.localStorage.XummSdkJwt){const r=window.localStorage.XummSdkJwt.split(":");if(r[0]===e){h("Restoring OTT from localStorage:",e);try{return JSON.parse(r.slice(1).join(":"))}catch(e){h("Error restoring OTT Data (JWT) from localStorage",null===(t=e)||void 0===t?void 0:t.message)}}}},set(e,t){h("[JwtStore] » Builtin JWT store SET",e),"undefined"!=typeof window&&"undefined"!=typeof localStorage&&(window.localStorage.XummSdkJwt=e+":"+JSON.stringify(t))}},(null===(o=null==r?void 0:r.store)||void 0===o?void 0:o.get)&&(this.store.get=r.store.get),(null===(i=null==r?void 0:r.store)||void 0===i?void 0:i.set)&&(this.store.set=r.store.set),a?(this.reject(new Error("Not in OTT flow: in raw JWT (OAuth2-like) flow")),h("Using JWT (Raw, OAuth2) flow")):h("Using JWT (xApp) flow")}_jwtStore(e,t){if(e&&(null==e?void 0:e.constructor)===c.Meta)return{get:e=>{var t;return h("[JwtStore] Proxy GET"),null===(t=this.store)||void 0===t?void 0:t.get(e)},set:(e,r)=>{var n;return h("[JwtStore] Proxy SET"),this.resolve(r.ott),t(r.jwt),null===(n=this.store)||void 0===n?void 0:n.set(e,r)}};throw new Error("Invalid _jwtStore invoker")}getOttData(){return s(this,void 0,void 0,(function*(){const e=yield this.ottResolved;if(e)return e;throw new Error("Called getOttData on a non OTT-JWT flow")}))}caught(e){this.reject(e)}}}).call(this)}).call(this,e("_process"))},{"./Meta":1,"./Payload":2,"./Storage":3,"./xApp":5,_process:16,debug:8,dotenv:10}]},{},[]);
require=function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=r[s]={exports:{}};t[s][0].call(d.exports,(function(e){return o(t[s][1][e]||e)}),d,d.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.Meta=void 0;const i=e("debug"),s=o(e("fetch-ponyfill")),{fetch:a,Request:u,Response:c,Headers:d}=s.default(),l=e("os-browserify"),f=e("./utils"),h=e("./index"),p=i.debug("xumm-sdk:meta");r.Meta=class{constructor(e,r){this.isBrowser=!1,this.jwtFlow=!1,this.injected=!1,this.endpoint="https://xumm.app",p("Constructed");const n=new RegExp("^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"),o={split:r.split(":"),uuidv4:""};if(3===o.split.length&&"xApp:OneTimeToken"===o.split.slice(0,2).join(":")?(o.uuidv4=o.split[2],this.jwtFlow=!0):o.split.length>1&&"RAWJWT"===o.split[0]?(this.jwtFlow=!0,this.jwt=o.split.slice(1).join(":")):o.uuidv4=r,!n.test(e)||!n.test(o.uuidv4)){if(!this.jwtFlow)throw new Error("Invalid API Key and/or API Secret. Use dotenv or constructor params.");if(!this.jwt)throw new Error("Invalid API Key and/or OTT (One Time Token). Provide OTT param (2nd param) or make sure `xAppToken` query param is present (Browser)")}return void 0!==t&&Object.keys(t).indexOf("window")<0?p("Running in node"):(console.log("XUMM SDK: Running in browser"),this.isBrowser=!0),this.apiKey=e,this.apiSecret=o.uuidv4,this.jwtFlow&&!this.jwt&&Promise.resolve().then((()=>this.authorize())).catch((e=>{p("Authorize error:",e.message),(null==this?void 0:this.invoker)&&this.invoker.caught(e)})),this}setEndpoint(e){return!!e.match(/^http/)&&(this.endpoint=e.trim(),!0)}authorize(){var e,t,r,o;return n(this,void 0,void 0,(function*(){let n;p("JWT Authorize",this.apiSecret),(null==this?void 0:this.invoker)&&this.invoker.constructor===h.XummSdkJwt&&(n=this.invoker._jwtStore(this,(e=>this.jwt=e)));const i=(null==n?void 0:n.get(this.apiSecret))||(yield this.call("authorize"));if(null===(t=null===(e=i)||void 0===e?void 0:e.error)||void 0===t?void 0:t.code)p("Could not resolve API Key & OTT to JWT (already fetched? Unauthorized?)"),(null==this?void 0:this.invoker)&&this.invoker.constructor===h.XummSdkJwt&&(null===(r=null==this?void 0:this.invoker)||void 0===r?void 0:r.fatalHandler)?this.invoker.fatalHandler(new Error(i.error.reference)):f.throwIfError(i);else{if(!(null===(o=i)||void 0===o?void 0:o.jwt))throw new Error("Unexpected response for xApp JWT authorize request");{const e=i;null==n||n.set(this.apiSecret,e)}}}))}call(e,t="GET",r){var o;return n(this,void 0,void 0,(function*(){const n=t.toUpperCase();try{let t;void 0!==r&&("object"==typeof r&&null!==r&&(t=JSON.stringify(r)),"string"==typeof r&&(t=r));const o={"Content-Type":"application/json"};this.isBrowser||Object.assign(o,{"User-Agent":`xumm-sdk/node (${l.hostname()}) node-fetch`}),this.jwtFlow?"authorize"===e?Object.assign(o,{"x-api-key":this.apiKey,"x-api-ott":this.apiSecret}):Object.assign(o,{Authorization:"Bearer "+this.jwt}):Object.assign(o,{"x-api-key":this.apiKey,"x-api-secret":this.apiSecret});const i=["authorize","ping","curated-assets","rates","payload","userdata"],s=this.jwtFlow&&i.indexOf(e.split("/")[0])>-1?"jwt":"platform",u=yield a(this.endpoint+"/api/v1/"+s+"/"+e,{method:n,body:t,headers:o});return yield u.json()}catch(t){const r=new Error(`Unexpected response from XUMM API [${n}:${e}]`);throw r.stack=(null===(o=t)||void 0===o?void 0:o.stack)||void 0,r}}))}ping(){var e,t;return n(this,void 0,void 0,(function*(){const r=yield this.call("ping");if(f.throwIfError(r),void 0!==r.auth)return r.auth;if(void 0!==(null===(e=r)||void 0===e?void 0:e.ott_uuidv4))return{application:{uuidv4:r.app_uuidv4,name:r.app_name},jwtData:r};if(void 0!==(null===(t=r)||void 0===t?void 0:t.usertoken_uuidv4))return{application:{uuidv4:r.client_id,name:r.app_name},jwtData:r};throw new Error("Unexpected response for ping request")}))}getCuratedAssets(){return n(this,void 0,void 0,(function*(){return yield this.call("curated-assets")}))}getRates(e){return n(this,void 0,void 0,(function*(){return yield this.call("rates/"+e.trim().toUpperCase())}))}getKycStatus(e){return n(this,void 0,void 0,(function*(){if(e.trim().match(/^r/)){const t=yield this.call("kyc-status/"+e.trim());return(null==t?void 0:t.kycApproved)?"SUCCESSFUL":"NONE"}{const t=yield this.call("kyc-status","POST",{user_token:e});return(null==t?void 0:t.kycStatus)||"NONE"}}))}getTransaction(e){return n(this,void 0,void 0,(function*(){return yield this.call("xrpl-tx/"+e.trim())}))}verifyUserTokens(e){return n(this,void 0,void 0,(function*(){return(yield this.call("user-tokens","POST",{tokens:Array.isArray(e)?e:[e]})).tokens}))}_inject(e){if(this.injected)throw new Error("Cannot `_inject` twice");this.invoker=e}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./index":"xumm-sdk","./utils":4,debug:7,"fetch-ponyfill":10,"os-browserify":12}],2:[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.Payload=void 0;const o=e("debug"),i=e("websocket"),s=e("./utils"),a=o.debug("xumm-sdk:payload"),u=o.debug("xumm-sdk:payload:websocket");r.Payload=class{constructor(e){a("Constructed"),this.Meta=e}resolvePayload(e){var t,r,o;return n(this,void 0,void 0,(function*(){if("string"==typeof e)return yield this.get(e,!0);if(void 0!==(null===(t=e)||void 0===t?void 0:t.uuid))return yield this.get(e.uuid,!0);if(void 0!==(null===(o=null===(r=e)||void 0===r?void 0:r.meta)||void 0===o?void 0:o.uuid))return e;throw new Error("Could not resolve payload (not found)")}))}create(e,t=!1){var r;return n(this,void 0,void 0,(function*(){const n=void 0!==e.TransactionType&&void 0===e.txjson,o=yield this.Meta.call("payload","POST",n?{txjson:e}:e);t&&s.throwIfError(o);return void 0!==(null===(r=o)||void 0===r?void 0:r.next)?o:null}))}get(e,t=!1){var r,o;return n(this,void 0,void 0,(function*(){const n="string"==typeof e?e:null==e?void 0:e.uuid,i=yield this.Meta.call("payload/"+n,"GET");t&&s.throwIfError(i);return void 0!==(null===(o=null===(r=i)||void 0===r?void 0:r.meta)||void 0===o?void 0:o.uuid)?i:null}))}subscribe(e,r){var o,a;return n(this,void 0,void 0,(function*(){const c=new s.DeferredPromise,d=yield this.resolvePayload(e);if(d){const e=void 0!==(null===(o=t)||void 0===o?void 0:o.MockedWebSocket)&&"undefined"!=typeof jest?new(null===(a=t)||void 0===a?void 0:a.MockedWebSocket)("ws://xumm.local"):new i.w3cwebsocket(this.Meta.endpoint.replace(/^http/,"ws")+"/sign/"+d.meta.uuid);return c.promise.then((()=>{e.close()})),e.onopen=()=>{u(`Payload ${d.meta.uuid}: Subscription active (WebSocket opened)`)},e.onmessage=e=>n(this,void 0,void 0,(function*(){const t=e.data;let o;try{o=JSON.parse(t.toString())}catch(e){u(`Payload ${d.meta.uuid}: Received message, unable to parse as JSON`,e)}if(o&&r&&void 0===o.devapp_fetched)try{const e=yield r({uuid:d.meta.uuid,data:o,resolve(e){return n(this,void 0,void 0,(function*(){yield c.resolve(e||void 0)}))},payload:d});void 0!==e&&c.resolve(e)}catch(e){u(`Payload ${d.meta.uuid}: Callback exception`,e)}})),e.onclose=e=>{u(`Payload ${d.meta.uuid}: Subscription ended (WebSocket closed)`)},{payload:d,resolve(e){c.resolve(e||void 0)},resolved:c.promise,websocket:e}}throw s.throwIfError(d),Error("Couldn't subscribe: couldn't fetch payload")}))}cancel(e,t=!1){var r,o,i;return n(this,void 0,void 0,(function*(){const n=yield this.resolvePayload(e),a=yield this.Meta.call("payload/"+(null===(r=null==n?void 0:n.meta)||void 0===r?void 0:r.uuid),"DELETE");t&&s.throwIfError(a);return void 0!==(null===(i=null===(o=a)||void 0===o?void 0:o.meta)||void 0===i?void 0:i.uuid)?a:null}))}createAndSubscribe(e,t){return n(this,void 0,void 0,(function*(){const r=yield this.create(e,!0);if(r){const e=yield this.subscribe(r,t);return Object.assign({created:r},e)}throw new Error("Error creating payload or subscribing to created payload")}))}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":4,debug:7,websocket:14}],3:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.Storage=void 0;const o=e("debug"),i=e("./utils"),s=o.debug("xumm-sdk:storage");r.Storage=class{constructor(e){s("Constructed"),this.Meta=e}get(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("app-storage","GET");return i.throwIfError(e),e.data}))}set(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("app-storage","POST",e);return i.throwIfError(t),t.stored}))}delete(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("app-storage","DELETE");return i.throwIfError(e),e.stored}))}}},{"./utils":4,debug:7}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DeferredPromise=r.throwIfError=void 0,r.throwIfError=function(e){var t,r,n,o,i,s;if(void 0!==e.message)throw new Error(e.message);if(void 0===e.next&&void 0===(null===(r=null===(t=e)||void 0===t?void 0:t.meta)||void 0===r?void 0:r.uuid)&&void 0===(null===(o=null===(n=e)||void 0===n?void 0:n.application)||void 0===o?void 0:o.uuidv4)&&void 0!==(null===(s=null===(i=e)||void 0===i?void 0:i.error)||void 0===s?void 0:s.code)){const t=e.error;throw new Error(`Error code ${t.code}, see XUMM Dev Console, reference: ${t.reference}`)}};r.DeferredPromise=class{constructor(){this.resolveFn=e=>{},this.rejectFn=e=>{},this.promise=new Promise(((e,t)=>{this.resolveFn=e,this.rejectFn=t}))}resolve(e){return this.resolveFn(e),this.promise}reject(e){return this.rejectFn(e),this.promise}}},{}],5:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.xApp=void 0;const o=e("debug"),i=e("./xAppUserdata"),s=e("./utils"),a=o.debug("xumm-sdk:xapp");r.xApp=class{constructor(e){a("Constructed"),this.Meta=e,this.userdata=new i.xAppUserdata(this.Meta)}get(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/ott/"+e,"GET");return s.throwIfError(t),t}))}event(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/event","POST",e);return s.throwIfError(t),t}))}push(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("xapp/push","POST",e);return s.throwIfError(t),t}))}}},{"./utils":4,"./xAppUserdata":6,debug:7}],6:[function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.xAppUserdata=void 0;const o=e("debug"),i=e("./utils"),s=o.debug("xumm-sdk:xapp:userdata");r.xAppUserdata=class{constructor(e){s("Constructed"),this.Meta=e}list(){return n(this,void 0,void 0,(function*(){const e=yield this.Meta.call("userdata","GET");return i.throwIfError(e),e.keys}))}get(e){var t;return n(this,void 0,void 0,(function*(){const r=Array.isArray(e)?e.join(","):e,n=yield this.Meta.call("userdata/"+r,"GET");return i.throwIfError(n),r.split(",").length>1?n.data:(null===(t=n.data)||void 0===t?void 0:t[r])||{}}))}delete(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.call("userdata/"+e,"DELETE");return i.throwIfError(t),t.persisted}))}set(e,t){return n(this,void 0,void 0,(function*(){const r=yield this.Meta.call("userdata/"+e,"POST",t);return i.throwIfError(r),r.persisted}))}}},{"./utils":4,debug:7}],7:[function(e,t,r){(function(n){(function(){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,o=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(o=n))})),e.splice(o,0,r)},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")}catch(e){}!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG);return e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:o}=t.exports;o.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":8,_process:13}],8:[function(e,t,r){t.exports=function(t){function r(e){let t,o=null;function i(...e){if(!i.enabled)return;const n=i,o=Number(new Date),s=o-(t||o);n.diff=s,n.prev=t,n.curr=o,t=o,e[0]=r.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,o)=>{if("%%"===t)return"%";a++;const i=r.formatters[o];if("function"==typeof i){const r=e[a];t=i.call(n,r),e.splice(a,1),a--}return t})),r.formatArgs.call(n,e);(n.log||r.log).apply(n,e)}return i.namespace=e,i.useColors=r.useColors(),i.color=r.selectColor(e),i.extend=n,i.destroy=r.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?r.enabled(e):o,set:e=>{o=e}}),"function"==typeof r.init&&r.init(i),i}function n(e,t){const n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},r.disable=function(){const e=[...r.names.map(o),...r.skips.map(o).map((e=>"-"+e))].join(",");return r.enable(""),e},r.enable=function(e){let t;r.save(e),r.names=[],r.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),o=n.length;for(t=0;t<o;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;let t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((e=>{r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:11}],9:[function(e,t,r){var n=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return n()}try{return __global__||n()}finally{delete Object.prototype.__global__}}()},{}],10:[function(e,t,r){(function(e){(function(){!function(e){"use strict";function n(n){var o=n&&n.Promise||e.Promise,i=n&&n.XMLHttpRequest||e.XMLHttpRequest;return function(){var n=Object.create(e,{fetch:{value:void 0,writable:!0}});return function(e,n){"object"==typeof r&&void 0!==t?n(r):"function"==typeof define&&define.amd?define(["exports"],n):n(e.WHATWGFetch={})}(this,(function(e){var t=void 0!==n&&n||"undefined"!=typeof self&&self||void 0!==t&&t,r="URLSearchParams"in t,s="Symbol"in t&&"iterator"in Symbol,a="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),u="FormData"in t,c="ArrayBuffer"in t;if(c)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],l=ArrayBuffer.isView||function(e){return e&&d.indexOf(Object.prototype.toString.call(e))>-1};function f(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function h(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return s&&(t[Symbol.iterator]=function(){return t}),t}function y(e){this.map={},e instanceof y?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function v(e){if(e.bodyUsed)return o.reject(new TypeError("Already read"));e.bodyUsed=!0}function w(e){return new o((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function m(e){var t=new FileReader,r=w(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:u&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&a&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||l(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var e=v(this);if(e)return e;if(this._bodyBlob)return o.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return o.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return o.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=v(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?o.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):o.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var e,t,r,n=v(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=w(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return o.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return o.resolve(this._bodyText)},u&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}y.prototype.append=function(e,t){e=f(e),t=h(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},y.prototype.delete=function(e){delete this.map[f(e)]},y.prototype.get=function(e){return e=f(e),this.has(e)?this.map[e]:null},y.prototype.has=function(e){return this.map.hasOwnProperty(f(e))},y.prototype.set=function(e,t){this.map[f(e)]=h(t)},y.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},y.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),p(e)},y.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),p(e)},y.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),p(e)},s&&(y.prototype[Symbol.iterator]=y.prototype.entries);var C=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,n,o=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new y(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new y(t.headers)),this.method=(r=t.method||this.method||"GET",n=r.toUpperCase(),C.indexOf(n)>-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function T(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function x(e,t){if(!(this instanceof x))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"",this.headers=new y(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},b.call(E.prototype),b.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:0,statusText:""});return e.type="error",e};var _=[301,302,303,307,308];x.redirect=function(e,t){if(-1===_.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function A(r,n){return new o((function(o,s){var u=new E(r,n);if(u.signal&&u.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var d=new i;function l(){d.abort()}d.onload=function(){var e,t,r={status:d.status,statusText:d.statusText,headers:(e=d.getAllResponseHeaders()||"",t=new y,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in d?d.responseURL:r.headers.get("X-Request-URL");var n="response"in d?d.response:d.responseText;setTimeout((function(){o(new x(n,r))}),0)},d.onerror=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},d.ontimeout=function(){setTimeout((function(){s(new TypeError("Network request failed"))}),0)},d.onabort=function(){setTimeout((function(){s(new e.DOMException("Aborted","AbortError"))}),0)},d.open(u.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?d.withCredentials=!0:"omit"===u.credentials&&(d.withCredentials=!1),"responseType"in d&&(a?d.responseType="blob":c&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(d.responseType="arraybuffer")),!n||"object"!=typeof n.headers||n.headers instanceof y?u.headers.forEach((function(e,t){d.setRequestHeader(t,e)})):Object.getOwnPropertyNames(n.headers).forEach((function(e){d.setRequestHeader(e,h(n.headers[e]))})),u.signal&&(u.signal.addEventListener("abort",l),d.onreadystatechange=function(){4===d.readyState&&u.signal.removeEventListener("abort",l)}),d.send(void 0===u._bodyInit?null:u._bodyInit)}))}A.polyfill=!0,t.fetch||(t.fetch=A,t.Headers=y,t.Request=E,t.Response=x),e.Headers=y,e.Request=E,e.Response=x,e.fetch=A,Object.defineProperty(e,"__esModule",{value:!0})})),{fetch:n.fetch,Headers:n.Headers,Request:n.Request,Response:n.Response,DOMException:n.DOMException}}()}"function"==typeof define&&define.amd?define((function(){return n})):"object"==typeof r?t.exports=n:e.fetchPonyfill=n}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==e?e:this)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,r){var n=1e3,o=60*n,i=60*o,s=24*i,a=7*s,u=365.25*s;function c(e,t,r,n){var o=t>=1.5*r;return Math.round(e/r)+" "+n+(o?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*u;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*o;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=s)return c(e,t,s,"day");if(t>=i)return c(e,t,i,"hour");if(t>=o)return c(e,t,o,"minute");if(t>=n)return c(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=s)return Math.round(e/s)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=o)return Math.round(e/o)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],12:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],13:[function(e,t,r){var n,o,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var c,d=[],l=!1,f=-1;function h(){l&&c&&(l=!1,c.length?d=c.concat(d):f=-1,d.length&&p())}function p(){if(!l){var e=u(h);l=!0;for(var t=d.length;t;){for(c=d,d=[];++f<t;)c&&c[f].run();f=-1,t=d.length}c=null,l=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===a||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function v(){}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];d.push(new y(e,t)),1!==d.length||l||u(p)},y.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=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,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}},{}],14:[function(e,t,r){var n;if("object"==typeof globalThis)n=globalThis;else try{n=e("es5-ext/global")}catch(e){}finally{if(n||"undefined"==typeof window||(n=window),!n)throw new Error("Could not determine global this")}var o=n.WebSocket||n.MozWebSocket,i=e("./version");function s(e,t){return t?new o(e,t):new o(e)}o&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(s,e,{get:function(){return o[e]}})})),t.exports={w3cwebsocket:o?s:null,version:i}},{"./version":15,"es5-ext/global":9}],15:[function(e,t,r){t.exports=e("../package.json").version},{"../package.json":16}],16:[function(e,t,r){t.exports={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)",contributors:["Iñaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"}},{}],"xumm-sdk":[function(e,t,r){(function(t){(function(){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(r,"__esModule",{value:!0}),r.XummSdkJwt=r.XummSdk=void 0;const o=e("debug"),i=e("./Meta"),s=e("./Storage"),a=e("./Payload"),u=e("./xApp"),c=o.debug("xumm-sdk");class d{constructor(e,t){return c("Constructed"),this.Meta=new i.Meta(e||this.getEnv("XUMM_APIKEY"),t||this.getEnv("XUMM_APISECRET")),this.storage=new s.Storage(this.Meta),this.payload=new a.Payload(this.Meta),this.xApp=new u.xApp(this.Meta),this.Meta._inject(this),this}getEnv(e){let r="";try{r="undefined"!=typeof Deno&&Deno.env.get(e)||"",r=(null==t?void 0:t.env[e])||""}catch(e){}return r}ping(){return this.Meta.ping()}getCuratedAssets(){return this.Meta.getCuratedAssets()}getRates(e){return this.Meta.getRates(e)}getKycStatus(e){return this.Meta.getKycStatus(e)}getTransaction(e){return this.Meta.getTransaction(e)}verifyUserTokens(e){return this.Meta.verifyUserTokens(e)}verifyUserToken(e){return n(this,void 0,void 0,(function*(){const t=yield this.Meta.verifyUserTokens([e]);return Array.isArray(t)&&1===t.length?t[0]:null}))}setEndpoint(e){return this.Meta.setEndpoint(e)}caught(e){throw e}}r.XummSdk=d;r.XummSdkJwt=class extends d{constructor(e,t,r){var n,o,i;let s=String(t||"").trim().toLowerCase();const a=36!==e.length;if(!a&&void 0===t&&"undefined"!=typeof window&&void 0!==window.URLSearchParams){const e=new window.URLSearchParams((null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.search)||"");for(const t of e.entries())"xAppToken"===t[0]&&(s=t[1].toLowerCase().trim())}super(e,a||""===s?"RAWJWT:"+e:"xApp:OneTimeToken:"+s),this.resolve=e=>{c("OTT data resolved",e)},this.reject=e=>{c("OTT data rejected",e.message)},this.ottResolved=a?Promise.resolve():new Promise(((e,t)=>{this.resolve=e,this.reject=t})),(null==r?void 0:r.fatalHandler)&&(this.fatalHandler=r.fatalHandler),this.store={get(e){var t;if(c("[JwtStore] » Builtin JWT store GET"),"undefined"!=typeof window&&void 0!==window.localStorage&&"string"==typeof window.localStorage.XummSdkJwt){const r=window.localStorage.XummSdkJwt.split(":");if(r[0]===e){c("Restoring OTT from localStorage:",e);try{return JSON.parse(r.slice(1).join(":"))}catch(e){c("Error restoring OTT Data (JWT) from localStorage",null===(t=e)||void 0===t?void 0:t.message)}}}},set(e,t){c("[JwtStore] » Builtin JWT store SET",e),"undefined"!=typeof window&&"undefined"!=typeof localStorage&&(window.localStorage.XummSdkJwt=e+":"+JSON.stringify(t))}},(null===(o=null==r?void 0:r.store)||void 0===o?void 0:o.get)&&(this.store.get=r.store.get),(null===(i=null==r?void 0:r.store)||void 0===i?void 0:i.set)&&(this.store.set=r.store.set),a?(this.reject(new Error("Not in OTT flow: in raw JWT (OAuth2-like) flow")),c("Using JWT (Raw, OAuth2) flow")):c("Using JWT (xApp) flow")}_jwtStore(e,t){if(e&&(null==e?void 0:e.constructor)===i.Meta)return{get:e=>{var t;return c("[JwtStore] Proxy GET"),null===(t=this.store)||void 0===t?void 0:t.get(e)},set:(e,r)=>{var n;return c("[JwtStore] Proxy SET"),this.resolve(r.ott),t(r.jwt),null===(n=this.store)||void 0===n?void 0:n.set(e,r)}};throw new Error("Invalid _jwtStore invoker")}getOttData(){return n(this,void 0,void 0,(function*(){const e=yield this.ottResolved;if(e)return e;throw new Error("Called getOttData on a non OTT-JWT flow")}))}caught(e){this.reject(e)}}}).call(this)}).call(this,e("_process"))},{"./Meta":1,"./Payload":2,"./Storage":3,"./xApp":5,_process:13,debug:7}]},{},[]);
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -33,3 +14,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

const debug_1 = require("debug");
const dotenv = __importStar(require("dotenv"));
const Meta_1 = require("./Meta");

@@ -55,3 +35,2 @@ const Storage_1 = require("./Storage");

/* Deno */ value = typeof Deno !== 'undefined' ? (Deno.env.get(arg) || '') : '';
/* Node */ dotenv.config();
/* Node */ value = (process === null || process === void 0 ? void 0 : process.env[arg]) || '';

@@ -58,0 +37,0 @@ }

{
"name": "xumm-sdk",
"version": "1.3.5",
"version": "1.3.6",
"description": "Interact with the Xumm Developer API",

@@ -12,3 +12,3 @@ "main": "dist/src/index.js",

"watch": "tsc -w",
"dev": "clear; npm run build; DEBUG=xumm-sdk* nodemon dist/samples/dev.js",
"dev": "clear; npm run build; DEBUG=xumm-sdk* nodemon --require dotenv/config dist/samples/dev.js",
"browserify": "browserify -r ./dist/src/index.js:xumm-sdk -o dist/browser.js && npm run minify",

@@ -30,3 +30,2 @@ "minify": "cat dist/browser.js | terser --compress --mangle > dist/browser.min.js",

"debug": "^4.1.1",
"dotenv": "^8.2.0",
"fetch-ponyfill": "^7.1.0",

@@ -42,2 +41,3 @@ "node-fetch": "^2.6.1",

"@types/node-fetch": "^2.5.7",
"dotenv": "^8.2.0",
"browserify": "^17.0.0",

@@ -44,0 +44,0 @@ "jest": "^26.4.2",

@@ -56,3 +56,3 @@ # XUMM SDK (JS/TS) [![npm version](https://badge.fury.io/js/xumm-sdk.svg)](https://www.npmjs.com/xumm-sdk) [![GitHub Actions NodeJS status](https://github.com/XRPL-Labs/XUMM-SDK/workflows/NodeJS/badge.svg?branch=master)](https://github.com/XRPL-Labs/XUMM-SDK/actions) [![GitHub Actions Deno status](https://github.com/XRPL-Labs/XUMM-SDK/workflows/Deno/badge.svg?branch=master)](https://github.com/XRPL-Labs/XUMM-SDK/actions)

const Sdk = new XummSdk();
// Or with manually provided credentials (instead of using dotenv):
// Or with manually provided credentials (instead of using dotenv (see note further down)):
// const Sdk = new XummSdk('someAppKey', 'someAppSecret')

@@ -84,4 +84,18 @@ //

The SDK will look in your environment or dotenv file (`.env`) for the `XUMM_APIKEY` and `XUMM_APISECRET` values. A `.env.sample` file is provided in this repository. A [sample dotenv file looks like this](https://github.com/XRPL-Labs/XUMM-SDK/blob/master/.env.sample). Alternatively you can provide your XUMM API Key & Secret by passing them to the XummSdk constructor.
The SDK will look in your environment for the `XUMM_APIKEY` and `XUMM_APISECRET` environment values. A `.env.sample` file is provided in this repository. A [sample dotenv file looks like this](https://github.com/XRPL-Labs/XUMM-SDK/blob/master/.env.sample). Alternatively you can provide your XUMM API Key & Secret by passing them to the XummSdk constructor.
Please note that you will have to load `dotenv` yourself, when running on the command line, you can run `dotenv` to parse a `.env` file like this:
```
node --require dotenv/config dist/samples/dev.js
```
If you include `xumm-sdk` in a node project, make sure to include and call the `config()` method of `dotenv` before constructing the `XummSdk`:
```
import {XummSdk} from 'xumm-sdk'
import * as dotenv from 'dotenv'
dotenv.config()
const sdk = new XummSdk()
```
If both your environment and the SDK constructor contain credentials, the values provided to the constructor will be used.

@@ -88,0 +102,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc