@dynamic-labs/sdk-react-core 0.16.12-viem.0 → 0.16.12

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.
Files changed (176) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +5 -5
  5. package/src/index.cjs +3 -3
  6. package/src/index.js +2 -2
  7. package/src/lib/Main.cjs +1 -1
  8. package/src/lib/Main.js +1 -1
  9. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.cjs +1 -1
  10. package/src/lib/components/Accordion/components/AccordionItem/AccordionItem.js +1 -1
  11. package/src/lib/components/AnimatePresence/AnimatePresence.cjs +1 -1
  12. package/src/lib/components/AnimatePresence/AnimatePresence.js +1 -1
  13. package/src/lib/components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.cjs +1 -1
  14. package/src/lib/components/AnimatePresence/animations/VerticalDrawerAnimation/VerticalDrawerAnimation.js +1 -1
  15. package/src/lib/components/Divider/Divider.cjs +1 -1
  16. package/src/lib/components/Divider/Divider.js +1 -1
  17. package/src/lib/components/NetworkPicker/components/ActionList/ActionList.cjs +1 -1
  18. package/src/lib/components/NetworkPicker/components/ActionList/ActionList.js +1 -1
  19. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.cjs +1 -1
  20. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.js +1 -1
  21. package/src/lib/components/NetworkPicker/components/Network/Network.cjs +1 -1
  22. package/src/lib/components/NetworkPicker/components/Network/Network.js +1 -1
  23. package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +2 -2
  24. package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +2 -2
  25. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +1 -1
  26. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +1 -1
  27. package/src/lib/components/Tooltip/Tooltip.cjs +1 -1
  28. package/src/lib/components/Tooltip/Tooltip.js +1 -1
  29. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
  30. package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
  31. package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.cjs +1 -1
  32. package/src/lib/components/UserProfile/parts/UserProfileSection/UserProfileSection.js +1 -1
  33. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
  34. package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
  35. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.cjs +1 -1
  36. package/src/lib/context/DynamicContext/useCustomerCallbacks/useCustomerAuthFlowCallbacks.js +1 -1
  37. package/src/lib/context/QrCodeContext/QrCodeContext.cjs +1 -1
  38. package/src/lib/context/QrCodeContext/QrCodeContext.js +1 -1
  39. package/src/lib/data/api.cjs +6 -1
  40. package/src/lib/data/api.js +7 -2
  41. package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +1 -1
  42. package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +1 -1
  43. package/src/lib/layout/DynamicAuthLayout/Footer/Footer.cjs +1 -1
  44. package/src/lib/layout/DynamicAuthLayout/Footer/Footer.js +1 -1
  45. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.cjs +1 -1
  46. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/Item/Item.js +1 -1
  47. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.cjs +1 -1
  48. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletExtensionOrAppContinueButton/WalletExtensionOrAppContinueButton.js +1 -1
  49. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.cjs +1 -1
  50. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletListFooterContent/WalletListFooterContent.js +1 -1
  51. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.cjs +1 -1
  52. package/src/lib/layout/DynamicAuthLayout/FooterContent/WalletMoreInfoContent/WalletMoreInfoContent.js +1 -1
  53. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +1 -1
  54. package/src/lib/layout/DynamicAuthLayout/Header/header.js +1 -1
  55. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.cjs +2 -2
  56. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.js +2 -2
  57. package/src/lib/modals/SignMessageConfirmationModal/SignMessageConfirmationModal.types.d.ts +3 -3
  58. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +13 -25
  59. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +13 -25
  60. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +5 -4
  61. package/src/lib/shared/types/index.d.ts +0 -9
  62. package/src/lib/styles/index.shadow.cjs +1 -1
  63. package/src/lib/styles/index.shadow.js +1 -1
  64. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +3 -3
  65. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +3 -3
  66. package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.cjs +1 -1
  67. package/src/lib/views/CaptchaVerifyUser/CaptchaVerifyUser.js +1 -1
  68. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +1 -1
  69. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +1 -1
  70. package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +1 -1
  71. package/src/lib/views/CollectUserDataView/UserDataFields/index.js +1 -1
  72. package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.cjs +1 -1
  73. package/src/lib/views/CollectUserDataView/UserDataForm/UserDataForm.js +1 -1
  74. package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.cjs +1 -1
  75. package/src/lib/views/CollectUserDataViewLoginWithEmail/CollectUserDataViewLoginWithEmail.js +1 -1
  76. package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.cjs +1 -1
  77. package/src/lib/views/EmailConfirmationWaitingView/EmailConfirmationWaitingView.js +1 -1
  78. package/src/lib/views/EmailUpdate/EmailUpdate.cjs +1 -1
  79. package/src/lib/views/EmailUpdate/EmailUpdate.js +1 -1
  80. package/src/lib/views/EmailVerification/EmailVerification.cjs +5 -2
  81. package/src/lib/views/EmailVerification/EmailVerification.js +5 -2
  82. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +1 -1
  83. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +1 -1
  84. package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.cjs +1 -1
  85. package/src/lib/views/LoginWithEmailView/components/ListItemButton/ListItemButton.js +1 -1
  86. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.cjs +1 -1
  87. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailForm/LoginWithEmailForm.js +1 -1
  88. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -1
  89. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -1
  90. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -1
  91. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -1
  92. package/src/lib/views/{WalletNoAccess/WalletNoAccess.cjs → NoAccess/NoAccess.cjs} +18 -6
  93. package/src/lib/views/NoAccess/NoAccess.d.ts +2 -0
  94. package/src/lib/views/{WalletNoAccess/WalletNoAccess.js → NoAccess/NoAccess.js} +20 -8
  95. package/src/lib/views/NoAccess/index.d.ts +1 -0
  96. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +1 -1
  97. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +1 -1
  98. package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.cjs +1 -1
  99. package/src/lib/views/NoQrNotInstalledView/WalletHelpLink.js +1 -1
  100. package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -1
  101. package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -1
  102. package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
  103. package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
  104. package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +1 -1
  105. package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +1 -1
  106. package/src/lib/views/QrCodeView/QrCodeView.cjs +1 -1
  107. package/src/lib/views/QrCodeView/QrCodeView.js +1 -1
  108. package/src/lib/views/WalletList/SearchInstead/SearchInstead.cjs +1 -1
  109. package/src/lib/views/WalletList/SearchInstead/SearchInstead.js +1 -1
  110. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
  111. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
  112. package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +1 -1
  113. package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +1 -1
  114. package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
  115. package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
  116. package/src/lib/views/index.d.ts +1 -1
  117. package/src/lib/views/viewToComponentMap.cjs +3 -3
  118. package/src/lib/views/viewToComponentMap.js +3 -3
  119. package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +1 -1
  120. package/src/lib/widgets/DynamicWidget/DynamicWidget.js +1 -1
  121. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +1 -1
  122. package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +1 -1
  123. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +3 -3
  124. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +3 -3
  125. package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -1
  126. package/src/lib/widgets/DynamicWidget/components/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -1
  127. package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.cjs +1 -1
  128. package/src/lib/widgets/DynamicWidget/components/DotsMenu/DotsMenu.js +1 -1
  129. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.cjs +1 -1
  130. package/src/lib/widgets/DynamicWidget/components/DotsMenuDropdown/DotsMenuDropdown.js +1 -1
  131. package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.cjs +1 -1
  132. package/src/lib/widgets/DynamicWidget/components/DotsMenuWrapper/DotsMenuWrapper.js +1 -1
  133. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
  134. package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
  135. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs +1 -1
  136. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js +1 -1
  137. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +1 -1
  138. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +1 -1
  139. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.cjs +1 -1
  140. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetSwitcher/DynamicWidgetSwitcher.js +1 -1
  141. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.cjs +1 -1
  142. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetVariants/variants/DynamicWidgetModal/DynamicWidgetModal.js +1 -1
  143. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +1 -1
  144. package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +1 -1
  145. package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.cjs +1 -1
  146. package/src/lib/widgets/DynamicWidget/components/EmailConnectorPendingSignModalContent/EmailConnectorPendingSignModalContent.js +1 -1
  147. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +1 -1
  148. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +1 -1
  149. package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.cjs +1 -1
  150. package/src/lib/widgets/DynamicWidget/components/EmptyWallets/EmptyWallets.js +1 -1
  151. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -1
  152. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -1
  153. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.cjs +1 -1
  154. package/src/lib/widgets/DynamicWidget/components/Wallet/Wallet.js +1 -1
  155. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -1
  156. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -1
  157. package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.cjs +1 -1
  158. package/src/lib/widgets/DynamicWidget/prompts/DetectedKnownSecondaryWalletModal/DetectedKnownSecondaryWalletModal.js +1 -1
  159. package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.cjs +1 -1
  160. package/src/lib/widgets/DynamicWidget/prompts/DetectedNewWalletModal/DetectedNewWalletModal.js +1 -1
  161. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -1
  162. package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -1
  163. package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
  164. package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
  165. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +1 -1
  166. package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +1 -1
  167. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.cjs +1 -1
  168. package/src/lib/widgets/DynamicWidget/prompts/UnlinkWalletPopUp/UnlinkWalletPopUp.js +1 -1
  169. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.cjs +1 -1
  170. package/src/lib/widgets/DynamicWidget/views/EditProfileView/EditProfileView.js +1 -1
  171. package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.cjs +1 -1
  172. package/src/lib/widgets/DynamicWidget/views/IndexView/IndexView.js +1 -1
  173. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.cjs +1 -1
  174. package/src/lib/widgets/DynamicWidget/views/ProfileView/ProfileView.js +1 -1
  175. package/src/lib/views/WalletNoAccess/WalletNoAccess.d.ts +0 -2
  176. package/src/lib/views/WalletNoAccess/index.d.ts +0 -1
