@dynamic-labs/sdk-react-core 0.18.0-beta.29 → 0.19.0-alpha.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.
- package/CHANGELOG.md +1 -49
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -6
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -6
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +4 -6
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +1 -3
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +4 -6
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +6 -12
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +6 -12
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -13
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -13
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +3 -13
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +3 -13
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,53 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
## [0.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
### ⚠ BREAKING CHANGES
|
|
6
|
-
|
|
7
|
-
* remove deprecated multiwallet prop (#2821)
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
* array of dynamicWagmiSettings not being sent, must be turned into object ([#2837](https://github.com/dynamic-labs/DynamicAuth/issues/2837)) ([fc5051d](https://github.com/dynamic-labs/DynamicAuth/commit/fc5051d3ce4c5e28d54a74cc9d74424748b52df9)), closes [#2835](https://github.com/dynamic-labs/DynamicAuth/issues/2835)
|
|
12
|
-
* change network modal doesn't pop on secondary wallet, when primaryWallet was disconnected ([#2831](https://github.com/dynamic-labs/DynamicAuth/issues/2831)) ([4a78cc8](https://github.com/dynamic-labs/DynamicAuth/commit/4a78cc8c9004e6716fa9e35d8572c57bfd8bdc22))
|
|
13
|
-
* connectSuccess callback is not being called when connecting new wallet after unlink ([#2829](https://github.com/dynamic-labs/DynamicAuth/issues/2829)) ([37795e5](https://github.com/dynamic-labs/DynamicAuth/commit/37795e5304d65766968ae6168d329b899c0afdfa))
|
|
14
|
-
* **wcv2:** simulate chain change event in switchNetwork ([#2827](https://github.com/dynamic-labs/DynamicAuth/issues/2827)) ([98cff76](https://github.com/dynamic-labs/DynamicAuth/commit/98cff7687112ddbf2971fa4e42cc959f5be62014)), closes [#2809](https://github.com/dynamic-labs/DynamicAuth/issues/2809)
|
|
15
|
-
* wrong wallet list is showing after disconnecting and network change ([#2832](https://github.com/dynamic-labs/DynamicAuth/issues/2832)) ([b7af548](https://github.com/dynamic-labs/DynamicAuth/commit/b7af5480a0f05b851cf9accb3ab0870fd2836a92))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* remove deprecated multiwallet prop ([#2821](https://github.com/dynamic-labs/DynamicAuth/issues/2821)) ([d95173d](https://github.com/dynamic-labs/DynamicAuth/commit/d95173de890104b1b94b612976682c9d86ec4b17))
|
|
19
|
-
|
|
20
|
-
## [0.18.0-beta.28](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.27...v0.18.0-beta.28) (2023-08-03)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### Bug Fixes
|
|
24
|
-
|
|
25
|
-
* gracefully handle walletbook fallbacks ([#2812](https://github.com/dynamic-labs/DynamicAuth/issues/2812)) ([#2822](https://github.com/dynamic-labs/DynamicAuth/issues/2822)) ([8e737d6](https://github.com/dynamic-labs/DynamicAuth/commit/8e737d602d64fa2414ba136799b8878e975a40a2))
|
|
26
|
-
|
|
27
|
-
## [0.18.0-RC.27](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.26...v0.18.0-RC.27) (2023-08-03)
|
|
28
|
-
|
|
29
|
-
### Bug Fixes
|
|
30
|
-
|
|
31
|
-
* fixes circular dependency issues on usePromise
|
|
32
|
-
|
|
33
|
-
## [0.18.0-RC.26](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.24...v0.18.0-RC.26) (2023-08-02)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### ⚠ BREAKING CHANGES
|
|
37
|
-
|
|
38
|
-
* displayTermsOfService prop set to false breaks message verfication (#2751)
|
|
39
|
-
|
|
40
|
-
### Features
|
|
41
|
-
|
|
42
|
-
* send wagmi settings from wagmi connector ([#2791](https://github.com/dynamic-labs/DynamicAuth/issues/2791)) ([#2800](https://github.com/dynamic-labs/DynamicAuth/issues/2800)) ([5b65605](https://github.com/dynamic-labs/DynamicAuth/commit/5b656059361a48de57e01ad2dd81de0bc9b2c7e8))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Bug Fixes
|
|
46
|
-
|
|
47
|
-
* always call onBeforeConnectSuccess callback when wallet state changes ([#2786](https://github.com/dynamic-labs/DynamicAuth/issues/2786)) ([e2eaef3](https://github.com/dynamic-labs/DynamicAuth/commit/e2eaef3da1f80cdc7dc21e902e9c033e581242d2))
|
|
48
|
-
* displayTermsOfService prop set to false breaks message verfication ([#2751](https://github.com/dynamic-labs/DynamicAuth/issues/2751)) ([6433732](https://github.com/dynamic-labs/DynamicAuth/commit/6433732fac87d641f2475d19ef743ac31130274f))
|
|
49
|
-
* ensure auto-redirect back to dapp after message signing ([#2783](https://github.com/dynamic-labs/DynamicAuth/issues/2783)) ([dba4664](https://github.com/dynamic-labs/DynamicAuth/commit/dba466473ecc2afd808cdae0fd9023d38676b01f))
|
|
50
|
-
* use css.supports only when available ([#2802](https://github.com/dynamic-labs/DynamicAuth/issues/2802)) ([7651898](https://github.com/dynamic-labs/DynamicAuth/commit/76518982a97e728ab65549f37f55b537eed4e890))
|
|
2
|
+
## [0.19.0-alpha.0](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.25...v0.19.0-alpha.0) (2023-08-01)
|
|
51
3
|
|
|
52
4
|
## [0.18.0-RC.25](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.24...v0.18.0-RC.25) (2023-08-01)
|
|
53
5
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-alpha.0",
|
|
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.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.
|
|
22
|
-
"@dynamic-labs/types": "0.
|
|
23
|
-
"@dynamic-labs/utils": "0.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.
|
|
19
|
+
"@dynamic-labs/logger": "0.19.0-alpha.0",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.0",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.0",
|
|
22
|
+
"@dynamic-labs/types": "0.19.0-alpha.0",
|
|
23
|
+
"@dynamic-labs/utils": "0.19.0-alpha.0",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.0",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
|
@@ -357,12 +357,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
357
357
|
user,
|
|
358
358
|
});
|
|
359
359
|
const sendWagmiSettings = (settings) => {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
dynamicWagmiSettings: { dynamicWagmiSettings },
|
|
364
|
-
});
|
|
365
|
-
}
|
|
360
|
+
api.sendDynamicProps(environmentId, {
|
|
361
|
+
dynamicWagmiSettings: settings.dynamicWagmiSettings,
|
|
362
|
+
});
|
|
366
363
|
};
|
|
367
364
|
const clearStatesOnBackClick = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
368
365
|
setDesktopUri('');
|
|
@@ -353,12 +353,9 @@ const DynamicContextProvider = ({ children, theme, settings, }) => {
|
|
|
353
353
|
user,
|
|
354
354
|
});
|
|
355
355
|
const sendWagmiSettings = (settings) => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
dynamicWagmiSettings: { dynamicWagmiSettings },
|
|
360
|
-
});
|
|
361
|
-
}
|
|
356
|
+
sendDynamicProps(environmentId, {
|
|
357
|
+
dynamicWagmiSettings: settings.dynamicWagmiSettings,
|
|
358
|
+
});
|
|
362
359
|
};
|
|
363
360
|
const clearStatesOnBackClick = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
364
361
|
setDesktopUri('');
|
|
@@ -28,11 +28,11 @@ require('@dynamic-labs/multi-wallet');
|
|
|
28
28
|
var isSupportedNetwork = require('../../../functions/isSupportedNetwork/isSupportedNetwork.cjs');
|
|
29
29
|
var isProgrammableNetworkSwitchSupported = require('../../../functions/isProgrammableNetworkSwitchSupported/isProgrammableNetworkSwitchSupported.cjs');
|
|
30
30
|
|
|
31
|
-
const useConnectAndSign = (
|
|
31
|
+
const useConnectAndSign = () => {
|
|
32
32
|
const { setView, goToInitialView } = ViewContext.useViewContext();
|
|
33
33
|
const { setErrorMessage } = ErrorContext.useErrorContext();
|
|
34
34
|
const { captchaToken } = CaptchaContext.useCaptchaContext();
|
|
35
|
-
const { authMode, connectWallet, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected,
|
|
35
|
+
const { authMode, connectWallet, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
36
36
|
const { handleWalletsToConnect } = useHandleWalletsToConnect.useHandleWalletsToConnect();
|
|
37
37
|
const verifyWallet = useVerifyWallet.useVerifyWallet({
|
|
38
38
|
consumeNonce,
|
|
@@ -72,10 +72,8 @@ const useConnectAndSign = ({ shouldUpdateWallets = true } = {}) => {
|
|
|
72
72
|
}
|
|
73
73
|
if (isConnectOnly.isConnectOnly(user, authMode)) {
|
|
74
74
|
localStorage.LocalStorage.setToLS(localStorage$1.LAST_USED_WALLET, walletConnector.name);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
if (!isFullyConnected || (walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)) {
|
|
75
|
+
handleWalletsToConnect();
|
|
76
|
+
if (!isFullyConnected) {
|
|
79
77
|
setCallback('connectSuccess');
|
|
80
78
|
}
|
|
81
79
|
return;
|
|
@@ -3,7 +3,5 @@ type Props = {
|
|
|
3
3
|
fetchPublicAddressOpts?: FetchPublicAddressOpts;
|
|
4
4
|
walletConnector: WalletConnector;
|
|
5
5
|
};
|
|
6
|
-
export declare const useConnectAndSign: ({
|
|
7
|
-
shouldUpdateWallets?: boolean | undefined;
|
|
8
|
-
}) => ({ walletConnector, fetchPublicAddressOpts, }: Props) => Promise<void>;
|
|
6
|
+
export declare const useConnectAndSign: () => ({ walletConnector, fetchPublicAddressOpts, }: Props) => Promise<void>;
|
|
9
7
|
export {};
|
|
@@ -24,11 +24,11 @@ import '@dynamic-labs/multi-wallet';
|
|
|
24
24
|
import { isSupportedNetwork } from '../../../functions/isSupportedNetwork/isSupportedNetwork.js';
|
|
25
25
|
import { isProgrammableNetworkSwitchSupported } from '../../../functions/isProgrammableNetworkSwitchSupported/isProgrammableNetworkSwitchSupported.js';
|
|
26
26
|
|
|
27
|
-
const useConnectAndSign = (
|
|
27
|
+
const useConnectAndSign = () => {
|
|
28
28
|
const { setView, goToInitialView } = useViewContext();
|
|
29
29
|
const { setErrorMessage } = useErrorContext();
|
|
30
30
|
const { captchaToken } = useCaptchaContext();
|
|
31
|
-
const { authMode, connectWallet, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected,
|
|
31
|
+
const { authMode, connectWallet, consumeNonce, displaySiweStatement, environmentId, projectSettings, setIsSingleWalletAccount, user, walletUiUtils, setCallback, setIsVerificationInProgress, isFullyConnected, } = useInternalDynamicContext();
|
|
32
32
|
const { handleWalletsToConnect } = useHandleWalletsToConnect();
|
|
33
33
|
const verifyWallet = useVerifyWallet({
|
|
34
34
|
consumeNonce,
|
|
@@ -68,10 +68,8 @@ const useConnectAndSign = ({ shouldUpdateWallets = true } = {}) => {
|
|
|
68
68
|
}
|
|
69
69
|
if (isConnectOnly(user, authMode)) {
|
|
70
70
|
LocalStorage.setToLS(LAST_USED_WALLET, walletConnector.name);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
if (!isFullyConnected || (walletsToConnectByChain === null || walletsToConnectByChain === void 0 ? void 0 : walletsToConnectByChain.length)) {
|
|
71
|
+
handleWalletsToConnect();
|
|
72
|
+
if (!isFullyConnected) {
|
|
75
73
|
setCallback('connectSuccess');
|
|
76
74
|
}
|
|
77
75
|
return;
|
|
@@ -21,7 +21,6 @@ const orderedSecondaryWalletAddresses = (wallets) => wallets.map((wallet) => wal
|
|
|
21
21
|
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
22
22
|
const [loadingNetwork, setLoadingNetwork] = React.useState(true);
|
|
23
23
|
const [network, setNetwork] = React.useState(undefined);
|
|
24
|
-
const seen = new Set();
|
|
25
24
|
React.useEffect(() => {
|
|
26
25
|
const fetchNetwork = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
26
|
try {
|
|
@@ -44,9 +43,14 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
44
43
|
if (!primaryWallet) {
|
|
45
44
|
return;
|
|
46
45
|
}
|
|
46
|
+
const seen = new Set();
|
|
47
47
|
addPrimaryWalletEventListeners(seen);
|
|
48
|
+
addSecondaryWalletEventListeners(seen);
|
|
48
49
|
return () => {
|
|
49
50
|
primaryWallet.connector.teardownEventListeners();
|
|
51
|
+
for (const wallet of secondaryWallets) {
|
|
52
|
+
wallet.connector.teardownEventListeners();
|
|
53
|
+
}
|
|
50
54
|
};
|
|
51
55
|
// justification: we don't want to setup event listeners more than needed
|
|
52
56
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -56,20 +60,10 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
56
60
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
57
61
|
multiWalletWidgetState,
|
|
58
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
59
64
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
60
65
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isInitialized,
|
|
61
66
|
]);
|
|
62
|
-
React.useEffect(() => {
|
|
63
|
-
addSecondaryWalletEventListeners(seen);
|
|
64
|
-
return () => {
|
|
65
|
-
for (const wallet of secondaryWallets) {
|
|
66
|
-
wallet.connector.teardownEventListeners();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}, [
|
|
70
|
-
multiWalletWidgetState,
|
|
71
|
-
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
72
|
-
]);
|
|
73
67
|
const handleAccountChangeWhenAwaitingAccountSwitch = React.useCallback((isPrimaryWallet, newAddress) => {
|
|
74
68
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => walletConnectorCore.isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
75
69
|
// this means the user is linking a new account, so we need proof of ownership...
|
|
@@ -17,7 +17,6 @@ const orderedSecondaryWalletAddresses = (wallets) => wallets.map((wallet) => wal
|
|
|
17
17
|
const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut, multiWallet, multiWalletWidgetState, primaryWallet, secondaryWallets, selectedWalletConnector, selectedWalletWithAction, setSelectedWalletConnector, setSelectedWalletWithAction, setMultiWalletWidgetState, user, setPrimaryWalletId, authMode, refreshConnectedWallet, }) => {
|
|
18
18
|
const [loadingNetwork, setLoadingNetwork] = useState(true);
|
|
19
19
|
const [network, setNetwork] = useState(undefined);
|
|
20
|
-
const seen = new Set();
|
|
21
20
|
useEffect(() => {
|
|
22
21
|
const fetchNetwork = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
22
|
try {
|
|
@@ -40,9 +39,14 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
40
39
|
if (!primaryWallet) {
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
42
|
+
const seen = new Set();
|
|
43
43
|
addPrimaryWalletEventListeners(seen);
|
|
44
|
+
addSecondaryWalletEventListeners(seen);
|
|
44
45
|
return () => {
|
|
45
46
|
primaryWallet.connector.teardownEventListeners();
|
|
47
|
+
for (const wallet of secondaryWallets) {
|
|
48
|
+
wallet.connector.teardownEventListeners();
|
|
49
|
+
}
|
|
46
50
|
};
|
|
47
51
|
// justification: we don't want to setup event listeners more than needed
|
|
48
52
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -52,20 +56,10 @@ const useWalletEventListeners = ({ computeConnectedStateForWallets, handleLogOut
|
|
|
52
56
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
53
57
|
multiWalletWidgetState,
|
|
54
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
55
60
|
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
56
61
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isInitialized,
|
|
57
62
|
]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
addSecondaryWalletEventListeners(seen);
|
|
60
|
-
return () => {
|
|
61
|
-
for (const wallet of secondaryWallets) {
|
|
62
|
-
wallet.connector.teardownEventListeners();
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
}, [
|
|
66
|
-
multiWalletWidgetState,
|
|
67
|
-
orderedSecondaryWalletAddresses(secondaryWallets).join(),
|
|
68
|
-
]);
|
|
69
63
|
const handleAccountChangeWhenAwaitingAccountSwitch = useCallback((isPrimaryWallet, newAddress) => {
|
|
70
64
|
const linkedSecondaryWallet = secondaryWallets.find((wallet) => isSameAddress(wallet.address, newAddress, wallet.chain));
|
|
71
65
|
// this means the user is linking a new account, so we need proof of ownership...
|
|
@@ -53,12 +53,10 @@ 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,
|
|
56
|
+
const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, } = 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
|
-
const finishConnectAndSign = useConnectAndSign.useConnectAndSign(
|
|
60
|
-
shouldUpdateWallets: !isFullyConnected,
|
|
61
|
-
});
|
|
59
|
+
const finishConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
62
60
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
63
61
|
// Finishes auth flow when wallet switches to proper network
|
|
64
62
|
React.useEffect(() => {
|
|
@@ -66,16 +64,8 @@ const NetworkNotSupported = () => {
|
|
|
66
64
|
finishConnectAndSign({
|
|
67
65
|
walletConnector: walletConnector,
|
|
68
66
|
});
|
|
69
|
-
// there are two scenarios here, one in not connected state and the other one in connected state.
|
|
70
|
-
// previously we were calling setShowAuthFlow(false) in useHandleWalletsToConnect.
|
|
71
|
-
// now, we don't call it in network-not-supported view, so we need to handle that scenario and close modal here
|
|
72
|
-
// this should be gone, once we're done with the useConnectAndSign hook refactor.
|
|
73
|
-
// TODO: https://linear.app/dynamic-labs/issue/QNTM-117/break-useconnectandsign-hook-to-small-parts
|
|
74
|
-
if (isFullyConnected) {
|
|
75
|
-
setShowAuthFlow(false);
|
|
76
|
-
}
|
|
77
67
|
}
|
|
78
|
-
}, [walletConnectorNetwork
|
|
68
|
+
}, [walletConnectorNetwork]);
|
|
79
69
|
// Updates the contexts 'network' based on the selected wallet connector.
|
|
80
70
|
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
81
71
|
// Prevents 'network' from being 'undefined'.
|
|
@@ -49,12 +49,10 @@ 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,
|
|
52
|
+
const { network, onboardingImageUrl, selectedWalletConnector: walletConnector, connectedWallets, primaryWallet, } = 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
|
-
const finishConnectAndSign = useConnectAndSign(
|
|
56
|
-
shouldUpdateWallets: !isFullyConnected,
|
|
57
|
-
});
|
|
55
|
+
const finishConnectAndSign = useConnectAndSign();
|
|
58
56
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
59
57
|
// Finishes auth flow when wallet switches to proper network
|
|
60
58
|
useEffect(() => {
|
|
@@ -62,16 +60,8 @@ const NetworkNotSupported = () => {
|
|
|
62
60
|
finishConnectAndSign({
|
|
63
61
|
walletConnector: walletConnector,
|
|
64
62
|
});
|
|
65
|
-
// there are two scenarios here, one in not connected state and the other one in connected state.
|
|
66
|
-
// previously we were calling setShowAuthFlow(false) in useHandleWalletsToConnect.
|
|
67
|
-
// now, we don't call it in network-not-supported view, so we need to handle that scenario and close modal here
|
|
68
|
-
// this should be gone, once we're done with the useConnectAndSign hook refactor.
|
|
69
|
-
// TODO: https://linear.app/dynamic-labs/issue/QNTM-117/break-useconnectandsign-hook-to-small-parts
|
|
70
|
-
if (isFullyConnected) {
|
|
71
|
-
setShowAuthFlow(false);
|
|
72
|
-
}
|
|
73
63
|
}
|
|
74
|
-
}, [walletConnectorNetwork
|
|
64
|
+
}, [walletConnectorNetwork]);
|
|
75
65
|
// Updates the contexts 'network' based on the selected wallet connector.
|
|
76
66
|
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
77
67
|
// Prevents 'network' from being 'undefined'.
|
|
@@ -54,30 +54,20 @@ 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,
|
|
57
|
+
const { user, selectedWalletConnector: walletConnector, connectedWallets, } = 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
|
-
const finishConnectAndSign = useConnectAndSign.useConnectAndSign(
|
|
63
|
-
shouldUpdateWallets: !isFullyConnected,
|
|
64
|
-
});
|
|
62
|
+
const finishConnectAndSign = useConnectAndSign.useConnectAndSign();
|
|
65
63
|
// Finishes auth flow when wallet switches to proper network
|
|
66
64
|
React.useEffect(() => {
|
|
67
65
|
if (isSupportedNetwork.isSupportedNetwork({ network: walletConnectorNetwork, walletConnector })) {
|
|
68
66
|
finishConnectAndSign({
|
|
69
67
|
walletConnector: walletConnector,
|
|
70
68
|
});
|
|
71
|
-
// there are two scenarios here, one in not connected state and the other one in connected state.
|
|
72
|
-
// previously we were calling setShowAuthFlow(false) in useHandleWalletsToConnect.
|
|
73
|
-
// now, we don't call it in network-not-supported view, so we need to handle that scenario and close modal here
|
|
74
|
-
// this should be gone, once we're done with the useConnectAndSign hook refactor.
|
|
75
|
-
// TODO: https://linear.app/dynamic-labs/issue/QNTM-117/break-useconnectandsign-hook-to-small-parts
|
|
76
|
-
if (isFullyConnected) {
|
|
77
|
-
setShowAuthFlow(false);
|
|
78
|
-
}
|
|
79
69
|
}
|
|
80
|
-
}, [walletConnectorNetwork
|
|
70
|
+
}, [walletConnectorNetwork]);
|
|
81
71
|
// Updates the contexts 'network' based on the selected wallet connector.
|
|
82
72
|
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
83
73
|
// Prevents 'network' from being 'undefined'.
|
|
@@ -50,30 +50,20 @@ 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,
|
|
53
|
+
const { user, selectedWalletConnector: walletConnector, connectedWallets, } = 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
|
-
const finishConnectAndSign = useConnectAndSign(
|
|
59
|
-
shouldUpdateWallets: !isFullyConnected,
|
|
60
|
-
});
|
|
58
|
+
const finishConnectAndSign = useConnectAndSign();
|
|
61
59
|
// Finishes auth flow when wallet switches to proper network
|
|
62
60
|
useEffect(() => {
|
|
63
61
|
if (isSupportedNetwork({ network: walletConnectorNetwork, walletConnector })) {
|
|
64
62
|
finishConnectAndSign({
|
|
65
63
|
walletConnector: walletConnector,
|
|
66
64
|
});
|
|
67
|
-
// there are two scenarios here, one in not connected state and the other one in connected state.
|
|
68
|
-
// previously we were calling setShowAuthFlow(false) in useHandleWalletsToConnect.
|
|
69
|
-
// now, we don't call it in network-not-supported view, so we need to handle that scenario and close modal here
|
|
70
|
-
// this should be gone, once we're done with the useConnectAndSign hook refactor.
|
|
71
|
-
// TODO: https://linear.app/dynamic-labs/issue/QNTM-117/break-useconnectandsign-hook-to-small-parts
|
|
72
|
-
if (isFullyConnected) {
|
|
73
|
-
setShowAuthFlow(false);
|
|
74
|
-
}
|
|
75
65
|
}
|
|
76
|
-
}, [walletConnectorNetwork
|
|
66
|
+
}, [walletConnectorNetwork]);
|
|
77
67
|
// Updates the contexts 'network' based on the selected wallet connector.
|
|
78
68
|
// It helps ensure that the 'network' is always in sync with the wallet's actual network,
|
|
79
69
|
// Prevents 'network' from being 'undefined'.
|
|
@@ -65,7 +65,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
65
65
|
}), [goToProfileView, setShowAuthFlow, setView, updateUser]);
|
|
66
66
|
const isKYCEnabled = useKYCFlag.useKYCFlag();
|
|
67
67
|
const isMultiWalletEnabled = useMultiWalletFlag.useMultiWalletFlag();
|
|
68
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My
|
|
68
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My information" }))), jsxRuntime.jsx(UserProfileForm.UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
exports.EditProfileView = EditProfileView;
|
|
@@ -61,7 +61,7 @@ const EditProfileView = ({ rootClassName, }) => {
|
|
|
61
61
|
}), [goToProfileView, setShowAuthFlow, setView, updateUser]);
|
|
62
62
|
const isKYCEnabled = useKYCFlag();
|
|
63
63
|
const isMultiWalletEnabled = useMultiWalletFlag();
|
|
64
|
-
return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My
|
|
64
|
+
return (jsxs(Fragment, { children: [!isMultiWalletEnabled && isKYCEnabled && (jsx(Typography, Object.assign({ weight: 'regular', color: 'secondary', variant: 'body_normal', className: 'dynamic-widget-edit-profile-view__profile-title' }, { children: "My information" }))), jsx(UserProfileForm, { formClassName: rootClassName, onEditProfileSubmit: onEditProfileFormSubmit, onEditProfileCancel: goToProfileView })] }));
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
export { EditProfileView };
|