@getpara/evm-wallet-connectors 2.0.0-alpha.23 → 2.0.0-alpha.25

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.
@@ -298,10 +298,6 @@ function EvmExternalWalletProvider({
298
298
  const _connector = connector.walletConnectModalConnector && _isMobile ? connector.walletConnectModalConnector : connector;
299
299
  return yield connect(_connector);
300
300
  });
301
- const getQrUri = (connector) => () => {
302
- var _a;
303
- return getWalletConnectUri(connector, (_a = connector.paraDetails) == null ? void 0 : _a.getUri);
304
- };
305
301
  const requestInfo = (providerId) => __async(this, null, function* () {
306
302
  var _a, _b;
307
303
  const connector = connectors.find((c) => {
@@ -368,14 +364,18 @@ function EvmExternalWalletProvider({
368
364
  return c;
369
365
  }).filter((c) => !!c);
370
366
  const wallets = dedupedConnectors.map((c) => {
367
+ var _a, _b, _c;
368
+ if (((_a = c.paraDetails) == null ? void 0 : _a.internalId) === "SAFE" && (typeof window === "undefined" || window.parent === window)) {
369
+ return void 0;
370
+ }
371
371
  const connector = __spreadValues(__spreadValues({}, c), c.paraDetails);
372
- return __spreadProps(__spreadValues({}, connector), {
372
+ const supportsWalletConnect = connector.type === "walletConnect" || ((_b = connector.paraDetails) == null ? void 0 : _b.internalId) === "WALLETCONNECT" || ((_c = connector.paraDetails) == null ? void 0 : _c.showQrModal);
373
+ return __spreadValues(__spreadProps(__spreadValues({}, connector), {
373
374
  connect: () => connect(connector),
374
- connectMobile: (isManualWalletConnect) => connectMobile(connector, isManualWalletConnect),
375
- type: "EVM",
376
- getQrUri: getQrUri(connector)
377
- });
378
- });
375
+ connectMobile: (manual) => connectMobile(connector, manual),
376
+ type: "EVM"
377
+ }), supportsWalletConnect && { getQrUri: () => getWalletConnectUri(connector, connector.getUri) });
378
+ }).filter(Boolean);
379
379
  const getConnectorInfo = (connector) => {
380
380
  const paraDetails = connector.paraDetails;
381
381
  const providerId = paraDetails == null ? void 0 : paraDetails.internalId;
@@ -3,19 +3,22 @@ import {
3
3
  __async
4
4
  } from "../chunk-MMUBH76A.js";
5
5
  const getWalletConnectUri = (connector, uriConverter) => __async(void 0, null, function* () {
6
- const provider = yield connector.getProvider();
7
- if (connector.type === "coinbaseWallet") {
6
+ var _a, _b;
7
+ const provider = yield (_b = (_a = connector.getProvider) == null ? void 0 : _a.call(connector)) != null ? _b : void 0;
8
+ if (connector.type === "coinbaseWallet" && (provider == null ? void 0 : provider.qrUrl)) {
8
9
  return provider.qrUrl;
9
10
  }
10
- return new Promise(
11
- (resolve) => (
12
- // Wagmi v2 doesn't have a return type for provider yet
13
- // @ts-expect-error
14
- provider.once("display_uri", (uri) => {
15
- resolve(uriConverter ? uriConverter(uri) : uri);
16
- })
17
- )
18
- );
11
+ if (!provider || typeof provider.once !== "function" && typeof provider.on !== "function") {
12
+ throw new Error("display_uri event not supported for this connector");
13
+ }
14
+ const listen = typeof provider.once === "function" ? provider.once.bind(provider) : provider.on.bind(provider);
15
+ return new Promise((resolve, reject) => {
16
+ const cancel = setTimeout(() => reject(new Error("display_uri event not emitted")), 1e4);
17
+ listen("display_uri", (uri) => {
18
+ clearTimeout(cancel);
19
+ resolve(uriConverter ? uriConverter(uri) : uri);
20
+ });
21
+ });
19
22
  });
20
23
  export {
21
24
  getWalletConnectUri
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/evm-wallet-connectors",
3
- "version": "2.0.0-alpha.23",
3
+ "version": "2.0.0-alpha.25",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,8 +10,8 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@coinbase/wallet-sdk": "4.3.0",
13
- "@getpara/wagmi-v2-connector": "2.0.0-alpha.23",
14
- "@getpara/web-sdk": "2.0.0-alpha.23",
13
+ "@getpara/wagmi-v2-connector": "2.0.0-alpha.25",
14
+ "@getpara/web-sdk": "2.0.0-alpha.25",
15
15
  "viem": "^2.24.2",
16
16
  "wagmi": "^2.14.16",
17
17
  "zustand": "^4.5.2",
@@ -23,7 +23,7 @@
23
23
  "test": "vitest run --coverage"
24
24
  },
25
25
  "devDependencies": {
26
- "@getpara/react-common": "2.0.0-alpha.23",
26
+ "@getpara/react-common": "2.0.0-alpha.25",
27
27
  "@tanstack/react-query": ">=5.0.0",
28
28
  "@types/react": "^18.0.31",
29
29
  "@types/react-dom": "^18.2.7",
@@ -39,5 +39,5 @@
39
39
  "dist",
40
40
  "package.json"
41
41
  ],
42
- "gitHead": "e7c7e95f79bcfca4d57a80f4dd721dc5ecaff24d"
42
+ "gitHead": "51f576cb7d3f0d55fdd5508f7445b2c7b48d0696"
43
43
  }