@dynamic-labs/sdk-react-core 0.16.17-viem.0 → 0.16.18
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 +10 -2
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +6 -6
- package/src/index.cjs +1 -1
- package/src/index.js +1 -1
- package/src/lib/Main.cjs +1 -1
- package/src/lib/Main.js +1 -1
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
- package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
- package/src/lib/components/AnimatePresence/AnimatePresence.cjs +1 -1
- package/src/lib/components/AnimatePresence/AnimatePresence.js +1 -1
- package/src/lib/components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.cjs +1 -1
- package/src/lib/components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.js +1 -1
- package/src/lib/components/Divider/Divider.cjs +1 -1
- package/src/lib/components/Divider/Divider.js +1 -1
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/ActionList/ActionList.js +1 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +1 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/Network/Network.js +1 -1
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +2 -2
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +2 -2
- package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +1 -1
- package/src/lib/components/OTPVerificationView/OTPVerificationView.js +1 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +1 -1
- package/src/lib/components/Tooltip/Tooltip.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.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/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +1 -1
- package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +1 -1
- package/src/lib/context/QrCodeContext/QrCodeContext.cjs +1 -1
- package/src/lib/context/QrCodeContext/QrCodeContext.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js +1 -1
- package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +12 -4
- package/src/lib/layout/DynamicAuthLayout/Header/header.js +12 -4
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +2 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +2 -2
- package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +3 -3
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +18 -25
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +19 -26
- package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +5 -4
- package/src/lib/shared/types/index.d.ts +0 -9
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +3 -3
- package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +3 -3
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +1 -1
- package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +1 -1
- package/src/lib/views/CollectUserDataView/UserDataFields/index.js +1 -1
- package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.cjs +1 -1
- package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.js +1 -1
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +1 -1
- package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +1 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -1
- package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.cjs +1 -1
- package/src/lib/views/EmailUpdate/EmailUpdate.js +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.cjs +1 -1
- package/src/lib/views/EmailVerification/EmailVerification.js +1 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
- package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +1 -1
- package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +1 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +1 -1
- package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -1
- package/src/lib/views/NoAccess/NoAccess.cjs +1 -1
- package/src/lib/views/NoAccess/NoAccess.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +1 -1
- package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +1 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +1 -1
- package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -1
- package/src/lib/views/QrCodeView/QrCodeView.js +1 -1
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.cjs +1 -1
- package/src/lib/views/WalletList/SearchInstead/SearchInstead.js +1 -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/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +3 -3
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -1
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
- 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/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.js +1 -1
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -1
|
@@ -22,7 +22,7 @@ import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransitio
|
|
|
22
22
|
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
23
23
|
import '../../../../config/ApiEndpoint.js';
|
|
24
24
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
25
|
-
import '
|
|
25
|
+
import 'ethers';
|
|
26
26
|
import '../../../../context/MockContext/MockContext.js';
|
|
27
27
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
28
28
|
import '../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -24,7 +24,7 @@ require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.
|
|
|
24
24
|
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
25
25
|
require('../../../config/ApiEndpoint.cjs');
|
|
26
26
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
27
|
-
require('
|
|
27
|
+
require('ethers');
|
|
28
28
|
require('../../../context/MockContext/MockContext.cjs');
|
|
29
29
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
30
|
require('../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
@@ -34,13 +34,21 @@ var Skeleton = require('../../../components/Skeleton/Skeleton.cjs');
|
|
|
34
34
|
var QrCodeContext = require('../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
35
35
|
|
|
36
36
|
const Header = ({ onClose: handleClose, heading, projectSettings, }) => {
|
|
37
|
-
const { clearStatesOnBackClick, loginWithEmail } = useInternalDynamicContext.useInternalDynamicContext();
|
|
37
|
+
const { clearStatesOnBackClick, loginWithEmail, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
|
|
38
38
|
const { showQrCodeMessage, setShowQrCodeImage, showQrCodeImage } = QrCodeContext.useQrCodeContext();
|
|
39
39
|
const { view, setView } = ViewContext.useViewContext();
|
|
40
40
|
const handleBackClick = React.useCallback(() => {
|
|
41
|
-
clearStatesOnBackClick();
|
|
42
41
|
setView(loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list');
|
|
43
|
-
|
|
42
|
+
// on back button click in Coinbase wallet clearing state would kill connection and refresh the page
|
|
43
|
+
if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
|
|
44
|
+
clearStatesOnBackClick();
|
|
45
|
+
}
|
|
46
|
+
}, [
|
|
47
|
+
clearStatesOnBackClick,
|
|
48
|
+
loginWithEmail,
|
|
49
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
50
|
+
setView,
|
|
51
|
+
]);
|
|
44
52
|
const positionAbsolute = view === 'login-with-email-verification';
|
|
45
53
|
const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
|
|
46
54
|
view !== 'login-with-email-verification';
|
|
@@ -20,7 +20,7 @@ import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.j
|
|
|
20
20
|
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
21
21
|
import '../../../config/ApiEndpoint.js';
|
|
22
22
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
23
|
-
import '
|
|
23
|
+
import 'ethers';
|
|
24
24
|
import '../../../context/MockContext/MockContext.js';
|
|
25
25
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
26
26
|
import '../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -30,13 +30,21 @@ import { Skeleton } from '../../../components/Skeleton/Skeleton.js';
|
|
|
30
30
|
import { useQrCodeContext } from '../../../context/QrCodeContext/QrCodeContext.js';
|
|
31
31
|
|
|
32
32
|
const Header = ({ onClose: handleClose, heading, projectSettings, }) => {
|
|
33
|
-
const { clearStatesOnBackClick, loginWithEmail } = useInternalDynamicContext();
|
|
33
|
+
const { clearStatesOnBackClick, loginWithEmail, selectedWalletConnector } = useInternalDynamicContext();
|
|
34
34
|
const { showQrCodeMessage, setShowQrCodeImage, showQrCodeImage } = useQrCodeContext();
|
|
35
35
|
const { view, setView } = useViewContext();
|
|
36
36
|
const handleBackClick = useCallback(() => {
|
|
37
|
-
clearStatesOnBackClick();
|
|
38
37
|
setView(loginWithEmail ? 'login-with-email-or-wallet' : 'wallet-list');
|
|
39
|
-
|
|
38
|
+
// on back button click in Coinbase wallet clearing state would kill connection and refresh the page
|
|
39
|
+
if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
|
|
40
|
+
clearStatesOnBackClick();
|
|
41
|
+
}
|
|
42
|
+
}, [
|
|
43
|
+
clearStatesOnBackClick,
|
|
44
|
+
loginWithEmail,
|
|
45
|
+
selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
|
|
46
|
+
setView,
|
|
47
|
+
]);
|
|
40
48
|
const positionAbsolute = view === 'login-with-email-verification';
|
|
41
49
|
const showCloseButton = view !== 'login-with-email-or-wallet-full-wallet-list' &&
|
|
42
50
|
view !== 'login-with-email-verification';
|
|
@@ -23,7 +23,7 @@ var Portal = require('../../components/Portal/Portal.cjs');
|
|
|
23
23
|
require('react-dom');
|
|
24
24
|
require('../../config/ApiEndpoint.cjs');
|
|
25
25
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
26
|
-
require('
|
|
26
|
+
require('ethers');
|
|
27
27
|
require('../../context/MockContext/MockContext.cjs');
|
|
28
28
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
29
29
|
var useMutation = require('../../utils/hooks/useMutation/useMutation.cjs');
|
|
@@ -46,7 +46,7 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
46
46
|
didConfirmRef.current = false;
|
|
47
47
|
setShow(false);
|
|
48
48
|
}, [setShow]);
|
|
49
|
-
const { isLoading, mutate: confirm, data: signedMessage, error: signMessageError, } = useMutation.useMutation(handler, {
|
|
49
|
+
const { isLoading, mutate: confirm, data: signedMessage, error: signMessageError, } = useMutation.useMutation(() => handler(message), {
|
|
50
50
|
onSuccess: () => {
|
|
51
51
|
didConfirmRef.current = true;
|
|
52
52
|
setShow(false);
|
|
@@ -19,7 +19,7 @@ import { Portal } from '../../components/Portal/Portal.js';
|
|
|
19
19
|
import 'react-dom';
|
|
20
20
|
import '../../config/ApiEndpoint.js';
|
|
21
21
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
22
|
-
import '
|
|
22
|
+
import 'ethers';
|
|
23
23
|
import '../../context/MockContext/MockContext.js';
|
|
24
24
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
25
25
|
import { useMutation } from '../../utils/hooks/useMutation/useMutation.js';
|
|
@@ -42,7 +42,7 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
|
|
|
42
42
|
didConfirmRef.current = false;
|
|
43
43
|
setShow(false);
|
|
44
44
|
}, [setShow]);
|
|
45
|
-
const { isLoading, mutate: confirm, data: signedMessage, error: signMessageError, } = useMutation(handler, {
|
|
45
|
+
const { isLoading, mutate: confirm, data: signedMessage, error: signMessageError, } = useMutation(() => handler(message), {
|
|
46
46
|
onSuccess: () => {
|
|
47
47
|
didConfirmRef.current = true;
|
|
48
48
|
setShow(false);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
3
|
export type SignMessageConfirmationModalProps = {
|
|
4
4
|
appLogoUrl?: string;
|
|
5
5
|
appName?: string;
|
|
6
6
|
appOrigin: string;
|
|
7
|
-
handler: () => Promise<string>;
|
|
8
|
-
message: string | Bytes;
|
|
7
|
+
handler: (message: string | ethers.utils.Bytes) => Promise<string>;
|
|
8
|
+
message: string | ethers.utils.Bytes;
|
|
9
9
|
onReject: (error: unknown) => void;
|
|
10
10
|
onSignMessage: (signedMessage: string) => void;
|
|
11
11
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var
|
|
8
|
+
var ethers = require('ethers');
|
|
9
9
|
var multiWallet = require('@dynamic-labs/multi-wallet');
|
|
10
10
|
var Typography = require('../../components/Typography/Typography.cjs');
|
|
11
11
|
require('@dynamic-labs/sdk-api');
|
|
@@ -27,6 +27,8 @@ var Portal = require('../../components/Portal/Portal.cjs');
|
|
|
27
27
|
require('react-dom');
|
|
28
28
|
require('../../config/ApiEndpoint.cjs');
|
|
29
29
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
+
var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
|
|
31
|
+
var transactionErrorMessage = require('./helpers/transactionErrorMessage.cjs');
|
|
30
32
|
require('../../context/MockContext/MockContext.cjs');
|
|
31
33
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
32
34
|
var usePromise = require('../../utils/hooks/usePromise/usePromise.cjs');
|
|
@@ -41,11 +43,9 @@ var AppOriginTile = require('../../components/AppOriginTile/AppOriginTile.cjs');
|
|
|
41
43
|
var AnimatePresence = require('../../components/AnimatePresence/AnimatePresence.cjs');
|
|
42
44
|
var VerticalDrawerAnimation = require('../../components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.cjs');
|
|
43
45
|
var ErrorContainer = require('../../components/ErrorContainer/ErrorContainer.cjs');
|
|
44
|
-
var useFetchCurrency = require('../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.cjs');
|
|
45
|
-
var transactionErrorMessage = require('./helpers/transactionErrorMessage.cjs');
|
|
46
46
|
|
|
47
|
-
const digitsLimitSub =
|
|
48
|
-
const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onTransactionResponseSuccess, appLogoUrl, appName, transaction, buttonText = 'Send', }) => {
|
|
47
|
+
const digitsLimitSub = 1e8;
|
|
48
|
+
const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onTransactionResponseSuccess, appLogoUrl, appName, transaction, buttonText = 'Send', provider, }) => {
|
|
49
49
|
usePreventPageScroll.usePreventPageScroll(true);
|
|
50
50
|
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
51
51
|
const didConfirmRef = React.useRef(false);
|
|
@@ -78,22 +78,25 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
|
|
|
78
78
|
]);
|
|
79
79
|
const { data: effectiveValue, isLoading: isEffectiveValueLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
80
80
|
const val = yield value;
|
|
81
|
-
return val ?
|
|
81
|
+
return val ? ethers.ethers.BigNumber.from(val) : undefined;
|
|
82
82
|
}));
|
|
83
83
|
const { data: effectiveGasPrice, isLoading: isEffectiveGasPriceLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
// To safely run estimateGas using alchemy, we need to remove the from address
|
|
85
|
+
// because alchemy checks the origin address funds and can return an error if
|
|
86
|
+
// origin wallet has no funds for the transaction
|
|
87
|
+
// https://docs.alchemy.com/reference/eth-estimategas
|
|
88
|
+
const { from } = transaction, transactionWithNoOrigin = _tslib.__rest(transaction, ["from"]);
|
|
89
|
+
const gasPrice = yield provider.getGasPrice();
|
|
90
|
+
const estimatedGas = yield provider.estimateGas(transactionWithNoOrigin);
|
|
88
91
|
return gasPrice && estimatedGas
|
|
89
|
-
?
|
|
92
|
+
? ethers.ethers.BigNumber.from(gasPrice).mul(estimatedGas)
|
|
90
93
|
: undefined;
|
|
91
94
|
}));
|
|
92
95
|
const { data: effectiveToAddress, isLoading: isEffectiveToAddressLoading } = usePromise.usePromise(() => to);
|
|
93
96
|
const { data: effectiveFromAddress, isLoading: isEffectiveFromAddressLoading, } = usePromise.usePromise(() => from);
|
|
94
97
|
const total = React.useMemo(() => {
|
|
95
98
|
if (effectiveGasPrice !== undefined && effectiveValue !== undefined) {
|
|
96
|
-
return effectiveGasPrice
|
|
99
|
+
return effectiveGasPrice.add(effectiveValue);
|
|
97
100
|
}
|
|
98
101
|
return effectiveValue || effectiveGasPrice;
|
|
99
102
|
}, [effectiveGasPrice, effectiveValue]);
|
|
@@ -109,24 +112,14 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
|
|
|
109
112
|
const ChainIcon = getChainIcon.getChainIcon('evm');
|
|
110
113
|
const formatValue = (value, sub) => {
|
|
111
114
|
if (!sub) {
|
|
112
|
-
return
|
|
115
|
+
return ethers.ethers.utils.formatEther(value);
|
|
113
116
|
}
|
|
114
|
-
return
|
|
117
|
+
return ethers.ethers.utils.formatEther(value.sub(value.mod(sub)));
|
|
115
118
|
};
|
|
116
119
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
|
|
117
120
|
return (jsxRuntime.jsx(Portal.Portal, Object.assign({ handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
|
|
118
121
|
onUnmount: handleOnModalUnmount,
|
|
119
|
-
} }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'brand-primary' }, { children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsxRuntime.jsx(AnimatePresence.AnimatePresence, Object.assign({ animationComponent: jsxRuntime.jsx(VerticalDrawerAnimation.VerticalDrawerAnimation, {}) }, { children: transactionError && (jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: transactionErrorMessage.transactionErrorMessage(transactionError) }) }))) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-info' }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "From (You)" })), isEffectiveFromAddressLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveFromAddressLoading && effectiveFromAddress && (jsxRuntime.jsx(CoinCell, { children: shortenWalletAddress.shortenWalletAddress(effectiveFromAddress, 4, 4) })), !isEffectiveFromAddressLoading && !effectiveFromAddress && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "To" })), isEffectiveToAddressLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveToAddressLoading && !effectiveToAddress && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveToAddressLoading && effectiveToAddress && (jsxRuntime.jsx(CoinCell, { children: shortenWalletAddress.shortenWalletAddress(effectiveToAddress, 4, 4) }))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Amount" })), isEffectiveValueLoading && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}) }, { children: "--" }))), !isEffectiveValueLoading &&
|
|
120
|
-
// justification: Boolean(effectiveValue) is checked above
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
122
|
-
title: formatValue(effectiveValue) }, { children: formatValue(effectiveValue, digitsLimitSub) }))), !isEffectiveValueLoading && !effectiveValue && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Gas (estimated)" })), isEffectiveGasPriceLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveGasPriceLoading && !effectiveGasPrice && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveGasPriceLoading &&
|
|
123
|
-
Boolean(effectiveGasPrice) && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-gas-free',
|
|
124
|
-
// justification: Boolean(effectiveValue) is checked above
|
|
125
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
126
|
-
title: formatValue(effectiveGasPrice) }, { children: formatValue(effectiveGasPrice, digitsLimitSub) })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Total" })), Boolean(total) && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-total',
|
|
127
|
-
// justification: Boolean(total) is checked above
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
129
|
-
title: formatValue(total) }, { children: formatValue(total, digitsLimitSub) }))), !total && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] }))] }))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: () => sendTransaction(), expanded: true, buttonRounded: 'default', loading: isLoading, disabled: isLoadingTransaction }, { children: buttonText }))] })), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, {})] }))] })) })));
|
|
122
|
+
} }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: (props) => (jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'brand-primary' }, { children: jsxRuntime.jsx(signCircle.ReactComponent, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsxRuntime.jsx(AnimatePresence.AnimatePresence, Object.assign({ animationComponent: jsxRuntime.jsx(VerticalDrawerAnimation.VerticalDrawerAnimation, {}) }, { children: transactionError && (jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: transactionErrorMessage.transactionErrorMessage(transactionError) }) }))) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsxRuntime.jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsxRuntime.jsx(AppOriginTile.AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-info' }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "From (You)" })), isEffectiveFromAddressLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveFromAddressLoading && effectiveFromAddress && (jsxRuntime.jsx(CoinCell, { children: shortenWalletAddress.shortenWalletAddress(effectiveFromAddress, 4, 4) })), !isEffectiveFromAddressLoading && !effectiveFromAddress && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "To" })), isEffectiveToAddressLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveToAddressLoading && !effectiveToAddress && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveToAddressLoading && effectiveToAddress && (jsxRuntime.jsx(CoinCell, { children: shortenWalletAddress.shortenWalletAddress(effectiveToAddress, 4, 4) }))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Amount" })), isEffectiveValueLoading && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}) }, { children: "--" }))), !isEffectiveValueLoading && effectiveValue && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-amount', title: formatValue(effectiveValue) }, { children: formatValue(effectiveValue, digitsLimitSub) }))), !isEffectiveValueLoading && !effectiveValue && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Gas (estimated)" })), isEffectiveGasPriceLoading && jsxRuntime.jsx(CoinCell, { children: "--" }), !isEffectiveGasPriceLoading && !effectiveGasPrice && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveGasPriceLoading && effectiveGasPrice && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-gas-free', title: formatValue(effectiveGasPrice) }, { children: formatValue(effectiveGasPrice, digitsLimitSub) })))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Total" })), total && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-total', title: formatValue(total) }, { children: formatValue(total, digitsLimitSub) }))), !total && (jsxRuntime.jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] }))] }))] })), jsxRuntime.jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" })), jsxRuntime.jsx(Button.Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: () => sendTransaction(), expanded: true, buttonRounded: 'default', loading: isLoading, disabled: isLoadingTransaction }, { children: buttonText }))] })), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, {})] }))] })) })));
|
|
130
123
|
};
|
|
131
124
|
const CoinCell = ({ children, symbol, icon, color = 'primary', weight = 'medium', dataTestId, title, }) => (jsxRuntime.jsxs("div", Object.assign({ "data-testid": dataTestId, style: {
|
|
132
125
|
alignItems: 'center',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
1
|
+
import { __awaiter, __rest } from '../../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useRef, useState, useCallback, useMemo } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { ethers } from 'ethers';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/multi-wallet';
|
|
6
6
|
import { Typography } from '../../components/Typography/Typography.js';
|
|
7
7
|
import '@dynamic-labs/sdk-api';
|
|
@@ -23,6 +23,8 @@ import { Portal } from '../../components/Portal/Portal.js';
|
|
|
23
23
|
import 'react-dom';
|
|
24
24
|
import '../../config/ApiEndpoint.js';
|
|
25
25
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
26
|
+
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
27
|
+
import { transactionErrorMessage } from './helpers/transactionErrorMessage.js';
|
|
26
28
|
import '../../context/MockContext/MockContext.js';
|
|
27
29
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
28
30
|
import { usePromise } from '../../utils/hooks/usePromise/usePromise.js';
|
|
@@ -37,11 +39,9 @@ import { AppOriginTile } from '../../components/AppOriginTile/AppOriginTile.js';
|
|
|
37
39
|
import { AnimatePresence } from '../../components/AnimatePresence/AnimatePresence.js';
|
|
38
40
|
import { VerticalDrawerAnimation } from '../../components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.js';
|
|
39
41
|
import { ErrorContainer } from '../../components/ErrorContainer/ErrorContainer.js';
|
|
40
|
-
import { useFetchCurrency } from '../../widgets/DynamicWidget/hooks/useFetchCurrency/useFetchCurrency.js';
|
|
41
|
-
import { transactionErrorMessage } from './helpers/transactionErrorMessage.js';
|
|
42
42
|
|
|
43
|
-
const digitsLimitSub =
|
|
44
|
-
const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onTransactionResponseSuccess, appLogoUrl, appName, transaction, buttonText = 'Send', }) => {
|
|
43
|
+
const digitsLimitSub = 1e8;
|
|
44
|
+
const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onTransactionResponseSuccess, appLogoUrl, appName, transaction, buttonText = 'Send', provider, }) => {
|
|
45
45
|
usePreventPageScroll(true);
|
|
46
46
|
const { primaryWallet } = useInternalDynamicContext();
|
|
47
47
|
const didConfirmRef = useRef(false);
|
|
@@ -74,22 +74,25 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
|
|
|
74
74
|
]);
|
|
75
75
|
const { data: effectiveValue, isLoading: isEffectiveValueLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
76
76
|
const val = yield value;
|
|
77
|
-
return val ?
|
|
77
|
+
return val ? ethers.BigNumber.from(val) : undefined;
|
|
78
78
|
}));
|
|
79
79
|
const { data: effectiveGasPrice, isLoading: isEffectiveGasPriceLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
// To safely run estimateGas using alchemy, we need to remove the from address
|
|
81
|
+
// because alchemy checks the origin address funds and can return an error if
|
|
82
|
+
// origin wallet has no funds for the transaction
|
|
83
|
+
// https://docs.alchemy.com/reference/eth-estimategas
|
|
84
|
+
const { from } = transaction, transactionWithNoOrigin = __rest(transaction, ["from"]);
|
|
85
|
+
const gasPrice = yield provider.getGasPrice();
|
|
86
|
+
const estimatedGas = yield provider.estimateGas(transactionWithNoOrigin);
|
|
84
87
|
return gasPrice && estimatedGas
|
|
85
|
-
?
|
|
88
|
+
? ethers.BigNumber.from(gasPrice).mul(estimatedGas)
|
|
86
89
|
: undefined;
|
|
87
90
|
}));
|
|
88
91
|
const { data: effectiveToAddress, isLoading: isEffectiveToAddressLoading } = usePromise(() => to);
|
|
89
92
|
const { data: effectiveFromAddress, isLoading: isEffectiveFromAddressLoading, } = usePromise(() => from);
|
|
90
93
|
const total = useMemo(() => {
|
|
91
94
|
if (effectiveGasPrice !== undefined && effectiveValue !== undefined) {
|
|
92
|
-
return effectiveGasPrice
|
|
95
|
+
return effectiveGasPrice.add(effectiveValue);
|
|
93
96
|
}
|
|
94
97
|
return effectiveValue || effectiveGasPrice;
|
|
95
98
|
}, [effectiveGasPrice, effectiveValue]);
|
|
@@ -105,24 +108,14 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
|
|
|
105
108
|
const ChainIcon = getChainIcon('evm');
|
|
106
109
|
const formatValue = (value, sub) => {
|
|
107
110
|
if (!sub) {
|
|
108
|
-
return formatEther(value);
|
|
111
|
+
return ethers.utils.formatEther(value);
|
|
109
112
|
}
|
|
110
|
-
return formatEther(value
|
|
113
|
+
return ethers.utils.formatEther(value.sub(value.mod(sub)));
|
|
111
114
|
};
|
|
112
115
|
const closeButton = (jsx(IconButton, Object.assign({ type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading }, { children: jsx(SvgClose, {}) })));
|
|
113
116
|
return (jsx(Portal, Object.assign({ handleClose: handleOnReject, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
|
|
114
117
|
onUnmount: handleOnModalUnmount,
|
|
115
|
-
} }, { children: jsxs("div", Object.assign({ className: 'transaction-confirmation' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, Object.assign({ color: 'brand-primary' }, { children: jsx(SvgSignCircle, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerAnimation, {}) }, { children: transactionError && (jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsx(ErrorContainer, { children: transactionErrorMessage(transactionError) }) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-info' }, { children: [jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "From (You)" })), isEffectiveFromAddressLoading && jsx(CoinCell, { children: "--" }), !isEffectiveFromAddressLoading && effectiveFromAddress && (jsx(CoinCell, { children: shortenWalletAddress(effectiveFromAddress, 4, 4) })), !isEffectiveFromAddressLoading && !effectiveFromAddress && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "To" })), isEffectiveToAddressLoading && jsx(CoinCell, { children: "--" }), !isEffectiveToAddressLoading && !effectiveToAddress && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveToAddressLoading && effectiveToAddress && (jsx(CoinCell, { children: shortenWalletAddress(effectiveToAddress, 4, 4) }))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Amount" })), isEffectiveValueLoading && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}) }, { children: "--" }))), !isEffectiveValueLoading &&
|
|
116
|
-
// justification: Boolean(effectiveValue) is checked above
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
-
title: formatValue(effectiveValue) }, { children: formatValue(effectiveValue, digitsLimitSub) }))), !isEffectiveValueLoading && !effectiveValue && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Gas (estimated)" })), isEffectiveGasPriceLoading && jsx(CoinCell, { children: "--" }), !isEffectiveGasPriceLoading && !effectiveGasPrice && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveGasPriceLoading &&
|
|
119
|
-
Boolean(effectiveGasPrice) && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-gas-free',
|
|
120
|
-
// justification: Boolean(effectiveValue) is checked above
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
122
|
-
title: formatValue(effectiveGasPrice) }, { children: formatValue(effectiveGasPrice, digitsLimitSub) })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Total" })), Boolean(total) && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-total',
|
|
123
|
-
// justification: Boolean(total) is checked above
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
125
|
-
title: formatValue(total) }, { children: formatValue(total, digitsLimitSub) }))), !total && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] }))] }))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [jsx(Button, Object.assign({ buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" })), jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: () => sendTransaction(), expanded: true, buttonRounded: 'default', loading: isLoading, disabled: isLoadingTransaction }, { children: buttonText }))] })), jsx(PoweredByDynamic, {})] }))] })) })));
|
|
118
|
+
} }, { children: jsxs("div", Object.assign({ className: 'transaction-confirmation' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton, alignContent: 'bottom' }, { children: jsx(IconWithSpinner, { Icon: (props) => (jsx(Icon, Object.assign({ color: 'brand-primary' }, { children: jsx(SvgSignCircle, Object.assign({}, props)) }))), iconSize: 64, isSpinning: true }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__body' }, { children: [jsx(Typography, Object.assign({ variant: 'title', color: 'primary', className: 'transaction-confirmation__title' }, { children: title })), jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerAnimation, {}) }, { children: transactionError && (jsx("div", Object.assign({ className: 'transaction-confirmation__error' }, { children: jsx(ErrorContainer, { children: transactionErrorMessage(transactionError) }) }))) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__content' }, { children: [jsx("div", Object.assign({ className: 'transaction-confirmation__app-origin-tile' }, { children: jsx(AppOriginTile, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: appOrigin }) })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-info' }, { children: [jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "From (You)" })), isEffectiveFromAddressLoading && jsx(CoinCell, { children: "--" }), !isEffectiveFromAddressLoading && effectiveFromAddress && (jsx(CoinCell, { children: shortenWalletAddress(effectiveFromAddress, 4, 4) })), !isEffectiveFromAddressLoading && !effectiveFromAddress && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "To" })), isEffectiveToAddressLoading && jsx(CoinCell, { children: "--" }), !isEffectiveToAddressLoading && !effectiveToAddress && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveToAddressLoading && effectiveToAddress && (jsx(CoinCell, { children: shortenWalletAddress(effectiveToAddress, 4, 4) }))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Amount" })), isEffectiveValueLoading && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}) }, { children: "--" }))), !isEffectiveValueLoading && effectiveValue && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-amount', title: formatValue(effectiveValue) }, { children: formatValue(effectiveValue, digitsLimitSub) }))), !isEffectiveValueLoading && !effectiveValue && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Gas (estimated)" })), isEffectiveGasPriceLoading && jsx(CoinCell, { children: "--" }), !isEffectiveGasPriceLoading && !effectiveGasPrice && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" }))), !isEffectiveGasPriceLoading && effectiveGasPrice && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-gas-free', title: formatValue(effectiveGasPrice) }, { children: formatValue(effectiveGasPrice, digitsLimitSub) })))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__transaction-row' }, { children: [jsx(Typography, Object.assign({ color: 'secondary', variant: 'body_normal', weight: 'regular', className: 'transaction-confirmation__transaction-row__title' }, { children: "Total" })), total && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-total', title: formatValue(total) }, { children: formatValue(total, digitsLimitSub) }))), !total && (jsx(CoinCell, Object.assign({ color: 'secondary', weight: 'regular' }, { children: "N/A" })))] }))] }))] })), jsxs("div", Object.assign({ className: 'transaction-confirmation__actions' }, { children: [jsx(Button, Object.assign({ buttonVariant: 'secondary', onClick: handleOnReject, expanded: true, buttonPadding: 'large', buttonRounded: 'default', disabled: isLoading }, { children: "Cancel" })), jsx(Button, Object.assign({ buttonVariant: 'primary', buttonPadding: 'large', onClick: () => sendTransaction(), expanded: true, buttonRounded: 'default', loading: isLoading, disabled: isLoadingTransaction }, { children: buttonText }))] })), jsx(PoweredByDynamic, {})] }))] })) })));
|
|
126
119
|
};
|
|
127
120
|
const CoinCell = ({ children, symbol, icon, color = 'primary', weight = 'medium', dataTestId, title, }) => (jsxs("div", Object.assign({ "data-testid": dataTestId, style: {
|
|
128
121
|
alignItems: 'center',
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
3
|
export type TransactionConfirmationModalProps = {
|
|
4
4
|
appLogoUrl?: string;
|
|
5
5
|
appName?: string;
|
|
6
6
|
appOrigin: string;
|
|
7
7
|
buttonText?: ReactNode;
|
|
8
|
-
handler: (transaction: TransactionRequest) => Promise<
|
|
8
|
+
handler: (transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>) => Promise<ethers.providers.TransactionResponse>;
|
|
9
9
|
onReject: (error: unknown) => void;
|
|
10
|
-
onTransactionResponseSuccess: (transactionResponse:
|
|
10
|
+
onTransactionResponseSuccess: (transactionResponse: ethers.providers.TransactionResponse) => void;
|
|
11
|
+
provider: ethers.providers.Web3Provider;
|
|
11
12
|
title: ReactNode;
|
|
12
|
-
transaction: TransactionRequest
|
|
13
|
+
transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>;
|
|
13
14
|
};
|
|
14
15
|
export type TransactionConfirmationModalComponent = FC<TransactionConfirmationModalProps>;
|
|
@@ -2,14 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import type { NetworkConfigurationMap, EvmRpcProvider, SolanaRpcProvider } from '@dynamic-labs/multi-wallet';
|
|
3
3
|
import type { FetchPublicAddressOpts, WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { WalletProviderEnum, ProjectSettings, UserFields, NameServiceData, JwtVerifiedCredential } from '@dynamic-labs/sdk-api';
|
|
5
|
-
export type Deferrable<T> = {
|
|
6
|
-
[K in keyof T]: T[K] | Promise<T[K]>;
|
|
7
|
-
};
|
|
8
|
-
interface ArrayLike<T> {
|
|
9
|
-
readonly [n: number]: T;
|
|
10
|
-
readonly length: number;
|
|
11
|
-
}
|
|
12
|
-
export type Bytes = ArrayLike<number>;
|
|
13
5
|
export type BrowserName = 'brave' | 'chrome' | 'edge' | 'firefox' | 'safari';
|
|
14
6
|
export type Wallet = {
|
|
15
7
|
address: string;
|
|
@@ -141,4 +133,3 @@ export type DynamicEventsCallbacks = {
|
|
|
141
133
|
onUnlinkSuccess?: (unlinkedWallet: JwtVerifiedCredential) => void;
|
|
142
134
|
onUserProfileUpdate?: (user: UserProfile) => void;
|
|
143
135
|
};
|
|
144
|
-
export {};
|
|
@@ -25,12 +25,12 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
25
25
|
const jwt = getAuthToken.getAuthToken();
|
|
26
26
|
if (!jwt && fakeSignerRef.current === 'enabled') {
|
|
27
27
|
fakeSignerRef.current = 'disabled';
|
|
28
|
-
return handler();
|
|
28
|
+
return handler(message);
|
|
29
29
|
}
|
|
30
30
|
return openSignMessage((resolve, reject) => (jsxRuntime.jsx(SignMessageConfirmationModal.SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
31
31
|
}, [appLogoUrl, appName, getAppOrigin, openSignMessage]);
|
|
32
|
-
const sendTransaction = React.useCallback(({ transaction, handler }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject })));
|
|
32
|
+
const sendTransaction = React.useCallback(({ transaction, handler, provider }) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
return openSendTransaction((resolve, reject) => (jsxRuntime.jsx(TransactionConfirmationModal.TransactionConfirmationModal, { title: 'Send Transaction', appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
34
34
|
}), [appLogoUrl, appName, getAppOrigin, openSendTransaction]);
|
|
35
35
|
const enableInternalSign = React.useCallback(() => {
|
|
36
36
|
fakeSignerRef.current = 'enabled';
|
|
@@ -21,12 +21,12 @@ const useWalletUiUtils = ({ appLogoUrl, appName, getAppOrigin, }) => {
|
|
|
21
21
|
const jwt = getAuthToken();
|
|
22
22
|
if (!jwt && fakeSignerRef.current === 'enabled') {
|
|
23
23
|
fakeSignerRef.current = 'disabled';
|
|
24
|
-
return handler();
|
|
24
|
+
return handler(message);
|
|
25
25
|
}
|
|
26
26
|
return openSignMessage((resolve, reject) => (jsx(SignMessageConfirmationModal, { appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), message: message, handler: handler, onSignMessage: resolve, onReject: reject })));
|
|
27
27
|
}, [appLogoUrl, appName, getAppOrigin, openSignMessage]);
|
|
28
|
-
const sendTransaction = useCallback(({ transaction, handler }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
-
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject })));
|
|
28
|
+
const sendTransaction = useCallback(({ transaction, handler, provider }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
+
return openSendTransaction((resolve, reject) => (jsx(TransactionConfirmationModal, { title: 'Send Transaction', appLogoUrl: appLogoUrl, appName: appName, appOrigin: getAppOrigin(), transaction: transaction, handler: handler, onTransactionResponseSuccess: resolve, onReject: reject, provider: provider })));
|
|
30
30
|
}), [appLogoUrl, appName, getAppOrigin, openSendTransaction]);
|
|
31
31
|
const enableInternalSign = useCallback(() => {
|
|
32
32
|
fakeSignerRef.current = 'enabled';
|
|
@@ -24,7 +24,7 @@ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
|
|
|
24
24
|
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
25
25
|
require('../../config/ApiEndpoint.cjs');
|
|
26
26
|
var useVerifyWallet = require('../../utils/hooks/useVerifyWallet/useVerifyWallet.cjs');
|
|
27
|
-
require('
|
|
27
|
+
require('ethers');
|
|
28
28
|
require('../../context/MockContext/MockContext.cjs');
|
|
29
29
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
30
30
|
var CaptchaContext = require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -20,7 +20,7 @@ import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
|
20
20
|
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
21
21
|
import '../../config/ApiEndpoint.js';
|
|
22
22
|
import { useVerifyWallet } from '../../utils/hooks/useVerifyWallet/useVerifyWallet.js';
|
|
23
|
-
import '
|
|
23
|
+
import 'ethers';
|
|
24
24
|
import '../../context/MockContext/MockContext.js';
|
|
25
25
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
26
26
|
import { useCaptchaContext } from '../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -27,7 +27,7 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
27
27
|
var TextButton = require('../../components/TextButton/TextButton.cjs');
|
|
28
28
|
require('../../config/ApiEndpoint.cjs');
|
|
29
29
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
-
require('
|
|
30
|
+
require('ethers');
|
|
31
31
|
require('../../context/MockContext/MockContext.cjs');
|
|
32
32
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
33
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
@@ -23,7 +23,7 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
|
23
23
|
import { TextButton } from '../../components/TextButton/TextButton.js';
|
|
24
24
|
import '../../config/ApiEndpoint.js';
|
|
25
25
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
26
|
-
import '
|
|
26
|
+
import 'ethers';
|
|
27
27
|
import '../../context/MockContext/MockContext.js';
|
|
28
28
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
29
29
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -27,7 +27,7 @@ require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.
|
|
|
27
27
|
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
28
28
|
require('../../../config/ApiEndpoint.cjs');
|
|
29
29
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
-
require('
|
|
30
|
+
require('ethers');
|
|
31
31
|
require('../../../context/MockContext/MockContext.cjs');
|
|
32
32
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
33
33
|
require('../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
@@ -23,7 +23,7 @@ import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.j
|
|
|
23
23
|
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
24
24
|
import '../../../config/ApiEndpoint.js';
|
|
25
25
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
26
|
-
import '
|
|
26
|
+
import 'ethers';
|
|
27
27
|
import '../../../context/MockContext/MockContext.js';
|
|
28
28
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
29
29
|
import '../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -24,7 +24,7 @@ require('../../../components/Transition/SlideInUpTransition/SlideInUpTransition.
|
|
|
24
24
|
require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
25
25
|
require('../../../config/ApiEndpoint.cjs');
|
|
26
26
|
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
27
|
-
require('
|
|
27
|
+
require('ethers');
|
|
28
28
|
require('../../../context/MockContext/MockContext.cjs');
|
|
29
29
|
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
30
|
var useUserUpdateRequest = require('../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
@@ -20,7 +20,7 @@ import '../../../components/Transition/SlideInUpTransition/SlideInUpTransition.j
|
|
|
20
20
|
import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
21
21
|
import '../../../config/ApiEndpoint.js';
|
|
22
22
|
import '../../../context/ErrorContext/ErrorContext.js';
|
|
23
|
-
import '
|
|
23
|
+
import 'ethers';
|
|
24
24
|
import '../../../context/MockContext/MockContext.js';
|
|
25
25
|
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
26
26
|
import { useUserUpdateRequestInternal } from '../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs
CHANGED
|
@@ -24,7 +24,7 @@ require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
|
24
24
|
var TextButton = require('../../components/TextButton/TextButton.cjs');
|
|
25
25
|
require('../../config/ApiEndpoint.cjs');
|
|
26
26
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
27
|
-
require('
|
|
27
|
+
require('ethers');
|
|
28
28
|
require('../../context/MockContext/MockContext.cjs');
|
|
29
29
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
30
30
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js
CHANGED
|
@@ -20,7 +20,7 @@ import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
|
20
20
|
import { TextButton } from '../../components/TextButton/TextButton.js';
|
|
21
21
|
import '../../config/ApiEndpoint.js';
|
|
22
22
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
23
|
-
import '
|
|
23
|
+
import 'ethers';
|
|
24
24
|
import '../../context/MockContext/MockContext.js';
|
|
25
25
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
26
26
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -25,7 +25,7 @@ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
|
|
|
25
25
|
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
26
26
|
require('../../config/ApiEndpoint.cjs');
|
|
27
27
|
require('../../context/ErrorContext/ErrorContext.cjs');
|
|
28
|
-
require('
|
|
28
|
+
require('ethers');
|
|
29
29
|
require('../../context/MockContext/MockContext.cjs');
|
|
30
30
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
31
31
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|
|
@@ -21,7 +21,7 @@ import '../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
|
21
21
|
import '../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
22
22
|
import '../../config/ApiEndpoint.js';
|
|
23
23
|
import '../../context/ErrorContext/ErrorContext.js';
|
|
24
|
-
import '
|
|
24
|
+
import 'ethers';
|
|
25
25
|
import '../../context/MockContext/MockContext.js';
|
|
26
26
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
27
27
|
import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
|
|
@@ -25,7 +25,7 @@ require('../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
|
|
|
25
25
|
require('../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
26
26
|
var api = require('../../data/api.cjs');
|
|
27
27
|
var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
|
|
28
|
-
require('
|
|
28
|
+
require('ethers');
|
|
29
29
|
require('../../context/MockContext/MockContext.cjs');
|
|
30
30
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
31
31
|
require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
|