@btc-vision/walletconnect 1.9.5 → 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,10 +66,15 @@ const WalletConnectProvider = ({ theme, children }) => {
66
66
  setPublicKey(null);
67
67
  setWalletAddress(null);
68
68
  setConnecting(false);
69
- WalletController.removeDisconnectHook();
70
- WalletController.removeChainChangedHook();
71
- WalletController.removeAccountsChangedHook();
72
- await WalletController.disconnect();
69
+ try {
70
+ WalletController.removeDisconnectHook();
71
+ WalletController.removeChainChangedHook();
72
+ WalletController.removeAccountsChangedHook();
73
+ await WalletController.disconnect();
74
+ }
75
+ catch (hookError) {
76
+ console.warn('Error disconnecting from wallet:', hookError);
77
+ }
73
78
  setNetwork(null);
74
79
  }, []);
75
80
  const connectToWallet = useCallback(async (wallet) => {
@@ -85,9 +90,14 @@ const WalletConnectProvider = ({ theme, children }) => {
85
90
  setPublicKey(publicKey);
86
91
  const network = await WalletController.getNetwork();
87
92
  setNetwork(network);
88
- WalletController.setAccountsChangedHook(accountsChanged);
89
- WalletController.setChainChangedHook(chainChanged);
90
- WalletController.setDisconnectHook(disconnect);
93
+ try {
94
+ WalletController.setAccountsChangedHook(accountsChanged);
95
+ WalletController.setChainChangedHook(chainChanged);
96
+ WalletController.setDisconnectHook(disconnect);
97
+ }
98
+ catch (hookError) {
99
+ console.warn('Error setting up wallet hooks:', hookError);
100
+ }
91
101
  closeConnectModal();
92
102
  console.log('Connected to wallet:', wallet);
93
103
  setSelectedWallet(wallet);
@@ -121,26 +121,16 @@ class WalletController {
121
121
  if (!wallet) {
122
122
  return;
123
123
  }
124
- try {
125
- wallet.controller.removeAccountsChangedHook();
126
- wallet.controller.setAccountsChangedHook(fn);
127
- }
128
- catch (error) {
129
- console.error('Error setting accounts changed hook:', error);
130
- }
124
+ wallet.controller.removeAccountsChangedHook();
125
+ wallet.controller.setAccountsChangedHook(fn);
131
126
  }
132
127
  static setDisconnectHook(fn) {
133
128
  const wallet = this.currentWallet;
134
129
  if (!wallet) {
135
130
  return;
136
131
  }
137
- try {
138
- wallet.controller.removeDisconnectHook();
139
- wallet.controller.setDisconnectHook(fn);
140
- }
141
- catch (error) {
142
- console.error('Error setting disconnect hook:', error);
143
- }
132
+ wallet.controller.removeDisconnectHook();
133
+ wallet.controller.setDisconnectHook(fn);
144
134
  }
145
135
  static setChainChangedHook(fn) {
146
136
  const wallet = this.currentWallet;
@@ -148,18 +138,13 @@ class WalletController {
148
138
  console.log('No current wallet to set network switch hook for');
149
139
  return;
150
140
  }
151
- try {
152
- wallet.controller.removeChainChangedHook();
153
- wallet.controller.setChainChangedHook((chainType) => {
154
- const network = this.convertChainTypeToNetwork(chainType);
155
- if (network) {
156
- fn(network);
157
- }
158
- });
159
- }
160
- catch (error) {
161
- console.error('Error setting network switch hook:', error);
162
- }
141
+ wallet.controller.removeChainChangedHook();
142
+ wallet.controller.setChainChangedHook((chainType) => {
143
+ const network = this.convertChainTypeToNetwork(chainType);
144
+ if (network) {
145
+ fn(network);
146
+ }
147
+ });
163
148
  }
164
149
  static removeAccountsChangedHook() {
165
150
  const wallet = this.currentWallet;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@btc-vision/walletconnect",
3
3
  "type": "module",
4
- "version": "1.9.5",
4
+ "version": "1.9.7",
5
5
  "author": "impredmet",
6
6
  "description": "The OP_NET Wallet Connect library helps your dApp connect to any compatible wallet.",
7
7
  "engines": {
@@ -70,32 +70,32 @@
70
70
  "@babel/preset-env": "^7.28.3",
71
71
  "@babel/preset-react": "^7.27.1",
72
72
  "@babel/preset-typescript": "^7.27.1",
73
- "@types/react": "^19.1.13",
74
- "eslint-plugin-react-hooks": "^5.2.0",
75
- "eslint-plugin-react-refresh": "^0.4.21",
73
+ "@types/react": "^19.2.2",
74
+ "eslint-plugin-react-hooks": "^7.0.0",
75
+ "eslint-plugin-react-refresh": "^0.4.24",
76
76
  "gulp": "^5.0.1",
77
77
  "gulp-cached": "^1.1.1",
78
78
  "gulp-typescript": "^6.0.0-alpha.1",
79
79
  "https-browserify": "^1.0.0",
80
80
  "os-browserify": "^0.3.0",
81
- "react": "^19.1.1",
82
- "react-dom": "^19.1.1",
81
+ "react": "^19.2.0",
82
+ "react-dom": "^19.2.0",
83
83
  "stream-browserify": "^3.0.0",
84
84
  "stream-http": "^3.2.0",
85
- "typescript-eslint": "^8.44.1",
85
+ "typescript-eslint": "^8.46.1",
86
86
  "webpack-cli": "^6.0.1"
87
87
  },
88
88
  "dependencies": {
89
89
  "@btc-vision/bitcoin": "^6.4.8",
90
90
  "@btc-vision/transaction": "^1.6.17",
91
- "@eslint/js": "^9.36.0",
91
+ "@eslint/js": "^9.37.0",
92
92
  "css-loader": "^7.1.2",
93
- "eslint-plugin-react-hooks": "^5.2.0",
93
+ "eslint-plugin-react-hooks": "^7.0.0",
94
94
  "gulp-clean": "^0.4.0",
95
95
  "gulp-eslint-new": "^2.5.0",
96
96
  "gulp-logger-new": "^1.0.1",
97
- "opnet": "^1.6.37",
97
+ "opnet": "^1.6.39",
98
98
  "style-loader": "^4.0.0",
99
- "webpack": "^5.101.3"
99
+ "webpack": "^5.102.1"
100
100
  }
101
101
  }
@@ -90,10 +90,14 @@ const WalletConnectProvider: React.FC<WalletConnectProviderProps> = ({ theme, ch
90
90
  setPublicKey(null);
91
91
  setWalletAddress(null);
92
92
  setConnecting(false);
93
- WalletController.removeDisconnectHook();
94
- WalletController.removeChainChangedHook();
95
- WalletController.removeAccountsChangedHook();
96
- await WalletController.disconnect();
93
+ try {
94
+ WalletController.removeDisconnectHook();
95
+ WalletController.removeChainChangedHook();
96
+ WalletController.removeAccountsChangedHook();
97
+ await WalletController.disconnect();
98
+ } catch (hookError) {
99
+ console.warn('Error disconnecting from wallet:', hookError);
100
+ }
97
101
  setNetwork(null);
98
102
  }, []);
99
103
 
@@ -115,9 +119,13 @@ const WalletConnectProvider: React.FC<WalletConnectProviderProps> = ({ theme, ch
115
119
  const network = await WalletController.getNetwork();
116
120
  setNetwork(network);
117
121
 
118
- WalletController.setAccountsChangedHook(accountsChanged);
119
- WalletController.setChainChangedHook(chainChanged);
120
- WalletController.setDisconnectHook(disconnect);
122
+ try {
123
+ WalletController.setAccountsChangedHook(accountsChanged);
124
+ WalletController.setChainChangedHook(chainChanged);
125
+ WalletController.setDisconnectHook(disconnect);
126
+ } catch (hookError) {
127
+ console.warn('Error setting up wallet hooks:', hookError);
128
+ }
121
129
 
122
130
  closeConnectModal();
123
131
  console.log('Connected to wallet:', wallet);
@@ -151,12 +151,8 @@ class WalletController {
151
151
  if (!wallet) {
152
152
  return;
153
153
  }
154
- try {
155
- wallet.controller.removeAccountsChangedHook();
156
- wallet.controller.setAccountsChangedHook(fn);
157
- } catch (error) {
158
- console.error('Error setting accounts changed hook:', error);
159
- }
154
+ wallet.controller.removeAccountsChangedHook();
155
+ wallet.controller.setAccountsChangedHook(fn);
160
156
  }
161
157
 
162
158
  static setDisconnectHook(fn: () => void): void {
@@ -164,12 +160,8 @@ class WalletController {
164
160
  if (!wallet) {
165
161
  return;
166
162
  }
167
- try {
168
- wallet.controller.removeDisconnectHook();
169
- wallet.controller.setDisconnectHook(fn);
170
- } catch (error) {
171
- console.error('Error setting disconnect hook:', error);
172
- }
163
+ wallet.controller.removeDisconnectHook();
164
+ wallet.controller.setDisconnectHook(fn);
173
165
  }
174
166
 
175
167
  static setChainChangedHook(fn: (network: WalletConnectNetwork) => void): void {
@@ -178,17 +170,13 @@ class WalletController {
178
170
  console.log('No current wallet to set network switch hook for');
179
171
  return;
180
172
  }
181
- try {
182
- wallet.controller.removeChainChangedHook();
183
- wallet.controller.setChainChangedHook((chainType: UnisatChainType) => {
184
- const network = this.convertChainTypeToNetwork(chainType);
185
- if (network) {
186
- fn(network);
187
- }
188
- });
189
- } catch (error) {
190
- console.error('Error setting network switch hook:', error);
191
- }
173
+ wallet.controller.removeChainChangedHook();
174
+ wallet.controller.setChainChangedHook((chainType: UnisatChainType) => {
175
+ const network = this.convertChainTypeToNetwork(chainType);
176
+ if (network) {
177
+ fn(network);
178
+ }
179
+ });
192
180
  }
193
181
 
194
182
  static removeAccountsChangedHook(): void {