@dynamic-labs/sdk-react-core 0.18.2 → 0.18.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
1
 
2
+ ### [0.18.5](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.4...v0.18.5) (2023-08-19)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * ensure social sign in embedded wallets sync correctly with wagmi ([ae8784d](https://github.com/dynamic-labs/DynamicAuth/commit/ae8784d1dff047b370e0ccafbcb8180fa64bb99b))
8
+
9
+ ### [0.18.4](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.2...v0.18.4) (2023-08-17)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * always init magic connectors when enabled ([#3018](https://github.com/dynamic-labs/DynamicAuth/issues/3018)) ([e6bb091](https://github.com/dynamic-labs/DynamicAuth/commit/e6bb091d2b5b58242ecd9268496a69e92f840773)), closes [#3014](https://github.com/dynamic-labs/DynamicAuth/issues/3014)
15
+ * guard against null or undefined provider value when logging in w… ([#3027](https://github.com/dynamic-labs/DynamicAuth/issues/3027)) ([7354d5f](https://github.com/dynamic-labs/DynamicAuth/commit/7354d5f1a68603143ddd10d0b2ddb5283ec29ff1)), closes [#3021](https://github.com/dynamic-labs/DynamicAuth/issues/3021)
16
+ * issue where walletconnectors are instantiated without walletbook ([#3020](https://github.com/dynamic-labs/DynamicAuth/issues/3020)) ([#3032](https://github.com/dynamic-labs/DynamicAuth/issues/3032)) ([4452165](https://github.com/dynamic-labs/DynamicAuth/commit/4452165962856ba3ef0dc7aa6b41101fb8c48ad7))
17
+ * only use the production api environment of magicLink ([#3023](https://github.com/dynamic-labs/DynamicAuth/issues/3023)) ([767a1a5](https://github.com/dynamic-labs/DynamicAuth/commit/767a1a59074e992c446632a399f1b45bb0b759a0))
18
+ * switching network in connected state should update wallets to connect list ([#3029](https://github.com/dynamic-labs/DynamicAuth/issues/3029)) ([f07c993](https://github.com/dynamic-labs/DynamicAuth/commit/f07c993792824ce1b1390e38c2bcdb27b5d6ab73))
19
+
2
20
  ### [0.18.2](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.1...v0.18.2) (2023-08-15)
3
21
 
4
22
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.18.2";
5
+ var version = "0.18.5";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
8
  "@dynamic-labs/iconic": "0.1.23",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.18.2";
1
+ var version = "0.18.5";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
4
  "@dynamic-labs/iconic": "0.1.23",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.18.2",
3
+ "version": "0.18.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -16,13 +16,13 @@
16
16
  "formik": "2.2.9",
17
17
  "qrcode": "1.5.1",
18
18
  "ethers": "5.7.2",
19
- "@dynamic-labs/logger": "0.18.2",
20
- "@dynamic-labs/multi-wallet": "0.18.2",
21
- "@dynamic-labs/rpc-providers": "0.18.2",
22
- "@dynamic-labs/types": "0.18.2",
23
- "@dynamic-labs/utils": "0.18.2",
24
- "@dynamic-labs/wallet-book": "0.18.2",
25
- "@dynamic-labs/wallet-connector-core": "0.18.2",
19
+ "@dynamic-labs/logger": "0.18.5",
20
+ "@dynamic-labs/multi-wallet": "0.18.5",
21
+ "@dynamic-labs/rpc-providers": "0.18.5",
22
+ "@dynamic-labs/types": "0.18.5",
23
+ "@dynamic-labs/utils": "0.18.5",
24
+ "@dynamic-labs/wallet-book": "0.18.5",
25
+ "@dynamic-labs/wallet-connector-core": "0.18.5",
26
26
  "eventemitter3": "5.0.1"
27
27
  },
28
28
  "devDependencies": {
@@ -46,7 +46,7 @@ require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
46
46
  const SocialRedirectContext = React.createContext(undefined);
47
47
  const SocialRedirectContextProvider = ({ children, }) => {
48
48
  var _a, _b;
49
- const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, } = useInternalDynamicContext.useInternalDynamicContext();
49
+ const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, } = useInternalDynamicContext.useInternalDynamicContext();
50
50
  const { setErrorMessage } = ErrorContext.useErrorContext();
51
51
  const { setView } = ViewContext.useViewContext();
52
52
  const verifyWallet = useVerifyWallet.useVerifyWallet({
@@ -139,6 +139,7 @@ const SocialRedirectContextProvider = ({ children, }) => {
139
139
  }
140
140
  }
141
141
  else {
142
+ yield connectWallet(socialWalletConnector);
142
143
  const address = yield socialWalletConnector.fetchPublicAddress();
143
144
  walletUiUtils.disabledConfirmationOnce();
144
145
  yield verifyWallet({
@@ -42,7 +42,7 @@ import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
42
42
  const SocialRedirectContext = createContext(undefined);
43
43
  const SocialRedirectContextProvider = ({ children, }) => {
44
44
  var _a, _b;
45
- const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, } = useInternalDynamicContext();
45
+ const { setShowAuthFlow, wallets, setSelectedWalletConnector, walletUiUtils, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, setShowDynamicUserProfile, isAuthenticated, setPrimaryWalletId, secondaryWallets, sdkHasLoaded, authToken, connectWallet, } = useInternalDynamicContext();
46
46
  const { setErrorMessage } = useErrorContext();
47
47
  const { setView } = useViewContext();
48
48
  const verifyWallet = useVerifyWallet({
@@ -135,6 +135,7 @@ const SocialRedirectContextProvider = ({ children, }) => {
135
135
  }
136
136
  }
137
137
  else {
138
+ yield connectWallet(socialWalletConnector);
138
139
  const address = yield socialWalletConnector.fetchPublicAddress();
139
140
  walletUiUtils.disabledConfirmationOnce();
140
141
  yield verifyWallet({
@@ -22,7 +22,7 @@ var isProgrammableNetworkSwitchSupported = require('../../functions/isProgrammab
22
22
 
23
23
  const useConnectedWalletsNetworkValidation = () => {
24
24
  const { connectedWallets, selectedWalletConnector, setSelectedWalletConnector, setShowAuthFlow, showAuthFlow, walletsToConnectByChain, isBridgeFlow, } = useInternalDynamicContext.useInternalDynamicContext();
25
- const { view, setView } = ViewContext.useViewContext();
25
+ const { setView } = ViewContext.useViewContext();
26
26
  React.useEffect(() => {
27
27
  if (!isBridgeFlow) {
28
28
  return;
@@ -53,16 +53,17 @@ const useConnectedWalletsNetworkValidation = () => {
53
53
  }
54
54
  setView(networkNotSupportedView);
55
55
  }
56
+ // we need it to remove 'showAuthFlow' property. we don't want to react to it,
57
+ // because closing modal on network switch causes it to re-open
58
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
59
  }, [
57
- isBridgeFlow,
58
60
  connectedWallets,
59
- view,
61
+ isBridgeFlow,
60
62
  selectedWalletConnector,
61
- walletsToConnectByChain,
62
- showAuthFlow,
63
- setView,
64
63
  setSelectedWalletConnector,
65
64
  setShowAuthFlow,
65
+ setView,
66
+ walletsToConnectByChain,
66
67
  ]);
67
68
  };
68
69
 
@@ -18,7 +18,7 @@ import { isProgrammableNetworkSwitchSupported } from '../../functions/isProgramm
18
18
 
19
19
  const useConnectedWalletsNetworkValidation = () => {
20
20
  const { connectedWallets, selectedWalletConnector, setSelectedWalletConnector, setShowAuthFlow, showAuthFlow, walletsToConnectByChain, isBridgeFlow, } = useInternalDynamicContext();
21
- const { view, setView } = useViewContext();
21
+ const { setView } = useViewContext();
22
22
  useEffect(() => {
23
23
  if (!isBridgeFlow) {
24
24
  return;
@@ -49,16 +49,17 @@ const useConnectedWalletsNetworkValidation = () => {
49
49
  }
50
50
  setView(networkNotSupportedView);
51
51
  }
52
+ // we need it to remove 'showAuthFlow' property. we don't want to react to it,
53
+ // because closing modal on network switch causes it to re-open
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
52
55
  }, [
53
- isBridgeFlow,
54
56
  connectedWallets,
55
- view,
57
+ isBridgeFlow,
56
58
  selectedWalletConnector,
57
- walletsToConnectByChain,
58
- showAuthFlow,
59
- setView,
60
59
  setSelectedWalletConnector,
61
60
  setShowAuthFlow,
61
+ setView,
62
+ walletsToConnectByChain,
62
63
  ]);
63
64
  };
64
65
 
@@ -53,12 +53,13 @@ var SelectNetworkButton = require('../../components/SelectNetworkButton/SelectNe
53
53
  var useApplyWalletConnectorNetwork = require('../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.cjs');
54
54
 
55
55
  const NetworkNotSupported = () => {
56
- const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
56
+ const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext.useInternalDynamicContext();
57
57
  // Refresh selectedWalletConnector network when primaryWallet or connectedWallets updates
58
58
  const { data: walletConnectorNetwork } = usePromise.usePromise(() => walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(), { deps: [primaryWallet, walletConnector, connectedWallets] });
59
59
  const finishConnectAndSign = useConnectAndSign.useConnectAndSign({
60
60
  shouldCallCallback: false,
61
- shouldUpdateWallets: !isFullyConnected,
61
+ shouldUpdateWallets: !isFullyConnected ||
62
+ (isFullyConnected && Boolean(walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)),
62
63
  });
63
64
  const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
64
65
  // Finishes auth flow when wallet switches to proper network
@@ -49,12 +49,13 @@ import { SelectNetworkButton } from '../../components/SelectNetworkButton/Select
49
49
  import { useApplyWalletConnectorNetwork } from '../../utils/hooks/useApplyWalletConnectorNetwork/useApplyWalletConnectorNetwork.js';
50
50
 
51
51
  const NetworkNotSupported = () => {
52
- const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, } = useInternalDynamicContext();
52
+ const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext();
53
53
  // Refresh selectedWalletConnector network when primaryWallet or connectedWallets updates
54
54
  const { data: walletConnectorNetwork } = usePromise(() => walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(), { deps: [primaryWallet, walletConnector, connectedWallets] });
55
55
  const finishConnectAndSign = useConnectAndSign({
56
56
  shouldCallCallback: false,
57
- shouldUpdateWallets: !isFullyConnected,
57
+ shouldUpdateWallets: !isFullyConnected ||
58
+ (isFullyConnected && Boolean(walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)),
58
59
  });
59
60
  const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
60
61
  // Finishes auth flow when wallet switches to proper network
@@ -54,14 +54,15 @@ var useApplyWalletConnectorNetwork = require('../../utils/hooks/useApplyWalletCo
54
54
  // as the wallet does not support programmatic network change.
55
55
  const NetworkNotSupportedSwitchManual = () => {
56
56
  var _a, _b;
57
- const { user, selectedWalletConnector: walletConnector, connectedWallets, isFullyConnected, setShowAuthFlow, } = useInternalDynamicContext.useInternalDynamicContext();
57
+ const { user, selectedWalletConnector: walletConnector, connectedWallets, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext.useInternalDynamicContext();
58
58
  // Refresh selectedWalletConnector network when primaryWallet or connectedWallets updates
59
59
  const { data: walletConnectorNetwork } = usePromise.usePromise(() => walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(), {
60
60
  deps: [walletConnector, connectedWallets],
61
61
  });
62
62
  const finishConnectAndSign = useConnectAndSign.useConnectAndSign({
63
63
  shouldCallCallback: false,
64
- shouldUpdateWallets: !isFullyConnected,
64
+ shouldUpdateWallets: !isFullyConnected ||
65
+ (isFullyConnected && Boolean(walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)),
65
66
  });
66
67
  // Finishes auth flow when wallet switches to proper network
67
68
  React.useEffect(() => {
@@ -50,14 +50,15 @@ import { useApplyWalletConnectorNetwork } from '../../utils/hooks/useApplyWallet
50
50
  // as the wallet does not support programmatic network change.
51
51
  const NetworkNotSupportedSwitchManual = () => {
52
52
  var _a, _b;
53
- const { user, selectedWalletConnector: walletConnector, connectedWallets, isFullyConnected, setShowAuthFlow, } = useInternalDynamicContext();
53
+ const { user, selectedWalletConnector: walletConnector, connectedWallets, isFullyConnected, setShowAuthFlow, walletsToConnectByChain, } = useInternalDynamicContext();
54
54
  // Refresh selectedWalletConnector network when primaryWallet or connectedWallets updates
55
55
  const { data: walletConnectorNetwork } = usePromise(() => walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(), {
56
56
  deps: [walletConnector, connectedWallets],
57
57
  });
58
58
  const finishConnectAndSign = useConnectAndSign({
59
59
  shouldCallCallback: false,
60
- shouldUpdateWallets: !isFullyConnected,
60
+ shouldUpdateWallets: !isFullyConnected ||
61
+ (isFullyConnected && Boolean(walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)),
61
62
  });
62
63
  // Finishes auth flow when wallet switches to proper network
63
64
  useEffect(() => {