@dynamic-labs/sdk-react-core 0.18.100-viem.0 → 0.18.100-viem.10
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 +111 -1
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +10 -10
- package/src/index.cjs +4 -0
- package/src/index.js +2 -0
- package/src/lib/Main.cjs +5 -0
- package/src/lib/Main.js +5 -0
- package/src/lib/components/Button/Button.cjs +10 -7
- package/src/lib/components/Button/Button.js +10 -7
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
- package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
- package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +1 -1
- package/src/lib/components/ListTile/ListTile.cjs +1 -1
- package/src/lib/components/ListTile/ListTile.js +1 -1
- package/src/lib/components/ListTile/ListTile.types.d.ts +1 -0
- package/src/lib/components/MenuList/Dropdown/Dropdown.cjs +1 -1
- package/src/lib/components/MenuList/Dropdown/Dropdown.js +1 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.cjs +6 -2
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.d.ts +2 -1
- package/src/lib/components/ModalHeaderBanner/ModalHeaderBanner.js +6 -2
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +5 -3
- package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +2 -0
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +5 -3
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -1
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +2 -2
- package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +2 -2
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
- package/src/lib/components/UserProfile/UserProfile.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +15 -4
- package/src/lib/context/DynamicContext/DynamicContext.js +17 -6
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs +13 -3
- package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js +13 -3
- package/src/lib/context/DynamicContext/internalEvents/index.d.ts +2 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.cjs +14 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +8 -0
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.js +6 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +6 -3
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +2 -1
- package/src/lib/context/SendBalanceContext/SendBalanceContext.types.d.ts +2 -2
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +2 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +2 -1
- package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
- package/src/lib/data/api.cjs +33 -1
- package/src/lib/data/api.d.ts +3 -1
- package/src/lib/data/api.js +34 -4
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +10 -2
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +10 -2
- package/src/lib/main.global.cjs +1 -1
- package/src/lib/main.global.js +1 -1
- package/src/lib/modals/SendBalanceModal/SendBalanceModal.d.ts +2 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +11 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +11 -2
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +6 -3
- package/src/lib/shared/assets/double-arrow-right.cjs +53 -0
- package/src/lib/shared/assets/double-arrow-right.js +29 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs +28 -2
- package/src/lib/shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.js +28 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/errors.cjs +7 -0
- package/src/lib/utils/constants/errors.d.ts +1 -0
- package/src/lib/utils/constants/errors.js +3 -0
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/localStorage.cjs +2 -0
- package/src/lib/utils/constants/localStorage.d.ts +1 -0
- package/src/lib/utils/constants/localStorage.js +2 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +1 -1
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -1
- package/src/lib/utils/functions/digestSHA256/digestSHA256.cjs +11 -0
- package/src/lib/utils/functions/digestSHA256/digestSHA256.d.ts +1 -0
- package/src/lib/utils/functions/digestSHA256/digestSHA256.js +7 -0
- package/src/lib/utils/functions/digestSHA256/index.d.ts +1 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.cjs +14 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.d.ts +1 -0
- package/src/lib/utils/functions/encodeBase64URL/encodeBase64URL.js +10 -0
- package/src/lib/utils/functions/encodeBase64URL/index.d.ts +1 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.cjs +33 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.d.ts +1 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/getRedirectURIOrigin.js +29 -0
- package/src/lib/utils/functions/getRedirectURIOrigin/index.d.ts +1 -0
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.cjs +14 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.d.ts +3 -2
- package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.js +14 -2
- package/src/lib/utils/functions/index.d.ts +7 -0
- package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
- package/src/lib/utils/functions/isMagicConnector/isMagicConnector.js +6 -0
- package/src/lib/utils/functions/randomString/index.d.ts +1 -0
- package/src/lib/utils/functions/randomString/randomString.cjs +14 -0
- package/src/lib/utils/functions/randomString/randomString.d.ts +1 -0
- package/src/lib/utils/functions/randomString/randomString.js +10 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/index.d.ts +1 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.cjs +48 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.d.ts +18 -0
- package/src/lib/utils/functions/sendTransactionWithAutoNonce/sendTransactionWithAutoNonce.js +43 -0
- package/src/lib/utils/functions/stringifyURIQuery/index.d.ts +1 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.cjs +13 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.d.ts +1 -0
- package/src/lib/utils/functions/stringifyURIQuery/stringifyURIQuery.js +9 -0
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +10 -4
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +2 -1
- package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +11 -5
- package/src/lib/utils/hooks/index.d.ts +2 -0
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +19 -3
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
- package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +20 -4
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +15 -9
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -1
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +15 -9
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +16 -18
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +17 -19
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.cjs +7 -6
- package/src/lib/utils/hooks/useConnectedWalletsNetworkValidation/useConnectedWalletsNetworkValidation.js +7 -6
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +2 -7
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +16 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +2 -0
- package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +12 -0
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +6 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +2 -1
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +6 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +149 -26
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +5 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +151 -28
- package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +31 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +20 -0
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +27 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +56 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
- package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +52 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -2
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +5 -1
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -2
- package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -2
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +9 -3
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +9 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +4 -0
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +4 -0
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +13 -4
- package/src/lib/views/EmailUpdate/EmailUpdate.js +13 -4
- package/src/lib/views/EmailVerification/EmailVerification.cjs +12 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +14 -3
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +3 -2
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +3 -2
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +4 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +4 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +1 -1
- package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +111 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +2 -0
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +107 -0
- package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +4 -2
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +4 -2
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +4 -2
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +4 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +14 -35
- package/src/lib/views/SendBalanceView/SendBalanceView.d.ts +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.js +15 -36
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +67 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +63 -0
- package/src/lib/views/SendBalanceView/components/TransactionStage/index.d.ts +1 -0
- package/src/lib/views/SendBalanceView/components/index.d.ts +1 -0
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +1 -2
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +31 -8
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +4 -3
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +32 -9
- package/src/lib/views/TransactionConfirmationView/hooks/index.d.ts +2 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +69 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts +11 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +65 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +14 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +6 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +10 -0
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.cjs +1 -0
- package/src/lib/views/WalletGroupView/components/WalletGroupItem/WalletGroupItem.js +1 -0
- package/src/lib/views/WalletList/WalletList.cjs +4 -1
- package/src/lib/views/WalletList/WalletList.js +4 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +20 -4
- package/src/lib/views/WalletLockedView/WalletLockedView.js +20 -4
- package/src/lib/views/viewToComponentMap.cjs +2 -0
- package/src/lib/views/viewToComponentMap.js +2 -0
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs +4 -1
- package/src/lib/widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js +4 -1
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.cjs +13 -0
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.d.ts +2 -0
- package/src/lib/widgets/OAuthIFrameContainer/OAuthIFrameContainer.js +9 -0
- package/src/lib/widgets/OAuthIFrameContainer/index.d.ts +1 -0
- package/src/lib/widgets/index.d.ts +1 -0
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/index.d.ts +0 -1
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.cjs +0 -104
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +0 -17
- package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +0 -100
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import { useMemo } from 'react';
|
|
3
|
-
import { parseEther } from 'viem';
|
|
4
|
+
import { parseEther, isHex, hexToBigInt } from 'viem';
|
|
4
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
5
6
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
6
7
|
import '@dynamic-labs/sdk-api';
|
|
@@ -42,7 +43,8 @@ import 'yup';
|
|
|
42
43
|
import '../../components/InlineWidget/InlineWidget.js';
|
|
43
44
|
import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
44
45
|
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
45
|
-
import {
|
|
46
|
+
import { useTransactionGas } from './hooks/useTransactionGas/useTransactionGas.js';
|
|
47
|
+
import { useTransactionTotal } from './hooks/useTransactionTotal/useTransactionTotal.js';
|
|
46
48
|
import { transactionErrorMessage } from './helpers/transactionErrorMessage.js';
|
|
47
49
|
import '../../context/MockContext/MockContext.js';
|
|
48
50
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -50,23 +52,42 @@ import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
|
50
52
|
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
51
53
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
52
54
|
|
|
53
|
-
const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess, onClickBack, onClickClose, title, displayPoweredByDynamicFooter = false, }) => {
|
|
55
|
+
const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess, onClickBack, onClickClose, title, displayPoweredByDynamicFooter = false, provider, }) => {
|
|
54
56
|
const { appName, appLogoUrl, primaryWallet } = useInternalDynamicContext();
|
|
55
57
|
const appOrigin = getAppOrigin();
|
|
56
58
|
if (!primaryWallet) {
|
|
57
59
|
throw new DynamicError('Primary wallet is not available, transaction cannot be displayed');
|
|
58
60
|
}
|
|
59
61
|
const [currencySymbol] = useFetchCurrency(primaryWallet.connector);
|
|
60
|
-
const { data: balance } = usePromise(() =>
|
|
61
|
-
.getBalance()
|
|
62
|
-
|
|
62
|
+
const { data: balance } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const balanceText = yield primaryWallet.connector.getBalance();
|
|
64
|
+
return balanceText ? parseEther(balanceText) : undefined;
|
|
65
|
+
}));
|
|
63
66
|
const { mutate: send, isLoading, error: transactionError, } = useMutation(mutation, {
|
|
64
67
|
onFailure: (error) => onError === null || onError === void 0 ? void 0 : onError(error),
|
|
65
68
|
onSuccess: (tx) => onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(tx),
|
|
66
69
|
});
|
|
67
|
-
const { isLoading:
|
|
70
|
+
const { isLoading: isGasPriceLoading, gasTotalPrice, isGasEstimated, } = useTransactionGas({
|
|
71
|
+
provider,
|
|
68
72
|
transaction,
|
|
69
73
|
});
|
|
74
|
+
const { data: transactionToAddress, isLoading: isTransactionToAddressLoading, } = usePromise(() => transaction.to);
|
|
75
|
+
const { data: transactionFromAddress, isLoading: isTransactionFromAddressLoading, } = usePromise(() => transaction.from);
|
|
76
|
+
const { data: transactionValue, isLoading: isTransactionValueLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
+
const val = yield transaction.value;
|
|
78
|
+
if (isHex(val)) {
|
|
79
|
+
return hexToBigInt(val);
|
|
80
|
+
}
|
|
81
|
+
return val ? val : undefined;
|
|
82
|
+
}));
|
|
83
|
+
const total = useTransactionTotal({
|
|
84
|
+
gasTotalPrice,
|
|
85
|
+
transactionValue,
|
|
86
|
+
});
|
|
87
|
+
const isTransactionLoading = isTransactionValueLoading ||
|
|
88
|
+
isGasPriceLoading ||
|
|
89
|
+
isTransactionToAddressLoading ||
|
|
90
|
+
isTransactionFromAddressLoading;
|
|
70
91
|
const ChainIconComponent = getChainIcon(primaryWallet.chain);
|
|
71
92
|
const chainIcon = (jsx(Icon, { size: 'small', children: jsx(ChainIconComponent, {}) }));
|
|
72
93
|
const errorMessage = transactionError && transactionErrorMessage(transactionError);
|
|
@@ -87,8 +108,10 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
87
108
|
const amountLeft = formatBigNumber(missingFunds, 5);
|
|
88
109
|
return `Insufficient funds due to gas price increase from estimate. Please add ${amountLeft} ${currencySymbol} to continue.`;
|
|
89
110
|
}, [currencySymbol, hasInsufficientFunds, missingFunds]);
|
|
90
|
-
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton:
|
|
91
|
-
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: 'Amount', isLoading:
|
|
111
|
+
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, warningMessage: warningMessage, children: [jsx(TransactionRow, { label: 'From (You)', isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress(transactionFromAddress, 4, 4) }), jsx(TransactionRow, { label: 'To', isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
|
|
112
|
+
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: 'Amount', isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), jsx(TransactionRow, { label: isGasEstimated ? 'Gas (estimate)' : 'Gas', isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
113
|
+
? 'transaction-estimated-gas-fee'
|
|
114
|
+
: 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber(gasTotalPrice, 10) : 'N/A' }), jsx(TransactionRow, { label: 'Total', isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total ? formatBigNumber(total, 10) : 'N/A' })] }));
|
|
92
115
|
};
|
|
93
116
|
|
|
94
117
|
export { TransactionConfirmationView };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './useTransactionGas';
|
|
2
|
+
export * from './useTransactionTotal';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTransactionGas } from './useTransactionGas';
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
require('@dynamic-labs/utils');
|
|
8
|
+
require('@dynamic-labs/sdk-api');
|
|
9
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
10
|
+
require('../../../../shared/logger.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('react/jsx-runtime');
|
|
14
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
15
|
+
require('@dynamic-labs/wallet-book');
|
|
16
|
+
require('../../../../utils/constants/colors.cjs');
|
|
17
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('viem');
|
|
19
|
+
require('../../../../shared/consts/index.cjs');
|
|
20
|
+
require('@dynamic-labs/multi-wallet');
|
|
21
|
+
require('@dynamic-labs/rpc-providers');
|
|
22
|
+
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
23
|
+
require('../../../../context/DynamicContext/DynamicContext.cjs');
|
|
24
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
25
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
26
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
27
|
+
require('react-dom');
|
|
28
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
29
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
30
|
+
require('react-focus-lock');
|
|
31
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
32
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
33
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
34
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
35
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
36
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
37
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
38
|
+
require('formik');
|
|
39
|
+
require('yup');
|
|
40
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
41
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
42
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
43
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
44
|
+
var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
|
|
45
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
46
|
+
var useTransactionEstimatedGas = require('../../../../utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs');
|
|
47
|
+
|
|
48
|
+
const useTransactionGas = ({ provider, transaction, }) => {
|
|
49
|
+
const { data: estimatedGas, isLoading: isEstimatedGasLoading } = useTransactionEstimatedGas.useTransactionEstimatedGas(provider, transaction);
|
|
50
|
+
const { data: gasPrice, isLoading: isLoadingGasPrice } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
if (transaction.gasPrice) {
|
|
52
|
+
const { gasPrice } = transaction;
|
|
53
|
+
return gasPrice;
|
|
54
|
+
}
|
|
55
|
+
return provider.getGasPrice();
|
|
56
|
+
}), {
|
|
57
|
+
deps: [transaction.gasPrice],
|
|
58
|
+
});
|
|
59
|
+
const gasTotalPrice = React.useMemo(() => (gasPrice && estimatedGas ? gasPrice * estimatedGas : undefined), [gasPrice, estimatedGas]);
|
|
60
|
+
const isLoading = isEstimatedGasLoading || isLoadingGasPrice;
|
|
61
|
+
const isGasEstimated = Boolean(estimatedGas) && !transaction.gasPrice;
|
|
62
|
+
return {
|
|
63
|
+
gasTotalPrice,
|
|
64
|
+
isGasEstimated,
|
|
65
|
+
isLoading,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.useTransactionGas = useTransactionGas;
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PublicClient, TransactionRequest } from 'viem';
|
|
2
|
+
type UseTransactionGasProps = {
|
|
3
|
+
provider: PublicClient;
|
|
4
|
+
transaction: TransactionRequest;
|
|
5
|
+
};
|
|
6
|
+
export declare const useTransactionGas: ({ provider, transaction, }: UseTransactionGasProps) => {
|
|
7
|
+
gasTotalPrice: bigint | undefined;
|
|
8
|
+
isGasEstimated: boolean;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import '@dynamic-labs/utils';
|
|
4
|
+
import '@dynamic-labs/sdk-api';
|
|
5
|
+
import '../../../../config/ApiEndpoint.js';
|
|
6
|
+
import '../../../../shared/logger.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
import 'react/jsx-runtime';
|
|
10
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
11
|
+
import '@dynamic-labs/wallet-book';
|
|
12
|
+
import '../../../../utils/constants/colors.js';
|
|
13
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import 'viem';
|
|
15
|
+
import '../../../../shared/consts/index.js';
|
|
16
|
+
import '@dynamic-labs/multi-wallet';
|
|
17
|
+
import '@dynamic-labs/rpc-providers';
|
|
18
|
+
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
19
|
+
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
20
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
21
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
22
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
23
|
+
import 'react-dom';
|
|
24
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
25
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
26
|
+
import 'react-focus-lock';
|
|
27
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
28
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
29
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
30
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
31
|
+
import '../../../../components/Alert/Alert.js';
|
|
32
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
33
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
34
|
+
import 'formik';
|
|
35
|
+
import 'yup';
|
|
36
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
37
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
38
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
39
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
40
|
+
import { usePromise } from '../../../../utils/hooks/usePromise/usePromise.js';
|
|
41
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
42
|
+
import { useTransactionEstimatedGas } from '../../../../utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js';
|
|
43
|
+
|
|
44
|
+
const useTransactionGas = ({ provider, transaction, }) => {
|
|
45
|
+
const { data: estimatedGas, isLoading: isEstimatedGasLoading } = useTransactionEstimatedGas(provider, transaction);
|
|
46
|
+
const { data: gasPrice, isLoading: isLoadingGasPrice } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
if (transaction.gasPrice) {
|
|
48
|
+
const { gasPrice } = transaction;
|
|
49
|
+
return gasPrice;
|
|
50
|
+
}
|
|
51
|
+
return provider.getGasPrice();
|
|
52
|
+
}), {
|
|
53
|
+
deps: [transaction.gasPrice],
|
|
54
|
+
});
|
|
55
|
+
const gasTotalPrice = useMemo(() => (gasPrice && estimatedGas ? gasPrice * estimatedGas : undefined), [gasPrice, estimatedGas]);
|
|
56
|
+
const isLoading = isEstimatedGasLoading || isLoadingGasPrice;
|
|
57
|
+
const isGasEstimated = Boolean(estimatedGas) && !transaction.gasPrice;
|
|
58
|
+
return {
|
|
59
|
+
gasTotalPrice,
|
|
60
|
+
isGasEstimated,
|
|
61
|
+
isLoading,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useTransactionGas };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTransactionTotal } from './useTransactionTotal';
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => React.useMemo(() => {
|
|
8
|
+
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
9
|
+
return gasTotalPrice + transactionValue;
|
|
10
|
+
}
|
|
11
|
+
return transactionValue || gasTotalPrice;
|
|
12
|
+
}, [gasTotalPrice, transactionValue]);
|
|
13
|
+
|
|
14
|
+
exports.useTransactionTotal = useTransactionTotal;
|
package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
const useTransactionTotal = ({ transactionValue, gasTotalPrice, }) => useMemo(() => {
|
|
4
|
+
if (gasTotalPrice !== undefined && transactionValue !== undefined) {
|
|
5
|
+
return gasTotalPrice + transactionValue;
|
|
6
|
+
}
|
|
7
|
+
return transactionValue || gasTotalPrice;
|
|
8
|
+
}, [gasTotalPrice, transactionValue]);
|
|
9
|
+
|
|
10
|
+
export { useTransactionTotal };
|
|
@@ -13,6 +13,7 @@ require('@dynamic-labs/wallet-book');
|
|
|
13
13
|
var getWalletListItemLabel = require('../../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs');
|
|
14
14
|
require('viem');
|
|
15
15
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
16
17
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
17
18
|
var stroke = require('../../../../shared/assets/stroke.cjs');
|
|
18
19
|
require('../../../../shared/consts/index.cjs');
|
|
@@ -9,6 +9,7 @@ import '@dynamic-labs/wallet-book';
|
|
|
9
9
|
import { getWalletListItemLabel } from '../../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js';
|
|
10
10
|
import 'viem';
|
|
11
11
|
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
12
13
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
13
14
|
import { ReactComponent as SvgStroke } from '../../../../shared/assets/stroke.js';
|
|
14
15
|
import '../../../../shared/consts/index.js';
|
|
@@ -78,7 +78,10 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
78
78
|
};
|
|
79
79
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'wallet-list__container', children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), !projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsxRuntime.jsx(Search.Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxRuntime.jsxs("div", { className: classNames.classNames('wallet-list__scroll-container', {
|
|
80
80
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
81
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) =>
|
|
81
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsxRuntime.jsx(Skeleton.Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [wallets.length === 0 && (jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsxRuntime.jsx(noWalletFound.ReactComponent, {}) })) : (walletsList.map((wallet) => {
|
|
82
|
+
var _a;
|
|
83
|
+
return (jsxRuntime.jsx(WalletListItem.WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
84
|
+
}))] })), isSearchEnabled && !filterValue && projectSettings && (jsxRuntime.jsx(SearchNotFoundMessage.SearchNotFoundMessage, {}))] })] }), noDefaultFooter && (jsxRuntime.jsx("div", { className: classNames.classNames('wallet-list__tiny-footer', {
|
|
82
85
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
83
86
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
84
87
|
};
|
|
@@ -74,7 +74,10 @@ const WalletList = ({ isWalletConnectList = false, }) => {
|
|
|
74
74
|
};
|
|
75
75
|
return (jsxs(Fragment, { children: [jsxs("div", { className: 'wallet-list__container', children: [error && jsx(ErrorContainer, { children: error }), !projectSettings ? (jsx(Skeleton, { className: 'wallet-list__search-skeleton' })) : (isSearchEnabled && (jsx(Search, { label: `Search through ${numberOfWallets} wallets...`, value: filterValue, onChange: ({ target: { value } }) => handleFilterValueChange(value), onClickClear: () => handleFilterValueChange('') }))), jsxs("div", { className: classNames('wallet-list__scroll-container', {
|
|
76
76
|
'wallet-list__scroll-container--full-height': isSearchEnabled,
|
|
77
|
-
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) =>
|
|
77
|
+
}), "data-testid": 'wallet-list-scroll-container', ref: walletListScrollRef, onScroll: handleScroll, children: [!projectSettings ? (jsx(Skeleton, { count: 10, className: 'wallet-list__tile-skeleton' })) : (jsxs(Fragment, { children: [wallets.length === 0 && (jsx(ErrorContainer, { children: "Oops, no login methods have been configured." })), wallets.length && walletsList.length === 0 ? (jsx(SearchNotFoundMessage, { title: 'No wallet found.', subtitle: 'Try searching for a different wallet', image: jsx(SvgNoWalletFound, {}) })) : (walletsList.map((wallet) => {
|
|
78
|
+
var _a;
|
|
79
|
+
return (jsx(WalletListItem, { wallet: wallet, usingMultiWallet: isUsingMultiWallet, onResetSearchValue: () => handleFilterValueChange('') }, wallet.key + ((_a = wallet.groupedWallets) === null || _a === void 0 ? void 0 : _a.length)));
|
|
80
|
+
}))] })), isSearchEnabled && !filterValue && projectSettings && (jsx(SearchNotFoundMessage, {}))] })] }), noDefaultFooter && (jsx("div", { className: classNames('wallet-list__tiny-footer', {
|
|
78
81
|
'wallet-list__tiny-footer--hidden': footerIsVisible,
|
|
79
82
|
}), "data-testid": 'wallet-list-tiny-footer' }))] }));
|
|
80
83
|
};
|
|
@@ -16,11 +16,11 @@ require('@dynamic-labs/wallet-connector-core');
|
|
|
16
16
|
var getWalletListItemLabel = require('../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.cjs');
|
|
17
17
|
require('viem');
|
|
18
18
|
require('../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
require('@dynamic-labs/utils');
|
|
19
20
|
require('../../../shared/consts/index.cjs');
|
|
20
21
|
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
21
22
|
require('../../../utils/constants/colors.cjs');
|
|
22
23
|
require('@dynamic-labs/multi-wallet');
|
|
23
|
-
require('@dynamic-labs/utils');
|
|
24
24
|
var pixelToRem = require('../../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
25
25
|
require('../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
26
26
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -12,11 +12,11 @@ import '@dynamic-labs/wallet-connector-core';
|
|
|
12
12
|
import { getWalletListItemLabel } from '../../../shared/utils/functions/getWalletListItemLabel/getWalletListItemLabel.js';
|
|
13
13
|
import 'viem';
|
|
14
14
|
import '../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import '@dynamic-labs/utils';
|
|
15
16
|
import '../../../shared/consts/index.js';
|
|
16
17
|
import '../../../context/DynamicContext/DynamicContext.js';
|
|
17
18
|
import '../../../utils/constants/colors.js';
|
|
18
19
|
import '@dynamic-labs/multi-wallet';
|
|
19
|
-
import '@dynamic-labs/utils';
|
|
20
20
|
import { pixelToRem } from '../../../utils/functions/pixelToRem/pixelToRem.js';
|
|
21
21
|
import '../../../components/ShadowDOM/ShadowDOM.js';
|
|
22
22
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
6
8
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
|
-
require('react');
|
|
8
9
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api');
|
|
10
|
-
require('../../shared/logger.cjs');
|
|
11
|
+
var logger = require('../../shared/logger.cjs');
|
|
11
12
|
require('@dynamic-labs/iconic');
|
|
12
13
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
14
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
@@ -51,15 +52,30 @@ require('../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
|
51
52
|
|
|
52
53
|
const iconSize = 64;
|
|
53
54
|
const WalletLockedView = () => {
|
|
54
|
-
const { handleLogOut, primaryWallet, setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
55
|
+
const { handleLogOut, primaryWallet, setShowAuthFlow, appName, authToken } = useInternalDynamicContext.useInternalDynamicContext();
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
// when there is no valid session, we want to log user out
|
|
58
|
+
if (!authToken) {
|
|
59
|
+
handleLogOut();
|
|
60
|
+
}
|
|
61
|
+
}, [authToken, handleLogOut]);
|
|
55
62
|
if (!primaryWallet) {
|
|
56
63
|
return null;
|
|
57
64
|
}
|
|
65
|
+
const handleConnectWallet = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
yield primaryWallet.connector.connect();
|
|
68
|
+
setShowAuthFlow(false);
|
|
69
|
+
}
|
|
70
|
+
catch (_a) {
|
|
71
|
+
logger.logger.info('could not connect wallet');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
58
74
|
const icon = (jsxRuntime.jsx(walletBook.WalletIcon, { walletName: primaryWallet.connector.name, style: {
|
|
59
75
|
height: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
60
76
|
width: pixelToRem.pixelToRem(iconSize * IconWithSpinner.iconRatio),
|
|
61
77
|
} }));
|
|
62
|
-
return (jsxRuntime.jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, className: 'wallet-locked-view__error-container', children: "
|
|
78
|
+
return (jsxRuntime.jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsxRuntime.jsx(ErrorContainer.ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', children: "Connect your wallet to continue" }), jsxRuntime.jsxs("div", { className: 'wallet-locked-view__content', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', children: "Welcome back." }), jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', children: ["We couldn't connect to your wallet. Click connect to retry the connection ", appName, "."] }), jsxRuntime.jsx(Button.Button, { buttonRounded: 'default', onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', children: "Connect wallet" }), jsxRuntime.jsx(Divider.Divider, { text: 'Or' }), jsxRuntime.jsx(TextButton.TextButton, { className: 'wallet-locked-view__log-out', onClick: handleLogOut, children: "Log out" })] })] }));
|
|
63
79
|
};
|
|
64
80
|
|
|
65
81
|
exports.WalletLockedView = WalletLockedView;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useEffect } from 'react';
|
|
2
4
|
import { WalletIcon } from '@dynamic-labs/wallet-book';
|
|
3
|
-
import 'react';
|
|
4
5
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api';
|
|
6
|
-
import '../../shared/logger.js';
|
|
7
|
+
import { logger } from '../../shared/logger.js';
|
|
7
8
|
import '@dynamic-labs/iconic';
|
|
8
9
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
10
|
import '../../context/ViewContext/ViewContext.js';
|
|
@@ -47,15 +48,30 @@ import '../../components/MenuList/Dropdown/Dropdown.js';
|
|
|
47
48
|
|
|
48
49
|
const iconSize = 64;
|
|
49
50
|
const WalletLockedView = () => {
|
|
50
|
-
const { handleLogOut, primaryWallet, setShowAuthFlow } = useInternalDynamicContext();
|
|
51
|
+
const { handleLogOut, primaryWallet, setShowAuthFlow, appName, authToken } = useInternalDynamicContext();
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
// when there is no valid session, we want to log user out
|
|
54
|
+
if (!authToken) {
|
|
55
|
+
handleLogOut();
|
|
56
|
+
}
|
|
57
|
+
}, [authToken, handleLogOut]);
|
|
51
58
|
if (!primaryWallet) {
|
|
52
59
|
return null;
|
|
53
60
|
}
|
|
61
|
+
const handleConnectWallet = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
+
try {
|
|
63
|
+
yield primaryWallet.connector.connect();
|
|
64
|
+
setShowAuthFlow(false);
|
|
65
|
+
}
|
|
66
|
+
catch (_a) {
|
|
67
|
+
logger.info('could not connect wallet');
|
|
68
|
+
}
|
|
69
|
+
});
|
|
54
70
|
const icon = (jsx(WalletIcon, { walletName: primaryWallet.connector.name, style: {
|
|
55
71
|
height: pixelToRem(iconSize * iconRatio),
|
|
56
72
|
width: pixelToRem(iconSize * iconRatio),
|
|
57
73
|
} }));
|
|
58
|
-
return (jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsx(ErrorContainer, { withIcon: false, className: 'wallet-locked-view__error-container', children: "
|
|
74
|
+
return (jsxs("div", { "data-testid": 'wallet-locked-view', children: [jsx(ErrorContainer, { withIcon: false, variant: 'success', className: 'wallet-locked-view__error-container', children: "Connect your wallet to continue" }), jsxs("div", { className: 'wallet-locked-view__content', children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, className: 'wallet-locked-view__icon', isSpinning: true }), jsx(Typography, { variant: 'title', color: 'primary', weight: 'medium', className: 'wallet-locked-view__title', children: "Welcome back." }), jsxs(Typography, { variant: 'body_normal', color: 'secondary', weight: 'regular', children: ["We couldn't connect to your wallet. Click connect to retry the connection ", appName, "."] }), jsx(Button, { buttonRounded: 'default', onClick: () => handleConnectWallet(), buttonClassName: 'wallet-locked-view__button', children: "Connect wallet" }), jsx(Divider, { text: 'Or' }), jsx(TextButton, { className: 'wallet-locked-view__log-out', onClick: handleLogOut, children: "Log out" })] })] }));
|
|
59
75
|
};
|
|
60
76
|
|
|
61
77
|
export { WalletLockedView };
|
|
@@ -29,6 +29,7 @@ var BridgeWelcomeView = require('./BridgeWelcomeView/BridgeWelcomeView.cjs');
|
|
|
29
29
|
var BridgeSummaryView = require('./BridgeSummaryView/BridgeSummaryView.cjs');
|
|
30
30
|
var BridgeNextWalletConnectionView = require('./BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.cjs');
|
|
31
31
|
var AccountExistsView = require('./AccountExistsView/AccountExistsView.cjs');
|
|
32
|
+
var MergeUserAccountsView = require('./MergeUserAccountsView/MergeUserAccountsView.cjs');
|
|
32
33
|
|
|
33
34
|
const viewToComponentMap = {
|
|
34
35
|
'account-exists': jsxRuntime.jsx(AccountExistsView.AccountExistsView, {}),
|
|
@@ -44,6 +45,7 @@ const viewToComponentMap = {
|
|
|
44
45
|
'login-with-email-or-wallet': jsxRuntime.jsx(LoginWithEmailView.LoginWithEmailView, {}),
|
|
45
46
|
'login-with-email-or-wallet-full-wallet-list': jsxRuntime.jsx(WalletList.WalletList, {}),
|
|
46
47
|
'login-with-email-verification': jsxRuntime.jsx(EmailVerification.EmailVerification, {}),
|
|
48
|
+
'merge-user-accounts': jsxRuntime.jsx(MergeUserAccountsView.MergeUserAccountsView, {}),
|
|
47
49
|
'network-not-supported': jsxRuntime.jsx(NetworkNotSupported.NetworkNotSupported, {}),
|
|
48
50
|
'network-not-supported-manual': jsxRuntime.jsx(NetworkNotSupportedSwitchManual.NetworkNotSupportedSwitchManual, {}),
|
|
49
51
|
'no-access': jsxRuntime.jsx(NoAccess.NoAccess, {}),
|
|
@@ -25,6 +25,7 @@ import { BridgeWelcomeView } from './BridgeWelcomeView/BridgeWelcomeView.js';
|
|
|
25
25
|
import { BridgeSummaryView } from './BridgeSummaryView/BridgeSummaryView.js';
|
|
26
26
|
import { BridgeNextWalletConnectionView } from './BridgeNextWalletConnectionView/BridgeNextWalletConnectionView.js';
|
|
27
27
|
import { AccountExistsView } from './AccountExistsView/AccountExistsView.js';
|
|
28
|
+
import { MergeUserAccountsView } from './MergeUserAccountsView/MergeUserAccountsView.js';
|
|
28
29
|
|
|
29
30
|
const viewToComponentMap = {
|
|
30
31
|
'account-exists': jsx(AccountExistsView, {}),
|
|
@@ -40,6 +41,7 @@ const viewToComponentMap = {
|
|
|
40
41
|
'login-with-email-or-wallet': jsx(LoginWithEmailView, {}),
|
|
41
42
|
'login-with-email-or-wallet-full-wallet-list': jsx(WalletList, {}),
|
|
42
43
|
'login-with-email-verification': jsx(EmailVerification, {}),
|
|
44
|
+
'merge-user-accounts': jsx(MergeUserAccountsView, {}),
|
|
43
45
|
'network-not-supported': jsx(NetworkNotSupported, {}),
|
|
44
46
|
'network-not-supported-manual': jsx(NetworkNotSupportedSwitchManual, {}),
|
|
45
47
|
'no-access': jsx(NoAccess, {}),
|
|
@@ -18,7 +18,10 @@ const useFetchCurrency = (connector, network) => {
|
|
|
18
18
|
setCurrency(chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol);
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const network = connector.connectedChain === 'STARK'
|
|
22
|
+
? 'starknetNetworks'
|
|
23
|
+
: 'evmNetworks';
|
|
24
|
+
const result = (_b = connector[network]) === null || _b === void 0 ? void 0 : _b.find((element) => element.chainId === chainId);
|
|
22
25
|
setCurrency((_d = (_c = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _c === void 0 ? void 0 : _c.symbol) !== null && _d !== void 0 ? _d : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol);
|
|
23
26
|
return [currency];
|
|
24
27
|
});
|
|
@@ -14,7 +14,10 @@ const useFetchCurrency = (connector, network) => {
|
|
|
14
14
|
setCurrency(chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol);
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const network = connector.connectedChain === 'STARK'
|
|
18
|
+
? 'starknetNetworks'
|
|
19
|
+
: 'evmNetworks';
|
|
20
|
+
const result = (_b = connector[network]) === null || _b === void 0 ? void 0 : _b.find((element) => element.chainId === chainId);
|
|
18
21
|
setCurrency((_d = (_c = result === null || result === void 0 ? void 0 : result.nativeCurrency) === null || _c === void 0 ? void 0 : _c.symbol) !== null && _d !== void 0 ? _d : chainInfo === null || chainInfo === void 0 ? void 0 : chainInfo.symbol);
|
|
19
22
|
return [currency];
|
|
20
23
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
// we need to use an iframe to be the intermediary in communications between the oauth popup and the sdk
|
|
8
|
+
// because of twitter limitations with accessing the window.opener and BroadcastChannel not working between
|
|
9
|
+
// different origins (our api redirect page and the app where the sdk is running)
|
|
10
|
+
// https://linear.app/dynamic-labs/issue/GVTY-17/[frontend]-fix-twitter-linking
|
|
11
|
+
const OAuthIFrameContainer = () => (jsxRuntime.jsx("div", { id: 'oauth-iframe-container', "data-testid": 'oauth-iframe-container', style: { height: 0, visibility: 'hidden', width: 0 } }));
|
|
12
|
+
|
|
13
|
+
exports.OAuthIFrameContainer = OAuthIFrameContainer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
// we need to use an iframe to be the intermediary in communications between the oauth popup and the sdk
|
|
4
|
+
// because of twitter limitations with accessing the window.opener and BroadcastChannel not working between
|
|
5
|
+
// different origins (our api redirect page and the app where the sdk is running)
|
|
6
|
+
// https://linear.app/dynamic-labs/issue/GVTY-17/[frontend]-fix-twitter-linking
|
|
7
|
+
const OAuthIFrameContainer = () => (jsx("div", { id: 'oauth-iframe-container', "data-testid": 'oauth-iframe-container', style: { height: 0, visibility: 'hidden', width: 0 } }));
|
|
8
|
+
|
|
9
|
+
export { OAuthIFrameContainer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OAuthIFrameContainer } from './OAuthIFrameContainer';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useTransactionData } from './useTransactionData';
|