@dynamic-labs/sdk-react-core 4.19.5 → 4.19.7
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 +27 -0
- package/package.cjs +3 -2
- package/package.js +3 -2
- package/package.json +13 -12
- package/src/functions.d.ts +1 -0
- package/src/lib/client/client.cjs +19 -0
- package/src/lib/client/client.d.ts +8 -0
- package/src/lib/client/client.js +11 -0
- package/src/lib/client/extension/constants.cjs +12 -0
- package/src/lib/client/extension/constants.d.ts +5 -0
- package/src/lib/client/extension/constants.js +8 -0
- package/src/lib/client/extension/index.d.ts +1 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/MockedFetchError.cjs +14 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/MockedFetchError.d.ts +4 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/MockedFetchError.js +10 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/fetchOverride.cjs +29 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/fetchOverride.d.ts +7 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/fetchOverride.js +25 -0
- package/src/lib/client/extension/useInitializeSdkClient/fetchOverride/index.d.ts +1 -0
- package/src/lib/client/extension/useInitializeSdkClient/index.d.ts +1 -0
- package/src/lib/client/extension/useInitializeSdkClient/useInitializeSdkClient.cjs +30 -0
- package/src/lib/client/extension/useInitializeSdkClient/useInitializeSdkClient.d.ts +2 -0
- package/src/lib/client/extension/useInitializeSdkClient/useInitializeSdkClient.js +26 -0
- package/src/lib/client/extension/utils/useClientState/index.d.ts +1 -0
- package/src/lib/client/extension/utils/useClientState/useClientState.d.ts +2 -0
- package/src/lib/components/AppOriginTile/AppOriginTile.cjs +8 -5
- package/src/lib/components/AppOriginTile/AppOriginTile.d.ts +4 -1
- package/src/lib/components/AppOriginTile/AppOriginTile.js +8 -5
- package/src/lib/components/Chip/Chip.cjs +2 -3
- package/src/lib/components/Chip/Chip.d.ts +5 -4
- package/src/lib/components/Chip/Chip.js +2 -3
- package/src/lib/components/NeedHelpSection/NeedHelpSection.cjs +3 -2
- package/src/lib/components/NeedHelpSection/NeedHelpSection.js +3 -2
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -0
- package/src/lib/context/OnrampContext/useEnabledOnrampProviders/useEnabledOnrampProviders.d.ts +2 -2
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/exchangeAccounts/exchangeAccounts.d.ts +45 -0
- package/src/lib/data/api/exchangeAccounts/index.d.ts +1 -0
- package/src/lib/data/api/index.d.ts +1 -0
- package/src/lib/data/api/onramp/onramp.d.ts +2 -2
- package/src/lib/locale/en/translation.cjs +16 -0
- package/src/lib/locale/en/translation.d.ts +16 -0
- package/src/lib/locale/en/translation.js +16 -0
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +1 -1
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +1 -1
- package/src/lib/modals/ZkSyncApprovalModal/ZkSyncApprovalModal.cjs +22 -0
- package/src/lib/modals/ZkSyncApprovalModal/ZkSyncApprovalModal.d.ts +8 -0
- package/src/lib/modals/ZkSyncApprovalModal/ZkSyncApprovalModal.js +18 -0
- package/src/lib/modals/ZkSyncApprovalModal/index.d.ts +1 -0
- package/src/lib/modals/index.d.ts +1 -0
- package/src/lib/shared/assets/backup.cjs +52 -0
- package/src/lib/shared/assets/backup.js +28 -0
- package/src/lib/shared/assets/clock.cjs +54 -0
- package/src/lib/shared/assets/clock.js +30 -0
- package/src/lib/shared/assets/index.d.ts +2 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +1 -0
- package/src/lib/utils/constants/authViewLayoutChecks.js +1 -0
- package/src/lib/utils/functions/getSessionInformation/getSessionInformation.cjs +4 -1
- package/src/lib/utils/functions/getSessionInformation/getSessionInformation.js +4 -1
- package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.d.ts +2 -2
- package/src/lib/utils/functions/updatePrimaryWalletId/updatePrimaryWalletId.cjs +25 -18
- package/src/lib/utils/functions/updatePrimaryWalletId/updatePrimaryWalletId.js +25 -18
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/unsetInitialWalletVerificationFlag/unsetInitialWalletVerificationFlag.cjs +9 -6
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/unsetInitialWalletVerificationFlag/unsetInitialWalletVerificationFlag.d.ts +8 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/unsetInitialWalletVerificationFlag/unsetInitialWalletVerificationFlag.js +8 -7
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +3 -2
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +4 -3
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +4 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +4 -1
- package/src/lib/utils/hooks/useExchangeAccounts/index.d.ts +1 -0
- package/src/lib/utils/hooks/useExchangeAccounts/useExchangeAccounts.d.ts +13 -0
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.cjs +4 -2
- package/src/lib/utils/hooks/useSyncDynamicWaas/useSyncDynamicWaas.js +4 -2
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +12 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +12 -1
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.cjs +138 -0
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.d.ts +3 -0
- package/src/lib/views/BackupUnsuccessfulView/BackupUnsuccessfulView.js +133 -0
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +15 -88
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +15 -88
- package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyNewDomainDetectedView/PasskeyNewDomainDetectedView.js +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.cjs +1 -1
- package/src/lib/views/Passkey/PasskeyRecovery/InitRecovery/PasskeyInitRecovery.js +1 -1
- package/src/lib/views/SessionKeyApprovalView/SessionKeyApprovalView.cjs +114 -0
- package/src/lib/views/SessionKeyApprovalView/SessionKeyApprovalView.js +110 -0
- package/src/lib/views/SessionPermissionsView/SessionPermissionsView.cjs +6 -6
- package/src/lib/views/SessionPermissionsView/SessionPermissionsView.js +2 -2
- package/src/lib/views/index.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.d.ts +1 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.cjs +6 -4
- package/src/lib/widgets/DynamicWidget/views/SessionManagementView/RevokeAccessView/RevokeAccessView.js +7 -5
|
@@ -118,6 +118,7 @@ const viewsThatHideCloseButton = [
|
|
|
118
118
|
'mfa-display-backup-codes',
|
|
119
119
|
'mfa-recovery',
|
|
120
120
|
'user-delete-account',
|
|
121
|
+
'backup-unsuccessful',
|
|
121
122
|
];
|
|
122
123
|
|
|
123
124
|
export { mfaViewsThatPreventModalClose, viewsThatHideCloseButton, viewsThatHideHeader, viewsThatHideHelpContent, viewsThatPreventBorderBelowHeader, viewsThatPreventModalClose, viewsThatShowConnectedWalletProgress, viewsThatShowDynamicFooter, viewsWithWalletListType };
|
|
@@ -21,7 +21,10 @@ const getSessionInformationExpiration = (session) => {
|
|
|
21
21
|
/** Returns the spending limit of the session in ETH */
|
|
22
22
|
const getSessionInformationSpendingLimit = (session) => {
|
|
23
23
|
const { limit } = session.session.feeLimit;
|
|
24
|
-
const
|
|
24
|
+
const formatter = new Intl.NumberFormat(undefined, {
|
|
25
|
+
maximumFractionDigits: 6,
|
|
26
|
+
});
|
|
27
|
+
const ethString = formatter.format(Number(limit) / Math.pow(10, 18));
|
|
25
28
|
return `~${ethString} ETH`;
|
|
26
29
|
};
|
|
27
30
|
/** Exports the session information as a JSON string with a helper to process bigints */
|
|
@@ -17,7 +17,10 @@ const getSessionInformationExpiration = (session) => {
|
|
|
17
17
|
/** Returns the spending limit of the session in ETH */
|
|
18
18
|
const getSessionInformationSpendingLimit = (session) => {
|
|
19
19
|
const { limit } = session.session.feeLimit;
|
|
20
|
-
const
|
|
20
|
+
const formatter = new Intl.NumberFormat(undefined, {
|
|
21
|
+
maximumFractionDigits: 6,
|
|
22
|
+
});
|
|
23
|
+
const ethString = formatter.format(Number(limit) / Math.pow(10, 18));
|
|
21
24
|
return `~${ethString} ETH`;
|
|
22
25
|
};
|
|
23
26
|
/** Exports the session information as a JSON string with a helper to process bigints */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RampConfiguration } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import type { OnrampOption } from '../../../context/DynamicContext';
|
|
3
3
|
/**
|
|
4
4
|
* Converts an OnrampConfiguration to an OnrampOption based on the provider's display mode
|
|
5
5
|
*/
|
|
6
|
-
export declare const onrampConfigurationToOnrampOption: (provider:
|
|
6
|
+
export declare const onrampConfigurationToOnrampOption: (provider: RampConfiguration) => OnrampOption;
|
|
@@ -29,29 +29,36 @@ require('../../../locale/locale.cjs');
|
|
|
29
29
|
var wallets = require('../../../data/api/wallets/wallets.cjs');
|
|
30
30
|
|
|
31
31
|
const updatePrimaryWalletId = (walletId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
32
|
+
var _a;
|
|
32
33
|
primaryWalletId.setPrimaryWalletId(walletId);
|
|
33
34
|
const user$1 = user.getUser();
|
|
34
35
|
if (user$1) {
|
|
35
36
|
const environmentId = dynamicContextProps.getEnvironmentId();
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
// We will compare the value of this wallet's lastSelectedAt to the latest
|
|
38
|
+
// selected credential's lastSelectedAt. If it's the same, we can skip the
|
|
39
|
+
// /select endpoint. This is to avoid unnecessary calls to the /select
|
|
40
|
+
// endpoint, which causes an update to the user's JWT.
|
|
41
|
+
const currentWalletLastSelectedAt = (_a = user$1.verifiedCredentials.find((credential) => credential.id === walletId)) === null || _a === void 0 ? void 0 : _a.lastSelectedAt;
|
|
42
|
+
if (currentWalletLastSelectedAt) {
|
|
43
|
+
const lastSelectedWalletCredential = user$1.verifiedCredentials.reduce((mostRecentSelectedCredential, credentialToCheck) => {
|
|
44
|
+
if (credentialToCheck.format !== 'blockchain' ||
|
|
45
|
+
!credentialToCheck.lastSelectedAt) {
|
|
46
|
+
return mostRecentSelectedCredential;
|
|
47
|
+
}
|
|
48
|
+
if (!mostRecentSelectedCredential ||
|
|
49
|
+
!mostRecentSelectedCredential.lastSelectedAt) {
|
|
50
|
+
return credentialToCheck;
|
|
51
|
+
}
|
|
52
|
+
return credentialToCheck.lastSelectedAt >
|
|
53
|
+
mostRecentSelectedCredential.lastSelectedAt
|
|
54
|
+
? credentialToCheck
|
|
55
|
+
: mostRecentSelectedCredential;
|
|
56
|
+
}, null);
|
|
57
|
+
if ((lastSelectedWalletCredential === null || lastSelectedWalletCredential === void 0 ? void 0 : lastSelectedWalletCredential.lastSelectedAt) &&
|
|
58
|
+
lastSelectedWalletCredential.lastSelectedAt.getTime() ===
|
|
59
|
+
currentWalletLastSelectedAt.getTime()) {
|
|
60
|
+
return;
|
|
41
61
|
}
|
|
42
|
-
if (!mostRecentSelectedCredential ||
|
|
43
|
-
!mostRecentSelectedCredential.lastSelectedAt) {
|
|
44
|
-
return credentialToCheck;
|
|
45
|
-
}
|
|
46
|
-
return credentialToCheck.lastSelectedAt >
|
|
47
|
-
mostRecentSelectedCredential.lastSelectedAt
|
|
48
|
-
? credentialToCheck
|
|
49
|
-
: mostRecentSelectedCredential;
|
|
50
|
-
}, null);
|
|
51
|
-
// No need to select the primary if it's already the last selected wallet
|
|
52
|
-
if (lastSelectedWalletCredential &&
|
|
53
|
-
lastSelectedWalletCredential.id === walletId) {
|
|
54
|
-
return;
|
|
55
62
|
}
|
|
56
63
|
yield wallets.storeSelectedWallet({ environmentId, walletId });
|
|
57
64
|
}
|
|
@@ -25,29 +25,36 @@ import '../../../locale/locale.js';
|
|
|
25
25
|
import { storeSelectedWallet } from '../../../data/api/wallets/wallets.js';
|
|
26
26
|
|
|
27
27
|
const updatePrimaryWalletId = (walletId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
28
29
|
setPrimaryWalletId(walletId);
|
|
29
30
|
const user = getUser();
|
|
30
31
|
if (user) {
|
|
31
32
|
const environmentId = getEnvironmentId();
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
// We will compare the value of this wallet's lastSelectedAt to the latest
|
|
34
|
+
// selected credential's lastSelectedAt. If it's the same, we can skip the
|
|
35
|
+
// /select endpoint. This is to avoid unnecessary calls to the /select
|
|
36
|
+
// endpoint, which causes an update to the user's JWT.
|
|
37
|
+
const currentWalletLastSelectedAt = (_a = user.verifiedCredentials.find((credential) => credential.id === walletId)) === null || _a === void 0 ? void 0 : _a.lastSelectedAt;
|
|
38
|
+
if (currentWalletLastSelectedAt) {
|
|
39
|
+
const lastSelectedWalletCredential = user.verifiedCredentials.reduce((mostRecentSelectedCredential, credentialToCheck) => {
|
|
40
|
+
if (credentialToCheck.format !== 'blockchain' ||
|
|
41
|
+
!credentialToCheck.lastSelectedAt) {
|
|
42
|
+
return mostRecentSelectedCredential;
|
|
43
|
+
}
|
|
44
|
+
if (!mostRecentSelectedCredential ||
|
|
45
|
+
!mostRecentSelectedCredential.lastSelectedAt) {
|
|
46
|
+
return credentialToCheck;
|
|
47
|
+
}
|
|
48
|
+
return credentialToCheck.lastSelectedAt >
|
|
49
|
+
mostRecentSelectedCredential.lastSelectedAt
|
|
50
|
+
? credentialToCheck
|
|
51
|
+
: mostRecentSelectedCredential;
|
|
52
|
+
}, null);
|
|
53
|
+
if ((lastSelectedWalletCredential === null || lastSelectedWalletCredential === void 0 ? void 0 : lastSelectedWalletCredential.lastSelectedAt) &&
|
|
54
|
+
lastSelectedWalletCredential.lastSelectedAt.getTime() ===
|
|
55
|
+
currentWalletLastSelectedAt.getTime()) {
|
|
56
|
+
return;
|
|
37
57
|
}
|
|
38
|
-
if (!mostRecentSelectedCredential ||
|
|
39
|
-
!mostRecentSelectedCredential.lastSelectedAt) {
|
|
40
|
-
return credentialToCheck;
|
|
41
|
-
}
|
|
42
|
-
return credentialToCheck.lastSelectedAt >
|
|
43
|
-
mostRecentSelectedCredential.lastSelectedAt
|
|
44
|
-
? credentialToCheck
|
|
45
|
-
: mostRecentSelectedCredential;
|
|
46
|
-
}, null);
|
|
47
|
-
// No need to select the primary if it's already the last selected wallet
|
|
48
|
-
if (lastSelectedWalletCredential &&
|
|
49
|
-
lastSelectedWalletCredential.id === walletId) {
|
|
50
|
-
return;
|
|
51
58
|
}
|
|
52
59
|
yield storeSelectedWallet({ environmentId, walletId });
|
|
53
60
|
}
|
|
@@ -14,13 +14,16 @@ var loadingAndLifecycle = require('../../../../../store/state/loadingAndLifecycl
|
|
|
14
14
|
*/
|
|
15
15
|
const UNSET_TIMEOUT = 5500;
|
|
16
16
|
const unsetInitialWalletVerificationFlag = () => {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
loadingAndLifecycle.setIsInitialWalletVerificationInProgress(false);
|
|
18
|
+
};
|
|
19
|
+
const unsetInitialWalletVerificationFlagWithTimeout = () => {
|
|
20
|
+
const timeout = setTimeout(() => {
|
|
21
|
+
unsetInitialWalletVerificationFlag();
|
|
19
22
|
clearTimeout(timeout);
|
|
20
|
-
dynamicEvents.dynamicEvents.removeListener('walletAdded',
|
|
21
|
-
};
|
|
22
|
-
const timeout = setTimeout(resolve, UNSET_TIMEOUT);
|
|
23
|
-
dynamicEvents.dynamicEvents.once('walletAdded', resolve);
|
|
23
|
+
dynamicEvents.dynamicEvents.removeListener('walletAdded', unsetInitialWalletVerificationFlag);
|
|
24
|
+
}, UNSET_TIMEOUT);
|
|
24
25
|
};
|
|
25
26
|
|
|
27
|
+
exports.UNSET_TIMEOUT = UNSET_TIMEOUT;
|
|
26
28
|
exports.unsetInitialWalletVerificationFlag = unsetInitialWalletVerificationFlag;
|
|
29
|
+
exports.unsetInitialWalletVerificationFlagWithTimeout = unsetInitialWalletVerificationFlagWithTimeout;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The max time the SDK will wait before unsetting the initial wallet verification flag.
|
|
3
|
+
* If the corresponding walletAdded event is triggered before this timeout, the flag will be unset immediately.
|
|
4
|
+
*
|
|
5
|
+
* See justification for this in comments where it is being called.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UNSET_TIMEOUT = 5500;
|
|
1
8
|
export declare const unsetInitialWalletVerificationFlag: () => void;
|
|
9
|
+
export declare const unsetInitialWalletVerificationFlagWithTimeout: () => void;
|
|
@@ -10,13 +10,14 @@ import { setIsInitialWalletVerificationInProgress } from '../../../../../store/s
|
|
|
10
10
|
*/
|
|
11
11
|
const UNSET_TIMEOUT = 5500;
|
|
12
12
|
const unsetInitialWalletVerificationFlag = () => {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
setIsInitialWalletVerificationInProgress(false);
|
|
14
|
+
};
|
|
15
|
+
const unsetInitialWalletVerificationFlagWithTimeout = () => {
|
|
16
|
+
const timeout = setTimeout(() => {
|
|
17
|
+
unsetInitialWalletVerificationFlag();
|
|
15
18
|
clearTimeout(timeout);
|
|
16
|
-
dynamicEvents.removeListener('walletAdded',
|
|
17
|
-
};
|
|
18
|
-
const timeout = setTimeout(resolve, UNSET_TIMEOUT);
|
|
19
|
-
dynamicEvents.once('walletAdded', resolve);
|
|
19
|
+
dynamicEvents.removeListener('walletAdded', unsetInitialWalletVerificationFlag);
|
|
20
|
+
}, UNSET_TIMEOUT);
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
export { unsetInitialWalletVerificationFlag };
|
|
23
|
+
export { UNSET_TIMEOUT, unsetInitialWalletVerificationFlag, unsetInitialWalletVerificationFlagWithTimeout };
|
|
@@ -20,7 +20,7 @@ var localStorage = require('../../../constants/localStorage.cjs');
|
|
|
20
20
|
require('../../../constants/colors.cjs');
|
|
21
21
|
require('../../../constants/values.cjs');
|
|
22
22
|
require('../../../../shared/consts/index.cjs');
|
|
23
|
-
require('../../../../events/dynamicEvents.cjs');
|
|
23
|
+
var dynamicEvents = require('../../../../events/dynamicEvents.cjs');
|
|
24
24
|
var ErrorContext = require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
25
|
require('@dynamic-labs/multi-wallet');
|
|
26
26
|
require('react-international-phone');
|
|
@@ -161,6 +161,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
161
161
|
// Lock the variable that indicates that the login wallet verification is in progress
|
|
162
162
|
// Read UserWalletsContext.tsx explanation for more context
|
|
163
163
|
loadingAndLifecycle.setIsInitialWalletVerificationInProgress(true);
|
|
164
|
+
dynamicEvents.dynamicEvents.once('walletAdded', unsetInitialWalletVerificationFlag.unsetInitialWalletVerificationFlag);
|
|
164
165
|
yield showPendingConnectView.showPendingConnectView(walletConnector, pushView);
|
|
165
166
|
if (walletConnectorCore.isEmailWalletConnector(walletConnector)) {
|
|
166
167
|
if (walletConnectorCore.isEmailOTPWalletConnector(walletConnector)) {
|
|
@@ -238,7 +239,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
238
239
|
// 2. Add a useEffect somewhere that does primaryWallet.switchNetwork() and depends on primaryWallet
|
|
239
240
|
// 3. The SDK will enter a broken state. Try signing a message with wagmi.
|
|
240
241
|
// You can also add a "pause on exception" breakpoint in the debugger and see what happens during verification.
|
|
241
|
-
unsetInitialWalletVerificationFlag.
|
|
242
|
+
unsetInitialWalletVerificationFlag.unsetInitialWalletVerificationFlagWithTimeout();
|
|
242
243
|
}
|
|
243
244
|
});
|
|
244
245
|
};
|
|
@@ -16,7 +16,7 @@ import { LAST_USED_WALLET } from '../../../constants/localStorage.js';
|
|
|
16
16
|
import '../../../constants/colors.js';
|
|
17
17
|
import '../../../constants/values.js';
|
|
18
18
|
import '../../../../shared/consts/index.js';
|
|
19
|
-
import '../../../../events/dynamicEvents.js';
|
|
19
|
+
import { dynamicEvents } from '../../../../events/dynamicEvents.js';
|
|
20
20
|
import { useErrorContext } from '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
21
|
import '@dynamic-labs/multi-wallet';
|
|
22
22
|
import 'react-international-phone';
|
|
@@ -34,7 +34,7 @@ import { useHandleWalletsToConnect } from '../../useHandleWalletsToConnect/useHa
|
|
|
34
34
|
import { useVerifyWallet } from '../../useVerifyWallet/useVerifyWallet.js';
|
|
35
35
|
import { showPendingConnectView } from '../helpers/showPendingConnectView.js';
|
|
36
36
|
import { isConnectOnly } from '../helpers/isConnectOnly.js';
|
|
37
|
-
import { unsetInitialWalletVerificationFlag } from './unsetInitialWalletVerificationFlag/unsetInitialWalletVerificationFlag.js';
|
|
37
|
+
import { unsetInitialWalletVerificationFlag, unsetInitialWalletVerificationFlagWithTimeout } from './unsetInitialWalletVerificationFlag/unsetInitialWalletVerificationFlag.js';
|
|
38
38
|
import '../../../../context/VerificationContext/VerificationContext.js';
|
|
39
39
|
import 'react-dom';
|
|
40
40
|
import '../../../functions/compareChains/compareChains.js';
|
|
@@ -157,6 +157,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
157
157
|
// Lock the variable that indicates that the login wallet verification is in progress
|
|
158
158
|
// Read UserWalletsContext.tsx explanation for more context
|
|
159
159
|
setIsInitialWalletVerificationInProgress(true);
|
|
160
|
+
dynamicEvents.once('walletAdded', unsetInitialWalletVerificationFlag);
|
|
160
161
|
yield showPendingConnectView(walletConnector, pushView);
|
|
161
162
|
if (isEmailWalletConnector(walletConnector)) {
|
|
162
163
|
if (isEmailOTPWalletConnector(walletConnector)) {
|
|
@@ -234,7 +235,7 @@ const useConnectAndSign = ({ shouldUpdateWallets = true, shouldCallCallback = tr
|
|
|
234
235
|
// 2. Add a useEffect somewhere that does primaryWallet.switchNetwork() and depends on primaryWallet
|
|
235
236
|
// 3. The SDK will enter a broken state. Try signing a message with wagmi.
|
|
236
237
|
// You can also add a "pause on exception" breakpoint in the debugger and see what happens during verification.
|
|
237
|
-
|
|
238
|
+
unsetInitialWalletVerificationFlagWithTimeout();
|
|
238
239
|
}
|
|
239
240
|
});
|
|
240
241
|
};
|
|
@@ -76,3 +76,4 @@ export { useAggregateWalletEvents } from './useAggregateWalletEvents';
|
|
|
76
76
|
export { useDeleteUserAccount } from './useDeleteUserAccount';
|
|
77
77
|
export { useDynamicWaas } from './useDynamicWaas';
|
|
78
78
|
export { useSyncDynamicWaas } from './useSyncDynamicWaas';
|
|
79
|
+
export { useExchangeAccounts } from './useExchangeAccounts';
|
|
@@ -147,6 +147,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
147
147
|
copykey: 'dyn_account_exists.title',
|
|
148
148
|
heading: t('dyn_account_exists.title'),
|
|
149
149
|
},
|
|
150
|
+
'backup-unsuccessful': {
|
|
151
|
+
copykey: 'dyn_waas.backup_unsuccessful.title',
|
|
152
|
+
heading: t('dyn_waas.backup_unsuccessful.title'),
|
|
153
|
+
},
|
|
150
154
|
'chainalysis-blocked-wallet': {
|
|
151
155
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
152
156
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
@@ -143,6 +143,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
143
143
|
copykey: 'dyn_account_exists.title',
|
|
144
144
|
heading: t('dyn_account_exists.title'),
|
|
145
145
|
},
|
|
146
|
+
'backup-unsuccessful': {
|
|
147
|
+
copykey: 'dyn_waas.backup_unsuccessful.title',
|
|
148
|
+
heading: t('dyn_waas.backup_unsuccessful.title'),
|
|
149
|
+
},
|
|
146
150
|
'chainalysis-blocked-wallet': {
|
|
147
151
|
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
148
152
|
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
@@ -7,6 +7,7 @@ var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
9
|
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var UserWalletsContext = require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
10
11
|
require('../../constants/values.cjs');
|
|
11
12
|
require('@dynamic-labs/multi-wallet');
|
|
12
13
|
var getAuthToken = require('../../functions/getAuthToken/getAuthToken.cjs');
|
|
@@ -36,7 +37,6 @@ require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
|
36
37
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
37
38
|
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
38
39
|
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
39
|
-
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
40
40
|
require('../../../config/ApiEndpoint.cjs');
|
|
41
41
|
require('../../../locale/locale.cjs');
|
|
42
42
|
require('../../../store/state/authMode/authMode.cjs');
|
|
@@ -122,6 +122,7 @@ const useDynamicWaas = () => {
|
|
|
122
122
|
const walletConnectorOptions = walletOptions.useWalletConnectorOptions();
|
|
123
123
|
const refresh = useRefreshUser.useRefreshUser();
|
|
124
124
|
const relayUrl = (_b = (_a = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
125
|
+
const userWallets = UserWalletsContext.useUserWallets();
|
|
125
126
|
const embeddedWalletSettings = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk.embeddedWallets;
|
|
126
127
|
const enabledChains = (_c = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _c === void 0 ? void 0 : _c.filter((c) => c.enabled);
|
|
127
128
|
const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
|
|
@@ -225,9 +226,11 @@ const useDynamicWaas = () => {
|
|
|
225
226
|
});
|
|
226
227
|
yield refresh();
|
|
227
228
|
});
|
|
229
|
+
const getWaasWallets = React.useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
228
230
|
return {
|
|
229
231
|
createWalletAccount,
|
|
230
232
|
dynamicWaasIsEnabled,
|
|
233
|
+
getWaasWallets,
|
|
231
234
|
getWalletConnector,
|
|
232
235
|
importPrivateKey,
|
|
233
236
|
shouldAutoCreateDynamicWaasWallet,
|
|
@@ -14,6 +14,7 @@ export declare const useDynamicWaas: () => {
|
|
|
14
14
|
rawPublicKey: string | Uint8Array | undefined;
|
|
15
15
|
} | undefined)[]>;
|
|
16
16
|
dynamicWaasIsEnabled: boolean;
|
|
17
|
+
getWaasWallets: () => import("@dynamic-labs/wallet-connector-core").Wallet<import("@dynamic-labs/wallet-connector-core").WalletConnectorCore.WalletConnector>[];
|
|
17
18
|
getWalletConnector: (chainName: string) => IDynamicWaasConnector | undefined;
|
|
18
19
|
importPrivateKey: ({ chainName, privateKey, }: {
|
|
19
20
|
chainName: string;
|
|
@@ -3,6 +3,7 @@ import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { useCallback, useMemo } from 'react';
|
|
4
4
|
import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { useUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
6
7
|
import '../../constants/values.js';
|
|
7
8
|
import '@dynamic-labs/multi-wallet';
|
|
8
9
|
import { getAuthToken } from '../../functions/getAuthToken/getAuthToken.js';
|
|
@@ -32,7 +33,6 @@ import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
|
32
33
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
33
34
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
34
35
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
35
|
-
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
36
36
|
import '../../../config/ApiEndpoint.js';
|
|
37
37
|
import '../../../locale/locale.js';
|
|
38
38
|
import '../../../store/state/authMode/authMode.js';
|
|
@@ -118,6 +118,7 @@ const useDynamicWaas = () => {
|
|
|
118
118
|
const walletConnectorOptions = useWalletConnectorOptions();
|
|
119
119
|
const refresh = useRefreshUser();
|
|
120
120
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
121
|
+
const userWallets = useUserWallets();
|
|
121
122
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
122
123
|
const enabledChains = (_c = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations) === null || _c === void 0 ? void 0 : _c.filter((c) => c.enabled);
|
|
123
124
|
const primaryChain = enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary);
|
|
@@ -221,9 +222,11 @@ const useDynamicWaas = () => {
|
|
|
221
222
|
});
|
|
222
223
|
yield refresh();
|
|
223
224
|
});
|
|
225
|
+
const getWaasWallets = useCallback(() => userWallets.filter((w) => w.key === 'dynamicwaas'), [userWallets]);
|
|
224
226
|
return {
|
|
225
227
|
createWalletAccount,
|
|
226
228
|
dynamicWaasIsEnabled,
|
|
229
|
+
getWaasWallets,
|
|
227
230
|
getWalletConnector,
|
|
228
231
|
importPrivateKey,
|
|
229
232
|
shouldAutoCreateDynamicWaasWallet,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useExchangeAccounts';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Account, CreateExchangeTransferRequest, ExchangeKeyEnum, ExchangeTransferResponse } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
type Props = {
|
|
3
|
+
exchange: ExchangeKeyEnum;
|
|
4
|
+
};
|
|
5
|
+
type TransferProps = {
|
|
6
|
+
exchange: ExchangeKeyEnum;
|
|
7
|
+
transferRequest: CreateExchangeTransferRequest;
|
|
8
|
+
};
|
|
9
|
+
export declare const useExchangeAccounts: () => {
|
|
10
|
+
exchangeTransfer: ({ exchange, transferRequest, }: TransferProps) => Promise<ExchangeTransferResponse>;
|
|
11
|
+
getExchangeUserAccounts: ({ exchange, }: Props) => Promise<Account[]>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -10,7 +10,7 @@ var logger = require('../../../shared/logger.cjs');
|
|
|
10
10
|
require('@dynamic-labs/iconic');
|
|
11
11
|
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('react/jsx-runtime');
|
|
13
|
-
require('../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
14
14
|
require('@dynamic-labs/wallet-book');
|
|
15
15
|
require('@dynamic-labs/utils');
|
|
16
16
|
require('../../constants/colors.cjs');
|
|
@@ -101,6 +101,7 @@ var useInternalDynamicContext = require('../../../context/DynamicContext/useDyna
|
|
|
101
101
|
const useSyncDynamicWaas = () => {
|
|
102
102
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
103
103
|
const { loading: globalLoading } = LoadingContext.useLoadingContext();
|
|
104
|
+
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
104
105
|
const { user: user$1 } = user.useUser();
|
|
105
106
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
106
107
|
const walletConnectorOptions = walletOptions.useWalletConnectorOptions();
|
|
@@ -119,7 +120,8 @@ const useSyncDynamicWaas = () => {
|
|
|
119
120
|
}
|
|
120
121
|
catch (error) {
|
|
121
122
|
logger.logger.error('Error creating dynamic waas wallet', error);
|
|
122
|
-
setShowAuthFlow(
|
|
123
|
+
setShowAuthFlow(true);
|
|
124
|
+
clearStackAndPush('backup-unsuccessful');
|
|
123
125
|
}
|
|
124
126
|
});
|
|
125
127
|
const shouldSyncCreateWallet = shouldAutoCreateDynamicWaasWallet && !triggeredCreate.current;
|
|
@@ -6,7 +6,7 @@ import { logger } from '../../../shared/logger.js';
|
|
|
6
6
|
import '@dynamic-labs/iconic';
|
|
7
7
|
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'react/jsx-runtime';
|
|
9
|
-
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
10
10
|
import '@dynamic-labs/wallet-book';
|
|
11
11
|
import '@dynamic-labs/utils';
|
|
12
12
|
import '../../constants/colors.js';
|
|
@@ -97,6 +97,7 @@ import { useInternalDynamicContext } from '../../../context/DynamicContext/useDy
|
|
|
97
97
|
const useSyncDynamicWaas = () => {
|
|
98
98
|
const { primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
99
99
|
const { loading: globalLoading } = useLoadingContext();
|
|
100
|
+
const { clearStackAndPush } = useViewContext();
|
|
100
101
|
const { user } = useUser();
|
|
101
102
|
const projectSettings = useProjectSettings();
|
|
102
103
|
const walletConnectorOptions = useWalletConnectorOptions();
|
|
@@ -115,7 +116,8 @@ const useSyncDynamicWaas = () => {
|
|
|
115
116
|
}
|
|
116
117
|
catch (error) {
|
|
117
118
|
logger.error('Error creating dynamic waas wallet', error);
|
|
118
|
-
setShowAuthFlow(
|
|
119
|
+
setShowAuthFlow(true);
|
|
120
|
+
clearStackAndPush('backup-unsuccessful');
|
|
119
121
|
}
|
|
120
122
|
});
|
|
121
123
|
const shouldSyncCreateWallet = shouldAutoCreateDynamicWaasWallet && !triggeredCreate.current;
|
|
@@ -98,6 +98,7 @@ var SignMessageConfirmationModal = require('../../../modals/SignMessageConfirmat
|
|
|
98
98
|
var SyncWalletPromptModal = require('../../../modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs');
|
|
99
99
|
var TransactionConfirmationModal = require('../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
|
|
100
100
|
var AddNetworkModal = require('../../../modals/AddNetworkModal/AddNetworkModal.cjs');
|
|
101
|
+
var ZkSyncApprovalModal = require('../../../modals/ZkSyncApprovalModal/ZkSyncApprovalModal.cjs');
|
|
101
102
|
|
|
102
103
|
const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
103
104
|
const confirmationStateRef = React.useRef('enabled');
|
|
@@ -114,6 +115,9 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
114
115
|
const { modal: addNetworkModal, open: openAddNetwork } = useConfirmationModal.useConfirmationModal({
|
|
115
116
|
elementId: 'dynamic-prompt-to-add-network',
|
|
116
117
|
});
|
|
118
|
+
const { modal: zkSyncCreateSessionModal, open: openZkSyncCreateSession } = useConfirmationModal.useConfirmationModal({
|
|
119
|
+
elementId: 'dynamic-zksync-approval',
|
|
120
|
+
});
|
|
117
121
|
const shouldConfirmAction = React.useCallback(() => {
|
|
118
122
|
if (confirmationStateRef.current === 'disabled') {
|
|
119
123
|
confirmationStateRef.current = 'enabled';
|
|
@@ -174,6 +178,9 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
174
178
|
const addNetwork = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ handler, network, walletConnector }) {
|
|
175
179
|
yield openAddNetwork((resolve) => (jsxRuntime.jsx(AddNetworkModal.AddNetworkModal, { network: network, walletConnector: walletConnector, onCancel: resolve, onNetworkAdded: resolve, addNetworkMutation: handler })));
|
|
176
180
|
}), [openAddNetwork]);
|
|
181
|
+
const zkSyncCreateSession = React.useCallback((_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ session: sessionConfig }) {
|
|
182
|
+
return yield openZkSyncCreateSession((resolve, reject) => (jsxRuntime.jsx(ZkSyncApprovalModal.ZkSyncApprovalModal, { session: sessionConfig, onCancel: reject, onApproved: () => resolve(true) })));
|
|
183
|
+
}), [openZkSyncCreateSession]);
|
|
177
184
|
const disabledConfirmationOnce = React.useCallback(() => {
|
|
178
185
|
confirmationStateRef.current = 'disabled';
|
|
179
186
|
}, []);
|
|
@@ -184,6 +191,7 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
184
191
|
signMessage,
|
|
185
192
|
signTransaction,
|
|
186
193
|
syncWallet,
|
|
194
|
+
zkSyncCreateSession,
|
|
187
195
|
}), [
|
|
188
196
|
signMessage,
|
|
189
197
|
signTransaction,
|
|
@@ -191,18 +199,21 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
191
199
|
sendTransaction,
|
|
192
200
|
syncWallet,
|
|
193
201
|
addNetwork,
|
|
202
|
+
zkSyncCreateSession,
|
|
194
203
|
]);
|
|
195
204
|
return React.useMemo(() => [
|
|
196
205
|
signMessageModal ||
|
|
197
206
|
sendTransactionModal ||
|
|
198
207
|
syncWalletPromptModal ||
|
|
199
|
-
addNetworkModal
|
|
208
|
+
addNetworkModal ||
|
|
209
|
+
zkSyncCreateSessionModal,
|
|
200
210
|
walletUiUtils,
|
|
201
211
|
], [
|
|
202
212
|
signMessageModal,
|
|
203
213
|
sendTransactionModal,
|
|
204
214
|
syncWalletPromptModal,
|
|
205
215
|
addNetworkModal,
|
|
216
|
+
zkSyncCreateSessionModal,
|
|
206
217
|
walletUiUtils,
|
|
207
218
|
]);
|
|
208
219
|
};
|
|
@@ -94,6 +94,7 @@ import { SignMessageConfirmationModal } from '../../../modals/SignMessageConfirm
|
|
|
94
94
|
import { SyncWalletPromptModal } from '../../../modals/SyncWalletPromptModal/SyncWalletPromptModal.js';
|
|
95
95
|
import { TransactionConfirmationModal } from '../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
|
|
96
96
|
import { AddNetworkModal } from '../../../modals/AddNetworkModal/AddNetworkModal.js';
|
|
97
|
+
import { ZkSyncApprovalModal } from '../../../modals/ZkSyncApprovalModal/ZkSyncApprovalModal.js';
|
|
97
98
|
|
|
98
99
|
const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
99
100
|
const confirmationStateRef = useRef('enabled');
|
|
@@ -110,6 +111,9 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
110
111
|
const { modal: addNetworkModal, open: openAddNetwork } = useConfirmationModal({
|
|
111
112
|
elementId: 'dynamic-prompt-to-add-network',
|
|
112
113
|
});
|
|
114
|
+
const { modal: zkSyncCreateSessionModal, open: openZkSyncCreateSession } = useConfirmationModal({
|
|
115
|
+
elementId: 'dynamic-zksync-approval',
|
|
116
|
+
});
|
|
113
117
|
const shouldConfirmAction = useCallback(() => {
|
|
114
118
|
if (confirmationStateRef.current === 'disabled') {
|
|
115
119
|
confirmationStateRef.current = 'enabled';
|
|
@@ -170,6 +174,9 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
170
174
|
const addNetwork = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ handler, network, walletConnector }) {
|
|
171
175
|
yield openAddNetwork((resolve) => (jsx(AddNetworkModal, { network: network, walletConnector: walletConnector, onCancel: resolve, onNetworkAdded: resolve, addNetworkMutation: handler })));
|
|
172
176
|
}), [openAddNetwork]);
|
|
177
|
+
const zkSyncCreateSession = useCallback((_d) => __awaiter(void 0, [_d], void 0, function* ({ session: sessionConfig }) {
|
|
178
|
+
return yield openZkSyncCreateSession((resolve, reject) => (jsx(ZkSyncApprovalModal, { session: sessionConfig, onCancel: reject, onApproved: () => resolve(true) })));
|
|
179
|
+
}), [openZkSyncCreateSession]);
|
|
173
180
|
const disabledConfirmationOnce = useCallback(() => {
|
|
174
181
|
confirmationStateRef.current = 'disabled';
|
|
175
182
|
}, []);
|
|
@@ -180,6 +187,7 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
180
187
|
signMessage,
|
|
181
188
|
signTransaction,
|
|
182
189
|
syncWallet,
|
|
190
|
+
zkSyncCreateSession,
|
|
183
191
|
}), [
|
|
184
192
|
signMessage,
|
|
185
193
|
signTransaction,
|
|
@@ -187,18 +195,21 @@ const useWalletUiUtils = ({ hideEmbeddedWalletTransactionUIs = false, }) => {
|
|
|
187
195
|
sendTransaction,
|
|
188
196
|
syncWallet,
|
|
189
197
|
addNetwork,
|
|
198
|
+
zkSyncCreateSession,
|
|
190
199
|
]);
|
|
191
200
|
return useMemo(() => [
|
|
192
201
|
signMessageModal ||
|
|
193
202
|
sendTransactionModal ||
|
|
194
203
|
syncWalletPromptModal ||
|
|
195
|
-
addNetworkModal
|
|
204
|
+
addNetworkModal ||
|
|
205
|
+
zkSyncCreateSessionModal,
|
|
196
206
|
walletUiUtils,
|
|
197
207
|
], [
|
|
198
208
|
signMessageModal,
|
|
199
209
|
sendTransactionModal,
|
|
200
210
|
syncWalletPromptModal,
|
|
201
211
|
addNetworkModal,
|
|
212
|
+
zkSyncCreateSessionModal,
|
|
202
213
|
walletUiUtils,
|
|
203
214
|
]);
|
|
204
215
|
};
|