@@ -24,7 +24,7 @@ require('../../../../../components/Transition/SlideInUpTransition/SlideInUpTrans
24
24
  require('../../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
25
25
  require('../../../../../config/ApiEndpoint.cjs');
26
26
  require('../../../../../context/ErrorContext/ErrorContext.cjs');
27
- require('../../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
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');
@@ -20,7 +20,7 @@ import '../../../../../components/Transition/SlideInUpTransition/SlideInUpTransi
20
20
  import '../../../../../components/Transition/OpacityTransition/OpacityTransition.js';
21
21
  import '../../../../../config/ApiEndpoint.js';
22
22
  import '../../../../../context/ErrorContext/ErrorContext.js';
23
- import '../../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
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';
@@ -27,7 +27,7 @@ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransiti
27
27
  require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
28
28
  require('../../../../config/ApiEndpoint.cjs');
29
29
  require('../../../../context/ErrorContext/ErrorContext.cjs');
30
- require('../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
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/SlideInUpTransitio
23
23
  import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
24
24
  import '../../../../config/ApiEndpoint.js';
25
25
  import '../../../../context/ErrorContext/ErrorContext.js';
26
- import '../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
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';
@@ -26,7 +26,7 @@ require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransiti
26
26
  require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
27
27
  require('../../../../config/ApiEndpoint.cjs');
28
28
  require('../../../../context/ErrorContext/ErrorContext.cjs');
29
- require('../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
29
+ require('ethers');
30
30
  require('../../../../context/MockContext/MockContext.cjs');
31
31
  require('../../../../context/CaptchaContext/CaptchaContext.cjs');
32
32
  require('../../../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
@@ -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 '../../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
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('../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs');
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');
@@ -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 '../../../modals/TransactionConfirmationModal/TransactionConfirmationModal.js';
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';
@@ -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('../TransactionConfirmationModal/TransactionConfirmationModal.cjs');
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 '../TransactionConfirmationModal/TransactionConfirmationModal.js';
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 { Bytes } from '../../shared/types';
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 viem = require('viem');
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 = BigInt(1e8);
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,20 @@ 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 ? BigInt(val) : undefined;
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
- const publicClient = yield primaryWallet.connector.getWeb3Provider();
85
- const gasPrice = yield publicClient.getGasPrice();
86
- const estimatedGas = yield publicClient.estimateGas(Object.assign({ account: from, to,
87
- value }, transaction));
84
+ const gasPrice = yield provider.getGasPrice();
85
+ const estimatedGas = yield provider.estimateGas(transaction);
88
86
  return gasPrice && estimatedGas
89
- ? BigInt(gasPrice) * estimatedGas
87
+ ? ethers.ethers.BigNumber.from(gasPrice).mul(estimatedGas)
90
88
  : undefined;
91
89
  }));
92
90
  const { data: effectiveToAddress, isLoading: isEffectiveToAddressLoading } = usePromise.usePromise(() => to);
93
91
  const { data: effectiveFromAddress, isLoading: isEffectiveFromAddressLoading, } = usePromise.usePromise(() => from);
94
92
  const total = React.useMemo(() => {
95
93
  if (effectiveGasPrice !== undefined && effectiveValue !== undefined) {
96
- return effectiveGasPrice + effectiveValue;
94
+ return effectiveGasPrice.add(effectiveValue);
97
95
  }
98
96
  return effectiveValue || effectiveGasPrice;
99
97
  }, [effectiveGasPrice, effectiveValue]);
@@ -109,24 +107,14 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
109
107
  const ChainIcon = getChainIcon.getChainIcon('evm');
110
108
  const formatValue = (value, sub) => {
111
109
  if (!sub) {
112
- return viem.formatEther(value);
110
+ return ethers.ethers.utils.formatEther(value);
113
111
  }
114
- return viem.formatEther(value - (value % sub));
112
+ return ethers.ethers.utils.formatEther(value.sub(value.mod(sub)));
115
113
  };
116
114
  const closeButton = (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
117
115
  return (jsxRuntime.jsx(Portal.Portal, Object.assign({ handleClose: handleOnReject, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
118
116
  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 && Boolean(effectiveValue) && (jsxRuntime.jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsxRuntime.jsx(ChainIcon, {}), dataTestId: 'transaction-amount',
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, {})] }))] })) })));
117
+ } }, { 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
118
  };
