@getpara/evm-wallet-connectors 2.0.0-alpha.33 → 2.0.0-alpha.35
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.
|
@@ -92,12 +92,10 @@ function EvmExternalWalletProvider({
|
|
|
92
92
|
switch (true) {
|
|
93
93
|
case !!externalWallet.providerId:
|
|
94
94
|
{
|
|
95
|
-
connector = (_a = connectionsRef.current.find(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
)) == null ? void 0 : _a.connector;
|
|
95
|
+
connector = (_a = connectionsRef.current.find((c) => {
|
|
96
|
+
var _a2;
|
|
97
|
+
return ((_a2 = c.connector) == null ? void 0 : _a2.name) === externalWallet.providerId;
|
|
98
|
+
})) == null ? void 0 : _a.connector;
|
|
101
99
|
}
|
|
102
100
|
break;
|
|
103
101
|
}
|
|
@@ -303,11 +301,8 @@ function EvmExternalWalletProvider({
|
|
|
303
301
|
return yield connect(_connector);
|
|
304
302
|
});
|
|
305
303
|
const requestInfo = (providerId) => __async(this, null, function* () {
|
|
306
|
-
var _a
|
|
307
|
-
const connector = connectors.find((c) =>
|
|
308
|
-
var _a2;
|
|
309
|
-
return ((_a2 = c.paraDetails) == null ? void 0 : _a2.internalId) === providerId;
|
|
310
|
-
});
|
|
304
|
+
var _a;
|
|
305
|
+
const connector = connectors.find((c) => c.name === providerId);
|
|
311
306
|
if (connector.isAuthorized) isLinkingAccount.current = true;
|
|
312
307
|
try {
|
|
313
308
|
const address = yield connectBase(connector);
|
|
@@ -315,13 +310,13 @@ function EvmExternalWalletProvider({
|
|
|
315
310
|
partnerId: para.partnerId,
|
|
316
311
|
address,
|
|
317
312
|
type: "EVM",
|
|
318
|
-
providerId:
|
|
313
|
+
providerId: connector.name,
|
|
319
314
|
provider: connector.name,
|
|
320
315
|
ensName,
|
|
321
316
|
ensAvatar
|
|
322
317
|
};
|
|
323
318
|
} catch (e) {
|
|
324
|
-
throw new Error((
|
|
319
|
+
throw new Error((_a = e == null ? void 0 : e.message) != null ? _a : e);
|
|
325
320
|
}
|
|
326
321
|
});
|
|
327
322
|
const disconnectBase = (providerId) => __async(this, null, function* () {
|
|
@@ -329,10 +324,7 @@ function EvmExternalWalletProvider({
|
|
|
329
324
|
if (!providerId) {
|
|
330
325
|
throw new Error("Provider ID is required to disconnect");
|
|
331
326
|
}
|
|
332
|
-
const connector = connectors.find((c) =>
|
|
333
|
-
var _a2;
|
|
334
|
-
return ((_a2 = c.paraDetails) == null ? void 0 : _a2.internalId) === providerId;
|
|
335
|
-
});
|
|
327
|
+
const connector = connectors.find((c) => c.id === providerId);
|
|
336
328
|
isLinkingAccount.current = true;
|
|
337
329
|
try {
|
|
338
330
|
yield connector.disconnect();
|
|
@@ -350,32 +342,45 @@ function EvmExternalWalletProvider({
|
|
|
350
342
|
}
|
|
351
343
|
}
|
|
352
344
|
});
|
|
353
|
-
const
|
|
345
|
+
const eip6963Names = connectors.filter((c) => isEIP6963Connector(c)).map((c) => c.name);
|
|
354
346
|
const dedupedConnectors = connectors.map((c) => {
|
|
355
|
-
var _a, _b
|
|
347
|
+
var _a, _b;
|
|
356
348
|
if ((_a = c.paraDetails) == null ? void 0 : _a.isWalletConnectModalConnector) {
|
|
357
349
|
return;
|
|
358
350
|
}
|
|
359
|
-
if (!isEIP6963Connector(c) &&
|
|
351
|
+
if (!isEIP6963Connector(c) && eip6963Names.includes(c.name)) {
|
|
360
352
|
return;
|
|
361
353
|
}
|
|
362
354
|
if (isEIP6963Connector(c)) {
|
|
363
355
|
const paraMetadata = nonEip6963ConnectorsByRdns[c.id];
|
|
364
356
|
return __spreadProps(__spreadValues({}, c), { paraDetails: paraMetadata });
|
|
365
357
|
}
|
|
366
|
-
if (((
|
|
358
|
+
if (((_b = c.paraDetails) == null ? void 0 : _b.id) === "WALLETCONNECT" && walletConnectModalConnector) {
|
|
367
359
|
return __spreadProps(__spreadValues({}, c), { walletConnectModalConnector });
|
|
368
360
|
}
|
|
369
361
|
return c;
|
|
370
362
|
}).filter((c) => !!c);
|
|
371
363
|
const wallets = dedupedConnectors.map((c) => {
|
|
372
|
-
var _a, _b, _c;
|
|
364
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
373
365
|
if (((_a = c.paraDetails) == null ? void 0 : _a.internalId) === "SAFE" && (typeof window === "undefined" || window.parent === window)) {
|
|
374
366
|
return void 0;
|
|
375
367
|
}
|
|
376
368
|
const connector = __spreadValues(__spreadValues({}, c), c.paraDetails);
|
|
377
369
|
const supportsWalletConnect = connector.type === "walletConnect" || ((_b = connector.paraDetails) == null ? void 0 : _b.internalId) === "WALLETCONNECT" || ((_c = connector.paraDetails) == null ? void 0 : _c.showQrModal);
|
|
370
|
+
const isInjected = !c.paraDetails && eip6963Names.includes(c.name);
|
|
371
|
+
if (isInjected && connectors.some((c2) => {
|
|
372
|
+
var _a2;
|
|
373
|
+
return ((_a2 = c2.paraDetails) == null ? void 0 : _a2.rdns) === c2.id;
|
|
374
|
+
})) {
|
|
375
|
+
return void 0;
|
|
376
|
+
}
|
|
378
377
|
return __spreadValues(__spreadProps(__spreadValues({}, connector), {
|
|
378
|
+
// Using name here since that's the only common id across the networks
|
|
379
|
+
id: connector.name,
|
|
380
|
+
internalId: (_d = connector.internalId) != null ? _d : connector.name,
|
|
381
|
+
isExtension: (_e = connector.isExtension) != null ? _e : isInjected,
|
|
382
|
+
installed: (_f = connector.installed) != null ? _f : isInjected,
|
|
383
|
+
iconUrl: (_g = connector.iconUrl) != null ? _g : connector.icon,
|
|
379
384
|
connect: () => connect(connector),
|
|
380
385
|
connectMobile: (manual) => connectMobile(connector, manual),
|
|
381
386
|
type: "EVM"
|
|
@@ -383,12 +388,11 @@ function EvmExternalWalletProvider({
|
|
|
383
388
|
}).filter(Boolean);
|
|
384
389
|
const getConnectorInfo = (connector) => {
|
|
385
390
|
const paraDetails = connector.paraDetails;
|
|
386
|
-
const
|
|
387
|
-
const withFullParaAuth = walletsWithFullAuth == null ? void 0 : walletsWithFullAuth.includes(providerId);
|
|
391
|
+
const withFullParaAuth = walletsWithFullAuth == null ? void 0 : walletsWithFullAuth.includes(paraDetails == null ? void 0 : paraDetails.internalId);
|
|
388
392
|
return {
|
|
389
393
|
type: "EVM",
|
|
390
|
-
providerId,
|
|
391
|
-
provider:
|
|
394
|
+
providerId: connector.name,
|
|
395
|
+
provider: connector.name,
|
|
392
396
|
withFullParaAuth
|
|
393
397
|
};
|
|
394
398
|
};
|
|
@@ -414,7 +418,7 @@ function EvmExternalWalletProvider({
|
|
|
414
418
|
return address ? { isPresent: true, isConnected: true, address } : { isPresent: true, isConnected: false };
|
|
415
419
|
}, [connections]);
|
|
416
420
|
const connectParaEmbedded = useCallback(() => __async(this, null, function* () {
|
|
417
|
-
const paraConnectorInstance = connectors.find((c) => c.id === "
|
|
421
|
+
const paraConnectorInstance = connectors.find((c) => c.id === "Para");
|
|
418
422
|
if (!paraConnectorInstance) {
|
|
419
423
|
return { error: "No para connector instance" };
|
|
420
424
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "../chunk-MMUBH76A.js";
|
|
3
3
|
const isEIP6963Connector = (wallet) => {
|
|
4
4
|
var _a;
|
|
5
|
-
return !!(!wallet.isRainbowKitConnector && ((_a = wallet.icon) == null ? void 0 : _a.startsWith("data:image")) && wallet.uid && wallet.name);
|
|
5
|
+
return !!(!wallet.isRainbowKitConnector && ((_a = wallet.icon) == null ? void 0 : _a.trim().startsWith("data:image")) && wallet.uid && wallet.name);
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
isEIP6963Connector
|
|
@@ -13,7 +13,7 @@ const backpackWallet = ({ projectId, walletConnectParameters }) => {
|
|
|
13
13
|
id: "backpack",
|
|
14
14
|
internalId: "BACKPACK",
|
|
15
15
|
name: "Backpack",
|
|
16
|
-
rdns: "app.backpack
|
|
16
|
+
rdns: "app.backpack",
|
|
17
17
|
iconUrl: icon,
|
|
18
18
|
installed: isBackpackInjected,
|
|
19
19
|
isExtension: true,
|
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.35",
|
|
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.35",
|
|
7
|
+
"@getpara/web-sdk": "2.0.0-alpha.35",
|
|
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.35",
|
|
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": "abfec8cf9931f7a8469b09b67b5d48eee6f4cfd5",
|
|
29
29
|
"main": "dist/index.js",
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@farcaster/miniapp-wagmi-connector": "^1.0.0",
|