Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@walletconnect/jsonrpc-ws-connection

Package Overview
Dependencies
Maintainers
10
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.0.11 to 1.0.12-843103d

dist/cjs/utils.d.ts

31

dist/cjs/ws.js

@@ -8,14 +8,5 @@ "use strict";

const jsonrpc_utils_1 = require("@walletconnect/jsonrpc-utils");
const utils_1 = require("./utils");
const EVENT_EMITTER_MAX_LISTENERS_DEFAULT = 10;
const resolveWebSocketImplementation = () => {
if (typeof global !== "undefined" && typeof global.WebSocket !== "undefined") {
return global.WebSocket;
}
if (typeof window !== "undefined" && typeof window.WebSocket !== "undefined") {
return window.WebSocket;
}
return require("ws");
};
const isBrowser = () => typeof window !== "undefined";
const WS = resolveWebSocketImplementation();
const WS = (0, utils_1.resolveWebSocketImplementation)();
class WsConnection {

@@ -26,3 +17,3 @@ constructor(url) {

this.registering = false;
if (!jsonrpc_utils_1.isWsUrl(url)) {
if (!(0, jsonrpc_utils_1.isWsUrl)(url)) {
throw new Error(`Provided URL is not compatible with WebSocket connection: ${url}`);

@@ -76,3 +67,3 @@ }

try {
this.socket.send(safe_json_1.safeJsonStringify(payload));
this.socket.send((0, safe_json_1.safeJsonStringify)(payload));
}

@@ -85,3 +76,3 @@ catch (e) {

register(url = this.url) {
if (!jsonrpc_utils_1.isWsUrl(url)) {
if (!(0, jsonrpc_utils_1.isWsUrl)(url)) {
throw new Error(`Provided URL is not compatible with WebSocket connection: ${url}`);

@@ -112,5 +103,5 @@ }

return new Promise((resolve, reject) => {
const opts = !jsonrpc_utils_1.isReactNative() ? { rejectUnauthorized: !jsonrpc_utils_1.isLocalhostUrl(url) } : undefined;
const opts = !(0, jsonrpc_utils_1.isReactNative)() ? { rejectUnauthorized: !(0, jsonrpc_utils_1.isLocalhostUrl)(url) } : undefined;
const socket = new WS(url, [], opts);
if (isBrowser()) {
if ((0, utils_1.isBrowser)()) {
socket.onerror = (event) => {

@@ -147,3 +138,3 @@ const errorEvent = event;

return;
const payload = typeof e.data === "string" ? safe_json_1.safeJsonParse(e.data) : e.data;
const payload = typeof e.data === "string" ? (0, safe_json_1.safeJsonParse)(e.data) : e.data;
this.events.emit("payload", payload);

@@ -154,7 +145,7 @@ }

const message = error.message || error.toString();
const payload = jsonrpc_utils_1.formatJsonRpcError(id, message);
const payload = (0, jsonrpc_utils_1.formatJsonRpcError)(id, message);
this.events.emit("payload", payload);
}
parseError(e, url = this.url) {
return jsonrpc_utils_1.parseConnectionError(e, url, "WS");
return (0, jsonrpc_utils_1.parseConnectionError)(e, (0, utils_1.truncateQuery)(url), "WS");
}

@@ -167,3 +158,3 @@ resetMaxListeners() {

emitError(errorEvent) {
const error = this.parseError(new Error((errorEvent === null || errorEvent === void 0 ? void 0 : errorEvent.message) || `WebSocket connection failed for URL: ${this.url}`));
const error = this.parseError(new Error((errorEvent === null || errorEvent === void 0 ? void 0 : errorEvent.message) || `WebSocket connection failed for host: ${(0, utils_1.truncateQuery)(this.url)}`));
this.events.emit("register_error", error);

@@ -170,0 +161,0 @@ return error;

import { EventEmitter } from "events";
import { safeJsonParse, safeJsonStringify } from "@walletconnect/safe-json";
import { formatJsonRpcError, isReactNative, isWsUrl, isLocalhostUrl, parseConnectionError, } from "@walletconnect/jsonrpc-utils";
import { truncateQuery, resolveWebSocketImplementation, isBrowser } from "./utils";
const EVENT_EMITTER_MAX_LISTENERS_DEFAULT = 10;
const resolveWebSocketImplementation = () => {
if (typeof global !== "undefined" && typeof global.WebSocket !== "undefined") {
return global.WebSocket;
}
if (typeof window !== "undefined" && typeof window.WebSocket !== "undefined") {
return window.WebSocket;
}
return require("ws");
};
const isBrowser = () => typeof window !== "undefined";
const WS = resolveWebSocketImplementation();

@@ -142,3 +133,3 @@ export class WsConnection {

parseError(e, url = this.url) {
return parseConnectionError(e, url, "WS");
return parseConnectionError(e, truncateQuery(url), "WS");
}

@@ -151,3 +142,3 @@ resetMaxListeners() {

emitError(errorEvent) {
const error = this.parseError(new Error((errorEvent === null || errorEvent === void 0 ? void 0 : errorEvent.message) || `WebSocket connection failed for URL: ${this.url}`));
const error = this.parseError(new Error((errorEvent === null || errorEvent === void 0 ? void 0 : errorEvent.message) || `WebSocket connection failed for host: ${truncateQuery(this.url)}`));
this.events.emit("register_error", error);

@@ -154,0 +145,0 @@ return error;

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

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

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

***************************************************************************** */
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}function c(e,t){return function(n,r){t(n,r,e)}}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function a(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,s)}c((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=t.call(e,u)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function l(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function p(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function v(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function R(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],u=0,s=i.length;u<s;u++,o++)r[o]=i[u];return r}function m(e){return this instanceof m?(this.v=e,this):new m(e)}function g(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(e){o[e]&&(r[e]=function(t){return new Promise((function(n,r){i.push([e,t,n,r])>1||s(e,t)}))})}function s(e,t){try{(n=o[e](t)).value instanceof m?Promise.resolve(n.value.v).then(c,f):a(i[0][2],n)}catch(e){a(i[0][3],e)}var n}function c(e){s("next",e)}function f(e){s("throw",e)}function a(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function _(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){t[r]=e[r]?function(t){return(n=!n)?{value:m(e[r](t)),done:"return"===r}:o?o(t):t}:o}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=v(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}function b(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function O(e){return e&&e.__esModule?e:{default:e}}function S(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function L(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.WsConnection=void 0;const r=n(4),o=n(18),i=n(19),u=n(20),s=void 0!==e&&void 0!==e.WebSocket?e.WebSocket:"undefined"!=typeof window&&void 0!==window.WebSocket?window.WebSocket:n(24);class c{constructor(e){if(this.url=e,this.events=new o.EventEmitter,this.registering=!1,!u.isWsUrl(e))throw new Error("Provided URL is not compatible with WebSocket connection: "+e);this.url=e}get connected(){return void 0!==this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}open(e=this.url){return r.__awaiter(this,void 0,void 0,(function*(){yield this.register(e)}))}close(){return r.__awaiter(this,void 0,void 0,(function*(){return new Promise((e,t)=>{void 0!==this.socket?(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()):t(new Error("Connection already closed"))})}))}send(e,t){return r.__awaiter(this,void 0,void 0,(function*(){void 0===this.socket&&(this.socket=yield this.register());try{this.socket.send(i.safeJsonStringify(e))}catch(t){this.onError(e.id,t)}}))}register(e=this.url){if(!u.isWsUrl(e))throw new Error("Provided URL is not compatible with WebSocket connection: "+e);if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),void 0===this.socket)return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{const r=u.isReactNative()?void 0:{rejectUnauthorized:!u.isLocalhostUrl(e)},o=new s(e,[],r);"undefined"!=typeof window?o.onerror=e=>{const t=e;n(this.emitError(t.error))}:o.on("error",e=>{n(this.emitError(e))}),o.onopen=()=>{this.onOpen(o),t(o)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(void 0===e.data)return;const t="string"==typeof e.data?i.safeJsonParse(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=n.message||n.toString(),o=u.formatJsonRpcError(e,r);this.events.emit("payload",o)}parseError(e,t=this.url){return u.parseConnectionError(e,t,"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error((null==e?void 0:e.message)||"WebSocket connection failed for URL: "+this.url));return this.events.emit("register_error",t),t}}t.WsConnection=c,t.default=c}).call(this,n(6))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t),n.d(t,"isNodeJs",(function(){return i}));var r=n(3);for(var o in r)["default","isNodeJs"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);const i=r.isNode},function(e,t,n){"use strict";n.d(t,"f",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return c})),n.d(t,"b",(function(){return f})),n.d(t,"a",(function(){return a}));var r=n(1),o=n(0);function i(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function u(e=6){return BigInt(i(e))}function s(e,t,n){return{id:n||i(),jsonrpc:"2.0",method:e,params:t}}function c(e,t){return{id:e,jsonrpc:"2.0",result:t}}function f(e,t,n){return{id:e,jsonrpc:"2.0",error:a(t,n)}}function a(e,t){return void 0===e?Object(r.a)(o.b):("string"==typeof e&&(e=Object.assign(Object.assign({},Object(r.a)(o.h)),{message:e})),void 0!==t&&(e.data=t),Object(r.c)(e.code)&&(e=Object(r.b)(e.code)),e)}},function(e,t,n){"use strict";function r(e){return e.includes("*")?i(e):!/\W/g.test(e)}function o(e){return"*"===e}function i(e){return!!o(e)||!!e.includes("*")&&(2===e.split("*").length&&1===e.split("*").filter(e=>""===e.trim()).length)}function u(e){return!o(e)&&i(e)&&!e.split("*")[0].trim()}function s(e){return!o(e)&&i(e)&&!e.split("*")[1].trim()}n.d(t,"c",(function(){return r})),n.d(t,"a",(function(){return o})),n.d(t,"e",(function(){return i})),n.d(t,"b",(function(){return u})),n.d(t,"d",(function(){return s}))},function(e,t,n){"use strict";n.r(t);var r=n(11);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o)},function(e,t,n){"use strict";n.r(t);var r=n(12);for(var o in r)["default"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(o);var i=n(2);n.d(t,"IEvents",(function(){return i.a}));var u=n(13);n.d(t,"IJsonRpcConnection",(function(){return u.b})),n.d(t,"IBaseJsonRpcProvider",(function(){return u.a})),n.d(t,"IJsonRpcProvider",(function(){return u.c}));var s=n(14);for(var o in s)["default","IEvents","IJsonRpcConnection","IBaseJsonRpcProvider","IJsonRpcProvider"].indexOf(o)<0&&function(e){n.d(t,e,(function(){return s[e]}))}(o)},function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(2);class o extends r.a{constructor(e){super()}}class i extends r.a{constructor(){super()}}class u extends i{constructor(e){super()}}},function(e,t){},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"b",(function(){return u}));function r(e,t){const n=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==n&&new RegExp(t).test(n)}function o(e){return r(e,"^https?:")}function i(e){return r(e,"^wss?:")}function u(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}},function(e,t,n){"use strict";function r(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function o(e){return r(e)&&"method"in e}function i(e){return r(e)&&(u(e)||s(e))}function u(e){return"result"in e}function s(e){return"error"in e}function c(e){return"error"in e&&!1===e.valid}n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"a",(function(){return s})),n.d(t,"f",(function(){return c}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(4),o=r.__importDefault(n(5));r.__exportStar(n(5),t),t.default=o.default},function(e,t,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var u=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}R(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&R(e,"error",t,n)}(e,o,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function d(e,t,n,r){var o,i,u,s;if(f(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),u=i[t]),void 0===u)u=i[t]=n,++e._eventsCount;else if("function"==typeof u?u=i[t]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),(o=a(e))>0&&u.length>o&&!u.warned){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=u.length,s=c,console&&console.warn&&console.warn(s)}return e}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(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=l.bind(r);return o.listener=n,r.wrapFn=o,o}function v(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):y(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function R(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function o(i){r.once&&e.removeEventListener(t,o),n(i)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||u(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),s.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},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||u(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var u;if(t.length>0&&(u=t[0]),u instanceof Error)throw u;var s=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw s.context=u,s}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var f=c.length,a=y(c,f);for(n=0;n<f;++n)i(a[n],this,t)}return!0},s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)},s.prototype.once=function(e,t){return f(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return f(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,o,i,u;if(f(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){u=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,u||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return v(this,e,!0)},s.prototype.rawListeners=function(e){return v(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";n.r(t),n.d(t,"safeJsonParse",(function(){return r})),n.d(t,"safeJsonStringify",(function(){return o}));function r(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type "+typeof e);try{return(e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,(e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t)})(e)}catch(t){return e}}function o(e){return"string"==typeof e?e:(t=e,JSON.stringify(t,(e,t)=>"bigint"==typeof t?t.toString()+"n":t)||"");var t}},function(e,t,n){"use strict";n.r(t);var r=n(0);n.d(t,"PARSE_ERROR",(function(){return r.f})),n.d(t,"INVALID_REQUEST",(function(){return r.d})),n.d(t,"METHOD_NOT_FOUND",(function(){return r.e})),n.d(t,"INVALID_PARAMS",(function(){return r.c})),n.d(t,"INTERNAL_ERROR",(function(){return r.b})),n.d(t,"SERVER_ERROR",(function(){return r.h})),n.d(t,"RESERVED_ERROR_CODES",(function(){return r.g})),n.d(t,"SERVER_ERROR_CODE_RANGE",(function(){return r.i})),n.d(t,"STANDARD_ERROR_MAP",(function(){return r.j})),n.d(t,"DEFAULT_ERROR",(function(){return r.a}));var o=n(1);n.d(t,"isServerErrorCode",(function(){return o.d})),n.d(t,"isReservedErrorCode",(function(){return o.c})),n.d(t,"isValidErrorCode",(function(){return o.e})),n.d(t,"getError",(function(){return o.a})),n.d(t,"getErrorByCode",(function(){return o.b})),n.d(t,"validateJsonRpcError",(function(){return o.g})),n.d(t,"parseConnectionError",(function(){return o.f}));var i=n(7);for(var u 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(u)<0&&function(e){n.d(t,e,(function(){return i[e]}))}(u);var s=n(8);n.d(t,"payloadId",(function(){return s.f})),n.d(t,"getBigIntRpcId",(function(){return s.e})),n.d(t,"formatJsonRpcRequest",(function(){return s.c})),n.d(t,"formatJsonRpcResult",(function(){return s.d})),n.d(t,"formatJsonRpcError",(function(){return s.b})),n.d(t,"formatErrorMessage",(function(){return s.a}));var c=n(9);n.d(t,"isValidRoute",(function(){return c.c})),n.d(t,"isValidDefaultRoute",(function(){return c.a})),n.d(t,"isValidWildcardRoute",(function(){return c.e})),n.d(t,"isValidLeadingWildcardRoute",(function(){return c.b})),n.d(t,"isValidTrailingWildcardRoute",(function(){return c.d}));var f=n(10);for(var u in f)["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","getBigIntRpcId","formatJsonRpcRequest","formatJsonRpcResult","formatJsonRpcError","formatErrorMessage","isValidRoute","isValidDefaultRoute","isValidWildcardRoute","isValidLeadingWildcardRoute","isValidTrailingWildcardRoute"].indexOf(u)<0&&function(e){n.d(t,e,(function(){return f[e]}))}(u);var a=n(15);n.d(t,"isHttpUrl",(function(){return a.a})),n.d(t,"isWsUrl",(function(){return a.c})),n.d(t,"isLocalhostUrl",(function(){return a.b}));var d=n(16);n.d(t,"isJsonRpcPayload",(function(){return d.b})),n.d(t,"isJsonRpcRequest",(function(){return d.c})),n.d(t,"isJsonRpcResponse",(function(){return d.d})),n.d(t,"isJsonRpcResult",(function(){return d.e})),n.d(t,"isJsonRpcError",(function(){return d.a})),n.d(t,"isJsonRpcValidationInvalid",(function(){return d.f}))},function(e,t,n){"use strict";(function(e){function n(){return(null==e?void 0:e.crypto)||(null==e?void 0:e.msCrypto)||{}}function r(){const e=n();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=n,t.getSubtleCrypto=r,t.isBrowserCryptoAvailable=function(){return!!n()&&!!r()}}).call(this,n(6))},function(e,t,n){"use strict";(function(e){function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function r(){return void 0!==e&&void 0!==e.versions&&void 0!==e.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=r,t.isBrowser=function(){return!n()&&!r()}}).call(this,n(23))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!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:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}}();var c,f=[],a=!1,d=-1;function l(){a&&c&&(a=!1,c.length?f=c.concat(f):d=-1,f.length&&p())}function p(){if(!a){var e=s(l);a=!0;for(var t=f.length;t;){for(c=f,f=[];++d<t;)c&&c[d].run();d=-1,t=f.length}c=null,a=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new v(e,t)),1!==f.length||a||s(p)},v.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=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}])}));
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function u(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function c(t,e,n,r){var o,i=arguments.length,u=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(u=(i<3?o(u):i>3?o(e,n,u):o(e,n))||u);return i>3&&u&&Object.defineProperty(e,n,u),u}function s(t,e){return function(n,r){e(n,r,t)}}function f(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}s((r=r.apply(t,e||[])).next())}))}function l(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function d(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}function p(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function v(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function y(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return t}function _(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,c=i.length;u<c;u++,o++)r[o]=i[u];return r}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function b(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),i=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(t){o[t]&&(r[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=o[t](e)).value instanceof m?Promise.resolve(n.value.v).then(s,f):a(i[0][2],n)}catch(t){a(i[0][3],t)}var n}function s(t){c("next",t)}function f(t){c("throw",t)}function a(t,e){t(e),i.shift(),i.length&&c(i[0][0],i[0][1])}}function g(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:m(t[r](e)),done:"return"===r}:o?o(e):e}:o}}function w(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=v(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function R(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function E(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function O(t){return t&&t.__esModule?t:{default:t}}function S(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function j(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WsConnection=void 0;const r=n(3),o=n(13),i=n(14),u=n(15),c=n(20),s=(0,c.resolveWebSocketImplementation)();class f{constructor(t){if(this.url=t,this.events=new o.EventEmitter,this.registering=!1,!(0,u.isWsUrl)(t))throw new Error("Provided URL is not compatible with WebSocket connection: "+t);this.url=t}get connected(){return void 0!==this.socket}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 r.__awaiter(this,void 0,void 0,(function*(){yield this.register(t)}))}close(){return r.__awaiter(this,void 0,void 0,(function*(){return new Promise((t,e)=>{void 0!==this.socket?(this.socket.onclose=e=>{this.onClose(e),t()},this.socket.close()):e(new Error("Connection already closed"))})}))}send(t,e){return r.__awaiter(this,void 0,void 0,(function*(){void 0===this.socket&&(this.socket=yield this.register());try{this.socket.send((0,i.safeJsonStringify)(t))}catch(e){this.onError(t.id,e)}}))}register(t=this.url){if(!(0,u.isWsUrl)(t))throw new Error("Provided URL is not compatible with WebSocket connection: "+t);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((t,e)=>{this.events.once("register_error",t=>{this.resetMaxListeners(),e(t)}),this.events.once("open",()=>{if(this.resetMaxListeners(),void 0===this.socket)return e(new Error("WebSocket connection is missing or invalid"));t(this.socket)})})}return this.url=t,this.registering=!0,new Promise((e,n)=>{const r=(0,u.isReactNative)()?void 0:{rejectUnauthorized:!(0,u.isLocalhostUrl)(t)},o=new s(t,[],r);(0,c.isBrowser)()?o.onerror=t=>{const e=t;n(this.emitError(e.error))}:o.on("error",t=>{n(this.emitError(t))}),o.onopen=()=>{this.onOpen(o),e(o)}})}onOpen(t){t.onmessage=t=>this.onPayload(t),t.onclose=t=>this.onClose(t),this.socket=t,this.registering=!1,this.events.emit("open")}onClose(t){this.socket=void 0,this.registering=!1,this.events.emit("close",t)}onPayload(t){if(void 0===t.data)return;const e="string"==typeof t.data?(0,i.safeJsonParse)(t.data):t.data;this.events.emit("payload",e)}onError(t,e){const n=this.parseError(e),r=n.message||n.toString(),o=(0,u.formatJsonRpcError)(t,r);this.events.emit("payload",o)}parseError(t,e=this.url){return(0,u.parseConnectionError)(t,(0,c.truncateQuery)(e),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(t){const e=this.parseError(new Error((null==t?void 0:t.message)||"WebSocket connection failed for host: "+(0,c.truncateQuery)(this.url)));return this.events.emit("register_error",e),e}}e.WsConnection=f,e.default=f},function(t,e,n){"use strict";n.r(e),n.d(e,"isNodeJs",(function(){return i}));var r=n(2);for(var o in r)["default","isNodeJs"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);const i=r.isNode},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.d(e,"f",(function(){return i})),n.d(e,"e",(function(){return u})),n.d(e,"c",(function(){return c})),n.d(e,"d",(function(){return s})),n.d(e,"b",(function(){return f})),n.d(e,"a",(function(){return a}));var r=n(1),o=n(0);function i(t=3){return Date.now()*Math.pow(10,t)+Math.floor(Math.random()*Math.pow(10,t))}function u(t=6){return BigInt(i(t))}function c(t,e,n){return{id:n||i(),jsonrpc:"2.0",method:t,params:e}}function s(t,e){return{id:t,jsonrpc:"2.0",result:e}}function f(t,e,n){return{id:t,jsonrpc:"2.0",error:a(e,n)}}function a(t,e){return void 0===t?Object(r.a)(o.b):("string"==typeof t&&(t=Object.assign(Object.assign({},Object(r.a)(o.h)),{message:t})),void 0!==e&&(t.data=e),Object(r.c)(t.code)&&(t=Object(r.b)(t.code)),t)}},function(t,e,n){"use strict";function r(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 u(t){return!o(t)&&i(t)&&!t.split("*")[0].trim()}function c(t){return!o(t)&&i(t)&&!t.split("*")[1].trim()}n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){return o})),n.d(e,"e",(function(){return i})),n.d(e,"b",(function(){return u})),n.d(e,"d",(function(){return c}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"b",(function(){return u}));function r(t,e){const n=function(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(e&&e.length)return e[0]}(t);return void 0!==n&&new RegExp(e).test(n)}function o(t){return r(t,"^https?:")}function i(t){return r(t,"^wss?:")}function u(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}},function(t,e,n){"use strict";function r(t){return"object"==typeof t&&"id"in t&&"jsonrpc"in t&&"2.0"===t.jsonrpc}function o(t){return r(t)&&"method"in t}function i(t){return r(t)&&(u(t)||c(t))}function u(t){return"result"in t}function c(t){return"error"in t}function s(t){return"error"in t&&!1===t.valid}n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"e",(function(){return u})),n.d(e,"a",(function(){return c})),n.d(e,"f",(function(){return s}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i})),n.d(e,"d",(function(){return u}));class r{}class o extends r{constructor(t){super()}}class i extends r{constructor(){super()}}class u extends i{constructor(t){super()}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const r=n(3),o=r.__importDefault(n(4));r.__exportStar(n(4),e),e.default=o.default},function(t,e,n){"use strict";var r,o="object"==typeof Reflect?Reflect:null,i=o&&"function"==typeof o.apply?o.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=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 u=Number.isNaN||function(t){return t!=t};function c(){c.init.call(this)}t.exports=c,t.exports.once=function(t,e){return new Promise((function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}_(t,e,i,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&_(t,"error",e,n)}(t,o,{once:!0})}))},c.EventEmitter=c,c.prototype._events=void 0,c.prototype._eventsCount=0,c.prototype._maxListeners=void 0;var s=10;function f(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function a(t){return void 0===t._maxListeners?c.defaultMaxListeners:t._maxListeners}function l(t,e,n,r){var o,i,u,c;if(f(n),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),u=i[e]),void 0===u)u=i[e]=n,++t._eventsCount;else if("function"==typeof u?u=i[e]=r?[n,u]:[u,n]:r?u.unshift(n):u.push(n),(o=a(t))>0&&u.length>o&&!u.warned){u.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=t,s.type=e,s.count=u.length,c=s,console&&console.warn&&console.warn(c)}return t}function d(){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,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=d.bind(r);return o.listener=n,r.wrapFn=o,o}function v(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(o):y(o,o.length)}function h(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function _(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);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){r.once&&t.removeEventListener(e,o),n(i)}))}}Object.defineProperty(c,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");s=t}}),c.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},c.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||u(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},c.prototype.getMaxListeners=function(){return a(this)},c.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var u;if(e.length>0&&(u=e[0]),u instanceof Error)throw u;var c=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw c.context=u,c}var s=o[t];if(void 0===s)return!1;if("function"==typeof s)i(s,this,e);else{var f=s.length,a=y(s,f);for(n=0;n<f;++n)i(a[n],this,e)}return!0},c.prototype.addListener=function(t,e){return l(this,t,e,!1)},c.prototype.on=c.prototype.addListener,c.prototype.prependListener=function(t,e){return l(this,t,e,!0)},c.prototype.once=function(t,e){return f(e),this.on(t,p(this,t,e)),this},c.prototype.prependOnceListener=function(t,e){return f(e),this.prependListener(t,p(this,t,e)),this},c.prototype.removeListener=function(t,e){var n,r,o,i,u;if(f(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){u=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,u||e)}return this},c.prototype.off=c.prototype.removeListener,c.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},c.prototype.listeners=function(t){return v(this,t,!0)},c.prototype.rawListeners=function(t){return v(this,t,!1)},c.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):h.call(t,e)},c.prototype.listenerCount=h,c.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";n.r(e),n.d(e,"safeJsonParse",(function(){return r})),n.d(e,"safeJsonStringify",(function(){return o}));function r(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return(t=>{const e=t.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(e,(t,e)=>"string"==typeof e&&e.match(/^\d+n$/)?BigInt(e.substring(0,e.length-1)):e)})(t)}catch(e){return t}}function o(t){return"string"==typeof t?t:(e=t,JSON.stringify(e,(t,e)=>"bigint"==typeof e?e.toString()+"n":e)||"");var e}},function(t,e,n){"use strict";n.r(e);var r=n(0);n.d(e,"PARSE_ERROR",(function(){return r.f})),n.d(e,"INVALID_REQUEST",(function(){return r.d})),n.d(e,"METHOD_NOT_FOUND",(function(){return r.e})),n.d(e,"INVALID_PARAMS",(function(){return r.c})),n.d(e,"INTERNAL_ERROR",(function(){return r.b})),n.d(e,"SERVER_ERROR",(function(){return r.h})),n.d(e,"RESERVED_ERROR_CODES",(function(){return r.g})),n.d(e,"SERVER_ERROR_CODE_RANGE",(function(){return r.i})),n.d(e,"STANDARD_ERROR_MAP",(function(){return r.j})),n.d(e,"DEFAULT_ERROR",(function(){return r.a}));var o=n(1);n.d(e,"isServerErrorCode",(function(){return o.d})),n.d(e,"isReservedErrorCode",(function(){return o.c})),n.d(e,"isValidErrorCode",(function(){return o.e})),n.d(e,"getError",(function(){return o.a})),n.d(e,"getErrorByCode",(function(){return o.b})),n.d(e,"validateJsonRpcError",(function(){return o.g})),n.d(e,"parseConnectionError",(function(){return o.f}));var i=n(5);for(var u 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(u)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(u);var c=n(7);n.d(e,"payloadId",(function(){return c.f})),n.d(e,"getBigIntRpcId",(function(){return c.e})),n.d(e,"formatJsonRpcRequest",(function(){return c.c})),n.d(e,"formatJsonRpcResult",(function(){return c.d})),n.d(e,"formatJsonRpcError",(function(){return c.b})),n.d(e,"formatErrorMessage",(function(){return c.a}));var s=n(8);n.d(e,"isValidRoute",(function(){return s.c})),n.d(e,"isValidDefaultRoute",(function(){return s.a})),n.d(e,"isValidWildcardRoute",(function(){return s.e})),n.d(e,"isValidLeadingWildcardRoute",(function(){return s.b})),n.d(e,"isValidTrailingWildcardRoute",(function(){return s.d}));var f=n(11);n.d(e,"IEvents",(function(){return f.b})),n.d(e,"IJsonRpcConnection",(function(){return f.c})),n.d(e,"IBaseJsonRpcProvider",(function(){return f.a})),n.d(e,"IJsonRpcProvider",(function(){return f.d}));var a=n(9);n.d(e,"isHttpUrl",(function(){return a.a})),n.d(e,"isWsUrl",(function(){return a.c})),n.d(e,"isLocalhostUrl",(function(){return a.b}));var l=n(10);n.d(e,"isJsonRpcPayload",(function(){return l.b})),n.d(e,"isJsonRpcRequest",(function(){return l.c})),n.d(e,"isJsonRpcResponse",(function(){return l.d})),n.d(e,"isJsonRpcResult",(function(){return l.e})),n.d(e,"isJsonRpcError",(function(){return l.a})),n.d(e,"isJsonRpcValidationInvalid",(function(){return l.f}))},function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",(function(){return o})),n.d(e,"__assign",(function(){return i})),n.d(e,"__rest",(function(){return u})),n.d(e,"__decorate",(function(){return c})),n.d(e,"__param",(function(){return s})),n.d(e,"__metadata",(function(){return f})),n.d(e,"__awaiter",(function(){return a})),n.d(e,"__generator",(function(){return l})),n.d(e,"__createBinding",(function(){return d})),n.d(e,"__exportStar",(function(){return p})),n.d(e,"__values",(function(){return v})),n.d(e,"__read",(function(){return h})),n.d(e,"__spread",(function(){return y})),n.d(e,"__spreadArrays",(function(){return _})),n.d(e,"__await",(function(){return m})),n.d(e,"__asyncGenerator",(function(){return b})),n.d(e,"__asyncDelegator",(function(){return g})),n.d(e,"__asyncValues",(function(){return w})),n.d(e,"__makeTemplateObject",(function(){return R})),n.d(e,"__importStar",(function(){return E})),n.d(e,"__importDefault",(function(){return O})),n.d(e,"__classPrivateFieldGet",(function(){return S})),n.d(e,"__classPrivateFieldSet",(function(){return j}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function u(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function c(t,e,n,r){var o,i=arguments.length,u=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(u=(i<3?o(u):i>3?o(e,n,u):o(e,n))||u);return i>3&&u&&Object.defineProperty(e,n,u),u}function s(t,e){return function(n,r){e(n,r,t)}}function f(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function c(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}s((r=r.apply(t,e||[])).next())}))}function l(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function d(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}function p(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||(e[n]=t[n])}function v(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function y(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return t}function _(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,c=i.length;u<c;u++,o++)r[o]=i[u];return r}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function b(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(t,e||[]),i=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(t){o[t]&&(r[t]=function(e){return new Promise((function(n,r){i.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=o[t](e)).value instanceof m?Promise.resolve(n.value.v).then(s,f):a(i[0][2],n)}catch(t){a(i[0][3],t)}var n}function s(t){c("next",t)}function f(t){c("throw",t)}function a(t,e){t(e),i.shift(),i.length&&c(i[0][0],i[0][1])}}function g(t){var e,n;return e={},r("next"),r("throw",(function(t){throw t})),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,o){e[r]=t[r]?function(e){return(n=!n)?{value:m(t[r](e)),done:"return"===r}:o?o(e):e}:o}}function w(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=v(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function R(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function E(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function O(t){return t&&t.__esModule?t:{default:t}}function S(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function j(t,e,n){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,n),n}},function(t,e,n){"use strict";(function(t){function n(){return(null==t?void 0:t.crypto)||(null==t?void 0:t.msCrypto)||{}}function r(){const t=n();return t.subtle||t.webkitSubtle}Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0,e.getBrowerCrypto=n,e.getSubtleCrypto=r,e.isBrowserCryptoAvailable=function(){return!!n()&&!!r()}}).call(this,n(6))},function(t,e,n){"use strict";(function(t){function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function r(){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=n,e.isNode=r,e.isBrowser=function(){return!n()&&!r()}}).call(this,n(19))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,f=[],a=!1,l=-1;function d(){a&&s&&(a=!1,s.length?f=s.concat(f):l=-1,f.length&&p())}function p(){if(!a){var t=c(d);a=!0;for(var e=f.length;e;){for(s=f,f=[];++l<e;)s&&s[l].run();l=-1,e=f.length}s=null,a=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function v(t,e){this.fun=t,this.array=e}function h(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new v(t,e)),1!==f.length||a||c(p)},v.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=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,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}},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.truncateQuery=e.isBrowser=e.resolveWebSocketImplementation=void 0;e.resolveWebSocketImplementation=()=>"undefined"!=typeof WebSocket?WebSocket:void 0!==t&&void 0!==t.WebSocket?t.WebSocket:"undefined"!=typeof window&&void 0!==window.WebSocket?window.WebSocket:"undefined"!=typeof self&&void 0!==self.WebSocket?self.WebSocket:n(21);e.isBrowser=()=>"undefined"!=typeof window;e.truncateQuery=t=>t.split("?")[0]}).call(this,n(6))},function(t,e,n){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}}])}));
{
"name": "@walletconnect/jsonrpc-ws-connection",
"description": "WS Connection for JSON-RPC",
"version": "1.0.11",
"version": "1.0.12-843103d",
"author": "WalletConnect, Inc. <walletconnect.com>",

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

"prettier": "^1.19.1",
"typescript": "^3.7.5",
"typescript": "^4.9.5",
"webpack": "^4.41.6",

@@ -88,0 +88,0 @@ "webpack-cli": "^3.3.11"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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