@reef-knot/core-react 3.2.0 → 4.0.0

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.
Files changed (42) hide show
  1. package/dist/components/AutoConnect.d.ts +1 -5
  2. package/dist/components/AutoConnect.d.ts.map +1 -1
  3. package/dist/constants/localStorage.d.ts +1 -0
  4. package/dist/constants/localStorage.d.ts.map +1 -1
  5. package/dist/constants/localStorage.js +6 -1
  6. package/dist/context/reefKnot.d.ts +7 -9
  7. package/dist/context/reefKnot.d.ts.map +1 -1
  8. package/dist/context/reefKnot.js +2 -16
  9. package/dist/context/reefKnotModalContext.js +2 -2
  10. package/dist/helpers/getUnsupportedChainError.d.ts +1 -1
  11. package/dist/helpers/getUnsupportedChainError.d.ts.map +1 -1
  12. package/dist/helpers/index.d.ts +1 -0
  13. package/dist/helpers/index.d.ts.map +1 -1
  14. package/dist/helpers/providerDetectors.d.ts +4 -0
  15. package/dist/helpers/providerDetectors.d.ts.map +1 -0
  16. package/dist/helpers/providerDetectors.js +12 -0
  17. package/dist/hooks/useAutoConnect.d.ts.map +1 -1
  18. package/dist/hooks/useAutoConnect.js +40 -21
  19. package/dist/hooks/useAutoConnectCheck.d.ts +0 -1
  20. package/dist/hooks/useAutoConnectCheck.d.ts.map +1 -1
  21. package/dist/hooks/useAutoConnectCheck.js +6 -14
  22. package/dist/hooks/useConnectorInfo.d.ts +1 -0
  23. package/dist/hooks/useConnectorInfo.d.ts.map +1 -1
  24. package/dist/hooks/useConnectorInfo.js +10 -11
  25. package/dist/hooks/useDisconnect.d.ts +2 -2
  26. package/dist/hooks/useDisconnect.d.ts.map +1 -1
  27. package/dist/hooks/useDisconnect.js +25 -16
  28. package/dist/hooks/useEagerConnect.d.ts +8 -6
  29. package/dist/hooks/useEagerConnect.d.ts.map +1 -1
  30. package/dist/hooks/useEagerConnect.js +33 -20
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +4 -3
  34. package/dist/walletData/index.d.ts +7 -5
  35. package/dist/walletData/index.d.ts.map +1 -1
  36. package/dist/walletData/index.js +17 -28
  37. package/package.json +16 -13
  38. package/dist/chains/holesky.d.ts +0 -21
  39. package/dist/chains/holesky.d.ts.map +0 -1
  40. package/dist/chains/holesky.js +0 -25
  41. package/dist/chains/index.d.ts +0 -2
  42. package/dist/chains/index.d.ts.map +0 -1
