Socket
Socket
Sign inDemoInstall

@walletconnect/jsonrpc-http-connection

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/jsonrpc-http-connection - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

dist/umd/index.min.js

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

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("HttpConnection",[],e):"object"==typeof exports?exports.HttpConnection=e():t.HttpConnection=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=16)}([function(t,e,r){"use strict";r.d(e,"e",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return i})),r.d(e,"b",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"g",(function(){return c})),r.d(e,"f",(function(){return a})),r.d(e,"h",(function(){return f})),r.d(e,"i",(function(){return d}));const n="PARSE_ERROR",o="INVALID_REQUEST",i="METHOD_NOT_FOUND",s="INVALID_PARAMS",u="INTERNAL_ERROR",c="SERVER_ERROR",a=[-32700,-32600,-32601,-32602,-32603],f=[-32e3,-32099],d={[n]:{code:-32700,message:"Parse error"},[o]:{code:-32600,message:"Invalid Request"},[i]:{code:-32601,message:"Method not found"},[s]:{code:-32602,message:"Invalid params"},[u]:{code:-32603,message:"Internal error"},[c]:{code:-32e3,message:"Server error"}}},function(t,e,r){"use strict";r.d(e,"d",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"g",(function(){return a})),r.d(e,"f",(function(){return f}));var n=r(0);function o(t){return t<=n.h[0]&&t>=n.h[1]}function i(t){return n.f.includes(t)}function s(t){return"number"==typeof t}function u(t){return Object.keys(n.i).includes(t)?n.i[t]:n.i[n.a]}function c(t){const e=Object.values(n.i).find(e=>e.code===t);return e||n.i[n.a]}function a(t){if(void 0===t.error.code)return{valid:!1,error:"Missing code for JSON-RPC error"};if(void 0===t.error.message)return{valid:!1,error:"Missing message for JSON-RPC error"};if(!s(t.error.code))return{valid:!1,error:"Invalid error code type for JSON-RPC: "+t.error.code};if(i(t.error.code)){const e=c(t.error.code);if(e.message!==n.i[n.a].message&&t.error.message===e.message)return{valid:!1,error:"Invalid error code message for JSON-RPC: "+t.error.code}}return{valid:!0}}function f(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));class n{}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4);n.__exportStar(r(21),e),n.__exportStar(r(23),e)},function(t,e,r){"use strict";r.r(e),r.d(e,"__extends",(function(){return o})),r.d(e,"__assign",(function(){return i})),r.d(e,"__rest",(function(){return s})),r.d(e,"__decorate",(function(){return u})),r.d(e,"__param",(function(){return c})),r.d(e,"__metadata",(function(){return a})),r.d(e,"__awaiter",(function(){return f})),r.d(e,"__generator",(function(){return d})),r.d(e,"__createBinding",(function(){return l})),r.d(e,"__exportStar",(function(){return p})),r.d(e,"__values",(function(){return h})),r.d(e,"__read",(function(){return y})),r.d(e,"__spread",(function(){return v})),r.d(e,"__spreadArrays",(function(){return b})),r.d(e,"__await",(function(){return m})),r.d(e,"__asyncGenerator",(function(){return _})),r.d(e,"__asyncDelegator",(function(){return g})),r.d(e,"__asyncValues",(function(){return R})),r.d(e,"__makeTemplateObject",(function(){return E})),r.d(e,"__importStar",(function(){return w})),r.d(e,"__importDefault",(function(){return O})),r.d(e,"__classPrivateFieldGet",(function(){return T})),r.d(e,"__classPrivateFieldSet",(function(){return x}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("HttpConnection",[],e):"object"==typeof exports?exports.HttpConnection=e():t.HttpConnection=e()}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=16)}([function(t,e,r){"use strict";r.d(e,"f",(function(){return n})),r.d(e,"d",(function(){return o})),r.d(e,"e",(function(){return i})),r.d(e,"c",(function(){return s})),r.d(e,"b",(function(){return u})),r.d(e,"h",(function(){return c})),r.d(e,"g",(function(){return a})),r.d(e,"i",(function(){return f})),r.d(e,"j",(function(){return d})),r.d(e,"a",(function(){return l}));const n="PARSE_ERROR",o="INVALID_REQUEST",i="METHOD_NOT_FOUND",s="INVALID_PARAMS",u="INTERNAL_ERROR",c="SERVER_ERROR",a=[-32700,-32600,-32601,-32602,-32603],f=[-32e3,-32099],d={[n]:{code:-32700,message:"Parse error"},[o]:{code:-32600,message:"Invalid Request"},[i]:{code:-32601,message:"Method not found"},[s]:{code:-32602,message:"Invalid params"},[u]:{code:-32603,message:"Internal error"},[c]:{code:-32e3,message:"Server error"}},l=c},function(t,e,r){"use strict";r.d(e,"d",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"g",(function(){return a})),r.d(e,"f",(function(){return f}));var n=r(0);function o(t){return t<=n.i[0]&&t>=n.i[1]}function i(t){return n.g.includes(t)}function s(t){return"number"==typeof t}function u(t){return Object.keys(n.j).includes(t)?n.j[t]:n.j[n.a]}function c(t){const e=Object.values(n.j).find(e=>e.code===t);return e||n.j[n.a]}function a(t){if(void 0===t.error.code)return{valid:!1,error:"Missing code for JSON-RPC error"};if(void 0===t.error.message)return{valid:!1,error:"Missing message for JSON-RPC error"};if(!s(t.error.code))return{valid:!1,error:"Invalid error code type for JSON-RPC: "+t.error.code};if(i(t.error.code)){const e=c(t.error.code);if(e.message!==n.j[n.a].message&&t.error.message===e.message)return{valid:!1,error:"Invalid error code message for JSON-RPC: "+t.error.code}}return{valid:!0}}function f(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return n}));class n{}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4);n.__exportStar(r(21),e),n.__exportStar(r(23),e)},function(t,e,r){"use strict";r.r(e),r.d(e,"__extends",(function(){return o})),r.d(e,"__assign",(function(){return i})),r.d(e,"__rest",(function(){return s})),r.d(e,"__decorate",(function(){return u})),r.d(e,"__param",(function(){return c})),r.d(e,"__metadata",(function(){return a})),r.d(e,"__awaiter",(function(){return f})),r.d(e,"__generator",(function(){return d})),r.d(e,"__createBinding",(function(){return l})),r.d(e,"__exportStar",(function(){return p})),r.d(e,"__values",(function(){return h})),r.d(e,"__read",(function(){return y})),r.d(e,"__spread",(function(){return v})),r.d(e,"__spreadArrays",(function(){return b})),r.d(e,"__await",(function(){return m})),r.d(e,"__asyncGenerator",(function(){return _})),r.d(e,"__asyncDelegator",(function(){return R})),r.d(e,"__asyncValues",(function(){return g})),r.d(e,"__makeTemplateObject",(function(){return E})),r.d(e,"__importStar",(function(){return w})),r.d(e,"__importDefault",(function(){return O})),r.d(e,"__classPrivateFieldGet",(function(){return T})),r.d(e,"__classPrivateFieldSet",(function(){return A}));
/*! *****************************************************************************

@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation.

***************************************************************************** */
var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function o(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function u(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function c(t,e){return function(r,n){e(r,n,t)}}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}c((n=n.apply(t,e||[])).next())}))}function d(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function l(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}function p(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(y(arguments[e]));return t}function b(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,u=i.length;s<u;s++,o++)n[o]=i[s];return n}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function _(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||u(t,e)}))})}function u(t,e){try{(r=o[t](e)).value instanceof m?Promise.resolve(r.value.v).then(c,a):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function c(t){u("next",t)}function a(t){u("throw",t)}function f(t,e){t(e),i.shift(),i.length&&u(i[0][0],i[0][1])}}function g(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:m(t[n](e)),done:"return"===n}:o?o(e):e}:o}}function R(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=h(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function E(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function w(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function O(t){return t&&t.__esModule?t:{default:t}}function T(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function x(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HttpConnection=void 0;const n=r(4),o=r(17),i=n.__importDefault(r(18)),s=r(19),u=r(20),c={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class a{constructor(t){if(this.url=t,this.events=new o.EventEmitter,this.isAvailable=!1,this.registering=!1,!u.isHttpUrl(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);this.url=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}open(t=this.url){return n.__awaiter(this,void 0,void 0,(function*(){yield this.register(t)}))}close(){return n.__awaiter(this,void 0,void 0,(function*(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}))}send(t,e){return n.__awaiter(this,void 0,void 0,(function*(){this.isAvailable||(yield this.register());try{const e=s.safeJsonStringify(t),r=yield i.default(this.url,Object.assign(Object.assign({},c),{body:e})),n=yield r.json();this.onPayload({data:n})}catch(e){this.onError(t.id,e)}}))}register(t=this.url){return n.__awaiter(this,void 0,void 0,(function*(){if(!u.isHttpUrl(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);if(this.registering)return new Promise((t,e)=>{this.events.once("register_error",t=>{e(t)}),this.events.once("open",()=>{if(void 0===this.isAvailable)return e(new Error("HTTP connection is missing or invalid"));t()})});this.url=t,this.registering=!0;try{const e=s.safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});yield i.default(t,Object.assign(Object.assign({},c),{body:e})),this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}))}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(void 0===t.data)return;const e="string"==typeof t.data?s.safeJsonParse(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const r=this.parseError(e),n=r.message||r.toString(),o=u.formatJsonRpcError(t,n);this.events.emit("payload",o)}parseError(t,e=this.url){return u.parseConnectionError(t,e,"HTTP")}}e.HttpConnection=a,e.default=a},function(t,e,r){"use strict";r.r(e),r.d(e,"isNodeJs",(function(){return i}));var n=r(3);for(var o in n)["default","isNodeJs"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);const i=n.isNode},function(t,e,r){"use strict";r.d(e,"e",(function(){return i})),r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"a",(function(){return a}));var n=r(1),o=r(0);function i(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function s(t,e,r){return{id:r||i(),jsonrpc:"2.0",method:t,params:e}}function u(t,e){return{id:t,jsonrpc:"2.0",result:e}}function c(t,e){return{id:t,jsonrpc:"2.0",error:a(e)}}function a(t){return void 0===t?Object(n.a)(o.a):("string"==typeof t&&(t=Object.assign(Object.assign({},Object(n.a)(o.g)),{message:t})),Object(n.c)(t.code)&&(t=Object(n.b)(t.code)),t)}},function(t,e,r){"use strict";function n(t){return t.includes("*")?i(t):!/\W/g.test(t)}function o(t){return"*"===t}function i(t){return!!o(t)||!!t.includes("*")&&(2===t.split("*").length&&1===t.split("*").filter(t=>""===t.trim()).length)}function s(t){return!o(t)&&i(t)&&!t.split("*")[0].trim()}function u(t){return!o(t)&&i(t)&&!t.split("*")[1].trim()}r.d(e,"c",(function(){return n})),r.d(e,"a",(function(){return o})),r.d(e,"e",(function(){return i})),r.d(e,"b",(function(){return s})),r.d(e,"d",(function(){return u}))},function(t,e,r){"use strict";r.r(e);var n=r(10);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o)},function(t,e,r){"use strict";r.r(e);var n=r(11);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);var i=r(2);r.d(e,"IEvents",(function(){return i.a}));var s=r(12);r.d(e,"IJsonRpcConnection",(function(){return s.b})),r.d(e,"IBaseJsonRpcProvider",(function(){return s.a})),r.d(e,"IJsonRpcProvider",(function(){return s.c}));var u=r(13);for(var o in u)["default","IEvents","IJsonRpcConnection","IBaseJsonRpcProvider","IJsonRpcProvider"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return u[t]}))}(o)},function(t,e){},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return i})),r.d(e,"c",(function(){return s}));var n=r(2);class o extends n.a{constructor(t){super()}}class i extends n.a{constructor(){super()}}class s extends i{constructor(t){super()}}},function(t,e){},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return s}));function n(t,e){const r=function(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(e&&e.length)return e[0]}(t);return void 0!==r&&new RegExp(e).test(r)}function o(t){return n(t,"^https?:")}function i(t){return n(t,"^wss?:")}function s(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}},function(t,e,r){"use strict";function n(t){return"object"==typeof t&&"id"in t&&"jsonrpc"in t&&"2.0"===t.jsonrpc}function o(t){return n(t)&&"method"in t}function i(t){return n(t)&&(s(t)||u(t))}function s(t){return"result"in t}function u(t){return"error"in t}function c(t){return"error"in t&&!1===t.valid}r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return i})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"f",(function(){return c}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4),o=n.__importDefault(r(5));n.__exportStar(r(5),e),e.default=o.default},function(t,e,r){"use strict";var n,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}b(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&b(t,"error",e,r)}(t,o,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function d(t,e,r,n){var o,i,s,u;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=f(t))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function h(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):v(o,o.length)}function y(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function v(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function b(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return f(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)i(c,this,e);else{var a=c.length,f=v(c,a);for(r=0;r<a;++r)i(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return d(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return d(this,t,e,!0)},u.prototype.once=function(t,e){return a(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,o,i,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return h(this,t,!0)},u.prototype.rawListeners=function(t){return h(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?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(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=h(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=a(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[a(t)]},l.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},l.prototype.set=function(t,e){this.map[a(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(t,e){var r,n,o=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function R(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(R.prototype),R.prototype.clone=function(){return new R(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},R.error=function(){var t=new R(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];R.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new R(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function w(t,r){return new Promise((function(n,i){var s=new _(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function c(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;n(new R(o,r))},u.onerror=function(){i(new TypeError("Network request failed"))},u.ontimeout=function(){i(new TypeError("Network request failed"))},u.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&o&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",c)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}w.polyfill=!0,t.fetch||(t.fetch=w,t.Headers=l,t.Request=_,t.Response=R),e.Headers=l,e.Request=_,e.Response=R,e.fetch=w,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e},function(t,e,r){"use strict";function n(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return JSON.parse(t)}catch(e){return t}}function o(t){return"string"==typeof t?t:JSON.stringify(t)}r.r(e),r.d(e,"safeJsonParse",(function(){return n})),r.d(e,"safeJsonStringify",(function(){return o}))},function(t,e,r){"use strict";r.r(e);var n=r(0);r.d(e,"PARSE_ERROR",(function(){return n.e})),r.d(e,"INVALID_REQUEST",(function(){return n.c})),r.d(e,"METHOD_NOT_FOUND",(function(){return n.d})),r.d(e,"INVALID_PARAMS",(function(){return n.b})),r.d(e,"INTERNAL_ERROR",(function(){return n.a})),r.d(e,"SERVER_ERROR",(function(){return n.g})),r.d(e,"RESERVED_ERROR_CODES",(function(){return n.f})),r.d(e,"SERVER_ERROR_CODE_RANGE",(function(){return n.h})),r.d(e,"STANDARD_ERROR_MAP",(function(){return n.i}));var o=r(1);r.d(e,"isServerErrorCode",(function(){return o.d})),r.d(e,"isReservedErrorCode",(function(){return o.c})),r.d(e,"isValidErrorCode",(function(){return o.e})),r.d(e,"getError",(function(){return o.a})),r.d(e,"getErrorByCode",(function(){return o.b})),r.d(e,"validateJsonRpcError",(function(){return o.g})),r.d(e,"parseConnectionError",(function(){return o.f}));var i=r(6);for(var s in i)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError"].indexOf(s)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(s);var u=r(7);r.d(e,"payloadId",(function(){return u.e})),r.d(e,"formatJsonRpcRequest",(function(){return u.c})),r.d(e,"formatJsonRpcResult",(function(){return u.d})),r.d(e,"formatJsonRpcError",(function(){return u.b})),r.d(e,"formatErrorMessage",(function(){return u.a}));var c=r(8);r.d(e,"isValidRoute",(function(){return c.c})),r.d(e,"isValidDefaultRoute",(function(){return c.a})),r.d(e,"isValidWildcardRoute",(function(){return c.e})),r.d(e,"isValidLeadingWildcardRoute",(function(){return c.b})),r.d(e,"isValidTrailingWildcardRoute",(function(){return c.d}));var a=r(9);for(var s in a)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError","payloadId","formatJsonRpcRequest","formatJsonRpcResult","formatJsonRpcError","formatErrorMessage","isValidRoute","isValidDefaultRoute","isValidWildcardRoute","isValidLeadingWildcardRoute","isValidTrailingWildcardRoute"].indexOf(s)<0&&function(t){r.d(e,t,(function(){return a[t]}))}(s);var f=r(14);r.d(e,"isHttpUrl",(function(){return f.a})),r.d(e,"isWsUrl",(function(){return f.c})),r.d(e,"isLocalhostUrl",(function(){return f.b}));var d=r(15);r.d(e,"isJsonRpcPayload",(function(){return d.b})),r.d(e,"isJsonRpcRequest",(function(){return d.c})),r.d(e,"isJsonRpcResponse",(function(){return d.d})),r.d(e,"isJsonRpcResult",(function(){return d.e})),r.d(e,"isJsonRpcError",(function(){return d.a})),r.d(e,"isJsonRpcValidationInvalid",(function(){return d.f}))},function(t,e,r){"use strict";(function(t){function r(){return(null==t?void 0:t.crypto)||(null==t?void 0:t.msCrypto)||{}}function n(){const t=r();return t.subtle||t.webkitSubtle}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0,e.getBrowerCrypto=r,e.getSubtleCrypto=n,e.isBrowserCryptoAvailable=function(){return!!r()&&!!n()}}).call(this,r(22))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){function r(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function n(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isNode=e.isReactNative=void 0,e.isReactNative=r,e.isNode=n,e.isBrowser=function(){return!r()&&!n()}}).call(this,r(24))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,a=[],f=!1,d=-1;function l(){f&&c&&(f=!1,c.length?a=c.concat(a):d=-1,a.length&&p())}function p(){if(!f){var t=u(l);f=!0;for(var e=a.length;e;){for(c=a,a=[];++d<e;)c&&c[d].run();d=-1,e=a.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];a.push(new h(t,e)),1!==a.length||f||u(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));
var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function o(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function s(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function u(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function c(t,e){return function(r,n){e(r,n,t)}}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function f(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,u)}c((n=n.apply(t,e||[])).next())}))}function d(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}function l(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}function p(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])}function h(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function v(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(y(arguments[e]));return t}function b(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,u=i.length;s<u;s++,o++)n[o]=i[s];return n}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function _(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(t,e||[]),i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){o[t]&&(n[t]=function(e){return new Promise((function(r,n){i.push([t,e,r,n])>1||u(t,e)}))})}function u(t,e){try{(r=o[t](e)).value instanceof m?Promise.resolve(r.value.v).then(c,a):f(i[0][2],r)}catch(t){f(i[0][3],t)}var r}function c(t){u("next",t)}function a(t){u("throw",t)}function f(t,e){t(e),i.shift(),i.length&&u(i[0][0],i[0][1])}}function R(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,o){e[n]=t[n]?function(e){return(r=!r)?{value:m(t[n](e)),done:"return"===n}:o?o(e):e}:o}}function g(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=h(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,o){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,o,(e=t[r](e)).done,e.value)}))}}}function E(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function w(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function O(t){return t&&t.__esModule?t:{default:t}}function T(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function A(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HttpConnection=void 0;const n=r(4),o=r(17),i=n.__importDefault(r(18)),s=r(19),u=r(20),c={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class a{constructor(t){if(this.url=t,this.events=new o.EventEmitter,this.isAvailable=!1,this.registering=!1,!u.isHttpUrl(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);this.url=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}open(t=this.url){return n.__awaiter(this,void 0,void 0,(function*(){yield this.register(t)}))}close(){return n.__awaiter(this,void 0,void 0,(function*(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}))}send(t,e){return n.__awaiter(this,void 0,void 0,(function*(){this.isAvailable||(yield this.register());try{const e=s.safeJsonStringify(t),r=yield i.default(this.url,Object.assign(Object.assign({},c),{body:e})),n=yield r.json();this.onPayload({data:n})}catch(e){this.onError(t.id,e)}}))}register(t=this.url){return n.__awaiter(this,void 0,void 0,(function*(){if(!u.isHttpUrl(t))throw new Error("Provided URL is not compatible with HTTP connection: "+t);if(this.registering)return new Promise((t,e)=>{this.events.once("register_error",t=>{e(t)}),this.events.once("open",()=>{if(void 0===this.isAvailable)return e(new Error("HTTP connection is missing or invalid"));t()})});this.url=t,this.registering=!0;try{const e=s.safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});yield i.default(t,Object.assign(Object.assign({},c),{body:e})),this.onOpen()}catch(t){const e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}))}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(void 0===t.data)return;const e="string"==typeof t.data?s.safeJsonParse(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const r=this.parseError(e),n=r.message||r.toString(),o=u.formatJsonRpcError(t,n);this.events.emit("payload",o)}parseError(t,e=this.url){return u.parseConnectionError(t,e,"HTTP")}}e.HttpConnection=a,e.default=a},function(t,e,r){"use strict";r.r(e),r.d(e,"isNodeJs",(function(){return i}));var n=r(3);for(var o in n)["default","isNodeJs"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);const i=n.isNode},function(t,e,r){"use strict";r.d(e,"e",(function(){return i})),r.d(e,"c",(function(){return s})),r.d(e,"d",(function(){return u})),r.d(e,"b",(function(){return c})),r.d(e,"a",(function(){return a}));var n=r(1),o=r(0);function i(){return Date.now()*Math.pow(10,3)+Math.floor(Math.random()*Math.pow(10,3))}function s(t,e,r){return{id:r||i(),jsonrpc:"2.0",method:t,params:e}}function u(t,e){return{id:t,jsonrpc:"2.0",result:e}}function c(t,e,r){return{id:t,jsonrpc:"2.0",error:a(e,r)}}function a(t,e){return void 0===t?Object(n.a)(o.b):("string"==typeof t&&(t=Object.assign(Object.assign({},Object(n.a)(o.h)),{message:t})),void 0!==e&&(t.data=e),Object(n.c)(t.code)&&(t=Object(n.b)(t.code)),t)}},function(t,e,r){"use strict";function n(t){return t.includes("*")?i(t):!/\W/g.test(t)}function o(t){return"*"===t}function i(t){return!!o(t)||!!t.includes("*")&&(2===t.split("*").length&&1===t.split("*").filter(t=>""===t.trim()).length)}function s(t){return!o(t)&&i(t)&&!t.split("*")[0].trim()}function u(t){return!o(t)&&i(t)&&!t.split("*")[1].trim()}r.d(e,"c",(function(){return n})),r.d(e,"a",(function(){return o})),r.d(e,"e",(function(){return i})),r.d(e,"b",(function(){return s})),r.d(e,"d",(function(){return u}))},function(t,e,r){"use strict";r.r(e);var n=r(10);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o)},function(t,e,r){"use strict";r.r(e);var n=r(11);for(var o in n)["default"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return n[t]}))}(o);var i=r(2);r.d(e,"IEvents",(function(){return i.a}));var s=r(12);r.d(e,"IJsonRpcConnection",(function(){return s.b})),r.d(e,"IBaseJsonRpcProvider",(function(){return s.a})),r.d(e,"IJsonRpcProvider",(function(){return s.c}));var u=r(13);for(var o in u)["default","IEvents","IJsonRpcConnection","IBaseJsonRpcProvider","IJsonRpcProvider"].indexOf(o)<0&&function(t){r.d(e,t,(function(){return u[t]}))}(o)},function(t,e){},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return i})),r.d(e,"c",(function(){return s}));var n=r(2);class o extends n.a{constructor(t){super()}}class i extends n.a{constructor(){super()}}class s extends i{constructor(t){super()}}},function(t,e){},function(t,e,r){"use strict";r.d(e,"a",(function(){return o})),r.d(e,"c",(function(){return i})),r.d(e,"b",(function(){return s}));function n(t,e){const r=function(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(e&&e.length)return e[0]}(t);return void 0!==r&&new RegExp(e).test(r)}function o(t){return n(t,"^https?:")}function i(t){return n(t,"^wss?:")}function s(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}},function(t,e,r){"use strict";function n(t){return"object"==typeof t&&"id"in t&&"jsonrpc"in t&&"2.0"===t.jsonrpc}function o(t){return n(t)&&"method"in t}function i(t){return n(t)&&(s(t)||u(t))}function s(t){return"result"in t}function u(t){return"error"in t}function c(t){return"error"in t&&!1===t.valid}r.d(e,"b",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"d",(function(){return i})),r.d(e,"e",(function(){return s})),r.d(e,"a",(function(){return u})),r.d(e,"f",(function(){return c}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=r(4),o=n.__importDefault(r(5));n.__exportStar(r(5),e),e.default=o.default},function(t,e,r){"use strict";var n,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var s=Number.isNaN||function(t){return t!=t};function u(){u.init.call(this)}t.exports=u,t.exports.once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}b(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&b(t,"error",e,r)}(t,o,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?u.defaultMaxListeners:t._maxListeners}function d(t,e,r,n){var o,i,s,u;if(a(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=f(t))>0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=t,c.type=e,c.count=s.length,u=c,console&&console.warn&&console.warn(u)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(n);return o.listener=r,n.wrapFn=o,o}function h(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):v(o,o.length)}function y(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function v(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function b(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(u,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");c=t}}),u.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||s(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},u.prototype.getMaxListeners=function(){return f(this)},u.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)i(c,this,e);else{var a=c.length,f=v(c,a);for(r=0;r<a;++r)i(f[r],this,e)}return!0},u.prototype.addListener=function(t,e){return d(this,t,e,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(t,e){return d(this,t,e,!0)},u.prototype.once=function(t,e){return a(e),this.on(t,p(this,t,e)),this},u.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,p(this,t,e)),this},u.prototype.removeListener=function(t,e){var r,n,o,i,s;if(a(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},u.prototype.off=u.prototype.removeListener,u.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},u.prototype.listeners=function(t){return h(this,t,!0)},u.prototype.rawListeners=function(t){return h(this,t,!1)},u.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):y.call(t,e)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}},function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,s="ArrayBuffer"in t;if(s)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function a(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function p(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function y(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||c(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?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(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=p(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,r,n=p(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,r=h(e),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n<e.length;n++)r[n]=String.fromCharCode(e[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i&&(this.formData=function(){return this.text().then(R)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=a(t),e=f(e);var r=this.map[t];this.map[t]=r?r+", "+e:e},l.prototype.delete=function(t){delete this.map[a(t)]},l.prototype.get=function(t){return t=a(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(a(t))},l.prototype.set=function(t,e){this.map[a(t)]=f(e)},l.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,r){t.push(r)})),d(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,r){t.push([r,e])})),d(t)},n&&(l.prototype[Symbol.iterator]=l.prototype.entries);var m=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function _(t,e){var r,n,o=(e=e||{}).body;if(t instanceof _){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(r=e.method||this.method||"GET",n=r.toUpperCase(),m.indexOf(n)>-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function R(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];g.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function w(t,r){return new Promise((function(n,i){var s=new _(t,r);if(s.signal&&s.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function c(){u.abort()}u.onload=function(){var t,e,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var o="response"in u?u.response:u.responseText;n(new g(o,r))},u.onerror=function(){i(new TypeError("Network request failed"))},u.ontimeout=function(){i(new TypeError("Network request failed"))},u.onabort=function(){i(new e.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&o&&(u.responseType="blob"),s.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",c)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}w.polyfill=!0,t.fetch||(t.fetch=w,t.Headers=l,t.Request=_,t.Response=g),e.Headers=l,e.Request=_,e.Response=g,e.fetch=w,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e},function(t,e,r){"use strict";function n(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return JSON.parse(t)}catch(e){return t}}function o(t){return"string"==typeof t?t:JSON.stringify(t)}r.r(e),r.d(e,"safeJsonParse",(function(){return n})),r.d(e,"safeJsonStringify",(function(){return o}))},function(t,e,r){"use strict";r.r(e);var n=r(0);r.d(e,"PARSE_ERROR",(function(){return n.f})),r.d(e,"INVALID_REQUEST",(function(){return n.d})),r.d(e,"METHOD_NOT_FOUND",(function(){return n.e})),r.d(e,"INVALID_PARAMS",(function(){return n.c})),r.d(e,"INTERNAL_ERROR",(function(){return n.b})),r.d(e,"SERVER_ERROR",(function(){return n.h})),r.d(e,"RESERVED_ERROR_CODES",(function(){return n.g})),r.d(e,"SERVER_ERROR_CODE_RANGE",(function(){return n.i})),r.d(e,"STANDARD_ERROR_MAP",(function(){return n.j})),r.d(e,"DEFAULT_ERROR",(function(){return n.a}));var o=r(1);r.d(e,"isServerErrorCode",(function(){return o.d})),r.d(e,"isReservedErrorCode",(function(){return o.c})),r.d(e,"isValidErrorCode",(function(){return o.e})),r.d(e,"getError",(function(){return o.a})),r.d(e,"getErrorByCode",(function(){return o.b})),r.d(e,"validateJsonRpcError",(function(){return o.g})),r.d(e,"parseConnectionError",(function(){return o.f}));var i=r(6);for(var s in i)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","DEFAULT_ERROR","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError"].indexOf(s)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(s);var u=r(7);r.d(e,"payloadId",(function(){return u.e})),r.d(e,"formatJsonRpcRequest",(function(){return u.c})),r.d(e,"formatJsonRpcResult",(function(){return u.d})),r.d(e,"formatJsonRpcError",(function(){return u.b})),r.d(e,"formatErrorMessage",(function(){return u.a}));var c=r(8);r.d(e,"isValidRoute",(function(){return c.c})),r.d(e,"isValidDefaultRoute",(function(){return c.a})),r.d(e,"isValidWildcardRoute",(function(){return c.e})),r.d(e,"isValidLeadingWildcardRoute",(function(){return c.b})),r.d(e,"isValidTrailingWildcardRoute",(function(){return c.d}));var a=r(9);for(var s in a)["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","DEFAULT_ERROR","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError","payloadId","formatJsonRpcRequest","formatJsonRpcResult","formatJsonRpcError","formatErrorMessage","isValidRoute","isValidDefaultRoute","isValidWildcardRoute","isValidLeadingWildcardRoute","isValidTrailingWildcardRoute"].indexOf(s)<0&&function(t){r.d(e,t,(function(){return a[t]}))}(s);var f=r(14);r.d(e,"isHttpUrl",(function(){return f.a})),r.d(e,"isWsUrl",(function(){return f.c})),r.d(e,"isLocalhostUrl",(function(){return f.b}));var d=r(15);r.d(e,"isJsonRpcPayload",(function(){return d.b})),r.d(e,"isJsonRpcRequest",(function(){return d.c})),r.d(e,"isJsonRpcResponse",(function(){return d.d})),r.d(e,"isJsonRpcResult",(function(){return d.e})),r.d(e,"isJsonRpcError",(function(){return d.a})),r.d(e,"isJsonRpcValidationInvalid",(function(){return d.f}))},function(t,e,r){"use strict";(function(t){function r(){return(null==t?void 0:t.crypto)||(null==t?void 0:t.msCrypto)||{}}function n(){const t=r();return t.subtle||t.webkitSubtle}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0,e.getBrowerCrypto=r,e.getSubtleCrypto=n,e.isBrowserCryptoAvailable=function(){return!!r()&&!!n()}}).call(this,r(22))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t){function r(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function n(){return void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isNode=e.isReactNative=void 0,e.isReactNative=r,e.isNode=n,e.isBrowser=function(){return!r()&&!n()}}).call(this,r(24))},function(t,e){var r,n,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(t){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,a=[],f=!1,d=-1;function l(){f&&c&&(f=!1,c.length?a=c.concat(a):d=-1,a.length&&p())}function p(){if(!f){var t=u(l);f=!0;for(var e=a.length;e;){for(c=a,a=[];++d<e;)c&&c[d].run();d=-1,e=a.length}c=null,f=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];a.push(new h(t,e)),1!==a.length||f||u(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));
{
"name": "@walletconnect/jsonrpc-http-connection",
"description": "HTTP Connection for JSON-RPC",
"version": "1.0.1",
"version": "1.0.2",
"author": "WalletConnect, Inc. <walletconnect.com>",

@@ -44,3 +44,3 @@ "license": "MIT",

"dependencies": {
"@walletconnect/jsonrpc-utils": "^1.0.2",
"@walletconnect/jsonrpc-utils": "^1.0.3",
"@walletconnect/safe-json": "^1.0.0",

@@ -47,0 +47,0 @@ "cross-fetch": "^3.1.4"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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