@getpara/evm-wallet-connectors 2.0.0-alpha.40 → 2.0.0-alpha.42
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.
|
@@ -77,14 +77,18 @@ function EvmExternalWalletProvider({
|
|
|
77
77
|
const switchAccount = useCallback(
|
|
78
78
|
(connectorName) => {
|
|
79
79
|
var _a;
|
|
80
|
-
const connector = (_a =
|
|
80
|
+
const connector = (_a = connectionsRef.current.find((c) => {
|
|
81
|
+
var _a2;
|
|
82
|
+
const paraDetails = (_a2 = c.connector) == null ? void 0 : _a2.paraDetails;
|
|
83
|
+
return [paraDetails == null ? void 0 : paraDetails.name, paraDetails == null ? void 0 : paraDetails.id, paraDetails == null ? void 0 : paraDetails.internalId].includes(connectorName);
|
|
84
|
+
})) == null ? void 0 : _a.connector;
|
|
81
85
|
if (!connector) {
|
|
82
86
|
console.warn(`connector not found: ${connectorName}`);
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
85
89
|
wagmiSwitchAccount({ connector });
|
|
86
90
|
},
|
|
87
|
-
[
|
|
91
|
+
[wagmiSwitchAccount]
|
|
88
92
|
);
|
|
89
93
|
const findConnectorAndAccount = (externalWallet) => {
|
|
90
94
|
var _a;
|
|
@@ -139,9 +143,11 @@ function EvmExternalWalletProvider({
|
|
|
139
143
|
yield para.logout();
|
|
140
144
|
});
|
|
141
145
|
const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
|
|
146
|
+
var _a;
|
|
142
147
|
let signOpts = {};
|
|
143
148
|
if (externalWallet) {
|
|
144
149
|
signOpts = findConnectorAndAccount(externalWallet);
|
|
150
|
+
yield switchAccount((_a = externalWallet.providerId) != null ? _a : "");
|
|
145
151
|
}
|
|
146
152
|
try {
|
|
147
153
|
const address = signOpts.account ? typeof signOpts.account === "string" ? signOpts.account : signOpts.account.getAddress() : wagmiAddress;
|
|
@@ -269,7 +275,7 @@ function EvmExternalWalletProvider({
|
|
|
269
275
|
authState = yield login(__spreadValues({
|
|
270
276
|
address
|
|
271
277
|
}, loginInfo));
|
|
272
|
-
verificationMessage.current = authState.
|
|
278
|
+
verificationMessage.current = authState.signatureVerificationMessage;
|
|
273
279
|
} catch (err) {
|
|
274
280
|
address = void 0;
|
|
275
281
|
error = err;
|
|
@@ -300,23 +306,35 @@ function EvmExternalWalletProvider({
|
|
|
300
306
|
const _connector = connector.walletConnectModalConnector && _isMobile ? connector.walletConnectModalConnector : connector;
|
|
301
307
|
return yield connect(_connector);
|
|
302
308
|
});
|
|
309
|
+
const findConnector = (providerId) => {
|
|
310
|
+
return connectorsRef.current.find(
|
|
311
|
+
(w) => {
|
|
312
|
+
var _a, _b, _c;
|
|
313
|
+
return [(_a = w == null ? void 0 : w.paraDetails) == null ? void 0 : _a.name, (_b = w == null ? void 0 : w.paraDetails) == null ? void 0 : _b.id, (_c = w == null ? void 0 : w.paraDetails) == null ? void 0 : _c.internalId].includes(providerId);
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
};
|
|
303
317
|
const requestInfo = (providerId) => __async(this, null, function* () {
|
|
304
|
-
var _a;
|
|
305
|
-
const connector =
|
|
306
|
-
|
|
318
|
+
var _a, _b, _c;
|
|
319
|
+
const connector = findConnector(providerId);
|
|
320
|
+
isLinkingAccount.current = true;
|
|
307
321
|
try {
|
|
308
322
|
const address = yield connectBase(connector);
|
|
323
|
+
const providerId2 = (_b = (_a = wallets.find((w) => {
|
|
324
|
+
var _a2, _b2;
|
|
325
|
+
return (w == null ? void 0 : w.name) === ((_b2 = (_a2 = connector == null ? void 0 : connector.paraDetails) == null ? void 0 : _a2.name) != null ? _b2 : "");
|
|
326
|
+
})) == null ? void 0 : _a.name) != null ? _b : connector == null ? void 0 : connector.name;
|
|
309
327
|
return {
|
|
310
328
|
partnerId: para.partnerId,
|
|
311
329
|
address,
|
|
312
330
|
type: "EVM",
|
|
313
|
-
providerId:
|
|
314
|
-
provider:
|
|
331
|
+
providerId: providerId2,
|
|
332
|
+
provider: providerId2,
|
|
315
333
|
ensName,
|
|
316
334
|
ensAvatar
|
|
317
335
|
};
|
|
318
336
|
} catch (e) {
|
|
319
|
-
throw new Error((
|
|
337
|
+
throw new Error((_c = e == null ? void 0 : e.message) != null ? _c : e);
|
|
320
338
|
}
|
|
321
339
|
});
|
|
322
340
|
const disconnectBase = (providerId) => __async(this, null, function* () {
|
|
@@ -324,10 +342,10 @@ function EvmExternalWalletProvider({
|
|
|
324
342
|
if (!providerId) {
|
|
325
343
|
throw new Error("Provider ID is required to disconnect");
|
|
326
344
|
}
|
|
327
|
-
const connector =
|
|
345
|
+
const connector = findConnector(providerId);
|
|
328
346
|
isLinkingAccount.current = true;
|
|
329
347
|
try {
|
|
330
|
-
yield connector.disconnect();
|
|
348
|
+
yield connector == null ? void 0 : connector.disconnect();
|
|
331
349
|
} catch (e) {
|
|
332
350
|
throw new Error((_a = e == null ? void 0 : e.message) != null ? _a : e);
|
|
333
351
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/evm-wallet-connectors",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.42",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@coinbase/wallet-sdk": "4.3.0",
|
|
6
|
-
"@getpara/wagmi-v2-connector": "2.0.0-alpha.
|
|
7
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
6
|
+
"@getpara/wagmi-v2-connector": "2.0.0-alpha.42",
|
|
7
|
+
"@getpara/web-sdk": "2.0.0-alpha.42",
|
|
8
8
|
"zustand": "^4.5.2",
|
|
9
9
|
"zustand-sync-tabs": "^0.2.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
12
|
+
"@getpara/react-common": "2.0.0-alpha.42",
|
|
13
13
|
"@tanstack/react-query": "^5.74.0",
|
|
14
14
|
"@types/react": "^18.0.31",
|
|
15
15
|
"@types/react-dom": "^18.2.7",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist",
|
|
26
26
|
"package.json"
|
|
27
27
|
],
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "6f44dc050550a1f567088c81b3ae06c7f1f8ebcb",
|
|
29
29
|
"main": "dist/index.js",
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@farcaster/miniapp-wagmi-connector": "^1.0.0",
|