@reef-knot/wallet-adapter-safe 5.1.0 → 5.1.1-alpha.1

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=allowedDomains.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowedDomains.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/allowedDomains.test.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { WalletAdapterType } from '@reef-knot/types';
2
2
  export declare const id = "safe";
3
3
  export declare const name = "Safe";
4
+ export declare const SAFE_DEFAULT_ALLOWED_DOMAINS: readonly RegExp[];
5
+ export declare const getSafeAllowedDomains: (allowedDomains?: readonly RegExp[]) => RegExp[];
4
6
  export declare const Safe: WalletAdapterType;
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,eAAO,MAAM,EAAE,SAAS,CAAC;AACzB,eAAO,MAAM,IAAI,SAAS,CAAC;AAgB3B,eAAO,MAAM,IAAI,EAAE,iBAmEjB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,eAAO,MAAM,EAAE,SAAS,CAAC;AACzB,eAAO,MAAM,IAAI,SAAS,CAAC;AAM3B,eAAO,MAAM,4BAA4B,EAAE,SAAS,MAAM,EAGzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,iBAAgB,SAAS,MAAM,EAAO,KACrC,MAAM,EAA0D,CAAC;AAQpE,eAAO,MAAM,IAAI,EAAE,iBAiEjB,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,12 @@
1
1
  import { safe } from "wagmi/connectors";
2
2
  import { withTimeout } from "viem";
3
-
4
3
  //#region src/index.ts
5
4
  const id = "safe";
6
5
  const name = "Safe";
7
- const getSafeConnector = ({ allowedDomains = [] }) => safe({
8
- allowedDomains: [
9
- /app.safe.global$/,
10
- /app.safe.protofire.io$/,
11
- ...allowedDomains
12
- ],
6
+ const SAFE_DEFAULT_ALLOWED_DOMAINS = [/^https:\/\/app\.safe\.global$/, /^https:\/\/app\.safe\.protofire\.io$/];
7
+ const getSafeAllowedDomains = (allowedDomains = []) => [...SAFE_DEFAULT_ALLOWED_DOMAINS, ...allowedDomains];
8
+ const getSafeConnector = ({ allowedDomains }) => safe({
9
+ allowedDomains: getSafeAllowedDomains(allowedDomains),
13
10
  debug: false
14
11
  });
15
12
  const Safe = ({ safeAllowedDomains }) => ({
@@ -24,7 +21,8 @@ const Safe = ({ safeAllowedDomains }) => ({
24
21
  let SDK;
25
22
  if (typeof SafeAppsSDK !== "function" && typeof SafeAppsSDK.default === "function") SDK = SafeAppsSDK.default;
26
23
  else SDK = SafeAppsSDK;
27
- const sdk = new SDK({ allowedDomains: safeAllowedDomains });
24
+ const parameters = { allowedDomains: getSafeAllowedDomains(safeAllowedDomains) };
25
+ const sdk = new SDK(parameters);
28
26
  const safeSdk = await withTimeout(() => sdk.safe.getInfo(), { timeout: 200 });
29
27
  if (!safeSdk) return false;
30
28
  const { SafeAppProvider } = await import("@safe-global/safe-apps-provider");
@@ -35,6 +33,5 @@ const Safe = ({ safeAllowedDomains }) => ({
35
33
  },
36
34
  createConnectorFn: getSafeConnector({ allowedDomains: safeAllowedDomains })
37
35
  });
38
-
39
36
  //#endregion
40
- export { Safe, id, name };
37
+ export { SAFE_DEFAULT_ALLOWED_DOMAINS, Safe, getSafeAllowedDomains, id, name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallet-adapter-safe",
3
- "version": "5.1.0",
3
+ "version": "5.1.1-alpha.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -35,17 +35,20 @@
35
35
  "build": "yarn run -T tsdown",
36
36
  "dev": "yarn run -T tsdown --watch",
37
37
  "lint": "eslint --ext ts,tsx,js,mjs .",
38
+ "test": "vitest run",
38
39
  "typecheck": "tsc --noEmit"
39
40
  },
40
41
  "devDependencies": {
41
- "@reef-knot/types": "5.2.0",
42
+ "@reef-knot/types": "5.2.1-alpha.1",
42
43
  "@safe-global/safe-apps-provider": "^0.18.6",
43
44
  "@safe-global/safe-apps-sdk": "^9.1.0",
44
45
  "build-config": "*",
45
- "eslint-config-custom": "*"
46
+ "eslint-config-custom": "*",
47
+ "happy-dom": "^20.0.0",
48
+ "vitest": "^4.1.11"
46
49
  },
47
50
  "peerDependencies": {
48
- "@reef-knot/types": "5.2.0",
51
+ "@reef-knot/types": "5.2.1-alpha.1",
49
52
  "@safe-global/safe-apps-provider": "^0.18.6",
50
53
  "@safe-global/safe-apps-sdk": "^9.1.0",
51
54
  "@tanstack/react-query": "^5.29.0",