jcwallet/patches/@walletconnect+socket-transport+1.8.0.patch
2022-08-26 15:52:50 +08:00

40 lines
1.5 KiB
Diff

diff --git a/node_modules/@walletconnect/socket-transport/dist/esm/index.js b/node_modules/@walletconnect/socket-transport/dist/esm/index.js
index 9a6cc32..2664801 100644
--- a/node_modules/@walletconnect/socket-transport/dist/esm/index.js
+++ b/node_modules/@walletconnect/socket-transport/dist/esm/index.js
@@ -74,6 +74,14 @@ class SocketTransport {
on(event, callback) {
this._events.push({ event, callback });
}
+ remove(event, callback) {
+ let self = this;
+ this._events.map((obj, i) => {
+ if (obj.event === event && obj.callback === callback) {
+ self._events.splice(i, 1);
+ }
+ })
+ }
_socketCreate() {
if (this._nextSocket) {
return;
@@ -99,6 +107,10 @@ class SocketTransport {
this._nextSocket = null;
this._queueSubscriptions();
this._pushQueue();
+ const events = this._events.filter(event => event.event === "open");
+ if (events && events.length) {
+ events.forEach(event => event.callback());
+ }
}
_socketClose() {
if (this._socket) {
@@ -176,7 +188,7 @@ function getWebSocketUrl(_url, protocol, version) {
protocol,
version,
env: "browser",
- host: ((_a = getLocation()) === null || _a === void 0 ? void 0 : _a.host) || "",
+ host: ((_a = getLocation()) === null || _a === void 0 ? void 0 : _a.host) || "www.cebg.games",
}
: {
protocol,