@@ -1,8 +1,4 @@
1
- import { Chain } from 'wagmi';
2
- import type { WalletAdapterData } from '@reef-knot/types';
3
- export declare const AutoConnect: ({ autoConnect, }: {
1
+ export declare const AutoConnect: ({ autoConnect }: {
4
2
  autoConnect: boolean;
5
- walletDataList: WalletAdapterData[];
6
- chains: Chain[];
7
3
  }) => null;
8
4
  //# sourceMappingURL=AutoConnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoConnect.d.ts","sourceRoot":"","sources":["../../src/components/AutoConnect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,eAAO,MAAM,WAAW;iBAGT,OAAO;oBACJ,iBAAiB,EAAE;YAC3B,KAAK,EAAE;UAIhB,CAAC"}
1
+ {"version":3,"file":"AutoConnect.d.ts","sourceRoot":"","sources":["../../src/components/AutoConnect.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,oBAAqB;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,SAGpE,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare const LS_KEY_TERMS_ACCEPTANCE = "reef-knot_accept-terms_n2";
2
+ export declare const LS_KEY_RECONNECT_WALLET_ID = "reef-knot_reconnect-wallet-id";
2
3
  //# sourceMappingURL=localStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/constants/localStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,8BAA8B,CAAC"}
1
+ {"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/constants/localStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AAMnE,eAAO,MAAM,0BAA0B,kCAAkC,CAAC"}
@@ -1,5 +1,10 @@
1
1
  // This key can be changed to enforce all users to accept the Terms again,
2
2
  // for example if the Terms were significantly updated
3
3
  const LS_KEY_TERMS_ACCEPTANCE = 'reef-knot_accept-terms_n2';
4
+ // Storage key for restoring connector after page refresh
5
+ // `/packages/core-react/src/hooks/useAutoConnect.ts`
6
+ // It keeps association with the reef-knot `WalletAdapterData['walletId']` metadata
7
+ // from the `ReefKnotContextValue['walletDataList']` instead of wagmi's `config.connectors` for better reliability
8
+ const LS_KEY_RECONNECT_WALLET_ID = 'reef-knot_reconnect-wallet-id';
4
9
 
5
- export { LS_KEY_TERMS_ACCEPTANCE };
10
+ export { LS_KEY_RECONNECT_WALLET_ID, LS_KEY_TERMS_ACCEPTANCE };
@@ -1,19 +1,17 @@
1
- import React, { FC, ReactNode } from 'react';
2
- import { WalletAdapterData } from '@reef-knot/types';
3
- import { Chain } from 'wagmi/chains';
1
+ import React, { ReactNode } from 'react';
2
+ import type { Chain } from 'wagmi/chains';
3
+ import type { WalletAdapterData } from '@reef-knot/types';
4
4
  export interface ReefKnotContextProps {
5
+ walletDataList: WalletAdapterData[];
5
6
  rpc: Record<number, string>;
6
- walletconnectProjectId?: string;
7
- chains: Chain[];
8
- defaultChain: Chain;
9
- autoConnect?: boolean;
7
+ chains: readonly [Chain, ...Chain[]];
10
8
  children?: ReactNode;
11
9
  }
12
10
  export type ReefKnotContextValue = {
13
11
  rpc: Record<number, string>;
14
12
  walletDataList: WalletAdapterData[];
15
- chains: Chain[];
13
+ chains: readonly [Chain, ...Chain[]];
16
14
  };
17
15
  export declare const ReefKnotContext: React.Context<ReefKnotContextValue>;
18
- export declare const ReefKnot: FC<ReefKnotContextProps>;
16
+ export declare const ReefKnot: ({ rpc, chains, walletDataList, children, }: ReefKnotContextProps) => React.JSX.Element;
19
17
  //# sourceMappingURL=reefKnot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reefKnot.d.ts","sourceRoot":"","sources":["../../src/context/reefKnot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,EAAE,EAAE,SAAS,EAAW,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAMrC,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,eAAe,qCAA4C,CAAC;AAEzE,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,oBAAoB,CAsC7C,CAAC"}
1
+ {"version":3,"file":"reefKnot.d.ts","sourceRoot":"","sources":["../../src/context/reefKnot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,SAAS,EAAW,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,cAAc,EAAE,iBAAiB,EAAE,CAAC;IACpC,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,eAAe,qCAA4C,CAAC;AAEzE,eAAO,MAAM,QAAQ,+CAKlB,oBAAoB,sBAiBtB,CAAC"}
@@ -1,24 +1,14 @@
1
1
  import React, { createContext, useMemo } from 'react';
2
2
  import { WCWarnBannerContextProvider } from '@reef-knot/ui-react';
3
- import { getWalletDataList } from '../walletData/index.js';
4
- import { AutoConnect } from '../components/AutoConnect.js';
5
3
  import { ReefKnotModalContextProvider } from './reefKnotModalContext.js';
6
4
 
7
5
  const ReefKnotContext = createContext({});
8
6
  const ReefKnot = ({
9
7
  rpc,
10
- walletconnectProjectId,
11
8
  chains,
12
- defaultChain,
13
- autoConnect = true,
9
+ walletDataList,
14
10
  children
15
11
  }) => {
16
- const walletDataList = getWalletDataList({
17
- rpc,
18
- walletconnectProjectId,
19
- chains,
20
- defaultChain
21
- });
22
12
  const contextValue = useMemo(() => ({
23
13
  rpc,
24
14
  walletDataList,
@@ -26,11 +16,7 @@ const ReefKnot = ({
26
16
  }), [rpc, walletDataList, chains]);
27
17
  return React.createElement(ReefKnotContext.Provider, {
28
18
  value: contextValue
29
- }, React.createElement(ReefKnotModalContextProvider, null, React.createElement(WCWarnBannerContextProvider, null, React.createElement(AutoConnect, {
30
- autoConnect: autoConnect,
31
- walletDataList: walletDataList,
32
- chains: chains
33
- }), children)));
19
+ }, React.createElement(ReefKnotModalContextProvider, null, React.createElement(WCWarnBannerContextProvider, null, children)));
34
20
  };
35
21
 
36
22
  export { ReefKnot, ReefKnotContext };
@@ -21,10 +21,10 @@ const ReefKnotModalContextProvider = ({
21
21
  onClose
22
22
  })]);
23
23
  },
24
- openModalAsync: ({
24
+ openModalAsync: _a => __awaiter(void 0, [_a], void 0, function* ({
25
25
  type,
26
26
  props
27
- }) => __awaiter(void 0, void 0, void 0, function* () {
27
+ }) {
28
28
  return new Promise(resolve => {
29
29
  updateModalStack(old => [
30
30
  // for some reason TS cannot match type and props here
@@ -1,3 +1,3 @@
1
1
  import { Chain } from 'wagmi/chains';
2
- export declare const getUnsupportedChainError: (supportedChains: Chain[]) => Error;
2
+ export declare const getUnsupportedChainError: (supportedChains: readonly [Chain, ...Chain[]]) => Error;
3
3
  //# sourceMappingURL=getUnsupportedChainError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUnsupportedChainError.d.ts","sourceRoot":"","sources":["../../src/helpers/getUnsupportedChainError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,wBAAwB,oBAAqB,KAAK,EAAE,UAkBhE,CAAC"}
1
+ {"version":3,"file":"getUnsupportedChainError.d.ts","sourceRoot":"","sources":["../../src/helpers/getUnsupportedChainError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,wBAAwB,oBAClB,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,UAmB9C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './getUnsupportedChainError';
2
2
  export * from './checkTermsAccepted';
3
+ export * from './providerDetectors';
3
4
  export * from './useLocalStorage';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import 'viem/window';
2
+ export declare const hasInjected: () => boolean;
3
+ export declare const isDappBrowserProvider: () => boolean;
4
+ //# sourceMappingURL=providerDetectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerDetectors.d.ts","sourceRoot":"","sources":["../../src/helpers/providerDetectors.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,CAAC;AAErB,eAAO,MAAM,WAAW,eAAsC,CAAC;AAE/D,eAAO,MAAM,qBAAqB,QAAO,OAExC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { isMobileOrTablet } from '@reef-knot/wallets-helpers';
2
+ import 'viem/window';
3
+
4
+ const hasInjected = () => {
5
+ var _a;
6
+ return !!((_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.ethereum);
7
+ };
8
+ const isDappBrowserProvider = () => {
9
+ return isMobileOrTablet && hasInjected();
10
+ };
11
+
12
+ export { hasInjected, isDappBrowserProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoConnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoConnect.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,uBAAwB,OAAO,SA4BzD,CAAC"}
1
+ {"version":3,"file":"useAutoConnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoConnect.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc,uBAAwB,OAAO,SA6CzD,CAAC"}
@@ -1,35 +1,54 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
- import { useClient, useAccount } from 'wagmi';
3
- import { useRef, useCallback, useEffect } from 'react';
4
- import { checkTermsAccepted } from '../helpers/checkTermsAccepted.js';
2
+ import { useEffect } from 'react';
3
+ import { useConfig, useReconnect, useAccount } from 'wagmi';
5
4
  import { useEagerConnect } from './useEagerConnect.js';
5
+ import { checkTermsAccepted } from '../helpers/checkTermsAccepted.js';
6
+ import { useReefKnotContext } from './useReefKnotContext.js';
7
+ import { LS_KEY_RECONNECT_WALLET_ID } from '../constants/localStorage.js';
6
8
 
7
9
  const useAutoConnect = autoConnectEnabled => {
8
- const isAutoConnectCalled = useRef(false);
9
- const client = useClient();
10
+ const {
11
+ storage
12
+ } = useConfig();
13
+ const {
14
+ reconnectAsync
15
+ } = useReconnect();
10
16
  const {
11
17
  isConnected
12
18
  } = useAccount();
13
19
  const {
14
20
  eagerConnect
15
21
  } = useEagerConnect();
16
- const autoConnect = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
17
- // Don't auto-connect if already connected or if the auto-connect feature is disabled or if already tried to auto-connect.
18
- if (isConnected || !autoConnectEnabled || isAutoConnectCalled.current) return;
19
- // The current logic is to try auto-connect only once, even if an error happened and connection was not successful.
20
- isAutoConnectCalled.current = true;
21
- // Try to eagerly connect wallets that are meant to be used only with auto-connection.
22
- // For example, wallets with dApp browsers, or using iframes to open dApps.
23
- const connectResult = yield eagerConnect();
24
- // If still not connected and there were no errors and the terms of service are accepted,
25
- // call the default wagmi autoConnect method, which attempts to connect to the last used connector.
26
- if (!connectResult && checkTermsAccepted()) {
27
- yield client.autoConnect();
28
- }
29
- }), [autoConnectEnabled, client, eagerConnect, isConnected]);
22
+ const {
23
+ walletDataList
24
+ } = useReefKnotContext();
30
25
  useEffect(() => {
31
- void autoConnect();
32
- }, [autoConnect]);
26
+ const tryReconnect = () => __awaiter(void 0, void 0, void 0, function* () {
27
+ var _a, _b;
28
+ // Don't auto-connect if already connected or if the auto-connect feature is disabled
29
+ if (isConnected || !autoConnectEnabled) return;
30
+ // Try to eagerly connect wallets that are meant to be used only with auto-connection.
31
+ // For example, wallets with dApp browsers, or using iframes to open dApps.
32
+ const connectResult = yield eagerConnect();
33
+ // If still not connected and there were no errors and the terms of service are accepted,
34
+ // call the default wagmi autoConnect method, which attempts to connect to the last used connector.
35
+ if (!connectResult && checkTermsAccepted() && (
36
+ // We do not want to reconnect if the `recentConnectorId` item was deleted during disconnect
37
+ yield storage === null || storage === void 0 ? void 0 : storage.getItem('recentConnectorId'))) {
38
+ const savedReconnectWalletId = yield storage === null || storage === void 0 ? void 0 : storage.getItem(LS_KEY_RECONNECT_WALLET_ID);
39
+ const walletData = walletDataList.find(data => data.walletId === savedReconnectWalletId);
40
+ if (walletData) {
41
+ const createConnectorFn = ((_b = (_a = walletData === null || walletData === void 0 ? void 0 : walletData.walletconnectExtras) === null || _a === void 0 ? void 0 : _a.connectionViaURI) === null || _b === void 0 ? void 0 : _b.condition) ? walletData === null || walletData === void 0 ? void 0 : walletData.walletconnectExtras.connectionViaURI.createConnectorFn : walletData === null || walletData === void 0 ? void 0 : walletData.createConnectorFn;
42
+ yield reconnectAsync({
43
+ connectors: [createConnectorFn]
44
+ });
45
+ }
46
+ }
47
+ });
48
+ void tryReconnect();
49
+ // No hook deps: do not retry the auto-connect attemption.
50
+ // eslint-disable-next-line react-hooks/exhaustive-deps
51
+ }, []);
33
52
  };
34
53
 
35
54
  export { useAutoConnect };
@@ -1,5 +1,4 @@
1
1
  export declare const useAutoConnectCheck: () => {
2
2
  checkIfShouldAutoConnect: () => Promise<boolean>;
3
- getAutoConnectOnlyConnectors: () => import("@wagmi/connectors/dist/base-84a689bb").C<any, any, any>[];
4
3
  };
5
4
  //# sourceMappingURL=useAutoConnectCheck.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoConnectCheck.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoConnectCheck.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;CAyB/B,CAAC"}
1
+ {"version":3,"file":"useAutoConnectCheck.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoConnectCheck.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;CAe/B,CAAC"}
@@ -1,30 +1,22 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
+ import { useCallback } from 'react';
2
3
  import { useReefKnotContext } from './useReefKnotContext.js';
3
4
 
4
5
  const useAutoConnectCheck = () => {
5
6
  const {
6
7
  walletDataList
7
8
  } = useReefKnotContext();
8
- const checkIfShouldAutoConnect = () => __awaiter(void 0, void 0, void 0, function* () {
9
+ const checkIfShouldAutoConnect = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
9
10
  var _a;
10
- const autoConnectOnlyAdapters = walletDataList.filter(({
11
- autoConnectOnly
12
- }) => autoConnectOnly);
13
- for (const adapter of autoConnectOnlyAdapters) {
11
+ for (const adapter of walletDataList) {
12
+ if (!adapter.autoConnectOnly) continue;
14
13
  // Try to detect at least one wallet, marked as for auto connection only
15
14
  if (yield (_a = adapter.detector) === null || _a === void 0 ? void 0 : _a.call(adapter)) return true;
16
15
  }
17
16
  return false;
18
- });
19
- const getAutoConnectOnlyConnectors = () => {
20
- const autoConnectOnlyAdapters = walletDataList.filter(({
21
- autoConnectOnly
22
- }) => autoConnectOnly);
23
- return autoConnectOnlyAdapters.map(adapter => adapter.connector);
24
- };
17
+ }), [walletDataList]);
25
18
  return {
26
- checkIfShouldAutoConnect,
27
- getAutoConnectOnlyConnectors
19
+ checkIfShouldAutoConnect
28
20
  };
29
21
  };
30
22
 
@@ -4,6 +4,7 @@ type ConnectorInfo = {
4
4
  isLedger: boolean;
5
5
  isLedgerLive: boolean;
6
6
  isDappBrowser: boolean;
7
+ isInjected: boolean;
7
8
  };
8
9
  export declare const useConnectorInfo: () => ConnectorInfo;
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useConnectorInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorInfo.ts"],"names":[],"mappings":"AAQA,KAAK,aAAa,GAAG;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,aAuBnC,CAAC"}
1
+ {"version":3,"file":"useConnectorInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnectorInfo.ts"],"names":[],"mappings":"AAOA,KAAK,aAAa,GAAG;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,aAyBnC,CAAC"}
@@ -1,29 +1,28 @@
1
1
  import { useAccount } from 'wagmi';
2
- import { SafeConnector } from 'wagmi/connectors/safe';
3
- import { LedgerHIDConnector, LedgerLiveConnector } from '@reef-knot/ledger-connector';
4
- import { isMobileOrTablet } from '@reef-knot/wallets-helpers';
2
+ import { idLedgerHid, idLedgerLive } from '@reef-knot/ledger-connector';
3
+ import { hasInjected, isDappBrowserProvider } from '../helpers/providerDetectors.js';
5
4
 
6
5
  const useConnectorInfo = () => {
7
- var _a;
8
6
  const {
9
7
  connector
10
8
  } = useAccount();
11
9
  // These checks are working only for connected wallets! There is no connector if a wallet is not connected yet.
12
- const isLedger = connector instanceof LedgerHIDConnector;
13
- const isLedgerLive = connector instanceof LedgerLiveConnector;
14
- const isGnosis = connector instanceof SafeConnector;
15
- const isDappBrowser = !!((_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.ethereum) && isMobileOrTablet;
16
- let connectorName = connector === null || connector === void 0 ? void 0 : connector.name;
10
+ const isLedger = Boolean((connector === null || connector === void 0 ? void 0 : connector.id) === idLedgerHid);
11
+ const isLedgerLive = Boolean((connector === null || connector === void 0 ? void 0 : connector.id) === idLedgerLive);
12
+ const isGnosis = Boolean((connector === null || connector === void 0 ? void 0 : connector.id) === 'safe');
13
+ const isInjected = hasInjected();
14
+ const isDappBrowser = isDappBrowserProvider();
17
15
  // Do not set connector's name if the app is opened in a mobile wallet dapp browser,
18
16
  // because we use a generic injected connector for this case and proper detection is hard.
19
17
  // Also, it will be easy for a user to understand which wallet app is being used for connection.
20
- if (isDappBrowser) connectorName = undefined;
18
+ const connectorName = isDappBrowser ? undefined : connector === null || connector === void 0 ? void 0 : connector.name;
21
19
  return {
22
20
  connectorName,
23
21
  isGnosis,
24
22
  isLedger,
25
23
  isLedgerLive,
26
- isDappBrowser
24
+ isDappBrowser,
25
+ isInjected
27
26
  };
28
27
  };
29
28
 
@@ -2,7 +2,7 @@ export declare const useForceDisconnect: () => {
2
2
  forceDisconnect: () => void;
3
3
  };
4
4
  export declare const useDisconnect: () => {
5
- disconnect?: (() => void) | undefined;
6
- checkIfDisconnectMakesSense: () => boolean;
5
+ disconnect?: () => void;
6
+ isDisconnectMakesSense: boolean;
7
7
  };
8
8
  //# sourceMappingURL=useDisconnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDisconnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisconnect.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;CAU9B,CAAC;AAEF,eAAO,MAAM,aAAa;wBACL,IAAI;iCACM,MAAM,OAAO;CAoB3C,CAAC"}
1
+ {"version":3,"file":"useDisconnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisconnect.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,kBAAkB;;CAU9B,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO;IAC/B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,sBAAsB,EAAE,OAAO,CAAC;CAmBjC,CAAC"}
@@ -1,12 +1,24 @@
1
- import { useCallback } from 'react';
2
- import { useDisconnect as useDisconnect$1, useAccount } from 'wagmi';
3
- import { useAutoConnectCheck } from './useAutoConnectCheck.js';
1
+ import { useCallback, useMemo } from 'react';
2
+ import { useAccount, useConfig, useDisconnect as useDisconnect$1 } from 'wagmi';
3
+ import { useReefKnotContext } from './useReefKnotContext.js';
4
4
  import { useReefKnotModal } from './useReefKnotModal.js';
5
+ import { LS_KEY_RECONNECT_WALLET_ID } from '../constants/localStorage.js';
5
6
 
6
- const useForceDisconnect = () => {
7
+ const useDisconnectCleaningStorage = () => {
8
+ const {
9
+ storage
10
+ } = useConfig();
7
11
  const {
8
12
  disconnect
9
13
  } = useDisconnect$1();
14
+ return useCallback((...args) => {
15
+ disconnect(...args);
16
+ void (storage === null || storage === void 0 ? void 0 : storage.removeItem('recentConnectorId'));
17
+ void (storage === null || storage === void 0 ? void 0 : storage.removeItem(LS_KEY_RECONNECT_WALLET_ID));
18
+ }, [disconnect, storage]);
19
+ };
20
+ const useForceDisconnect = () => {
21
+ const disconnect = useDisconnectCleaningStorage();
10
22
  const {
11
23
  forceCloseAllModals
12
24
  } = useReefKnotModal();
@@ -23,22 +35,19 @@ const useDisconnect = () => {
23
35
  isConnected,
24
36
  connector
25
37
  } = useAccount();
38
+ const disconnect = useDisconnectCleaningStorage();
26
39
  const {
27
- disconnect
28
- } = useDisconnect$1();
29
- const {
30
- getAutoConnectOnlyConnectors
31
- } = useAutoConnectCheck();
32
- const checkIfDisconnectMakesSense = () => {
40
+ walletDataList
41
+ } = useReefKnotContext();
42
+ const isDisconnectMakesSense = useMemo(() => {
33
43
  // It doesn't make sense to offer a user the ability to disconnect if the user is not connected yet,
34
44
  // or if the user was connected automatically
35
- const autoConnectOnlyConnectors = getAutoConnectOnlyConnectors();
36
- const isConnectorNotAutoConnectOnly = autoConnectOnlyConnectors.every(c => c.id !== (connector === null || connector === void 0 ? void 0 : connector.id));
37
- return isConnected && isConnectorNotAutoConnectOnly;
38
- };
45
+ const connectorData = walletDataList.find(c => c.walletId === (connector === null || connector === void 0 ? void 0 : connector.id));
46
+ return isConnected && !!(connectorData === null || connectorData === void 0 ? void 0 : connectorData.autoConnectOnly);
47
+ }, [isConnected, connector, walletDataList]);
39
48
  return {
40
- disconnect: checkIfDisconnectMakesSense() ? disconnect : undefined,
41
- checkIfDisconnectMakesSense
49
+ disconnect: isDisconnectMakesSense ? disconnect : undefined,
50
+ isDisconnectMakesSense
42
51
  };
43
52
  };
44
53
 
@@ -1,9 +1,11 @@
1
- import { Chain } from 'wagmi';
2
- import type { ConnectResult } from '@wagmi/core';
3
- import { WalletAdapterData } from '@reef-knot/types';
4
- import { ReefKnotModalContextValue } from '../context';
5
- export declare const connectEagerly: (adapters: WalletAdapterData[], openModalAsync: ReefKnotModalContextValue['openModalAsync'], supportedChains: Chain[]) => Promise<ConnectResult | null>;
1
+ import type { WalletAdapterData } from '@reef-knot/types';
2
+ import type { Chain } from 'wagmi/chains';
3
+ import type { Config, ConnectReturnType } from '@wagmi/core';
4
+ import type { ReefKnotModalContextValue } from '../context';
5
+ type ConnectResult = ConnectReturnType;
6
+ export declare const connectEagerly: (config: Config, adapters: WalletAdapterData[], openModalAsync: ReefKnotModalContextValue['openModalAsync'], supportedChains: readonly [Chain, ...Chain[]]) => Promise<ConnectResult | null>;
6
7
  export declare const useEagerConnect: () => {
7
- eagerConnect: () => Promise<ConnectResult<import("@wagmi/core/dist/index-35b6525c").P> | null>;
8
+ eagerConnect: () => Promise<ConnectResult | null>;
8
9
  };
10
+ export {};
9
11
  //# sourceMappingURL=useEagerConnect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEagerConnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useEagerConnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAgCvD,eAAO,MAAM,cAAc,aACf,iBAAiB,EAAE,kBACb,yBAAyB,CAAC,gBAAgB,CAAC,mBAC1C,KAAK,EAAE,KACvB,QAAQ,aAAa,GAAG,IAAI,CA2C9B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAY3B,CAAC"}
1
+ {"version":3,"file":"useEagerConnect.d.ts","sourceRoot":"","sources":["../../src/hooks/useEagerConnect.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAqB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,KAAK,aAAa,GAAG,iBAAiB,CAAC;AA6CvC,eAAO,MAAM,cAAc,WACjB,MAAM,YACJ,iBAAiB,EAAE,kBACb,yBAAyB,CAAC,gBAAgB,CAAC,mBAC1C,SAAS,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,KAC5C,QAAQ,aAAa,GAAG,IAAI,CA+C9B,CAAC;AAEF,eAAO,MAAM,eAAe;;CAmB3B,CAAC"}
@@ -1,45 +1,55 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
- import { connect, disconnect } from 'wagmi/actions';
3
2
  import { useCallback } from 'react';
4
- import { getUnsupportedChainError } from '../helpers/getUnsupportedChainError.js';
5
- import { checkTermsAccepted } from '../helpers/checkTermsAccepted.js';
3
+ import { useConfig } from 'wagmi';
6
4
  import { useReefKnotContext } from './useReefKnotContext.js';
7
5
  import { useReefKnotModal } from './useReefKnotModal.js';
6
+ import { connect, disconnect } from 'wagmi/actions';
7
+ import { getUnsupportedChainError } from '../helpers/getUnsupportedChainError.js';
8
+ import { checkTermsAccepted } from '../helpers/checkTermsAccepted.js';
8
9
 
9
- const connectToAdapter = (connector, supportedChains) => __awaiter(void 0, void 0, void 0, function* () {
10
- const connectResult = yield connect({
10
+ const connectToAdapter = (config, connector, supportedChains) => __awaiter(void 0, void 0, void 0, function* () {
11
+ var _a;
12
+ const connectResult = yield connect(config, {
11
13
  connector
12
14
  });
13
- if (connectResult === null || connectResult === void 0 ? void 0 : connectResult.chain.unsupported) {
15
+ if (connectResult && supportedChains.findIndex(({
16
+ id
17
+ }) => id === connectResult.chainId) === -1) {
14
18
  // No errors during connection, but the chain is unsupported.
15
19
  // This case is considered as error for now, and we explicitly call disconnect() here.
16
20
  // This logic comes from previously used web3-react connection logic, which wasn't reworked yet after web3-react removal.
17
21
  // web3-react logic was: if a chain is unsupported – break the connection, throw an error
18
- // wagmi logic is: if a chain is unsupported – connect anyway, without errors, set `chain.unsupported` flag to true.
22
+ // wagmi logic is: if a chain is unsupported – connect anyway, without errors.
19
23
  // So, here we are trying to mimic the legacy logic, because we are not ready to rework it yet.
20
24
  const connectError = getUnsupportedChainError(supportedChains);
21
- yield disconnect();
25
+ yield disconnect(config);
22
26
  // A user may change a chain in a wallet app, prepare for that event.
23
27
  // There is a strong recommendation in the MetaMask documentation
24
28
  // to reload the page upon chain changes, unless there is a good reason not to.
25
29
  // This looks like a good general approach.
26
- const provider = yield connector.getProvider();
27
- provider.once('chainChanged', () => {
28
- var _a;
29
- return (_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.location.reload();
30
- });
30
+ if (config.state.current) {
31
+ const activeConnector = (_a = config.state.connections.get(config.state.current)) === null || _a === void 0 ? void 0 : _a.connector;
32
+ if (activeConnector) {
33
+ const provider = yield activeConnector.getProvider();
34
+ provider.once('chainChanged', () => {
35
+ var _a;
36
+ return (_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.location.reload();
37
+ });
38
+ }
39
+ }
31
40
  throw connectError;
32
41
  }
33
42
  return connectResult;
34
43
  });
35
- const connectEagerly = (adapters, openModalAsync, supportedChains) => __awaiter(void 0, void 0, void 0, function* () {
36
- var _a;
44
+ const connectEagerly = (config, adapters, openModalAsync, supportedChains) => __awaiter(void 0, void 0, void 0, function* () {
45
+ var _b;
37
46
  const isTermsAccepted = checkTermsAccepted();
38
47
  for (const adapter of adapters) {
39
- if (yield (_a = adapter.detector) === null || _a === void 0 ? void 0 : _a.call(adapter)) {
48
+ if (yield (_b = adapter.detector) === null || _b === void 0 ? void 0 : _b.call(adapter)) {
40
49
  // wallet is detected
41
50
  let connectionResult = null;
42
- const tryConnection = () => connectToAdapter(adapter.connector, supportedChains).then(result => {
51
+ const tryConnection = () => __awaiter(void 0, void 0, void 0, function* () {
52
+ const result = yield connectToAdapter(config, adapter.createConnectorFn, supportedChains);
43
53
  connectionResult = result;
44
54
  return result;
45
55
  });
@@ -75,6 +85,7 @@ const connectEagerly = (adapters, openModalAsync, supportedChains) => __awaiter(
75
85
  return null;
76
86
  });
77
87
  const useEagerConnect = () => {
88
+ const config = useConfig();
78
89
  const {
79
90
  openModalAsync
80
91
  } = useReefKnotModal();
@@ -82,10 +93,12 @@ const useEagerConnect = () => {
82
93
  walletDataList,
83
94
  chains
84
95
  } = useReefKnotContext();
85
- const autoConnectOnlyAdapters = walletDataList.filter(adapter => adapter.autoConnectOnly);
86
96
  const eagerConnect = useCallback(() => {
87
- return connectEagerly(autoConnectOnlyAdapters, openModalAsync, chains);
88
- }, [openModalAsync, autoConnectOnlyAdapters, chains]);
97
+ const autoConnectOnlyAdapters = walletDataList.filter(({
98
+ autoConnectOnly
99
+ }) => autoConnectOnly);
100
+ return connectEagerly(config, autoConnectOnlyAdapters, openModalAsync, chains);
101
+ }, [openModalAsync, walletDataList, chains, config]);
89
102
  return {
90
103
  eagerConnect
91
104
  };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ export * from './components/AutoConnect';
1
2
  export * from './walletData';
2
3
  export * from './hooks';
3
4
  export * from './context';
4
5
  export * from './constants';
5
- export * from './chains';
6
6
  export * from './helpers';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- export { getConnectors, getWalletDataList } from './walletData/index.js';
1
+ export { AutoConnect } from './components/AutoConnect.js';
2
+ export { getWalletsDataList } from './walletData/index.js';
2
3
  export { useReefKnotContext } from './hooks/useReefKnotContext.js';
3
4
  export { useAutoConnect } from './hooks/useAutoConnect.js';
4
5
  export { useAutoConnectCheck } from './hooks/useAutoConnectCheck.js';
@@ -9,8 +10,8 @@ export { useConnect } from './hooks/useConnect.js';
9
10
  export { useReefKnotModal } from './hooks/useReefKnotModal.js';
10
11
  export { ReefKnot, ReefKnotContext } from './context/reefKnot.js';
11
12
  export { ReefKnotModalContextProvider } from './context/reefKnotModalContext.js';
12
- export { LS_KEY_TERMS_ACCEPTANCE } from './constants/localStorage.js';
13
- export { holesky } from './chains/holesky.js';
13
+ export { LS_KEY_RECONNECT_WALLET_ID, LS_KEY_TERMS_ACCEPTANCE } from './constants/localStorage.js';
14
14
  export { getUnsupportedChainError } from './helpers/getUnsupportedChainError.js';
15
15
  export { checkTermsAccepted } from './helpers/checkTermsAccepted.js';
16
+ export { hasInjected, isDappBrowserProvider } from './helpers/providerDetectors.js';
16
17
  export { useLocalStorage } from './helpers/useLocalStorage.js';
@@ -1,11 +1,13 @@
1
- import { WalletAdapterData } from '@reef-knot/types';
2
1
  import type { Chain } from 'wagmi/chains';
3
- export interface GetConnectorsArgs {
2
+ import type { WalletAdapterType } from '@reef-knot/types';
3
+ export interface GetWalletsDataListArgs {
4
+ walletsList: Record<string, WalletAdapterType>;
4
5
  rpc: Record<number, string>;
5
- chains: Chain[];
6
6
  defaultChain: Chain;
7
7
  walletconnectProjectId?: string;
8
+ safeAllowedDomains?: RegExp[];
8
9
  }
9
- export declare const getWalletDataList: ({ rpc, chains, defaultChain, walletconnectProjectId, }: GetConnectorsArgs) => WalletAdapterData[];
10
- export declare const getConnectors: (args: GetConnectorsArgs) => import("@wagmi/connectors/dist/base-84a689bb").C<any, any, any>[];
10
+ export declare const getWalletsDataList: ({ walletsList, rpc, defaultChain, walletconnectProjectId, safeAllowedDomains, }: GetWalletsDataListArgs) => {
11
+ walletsDataList: import("@reef-knot/types").WalletAdapterData[];
12
+ };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAI1C,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,2DAK3B,iBAAiB,wBAwBnB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,iBAAiB,sEAEpD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletData/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC/C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,kBAAkB,oFAM5B,sBAAsB;;CAmBxB,CAAC"}
@@ -1,34 +1,23 @@
1
- import { WalletsListEthereum } from '@reef-knot/wallets-list';
2
-
3
- let walletDataList;
4
- const getWalletDataList = ({
1
+ const getWalletsDataList = ({
2
+ walletsList,
5
3
  rpc,
6
- chains,
7
4
  defaultChain,
8
- walletconnectProjectId
5
+ walletconnectProjectId,
6
+ safeAllowedDomains
9
7
  }) => {
10
- const walletAdapters = Object.values(WalletsListEthereum);
11
- if (!walletDataList) {
12
- // Sorting supported chains, so the default chain is always first in the array
13
- // Have to do this because WalletConnect v2 via wagmi always tries to connect
14
- // to the first chain in the chains array
15
- const sortedChains = defaultChain ? chains.sort(chain => chain.id === defaultChain.id ? -1 : 1) : chains;
16
- if (!rpc[defaultChain.id]) {
17
- throw 'RPC for default chain must be provided';
18
- }
19
- walletDataList = walletAdapters.map(walletAdapter => walletAdapter({
20
- rpc,
21
- chains: sortedChains,
22
- defaultChain,
23
- walletconnectProjectId
24
- }));
8
+ const walletAdapters = Object.values(walletsList);
9
+ if (!rpc[defaultChain.id]) {
10
+ throw 'RPC for default chain must be provided';
25
11
  }
26
- return walletDataList;
27
- };
28
- const getConnectors = args => {
29
- return getWalletDataList(args).map(({
30
- connector
31
- }) => connector);
12
+ const walletsDataList = walletAdapters.map(walletAdapter => walletAdapter({
13
+ rpc,
14
+ defaultChain,
15
+ walletconnectProjectId,
16
+ safeAllowedDomains
17
+ }));
18
+ return {
19
+ walletsDataList
20
+ };
32
21
  };
33
22
 
34
- export { getConnectors, getWalletDataList };
23
+ export { getWalletsDataList };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/core-react",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -37,22 +37,25 @@
37
37
  "lint": "eslint --ext ts,tsx,js,mjs ."
38
38
  },
39
39
  "devDependencies": {
40
- "@reef-knot/ledger-connector": "^3.0.0",
41
- "@reef-knot/wallets-list": "^1.13.3",
42
- "@reef-knot/types": "^1.8.0",
43
- "@reef-knot/ui-react": "^1.0.8",
44
- "@reef-knot/wallets-helpers": "^1.1.6",
40
+ "@reef-knot/ledger-connector": "^4.0.0",
41
+ "@reef-knot/wallets-list": "^2.0.0",
42
+ "@reef-knot/types": "^2.0.0",
43
+ "@reef-knot/ui-react": "^2.0.0",
44
+ "@reef-knot/wallets-helpers": "^2.0.0",
45
45
  "eslint-config-custom": "*",
46
46
  "react": "18.2.0",
47
- "wagmi": "^0.12.19"
47
+ "viem": "2.13.3",
48
+ "wagmi": "2.10.4"
48
49
  },
49
50
  "peerDependencies": {
50
- "@reef-knot/ledger-connector": "^3.0.0",
51
- "@reef-knot/wallets-list": "^1.4.1",
52
- "@reef-knot/types": "^1.2.1",
53
- "@reef-knot/ui-react": "^1.0.4",
54
- "@reef-knot/wallets-helpers": "^1.1.6",
51
+ "@reef-knot/ledger-connector": "^4.0.0",
52
+ "@reef-knot/wallets-list": "^2.0.0",
53
+ "@reef-knot/types": "^2.0.0",
54
+ "@reef-knot/ui-react": "^2.0.0",
55
+ "@reef-knot/wallets-helpers": "^2.0.0",
55
56
  "react": ">=18",
56
- "wagmi": "^0.12.19"
57
+ "viem": "2.13.3",
58
+ "wagmi": "2.10.4",
59
+ "@tanstack/react-query": "^5.29.0"
57
60
  }
58
61
  }
@@ -1,21 +0,0 @@
1
- export declare const holesky: {
2
- readonly id: 17000;
3
- readonly network: "holesky";
4
- readonly name: "Holesky";
5
- readonly nativeCurrency: {
6
- readonly name: "Holesky Ether";
7
- readonly symbol: "ETH";
8
- readonly decimals: 18;
9
- };
10
- readonly rpcUrls: {
11
- readonly default: {
12
- readonly http: readonly ["https://rpc.holesky.ethpandaops.io"];
13
- };
14
- readonly public: {
15
- readonly http: readonly ["https://rpc.holesky.ethpandaops.io"];
16
- };
17
- };
18
- readonly contracts: {};
19
- readonly testnet: true;
20
- };
21
- //# sourceMappingURL=holesky.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"holesky.d.ts","sourceRoot":"","sources":["../../src/chains/holesky.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;CAeM,CAAC"}
@@ -1,25 +0,0 @@
1
- // wagmi v1.x already provides this chain (it takes it from viem and re-exports)
2
- // But, because we use wagmi v0.x, we have to define the chain like this.
3
- // Can be removed after updating wagmi to v1.x
4
- const holesky = {
5
- id: 17000,
6
- network: 'holesky',
7
- name: 'Holesky',
8
- nativeCurrency: {
9
- name: 'Holesky Ether',
10
- symbol: 'ETH',
11
- decimals: 18
12
- },
13
- rpcUrls: {
14
- default: {
15
- http: ['https://rpc.holesky.ethpandaops.io']
16
- },
17
- public: {
18
- http: ['https://rpc.holesky.ethpandaops.io']
19
- }
20
- },
21
- contracts: {},
22
- testnet: true
23
- };
24
-
25
- export { holesky };
@@ -1,2 +0,0 @@
1
- export * from './holesky';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chains/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}