@reef-knot/wallet-adapter-safe 4.2.0-alpha.2 → 4.2.0-alpha.3

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.
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { __awaiter } from './_virtual/_tslib.js';
2
1
  import { safe } from 'wagmi/connectors';
3
2
  import { withTimeout } from 'viem';
4
3
 
@@ -17,7 +16,7 @@ const Safe = ({
17
16
  walletId: id,
18
17
  type: safe.type,
19
18
  autoConnectOnly: true,
20
- detector: () => __awaiter(void 0, void 0, void 0, function* () {
19
+ detector: async () => {
21
20
  // We cannot longer use `safeConnector.getProvider()` directly
22
21
  // because in the current wagmi version it must be initialized
23
22
  // with `wagmi/createConfig/setup` otherewise the `getProvider` method is not accessible.
@@ -31,15 +30,14 @@ const Safe = ({
31
30
  // So, with that being said, as we do not have an access to `safeConnector.getProvider`
32
31
  // we forced to copy an implementation from its original source to implement a wallet detector:
33
32
  // https://github.com/wevm/wagmi/blob/fa5864bfb3ebfb0dc147b35003152a17a785ade6/packages/connectors/src/safe.ts#L85-L116
34
- var _a;
35
- const isIframe = globalThis.window && ((_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.parent) !== globalThis.window;
33
+ const isIframe = globalThis.window && globalThis.window?.parent !== globalThis.window;
36
34
  if (!isIframe) return false;
37
35
  try {
38
36
  // It is a dependency of @wagmi/connectors
39
37
  // eslint-disable-next-line import/no-extraneous-dependencies
40
38
  const {
41
39
  default: SafeAppsSDK
42
- } = yield import('@safe-global/safe-apps-sdk');
40
+ } = await import('@safe-global/safe-apps-sdk');
43
41
  let SDK;
44
42
  if (typeof SafeAppsSDK !== 'function' && typeof SafeAppsSDK.default === 'function') {
45
43
  SDK = SafeAppsSDK.default;
@@ -52,7 +50,7 @@ const Safe = ({
52
50
  const sdk = new SDK(parameters);
53
51
  // `getInfo` hangs when not used in Safe App iFrame
54
52
  // https://github.com/safe-global/safe-apps-sdk/issues/263#issuecomment-1029835840
55
- const safeSdk = yield withTimeout(() => sdk.safe.getInfo(), {
53
+ const safeSdk = await withTimeout(() => sdk.safe.getInfo(), {
56
54
  timeout: 200
57
55
  });
58
56
  if (!safeSdk) return false;
@@ -60,13 +58,13 @@ const Safe = ({
60
58
  // eslint-disable-next-line import/no-extraneous-dependencies
61
59
  const {
62
60
  SafeAppProvider
63
- } = yield import('@safe-global/safe-apps-provider');
61
+ } = await import('@safe-global/safe-apps-provider');
64
62
  const provider = new SafeAppProvider(safeSdk, sdk);
65
63
  return !!provider;
66
- } catch (_b) {
64
+ } catch {
67
65
  return false;
68
66
  }
69
- }),
67
+ },
70
68
  createConnectorFn: getSafeConnector({
71
69
  allowedDomains: safeAllowedDomains
72
70
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallet-adapter-safe",
3
- "version": "4.2.0-alpha.2",
3
+ "version": "4.2.0-alpha.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -37,14 +37,18 @@
37
37
  "lint": "eslint --ext ts,tsx,js,mjs ."
38
38
  },
39
39
  "devDependencies": {
40
- "@reef-knot/types": "4.2.0-alpha.1",
40
+ "@reef-knot/types": "4.2.0-alpha.2",
41
+ "@safe-global/safe-apps-provider": "^0.18.6",
42
+ "@safe-global/safe-apps-sdk": "^9.1.0",
41
43
  "@svgr/rollup": "^6.5.1",
42
44
  "eslint-config-custom": "*"
43
45
  },
44
46
  "peerDependencies": {
45
- "@reef-knot/types": "4.2.0-alpha.1",
47
+ "@reef-knot/types": "4.2.0-alpha.2",
48
+ "@safe-global/safe-apps-provider": "^0.18.6",
49
+ "@safe-global/safe-apps-sdk": "^9.1.0",
46
50
  "@tanstack/react-query": "^5.29.0",
47
- "viem": ">=2.23",
48
- "wagmi": ">=2.14"
51
+ "viem": ">=2.44",
52
+ "wagmi": ">=3.3"
49
53
  }
50
54
  }
@@ -1,33 +0,0 @@
1
- /******************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- /* global Reflect, Promise, SuppressedError, Symbol */
16
-
17
-
18
- function __awaiter(thisArg, _arguments, P, generator) {
19
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
20
- return new (P || (P = Promise))(function (resolve, reject) {
21
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
22
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
23
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24
- step((generator = generator.apply(thisArg, _arguments || [])).next());
25
- });
26
- }
27
-
28
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
29
- var e = new Error(message);
30
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
31
- };
32
-
33
- export { __awaiter };