131
119
  const CoinCell = ({ children, symbol, icon, color = 'primary', weight = 'medium', dataTestId, title, }) => (jsxRuntime.jsxs("div", Object.assign({ "data-testid": dataTestId, style: {
132
120
  alignItems: 'center',
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from '../../../../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useCallback, useMemo } from 'react';
4
- import { formatEther } from 'viem';
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 = BigInt(1e8);
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,20 @@ 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 ? BigInt(val) : undefined;
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
- const publicClient = yield primaryWallet.connector.getWeb3Provider();
81
- const gasPrice = yield publicClient.getGasPrice();
82
- const estimatedGas = yield publicClient.estimateGas(Object.assign({ account: from, to,
83
- value }, transaction));
80
+ const gasPrice = yield provider.getGasPrice();
81
+ const estimatedGas = yield provider.estimateGas(transaction);
84
82
  return gasPrice && estimatedGas
85
- ? BigInt(gasPrice) * estimatedGas
83
+ ? ethers.BigNumber.from(gasPrice).mul(estimatedGas)
86
84
  : undefined;
87
85
  }));
88
86
  const { data: effectiveToAddress, isLoading: isEffectiveToAddressLoading } = usePromise(() => to);
89
87
  const { data: effectiveFromAddress, isLoading: isEffectiveFromAddressLoading, } = usePromise(() => from);
90
88
  const total = useMemo(() => {
91
89
  if (effectiveGasPrice !== undefined && effectiveValue !== undefined) {
92
- return effectiveGasPrice + effectiveValue;
90
+ return effectiveGasPrice.add(effectiveValue);
93
91
  }
94
92
  return effectiveValue || effectiveGasPrice;
95
93
  }, [effectiveGasPrice, effectiveValue]);
@@ -105,24 +103,14 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
105
103
  const ChainIcon = getChainIcon('evm');
106
104
  const formatValue = (value, sub) => {
107
105
  if (!sub) {
108
- return formatEther(value);
106
+ return ethers.utils.formatEther(value);
109
107
  }
110
- return formatEther(value - (value % sub));
108
+ return ethers.utils.formatEther(value.sub(value.mod(sub)));
111
109
  };
112
110
  const closeButton = (jsx(IconButton, Object.assign({ type: 'button', onClick: handleOnReject, "data-testid": 'close', disabled: isLoading }, { children: jsx(SvgClose, {}) })));
113
111
  return (jsx(Portal, Object.assign({ handleClose: handleOnReject, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
114
112
  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 && Boolean(effectiveValue) && (jsx(CoinCell, Object.assign({ symbol: currencySymbol, icon: jsx(ChainIcon, {}), dataTestId: 'transaction-amount',
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, {})] }))] })) })));
113
+ } }, { 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
114
  };
127
115
  const CoinCell = ({ children, symbol, icon, color = 'primary', weight = 'medium', dataTestId, title, }) => (jsxs("div", Object.assign({ "data-testid": dataTestId, style: {
128
116
  alignItems: 'center',
@@ -1,14 +1,15 @@
1
1
  import { FC, ReactNode } from 'react';
2
- import { TransactionReceipt, TransactionRequest } from 'viem';
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<TransactionReceipt>;
8
+ handler: (transaction: ethers.utils.Deferrable<ethers.providers.TransactionRequest>) => Promise<ethers.providers.TransactionResponse>;
9
9
  onReject: (error: unknown) => void;
10
- onTransactionResponseSuccess: (transactionResponse: TransactionReceipt) => void;
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 {};