@reef-knot/core-react 6.2.4 → 7.0.0-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.
- package/dist/components/AutoConnect.js +7 -7
- package/dist/constants/localStorage.js +5 -9
- package/dist/context/reefKnotContext.js +6 -4
- package/dist/context/reefKnotModalContext.d.ts +1 -1
- package/dist/context/reefKnotModalContext.d.ts.map +1 -1
- package/dist/context/reefKnotModalContext.js +60 -64
- package/dist/context/reefKnotProvider.d.ts +2 -2
- package/dist/context/reefKnotProvider.d.ts.map +1 -1
- package/dist/context/reefKnotProvider.js +20 -22
- package/dist/eip6963.js +4 -2
- package/dist/helpers/checkTermsAccepted.js +6 -7
- package/dist/helpers/getDefaultConfig.js +47 -79
- package/dist/helpers/getUnsupportedChainError.js +10 -16
- package/dist/helpers/getWalletsDataList.js +14 -23
- package/dist/helpers/index.js +6 -0
- package/dist/helpers/providerDetectors.js +7 -8
- package/dist/helpers/useLocalStorage.js +15 -25
- package/dist/helpers/withCallback.js +8 -9
- package/dist/hooks/index.js +8 -0
- package/dist/hooks/useAutoConnect.js +32 -60
- package/dist/hooks/useAutoConnectCheck.js +13 -19
- package/dist/hooks/useConnect.js +18 -30
- package/dist/hooks/useConnectorInfo.js +20 -25
- package/dist/hooks/useDisconnect.js +37 -47
- package/dist/hooks/useEagerConnect.js +50 -73
- package/dist/hooks/useReefKnotContext.js +5 -3
- package/dist/hooks/useReefKnotModal.js +8 -6
- package/dist/index.js +22 -18
- package/package.json +20 -18
- package/dist/_virtual/_tslib.js +0 -45
|
@@ -1,63 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useEagerConnect } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { withCallback } from '../helpers/withCallback.js';
|
|
1
|
+
import { useReefKnotContext } from "./useReefKnotContext.js";
|
|
2
|
+
import { LS_KEY_RECONNECT_WALLET_ID } from "../constants/localStorage.js";
|
|
3
|
+
import { checkTermsAccepted } from "../helpers/checkTermsAccepted.js";
|
|
4
|
+
import { useEagerConnect } from "./useEagerConnect.js";
|
|
5
|
+
import { withCallback } from "../helpers/withCallback.js";
|
|
6
|
+
import { useEffect } from "react";
|
|
7
|
+
import { useConfig, useConnection, useReconnect } from "wagmi";
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// For example, wallets with dApp browsers, or using iframes to open dApps.
|
|
34
|
-
const connectResult = yield eagerConnect();
|
|
35
|
-
// If still not connected and there were no errors and the terms of service are accepted,
|
|
36
|
-
// call the default wagmi autoConnect method, which attempts to connect to the last used connector.
|
|
37
|
-
if (!connectResult && checkTermsAccepted() && (
|
|
38
|
-
// We do not want to reconnect if the `recentConnectorId` item was deleted during disconnect
|
|
39
|
-
yield storage === null || storage === void 0 ? void 0 : storage.getItem('recentConnectorId'))) {
|
|
40
|
-
const savedReconnectWalletId = yield storage === null || storage === void 0 ? void 0 : storage.getItem(LS_KEY_RECONNECT_WALLET_ID);
|
|
41
|
-
const walletData = walletDataList.find(data => data.walletId === savedReconnectWalletId);
|
|
42
|
-
if (walletData) {
|
|
43
|
-
let createConnectorFn = walletData.createConnectorFn;
|
|
44
|
-
if ((_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) {
|
|
45
|
-
createConnectorFn = walletData.walletconnectExtras.connectionViaURI.createConnectorFn;
|
|
46
|
-
}
|
|
47
|
-
// Wait for all EIP-6963 wallets to load their code and fire "eip6963:announceProvider" event
|
|
48
|
-
// Without the delay, this code can be called from a browser's cache faster than wallet extension code
|
|
49
|
-
yield new Promise(resolve => setTimeout(resolve, 100));
|
|
50
|
-
const reconnectWithCallback = withCallback(reconnectAsync, onReconnect);
|
|
51
|
-
yield reconnectWithCallback({
|
|
52
|
-
connectors: [createConnectorFn]
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
void tryReconnect();
|
|
58
|
-
// No hook deps: do not retry the auto-connect attemption.
|
|
59
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
}, []);
|
|
9
|
+
//#region src/hooks/useAutoConnect.ts
|
|
10
|
+
const useAutoConnect = (autoConnectEnabled) => {
|
|
11
|
+
const { storage } = useConfig();
|
|
12
|
+
const { mutateAsync: reconnectAsync } = useReconnect();
|
|
13
|
+
const { isConnected } = useConnection();
|
|
14
|
+
const { eagerConnect } = useEagerConnect();
|
|
15
|
+
const { walletDataList, onReconnect } = useReefKnotContext();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const tryReconnect = async () => {
|
|
18
|
+
if (isConnected || !autoConnectEnabled) return;
|
|
19
|
+
if (!await eagerConnect() && checkTermsAccepted() && await storage?.getItem("recentConnectorId")) {
|
|
20
|
+
const savedReconnectWalletId = await storage?.getItem(LS_KEY_RECONNECT_WALLET_ID);
|
|
21
|
+
const walletData = walletDataList.find((data) => data.walletId === savedReconnectWalletId);
|
|
22
|
+
if (walletData) {
|
|
23
|
+
let createConnectorFn = walletData.createConnectorFn;
|
|
24
|
+
if (walletData?.walletconnectExtras?.connectionViaURI?.condition) createConnectorFn = walletData.walletconnectExtras.connectionViaURI.createConnectorFn;
|
|
25
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
26
|
+
await withCallback(reconnectAsync, onReconnect)({ connectors: [createConnectorFn] });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
tryReconnect();
|
|
31
|
+
}, []);
|
|
61
32
|
};
|
|
62
33
|
|
|
63
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
export { useAutoConnect };
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useCallback } from
|
|
3
|
-
import { useReefKnotContext } from './useReefKnotContext.js';
|
|
1
|
+
import { useReefKnotContext } from "./useReefKnotContext.js";
|
|
2
|
+
import { useCallback } from "react";
|
|
4
3
|
|
|
4
|
+
//#region src/hooks/useAutoConnectCheck.ts
|
|
5
5
|
const useAutoConnectCheck = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (yield (_a = adapter.detector) === null || _a === void 0 ? void 0 : _a.call(adapter)) return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}), [walletDataList]);
|
|
18
|
-
return {
|
|
19
|
-
checkIfShouldAutoConnect
|
|
20
|
-
};
|
|
6
|
+
const { walletDataList } = useReefKnotContext();
|
|
7
|
+
return { checkIfShouldAutoConnect: useCallback(async () => {
|
|
8
|
+
for (const adapter of walletDataList) {
|
|
9
|
+
if (!adapter.autoConnectOnly) continue;
|
|
10
|
+
if (await adapter.detector?.()) return true;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}, [walletDataList]) };
|
|
21
14
|
};
|
|
22
15
|
|
|
23
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
export { useAutoConnectCheck };
|
package/dist/hooks/useConnect.js
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useAutoConnectCheck } from
|
|
4
|
-
import {
|
|
5
|
-
import { useReefKnotModal } from './useReefKnotModal.js';
|
|
1
|
+
import { useReefKnotModal } from "./useReefKnotModal.js";
|
|
2
|
+
import { useEagerConnect } from "./useEagerConnect.js";
|
|
3
|
+
import { useAutoConnectCheck } from "./useAutoConnectCheck.js";
|
|
4
|
+
import { useCallback } from "react";
|
|
6
5
|
|
|
6
|
+
//#region src/hooks/useConnect.ts
|
|
7
7
|
const useConnect = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const result = yield eagerConnect();
|
|
20
|
-
return {
|
|
21
|
-
success: !!result
|
|
22
|
-
};
|
|
23
|
-
} else {
|
|
24
|
-
return openModalAsync({
|
|
25
|
-
type: 'wallet'
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}), [checkIfShouldAutoConnect, eagerConnect, openModalAsync]);
|
|
29
|
-
return {
|
|
30
|
-
connect
|
|
31
|
-
};
|
|
8
|
+
const { openModalAsync } = useReefKnotModal();
|
|
9
|
+
const { checkIfShouldAutoConnect } = useAutoConnectCheck();
|
|
10
|
+
const { eagerConnect } = useEagerConnect();
|
|
11
|
+
return { connect: useCallback(async () => {
|
|
12
|
+
if (await checkIfShouldAutoConnect()) return { success: !!await eagerConnect() };
|
|
13
|
+
else return openModalAsync({ type: "wallet" });
|
|
14
|
+
}, [
|
|
15
|
+
checkIfShouldAutoConnect,
|
|
16
|
+
eagerConnect,
|
|
17
|
+
openModalAsync
|
|
18
|
+
]) };
|
|
32
19
|
};
|
|
33
20
|
|
|
34
|
-
|
|
21
|
+
//#endregion
|
|
22
|
+
export { useConnect };
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { hasInjected, isDappBrowserProvider } from "../helpers/providerDetectors.js";
|
|
2
|
+
import { useConnection } from "wagmi";
|
|
3
|
+
import { idLedgerHid, idLedgerLive } from "@reef-knot/ledger-connector";
|
|
4
4
|
|
|
5
|
+
//#region src/hooks/useConnectorInfo.ts
|
|
5
6
|
const useConnectorInfo = () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
connectorName,
|
|
21
|
-
isGnosis,
|
|
22
|
-
isLedger,
|
|
23
|
-
isLedgerLive,
|
|
24
|
-
isDappBrowser,
|
|
25
|
-
isInjected
|
|
26
|
-
};
|
|
7
|
+
const { connector } = useConnection();
|
|
8
|
+
const isLedger = Boolean(connector?.id === idLedgerHid);
|
|
9
|
+
const isLedgerLive = Boolean(connector?.id === idLedgerLive);
|
|
10
|
+
const isGnosis = Boolean(connector?.id === "safe");
|
|
11
|
+
const isInjected = hasInjected();
|
|
12
|
+
const isDappBrowser = isDappBrowserProvider();
|
|
13
|
+
return {
|
|
14
|
+
connectorName: isDappBrowser ? void 0 : connector?.name,
|
|
15
|
+
isGnosis,
|
|
16
|
+
isLedger,
|
|
17
|
+
isLedgerLive,
|
|
18
|
+
isDappBrowser,
|
|
19
|
+
isInjected
|
|
20
|
+
};
|
|
27
21
|
};
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useConnectorInfo };
|
|
@@ -1,54 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { useReefKnotContext } from "./useReefKnotContext.js";
|
|
2
|
+
import { LS_KEY_RECONNECT_WALLET_ID } from "../constants/localStorage.js";
|
|
3
|
+
import { useReefKnotModal } from "./useReefKnotModal.js";
|
|
4
|
+
import { useCallback, useMemo } from "react";
|
|
5
|
+
import { useConfig, useConnection, useDisconnect } from "wagmi";
|
|
6
6
|
|
|
7
|
+
//#region src/hooks/useDisconnect.ts
|
|
7
8
|
const useDisconnectCleaningStorage = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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]);
|
|
9
|
+
const { storage } = useConfig();
|
|
10
|
+
const { mutate: disconnect } = useDisconnect();
|
|
11
|
+
return useCallback((...args) => {
|
|
12
|
+
disconnect(...args);
|
|
13
|
+
storage?.removeItem("recentConnectorId");
|
|
14
|
+
storage?.removeItem(LS_KEY_RECONNECT_WALLET_ID);
|
|
15
|
+
}, [disconnect, storage]);
|
|
19
16
|
};
|
|
20
17
|
const useForceDisconnect = () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
disconnect();
|
|
28
|
-
}, [disconnect, forceCloseAllModals]);
|
|
29
|
-
return {
|
|
30
|
-
forceDisconnect
|
|
31
|
-
};
|
|
18
|
+
const disconnect = useDisconnectCleaningStorage();
|
|
19
|
+
const { forceCloseAllModals } = useReefKnotModal();
|
|
20
|
+
return { forceDisconnect: useCallback(() => {
|
|
21
|
+
forceCloseAllModals();
|
|
22
|
+
disconnect();
|
|
23
|
+
}, [disconnect, forceCloseAllModals]) };
|
|
32
24
|
};
|
|
33
|
-
const useDisconnect = () => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
disconnect: isDisconnectMakesSense ? disconnect : undefined,
|
|
50
|
-
isDisconnectMakesSense
|
|
51
|
-
};
|
|
25
|
+
const useDisconnect$1 = () => {
|
|
26
|
+
const { isConnected, connector } = useConnection();
|
|
27
|
+
const disconnect = useDisconnectCleaningStorage();
|
|
28
|
+
const { walletDataList } = useReefKnotContext();
|
|
29
|
+
const isDisconnectMakesSense = useMemo(() => {
|
|
30
|
+
const connectorData = walletDataList.find((c) => c.walletId === connector?.id);
|
|
31
|
+
return isConnected && !connectorData?.autoConnectOnly;
|
|
32
|
+
}, [
|
|
33
|
+
isConnected,
|
|
34
|
+
connector,
|
|
35
|
+
walletDataList
|
|
36
|
+
]);
|
|
37
|
+
return {
|
|
38
|
+
disconnect: isDisconnectMakesSense ? disconnect : void 0,
|
|
39
|
+
isDisconnectMakesSense
|
|
40
|
+
};
|
|
52
41
|
};
|
|
53
42
|
|
|
54
|
-
|
|
43
|
+
//#endregion
|
|
44
|
+
export { useDisconnect$1 as useDisconnect, useForceDisconnect };
|
|
@@ -1,77 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { connect } from
|
|
7
|
-
import { checkTermsAccepted } from '../helpers/checkTermsAccepted.js';
|
|
1
|
+
import { useReefKnotContext } from "./useReefKnotContext.js";
|
|
2
|
+
import { useReefKnotModal } from "./useReefKnotModal.js";
|
|
3
|
+
import { checkTermsAccepted } from "../helpers/checkTermsAccepted.js";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { useConfig } from "wagmi";
|
|
6
|
+
import { connect } from "wagmi/actions";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// when failed, open the terms modal, allow user to see the error and retry the connection
|
|
39
|
-
yield openModalAsync({
|
|
40
|
-
type: 'eager',
|
|
41
|
-
props: {
|
|
42
|
-
tryConnection,
|
|
43
|
-
initialError: e
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return connectionResult;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return null;
|
|
52
|
-
});
|
|
8
|
+
//#region src/hooks/useEagerConnect.ts
|
|
9
|
+
const connectEagerly = async (config, adapters, openModalAsync) => {
|
|
10
|
+
const isTermsAccepted = checkTermsAccepted();
|
|
11
|
+
for (const adapter of adapters) if (await adapter.detector?.()) {
|
|
12
|
+
let connectionResult = null;
|
|
13
|
+
const tryConnection = async () => {
|
|
14
|
+
const result = await connect(config, { connector: adapter.createConnectorFn });
|
|
15
|
+
connectionResult = result;
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
if (!isTermsAccepted) await openModalAsync({
|
|
19
|
+
type: "eager",
|
|
20
|
+
props: { tryConnection }
|
|
21
|
+
});
|
|
22
|
+
else try {
|
|
23
|
+
await tryConnection();
|
|
24
|
+
} catch (e) {
|
|
25
|
+
await openModalAsync({
|
|
26
|
+
type: "eager",
|
|
27
|
+
props: {
|
|
28
|
+
tryConnection,
|
|
29
|
+
initialError: e
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return connectionResult;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
53
37
|
const useEagerConnect = () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (connectionResult && onAutoConnect) {
|
|
68
|
-
onAutoConnect();
|
|
69
|
-
}
|
|
70
|
-
return connectionResult;
|
|
71
|
-
}), [openModalAsync, walletDataList, config, onAutoConnect]);
|
|
72
|
-
return {
|
|
73
|
-
eagerConnect
|
|
74
|
-
};
|
|
38
|
+
const config = useConfig();
|
|
39
|
+
const { openModalAsync } = useReefKnotModal();
|
|
40
|
+
const { walletDataList, onAutoConnect } = useReefKnotContext();
|
|
41
|
+
return { eagerConnect: useCallback(async () => {
|
|
42
|
+
const connectionResult = await connectEagerly(config, walletDataList.filter(({ autoConnectOnly }) => autoConnectOnly), openModalAsync);
|
|
43
|
+
if (connectionResult && onAutoConnect) onAutoConnect();
|
|
44
|
+
return connectionResult;
|
|
45
|
+
}, [
|
|
46
|
+
openModalAsync,
|
|
47
|
+
walletDataList,
|
|
48
|
+
config,
|
|
49
|
+
onAutoConnect
|
|
50
|
+
]) };
|
|
75
51
|
};
|
|
76
52
|
|
|
77
|
-
|
|
53
|
+
//#endregion
|
|
54
|
+
export { connectEagerly, useEagerConnect };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ReefKnotContext } from "../context/reefKnotContext.js";
|
|
2
|
+
import { useContext } from "react";
|
|
3
3
|
|
|
4
|
+
//#region src/hooks/useReefKnotContext.ts
|
|
4
5
|
const useReefKnotContext = () => useContext(ReefKnotContext);
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
//#endregion
|
|
8
|
+
export { useReefKnotContext };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ReefKnotModalContext } from "../context/reefKnotModalContext.js";
|
|
2
|
+
import { useContext } from "react";
|
|
3
3
|
|
|
4
|
+
//#region src/hooks/useReefKnotModal.ts
|
|
4
5
|
const useReefKnotModal = () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const value = useContext(ReefKnotModalContext);
|
|
7
|
+
if (!value) throw new Error("useReefKnotModal was called outside of the ReefKnotModalContext");
|
|
8
|
+
return value;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
export { useReefKnotModal };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { ReefKnotContext } from "./context/reefKnotContext.js";
|
|
2
|
+
import { useReefKnotContext } from "./hooks/useReefKnotContext.js";
|
|
3
|
+
import { useLocalStorage } from "./helpers/useLocalStorage.js";
|
|
4
|
+
import { LS_KEY_RECONNECT_WALLET_ID, LS_KEY_TERMS_ACCEPTANCE } from "./constants/localStorage.js";
|
|
5
|
+
import { ReefKnotModalContextProvider } from "./context/reefKnotModalContext.js";
|
|
6
|
+
import { useReefKnotModal } from "./hooks/useReefKnotModal.js";
|
|
7
|
+
import { checkTermsAccepted } from "./helpers/checkTermsAccepted.js";
|
|
8
|
+
import { connectEagerly, useEagerConnect } from "./hooks/useEagerConnect.js";
|
|
9
|
+
import { useAutoConnect } from "./hooks/useAutoConnect.js";
|
|
10
|
+
import { useAutoConnectCheck } from "./hooks/useAutoConnectCheck.js";
|
|
11
|
+
import { useDisconnect, useForceDisconnect } from "./hooks/useDisconnect.js";
|
|
12
|
+
import { hasInjected, isDappBrowserProvider } from "./helpers/providerDetectors.js";
|
|
13
|
+
import { useConnectorInfo } from "./hooks/useConnectorInfo.js";
|
|
14
|
+
import { useConnect } from "./hooks/useConnect.js";
|
|
15
|
+
import "./hooks/index.js";
|
|
16
|
+
import { getUnsupportedChainError } from "./helpers/getUnsupportedChainError.js";
|
|
17
|
+
import { getWalletsDataList } from "./helpers/getWalletsDataList.js";
|
|
18
|
+
import { getDefaultConfig } from "./helpers/getDefaultConfig.js";
|
|
19
|
+
import "./helpers/index.js";
|
|
20
|
+
import { ReefKnotProvider } from "./context/reefKnotProvider.js";
|
|
21
|
+
|
|
22
|
+
export { LS_KEY_RECONNECT_WALLET_ID, LS_KEY_TERMS_ACCEPTANCE, ReefKnotContext, ReefKnotModalContextProvider, ReefKnotProvider, checkTermsAccepted, connectEagerly, getDefaultConfig, getUnsupportedChainError, getWalletsDataList, hasInjected, isDappBrowserProvider, useAutoConnect, useAutoConnectCheck, useConnect, useConnectorInfo, useDisconnect, useEagerConnect, useForceDisconnect, useLocalStorage, useReefKnotContext, useReefKnotModal };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reef-knot/core-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -32,31 +32,33 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "
|
|
36
|
-
"dev": "
|
|
37
|
-
"lint": "eslint --ext ts,tsx,js,mjs ."
|
|
35
|
+
"build": "yarn run -T tsdown",
|
|
36
|
+
"dev": "yarn run -T tsdown --watch",
|
|
37
|
+
"lint": "eslint --ext ts,tsx,js,mjs .",
|
|
38
|
+
"typecheck": "tsc --noEmit"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@reef-knot/ledger-connector": "4.
|
|
41
|
-
"@reef-knot/types": "4.2.0",
|
|
42
|
-
"@reef-knot/ui-react": "2.3.0",
|
|
43
|
-
"@reef-knot/wallets-helpers": "2.3.0",
|
|
44
|
-
"@reef-knot/wallets-list": "4.2.
|
|
41
|
+
"@reef-knot/ledger-connector": "4.4.0-alpha.5",
|
|
42
|
+
"@reef-knot/types": "4.2.0-alpha.3",
|
|
43
|
+
"@reef-knot/ui-react": "2.3.0-alpha.3",
|
|
44
|
+
"@reef-knot/wallets-helpers": "2.3.0-alpha.3",
|
|
45
|
+
"@reef-knot/wallets-list": "4.2.0-alpha.6",
|
|
46
|
+
"build-config": "*",
|
|
45
47
|
"eslint-config-custom": "*",
|
|
46
48
|
"mipd": "0.0.7",
|
|
47
49
|
"react": "18.2.0",
|
|
48
|
-
"viem": ">=2.
|
|
49
|
-
"wagmi": ">=
|
|
50
|
+
"viem": ">=2.44",
|
|
51
|
+
"wagmi": ">=3.3"
|
|
50
52
|
},
|
|
51
53
|
"peerDependencies": {
|
|
52
|
-
"@reef-knot/ledger-connector": "4.
|
|
53
|
-
"@reef-knot/types": "4.2.0",
|
|
54
|
-
"@reef-knot/ui-react": "2.3.0",
|
|
55
|
-
"@reef-knot/wallets-helpers": "2.3.0",
|
|
56
|
-
"@reef-knot/wallets-list": "4.2.
|
|
54
|
+
"@reef-knot/ledger-connector": "4.4.0-alpha.5",
|
|
55
|
+
"@reef-knot/types": "4.2.0-alpha.3",
|
|
56
|
+
"@reef-knot/ui-react": "2.3.0-alpha.3",
|
|
57
|
+
"@reef-knot/wallets-helpers": "2.3.0-alpha.3",
|
|
58
|
+
"@reef-knot/wallets-list": "4.2.0-alpha.6",
|
|
57
59
|
"@tanstack/react-query": "^5.29.0",
|
|
58
60
|
"react": ">=18",
|
|
59
|
-
"viem": ">=2.
|
|
60
|
-
"wagmi": ">=
|
|
61
|
+
"viem": ">=2.44",
|
|
62
|
+
"wagmi": ">=3.3"
|
|
61
63
|
}
|
|
62
64
|
}
|