@getpara/solana-wallet-connectors 2.0.0-alpha.66 → 2.0.0-alpha.67
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.
|
@@ -64,12 +64,13 @@ function SolanaExternalWalletProvider({
|
|
|
64
64
|
wallets: adapters,
|
|
65
65
|
select: selectWallet,
|
|
66
66
|
disconnect,
|
|
67
|
+
disconnecting,
|
|
67
68
|
publicKey: solanaAddress,
|
|
68
69
|
wallet,
|
|
69
70
|
connecting,
|
|
70
71
|
signMessage: solanaSignMessage
|
|
71
72
|
} = useWallet();
|
|
72
|
-
const
|
|
73
|
+
const disconnectTypeRef = useRef();
|
|
73
74
|
const solanaSignMessageRef = useRef(solanaSignMessage);
|
|
74
75
|
const solanaAddressRef = useRef(solanaAddress);
|
|
75
76
|
const verificationMessage = useRef();
|
|
@@ -127,7 +128,7 @@ function SolanaExternalWalletProvider({
|
|
|
127
128
|
useEffect(() => {
|
|
128
129
|
var _a;
|
|
129
130
|
const storedExternalWallet = para.externalWallets[(_a = solanaAddress == null ? void 0 : solanaAddress.toString()) != null ? _a : ""];
|
|
130
|
-
if (!!solanaAddress && !storedExternalWallet && !
|
|
131
|
+
if (!!solanaAddress && !storedExternalWallet && !disconnectTypeRef.current) {
|
|
131
132
|
reset();
|
|
132
133
|
}
|
|
133
134
|
}, []);
|
|
@@ -139,7 +140,7 @@ function SolanaExternalWalletProvider({
|
|
|
139
140
|
}, [solanaAddress]);
|
|
140
141
|
useEffect(() => {
|
|
141
142
|
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
142
|
-
if (!connecting && (!wallet || (wallet == null ? void 0 : wallet.adapter.connected)) && (storedExternalWallet == null ? void 0 : storedExternalWallet.type) === "SOLANA" && (storedExternalWallet == null ? void 0 : storedExternalWallet.address) !== (solanaAddress == null ? void 0 : solanaAddress.toString()) && !
|
|
143
|
+
if (!connecting && (!wallet || (wallet == null ? void 0 : wallet.adapter.connected)) && (storedExternalWallet == null ? void 0 : storedExternalWallet.type) === "SOLANA" && (storedExternalWallet == null ? void 0 : storedExternalWallet.address) !== (solanaAddress == null ? void 0 : solanaAddress.toString()) && !disconnectTypeRef.current) {
|
|
143
144
|
switchWallet(solanaAddress == null ? void 0 : solanaAddress.toString());
|
|
144
145
|
}
|
|
145
146
|
}, [solanaAddress, connecting, wallet]);
|
|
@@ -254,7 +255,7 @@ function SolanaExternalWalletProvider({
|
|
|
254
255
|
var _a, _b;
|
|
255
256
|
const wallet2 = wallets.find((w) => w.id === providerId);
|
|
256
257
|
const adapter = getAdapter((_a = wallet2.name) != null ? _a : "");
|
|
257
|
-
|
|
258
|
+
disconnectTypeRef.current = "ACCOUNT_LINKING";
|
|
258
259
|
try {
|
|
259
260
|
const address = yield connectBase(adapter);
|
|
260
261
|
const externalWallet = {
|
|
@@ -270,7 +271,7 @@ function SolanaExternalWalletProvider({
|
|
|
270
271
|
throw new Error((_b = e == null ? void 0 : e.message) != null ? _b : e);
|
|
271
272
|
}
|
|
272
273
|
});
|
|
273
|
-
const disconnectBase = (
|
|
274
|
+
const disconnectBase = (_0, ..._1) => __async(this, [_0, ..._1], function* (providerId, { disconnectType } = {}) {
|
|
274
275
|
var _a;
|
|
275
276
|
const wallet2 = wallets.find((w) => w.id === providerId);
|
|
276
277
|
if (!wallet2) {
|
|
@@ -280,13 +281,15 @@ function SolanaExternalWalletProvider({
|
|
|
280
281
|
if (!(adapter == null ? void 0 : adapter.connected)) {
|
|
281
282
|
return;
|
|
282
283
|
}
|
|
283
|
-
|
|
284
|
+
if (disconnectType) {
|
|
285
|
+
disconnectTypeRef.current = disconnectType;
|
|
286
|
+
}
|
|
284
287
|
try {
|
|
285
288
|
yield adapter.disconnect();
|
|
286
289
|
} catch (e) {
|
|
287
290
|
console.error("Error disconnecting Solana wallet:", e);
|
|
288
291
|
} finally {
|
|
289
|
-
|
|
292
|
+
disconnectTypeRef.current = void 0;
|
|
290
293
|
}
|
|
291
294
|
});
|
|
292
295
|
const getAdapter = (name) => {
|
|
@@ -374,6 +377,7 @@ function SolanaExternalWalletProvider({
|
|
|
374
377
|
() => __spreadValues({
|
|
375
378
|
wallets: walletsWithInjected,
|
|
376
379
|
disconnect,
|
|
380
|
+
disconnectStatus: disconnecting ? "pending" : "idle",
|
|
377
381
|
signMessage,
|
|
378
382
|
signVerificationMessage,
|
|
379
383
|
requestInfo,
|
|
@@ -383,6 +387,7 @@ function SolanaExternalWalletProvider({
|
|
|
383
387
|
[
|
|
384
388
|
walletsWithInjected,
|
|
385
389
|
disconnect,
|
|
390
|
+
disconnecting,
|
|
386
391
|
signMessage,
|
|
387
392
|
signVerificationMessage,
|
|
388
393
|
requestInfo,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/solana-wallet-connectors",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.67",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
6
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
5
|
+
"@getpara/react-common": "2.0.0-alpha.67",
|
|
6
|
+
"@getpara/web-sdk": "2.0.0-alpha.67",
|
|
7
7
|
"bs58": "6.0.0"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist",
|
|
24
24
|
"package.json"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "0266cc49e978575fed0b12c9bb0c832651e140eb",
|
|
27
27
|
"main": "dist/index.js",
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@farcaster/mini-app-solana": "^1.0.0",
|