@btc-vision/walletconnect 1.0.4 → 1.0.6
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.
- package/browser/index.js +1 -1
- package/build/WalletConnection.js +0 -3
- package/build/WalletProvider.js +3 -1
- package/package.json +12 -12
- package/src/WalletConnection.ts +1 -5
- package/src/WalletProvider.tsx +6 -1
|
@@ -22,9 +22,6 @@ export class WalletConnection {
|
|
|
22
22
|
if (window.opnet) {
|
|
23
23
|
try {
|
|
24
24
|
await window.opnet.requestAccounts();
|
|
25
|
-
const signer = new UnisatSigner();
|
|
26
|
-
await signer.init();
|
|
27
|
-
this.signer = signer;
|
|
28
25
|
this.walletType = walletType;
|
|
29
26
|
this.walletWindowInstance = window.opnet;
|
|
30
27
|
return;
|
package/build/WalletProvider.js
CHANGED
|
@@ -22,7 +22,9 @@ export const WalletProvider = ({ children }) => {
|
|
|
22
22
|
}, []);
|
|
23
23
|
const connect = useCallback(async (walletType) => {
|
|
24
24
|
await walletConnection.connect(walletType);
|
|
25
|
-
if (
|
|
25
|
+
if ((walletConnection.walletType !== SupportedWallets.OP_WALLET &&
|
|
26
|
+
!walletConnection.signer) ||
|
|
27
|
+
!walletConnection.walletWindowInstance)
|
|
26
28
|
throw new Error('Failed to connect to wallet');
|
|
27
29
|
setIsConnected(true);
|
|
28
30
|
localStorage.setItem('walletType', walletType);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btc-vision/walletconnect",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"author": "impredmet",
|
|
6
6
|
"description": "The OP_NET Wallet Connect library helps your dApp connect to any compatible wallet.",
|
|
7
7
|
"engines": {
|
|
@@ -67,29 +67,29 @@
|
|
|
67
67
|
"react-dom": "^18"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@babel/core": "^7.26.
|
|
70
|
+
"@babel/core": "^7.26.8",
|
|
71
71
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
72
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
73
|
-
"@babel/preset-env": "^7.26.
|
|
72
|
+
"@babel/plugin-transform-runtime": "^7.26.8",
|
|
73
|
+
"@babel/preset-env": "^7.26.8",
|
|
74
74
|
"@babel/preset-flow": "^7.25.9",
|
|
75
75
|
"@babel/preset-react": "^7.26.3",
|
|
76
76
|
"@babel/preset-typescript": "^7.26.0",
|
|
77
|
-
"@types/node": "^22.13.
|
|
77
|
+
"@types/node": "^22.13.2",
|
|
78
78
|
"@types/react": "^19.0.8",
|
|
79
79
|
"@types/sha.js": "^2.4.4",
|
|
80
|
-
"eslint": "^9.
|
|
80
|
+
"eslint": "^9.20.1",
|
|
81
81
|
"gulp": "^5.0.0",
|
|
82
82
|
"gulp-cached": "^1.1.1",
|
|
83
83
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
84
84
|
"https-browserify": "^1.0.0",
|
|
85
85
|
"os-browserify": "^0.3.0",
|
|
86
|
-
"prettier": "^3.
|
|
86
|
+
"prettier": "^3.5.1",
|
|
87
87
|
"react": "^19.0.0",
|
|
88
88
|
"react-dom": "^19.0.0",
|
|
89
89
|
"stream-browserify": "^3.0.0",
|
|
90
90
|
"stream-http": "^3.2.0",
|
|
91
|
-
"typedoc": "^0.27.
|
|
92
|
-
"typescript-eslint": "^8.
|
|
91
|
+
"typedoc": "^0.27.7",
|
|
92
|
+
"typescript-eslint": "^8.24.0",
|
|
93
93
|
"webpack-cli": "^6.0.1"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@btc-vision/bitcoin": "^6.3.6",
|
|
99
99
|
"@btc-vision/bitcoin-rpc": "^1.0.1",
|
|
100
100
|
"@btc-vision/logger": "^1.0.6",
|
|
101
|
-
"@btc-vision/transaction": "^1.2.
|
|
102
|
-
"@eslint/js": "^9.
|
|
101
|
+
"@btc-vision/transaction": "^1.2.13",
|
|
102
|
+
"@eslint/js": "^9.20.0",
|
|
103
103
|
"@noble/secp256k1": "^2.2.3",
|
|
104
104
|
"assert": "^2.1.0",
|
|
105
105
|
"babel-loader": "^9.2.1",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"gulp-clean": "^0.4.0",
|
|
116
116
|
"gulp-eslint-new": "^2.4.0",
|
|
117
117
|
"gulp-logger-new": "^1.0.1",
|
|
118
|
-
"opnet": "^1.2.
|
|
118
|
+
"opnet": "^1.2.25",
|
|
119
119
|
"process": "^0.11.10",
|
|
120
120
|
"sha.js": "^2.4.11",
|
|
121
121
|
"ts-loader": "^9.5.2",
|
package/src/WalletConnection.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type Signers = UnisatSigner;
|
|
|
10
10
|
export type Wallets = Unisat;
|
|
11
11
|
|
|
12
12
|
export class WalletConnection {
|
|
13
|
-
public signer: Signers | null = null;
|
|
13
|
+
public signer: Signers | null = null; // OP_WALLET doesn't need a signer
|
|
14
14
|
public walletType: SupportedWallets | null = null;
|
|
15
15
|
public walletWindowInstance: Wallets | null = null;
|
|
16
16
|
|
|
@@ -29,10 +29,6 @@ export class WalletConnection {
|
|
|
29
29
|
try {
|
|
30
30
|
await window.opnet.requestAccounts(); // Trick on OP_WALLET: force the connection popup to appear
|
|
31
31
|
|
|
32
|
-
const signer = new UnisatSigner();
|
|
33
|
-
await signer.init();
|
|
34
|
-
|
|
35
|
-
this.signer = signer;
|
|
36
32
|
this.walletType = walletType;
|
|
37
33
|
this.walletWindowInstance = window.opnet;
|
|
38
34
|
return;
|
package/src/WalletProvider.tsx
CHANGED
|
@@ -49,7 +49,12 @@ export const WalletProvider: React.FC<{ children: React.ReactNode }> = ({ childr
|
|
|
49
49
|
async (walletType: SupportedWallets) => {
|
|
50
50
|
await walletConnection.connect(walletType);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
// OP_WALLET doesn't need a signer
|
|
53
|
+
if (
|
|
54
|
+
(walletConnection.walletType !== SupportedWallets.OP_WALLET &&
|
|
55
|
+
!walletConnection.signer) ||
|
|
56
|
+
!walletConnection.walletWindowInstance
|
|
57
|
+
)
|
|
53
58
|
throw new Error('Failed to connect to wallet');
|
|
54
59
|
|
|
55
60
|
setIsConnected(true);
|