@getpara/evm-wallet-connectors 2.0.0-alpha.41 → 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;
|
|
@@ -300,26 +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
|
-
var _a2;
|
|
307
|
-
return c.name === providerId || ((_a2 = c.paraDetails) == null ? void 0 : _a2.internalId) === providerId;
|
|
308
|
-
});
|
|
318
|
+
var _a, _b, _c;
|
|
319
|
+
const connector = findConnector(providerId);
|
|
309
320
|
isLinkingAccount.current = true;
|
|
310
321
|
try {
|
|
311
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;
|
|
312
327
|
return {
|
|
313
328
|
partnerId: para.partnerId,
|
|
314
329
|
address,
|
|
315
330
|
type: "EVM",
|
|
316
|
-
providerId:
|
|
317
|
-
provider:
|
|
331
|
+
providerId: providerId2,
|
|
332
|
+
provider: providerId2,
|
|
318
333
|
ensName,
|
|
319
334
|
ensAvatar
|
|
320
335
|
};
|
|
321
336
|
} catch (e) {
|
|
322
|
-
throw new Error((
|
|
337
|
+
throw new Error((_c = e == null ? void 0 : e.message) != null ? _c : e);
|
|
323
338
|
}
|
|
324
339
|
});
|
|
325
340
|
const disconnectBase = (providerId) => __async(this, null, function* () {
|
|
@@ -327,12 +342,7 @@ function EvmExternalWalletProvider({
|
|
|
327
342
|
if (!providerId) {
|
|
328
343
|
throw new Error("Provider ID is required to disconnect");
|
|
329
344
|
}
|
|
330
|
-
const connector =
|
|
331
|
-
(c) => {
|
|
332
|
-
var _a2;
|
|
333
|
-
return c.id === providerId || c.name === providerId || ((_a2 = c.paraDetails) == null ? void 0 : _a2.internalId) === providerId;
|
|
334
|
-
}
|
|
335
|
-
);
|
|
345
|
+
const connector = findConnector(providerId);
|
|
336
346
|
isLinkingAccount.current = true;
|
|
337
347
|
try {
|
|
338
348
|
yield connector == null ? void 0 : connector.disconnect();
|
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",
|