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

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 (150) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +9 -9
  5. package/src/index.cjs +2 -0
  6. package/src/index.js +1 -0
  7. package/src/lib/Main.cjs +5 -0
  8. package/src/lib/Main.js +5 -0
  9. package/src/lib/components/Button/Button.cjs +10 -7
  10. package/src/lib/components/Button/Button.js +10 -7
  11. package/src/lib/components/DynamicConnectButton/components/ConnectButton.cjs +1 -1
  12. package/src/lib/components/DynamicConnectButton/components/ConnectButton.js +1 -1
  13. package/src/lib/components/ErrorContainer/ErrorContainer.d.ts +1 -1
  14. package/src/lib/components/ListTile/ListTile.cjs +1 -1
  15. package/src/lib/components/ListTile/ListTile.js +1 -1
  16. package/src/lib/components/ListTile/ListTile.types.d.ts +1 -0
  17. package/src/lib/components/OTPVerificationView/OTPVerificationView.cjs +5 -3
  18. package/src/lib/components/OTPVerificationView/OTPVerificationView.d.ts +1 -0
  19. package/src/lib/components/OTPVerificationView/OTPVerificationView.js +5 -3
  20. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +3 -1
  21. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +3 -1
  22. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +2 -2
  23. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +2 -2
  24. package/src/lib/context/DynamicContext/DynamicContext.cjs +7 -2
  25. package/src/lib/context/DynamicContext/DynamicContext.js +8 -3
  26. package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.cjs +13 -3
  27. package/src/lib/context/DynamicContext/hooks/useVerificationInProgress/useVerificationInProgress.js +13 -3
  28. package/src/lib/context/DynamicContext/types/index.d.ts +2 -2
  29. package/src/lib/context/SendBalanceContext/SendBalanceContext.types.d.ts +2 -2
  30. package/src/lib/context/ViewContext/ViewContext.d.ts +1 -1
  31. package/src/lib/data/api.cjs +16 -0
  32. package/src/lib/data/api.d.ts +1 -0
  33. package/src/lib/data/api.js +18 -3
  34. package/src/lib/layout/DynamicAuthLayout/Header/header.cjs +10 -2
  35. package/src/lib/layout/DynamicAuthLayout/Header/header.js +10 -2
  36. package/src/lib/modals/SendBalanceModal/SendBalanceModal.d.ts +2 -2
  37. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.cjs +10 -2
  38. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.js +10 -2
  39. package/src/lib/modals/TransactionConfirmationModal/TransactionConfirmationModal.types.d.ts +6 -3
  40. package/src/lib/shared/assets/double-arrow-right.cjs +53 -0
  41. package/src/lib/shared/assets/double-arrow-right.js +29 -0
  42. package/src/lib/shared/assets/index.d.ts +1 -0
  43. package/src/lib/styles/index.shadow.cjs +1 -1
  44. package/src/lib/styles/index.shadow.js +1 -1
  45. package/src/lib/utils/constants/errors.cjs +7 -0
  46. package/src/lib/utils/constants/errors.d.ts +1 -0
  47. package/src/lib/utils/constants/errors.js +3 -0
  48. package/src/lib/utils/constants/index.d.ts +1 -1
  49. package/src/lib/utils/constants/localStorage.cjs +2 -0
  50. package/src/lib/utils/constants/localStorage.d.ts +1 -0
  51. package/src/lib/utils/constants/localStorage.js +2 -1
  52. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.cjs +14 -2
  53. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.d.ts +3 -2
  54. package/src/lib/utils/functions/getUserProfileFields/getUserProfileFields.js +14 -2
  55. package/src/lib/utils/functions/index.d.ts +1 -0
  56. package/src/lib/utils/functions/isMagicConnector/index.d.ts +1 -0
  57. package/src/lib/utils/functions/isMagicConnector/isMagicConnector.cjs +10 -0
  58. package/src/lib/utils/functions/isMagicConnector/isMagicConnector.d.ts +2 -0
  59. package/src/lib/utils/functions/isMagicConnector/isMagicConnector.js +6 -0
  60. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.cjs +2 -2
  61. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.d.ts +2 -1
  62. package/src/lib/utils/hooks/authenticationHooks/useConnectAndSign/useConnectAndSign.js +2 -2
  63. package/src/lib/utils/hooks/index.d.ts +2 -0
  64. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.cjs +19 -3
  65. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.d.ts +1 -2
  66. package/src/lib/utils/hooks/multiWallet/useMultiWallet/useMultiWallet.js +20 -4
  67. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +11 -9
  68. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.d.ts +1 -1
  69. package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +11 -9
  70. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
  71. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
  72. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -2
  73. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.d.ts +1 -1
  74. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +2 -2
  75. package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.cjs +2 -7
  76. package/src/lib/utils/hooks/useFetchNetworkConfigurations/useFetchNetworkConfigurations.js +2 -7
  77. package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/index.d.ts +1 -0
  78. package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/index.d.ts +1 -0
  79. package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.cjs +16 -0
  80. package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.d.ts +2 -0
  81. package/src/lib/utils/hooks/useFetchNetworkConfigurations/utils/mergeCustomerEvmNetworksWithServerNetworks/mergeCustomerEvmNetworksWithServerNetworks.js +12 -0
  82. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +22 -4
  83. package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +22 -4
  84. package/src/lib/utils/hooks/useTransactionEstimatedGas/index.d.ts +1 -0
  85. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +31 -0
  86. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.d.ts +20 -0
  87. package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +27 -0
  88. package/src/lib/utils/hooks/useTransactionWithGasPrice/index.d.ts +1 -0
  89. package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs +56 -0
  90. package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.d.ts +32 -0
  91. package/src/lib/utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js +52 -0
  92. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -0
  93. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -0
  94. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.d.ts +1 -1
  95. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -2
  96. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.d.ts +5 -1
  97. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -2
  98. package/src/lib/utils/hooks/useWallets/useWallets.d.ts +2 -2
  99. package/src/lib/views/CollectUserDataView/UserDataFields/index.cjs +4 -0
  100. package/src/lib/views/CollectUserDataView/UserDataFields/index.js +4 -0
  101. package/src/lib/views/EmailUpdate/EmailUpdate.cjs +13 -4
  102. package/src/lib/views/EmailUpdate/EmailUpdate.js +13 -4
  103. package/src/lib/views/EmailVerification/EmailVerification.cjs +12 -1
  104. package/src/lib/views/EmailVerification/EmailVerification.js +14 -3
  105. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.cjs +3 -2
  106. package/src/lib/views/EmailWalletOTPVerificationView/EmailWalletOTPVerificationView.js +3 -2
  107. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.cjs +4 -1
  108. package/src/lib/views/LoginWithEmailView/components/LoginWithEmailWalletList/LoginWithEmailWalletList.js +4 -1
  109. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.cjs +1 -1
  110. package/src/lib/views/LoginWithEmailView/components/SocialSignIn/SocialSignIn.js +1 -1
  111. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +111 -0
  112. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.d.ts +2 -0
  113. package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +107 -0
  114. package/src/lib/views/MergeUserAccountsView/index.d.ts +1 -0
  115. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -0
  116. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -0
  117. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -0
  118. package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -0
  119. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +14 -35
  120. package/src/lib/views/SendBalanceView/SendBalanceView.d.ts +2 -2
  121. package/src/lib/views/SendBalanceView/SendBalanceView.js +15 -36
  122. package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.cjs +73 -0
  123. package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.d.ts +8 -0
  124. package/src/lib/views/SendBalanceView/components/TransactionStage/TransactionStage.js +69 -0
  125. package/src/lib/views/SendBalanceView/components/TransactionStage/index.d.ts +1 -0
  126. package/src/lib/views/SendBalanceView/components/index.d.ts +1 -0
  127. package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +1 -2
  128. package/src/lib/views/SocialRedirectView/SocialRedirectView.js +1 -2
  129. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +31 -8
  130. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.d.ts +4 -3
  131. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +32 -9
  132. package/src/lib/views/TransactionConfirmationView/hooks/index.d.ts +2 -1
  133. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/index.d.ts +1 -0
  134. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.cjs +69 -0
  135. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.d.ts +11 -0
  136. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionGas/useTransactionGas.js +65 -0
  137. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/index.d.ts +1 -0
  138. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.cjs +14 -0
  139. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.d.ts +6 -0
  140. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionTotal/useTransactionTotal.js +10 -0
  141. package/src/lib/views/WalletList/WalletList.cjs +4 -1
  142. package/src/lib/views/WalletList/WalletList.js +4 -1
  143. package/src/lib/views/WalletLockedView/WalletLockedView.cjs +20 -4
  144. package/src/lib/views/WalletLockedView/WalletLockedView.js +20 -4
  145. package/src/lib/views/viewToComponentMap.cjs +2 -0
  146. package/src/lib/views/viewToComponentMap.js +2 -0
  147. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/index.d.ts +0 -1
  148. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.cjs +0 -104
  149. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.d.ts +0 -17
  150. package/src/lib/views/TransactionConfirmationView/hooks/useTransactionData/useTransactionData.js +0 -100
@@ -1,5 +1,5 @@
1
1
  import { SetStateAction, Dispatch, PropsWithChildren, FC } from 'react';
2
- export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists';
2
+ export type ViewType = 'captcha' | 'chainalysis-blocked-wallet' | 'collect-user-data' | 'collect-user-data-login-with-email' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-email-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'update-email' | 'verify-email' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts';
3
3
  export type ViewContextProps = {
4
4
  setView: Dispatch<SetStateAction<ViewType>>;
5
5
  view: ViewType;
@@ -128,6 +128,9 @@ const verifyEmail = ({ verificationToken, verificationUUID, environmentId, }, us
128
128
  catch (e) {
129
129
  const data = yield e.json();
130
130
  logger.logger.error(data.error);
131
+ if (data.code === sdkApi$1.UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
132
+ throw new utils.UserHasAccountWithEmailError(data.error);
133
+ }
131
134
  throw new utils.EmailVerificationError(data.code);
132
135
  }
133
136
  });
@@ -397,6 +400,18 @@ const sendDynamicProps = (environmentId, settingsToSend) => _tslib.__awaiter(voi
397
400
  logger.logger.error(e);
398
401
  }
399
402
  });
403
+ const mergeUserAccounts = (userJwt, environmentId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
404
+ try {
405
+ const { jwt } = yield sdkApi(userJwt).mergeUsers({
406
+ environmentId,
407
+ });
408
+ return jwt;
409
+ }
410
+ catch (e) {
411
+ logger.logger.error(e);
412
+ throw e;
413
+ }
414
+ });
400
415
 
401
416
  exports.createEmailVerification = createEmailVerification;
402
417
  exports.createVisit = createVisit;
@@ -409,6 +424,7 @@ exports.linkWallet = linkWallet;
409
424
  exports.mapAuthModeTypeToEnum = mapAuthModeTypeToEnum;
410
425
  exports.mapChainToChainEnum = mapChainToChainEnum;
411
426
  exports.mapProviderToProviderEnum = mapProviderToProviderEnum;
427
+ exports.mergeUserAccounts = mergeUserAccounts;
412
428
  exports.retryEmailVerification = retryEmailVerification;
413
429
  exports.revokeSession = revokeSession;
414
430
  exports.sendDynamicProps = sendDynamicProps;
@@ -66,3 +66,4 @@ export declare const sendDynamicProps: (environmentId: string, settingsToSend: {
66
66
  dynamicContextProps?: object;
67
67
  dynamicWagmiSettings?: object;
68
68
  }) => Promise<void>;
69
+ export declare const mergeUserAccounts: (userJwt: string, environmentId: string) => Promise<string | undefined>;
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from '../../../_virtual/_tslib.js';
2
- import { NoAccessError, AccountExistsError, EmailVerificationError, DynamicError, EmailAlreadyExistsError, UsernameAlreadyExistsError, EmailProviderError, WalletUsedError, WalletNotDeployedError, ChainalysisError, GateBlockedError } from '@dynamic-labs/utils';
3
- import { SDKApi, Configuration, VerifyRequestFromJSON, ChainEnum, WalletProviderEnum, AuthModeEnum } from '@dynamic-labs/sdk-api';
2
+ import { NoAccessError, AccountExistsError, EmailVerificationError, UserHasAccountWithEmailError, DynamicError, EmailAlreadyExistsError, UsernameAlreadyExistsError, EmailProviderError, WalletUsedError, WalletNotDeployedError, ChainalysisError, GateBlockedError } from '@dynamic-labs/utils';
3
+ import { UnprocessableEntityErrorCode, SDKApi, Configuration, VerifyRequestFromJSON, ChainEnum, WalletProviderEnum, AuthModeEnum } from '@dynamic-labs/sdk-api';
4
4
  import { VERSION, API_VERSION } from '../../version.js';
5
5
  import ApiEndpoint from '../config/ApiEndpoint.js';
6
6
  import { logger } from '../shared/logger.js';
@@ -124,6 +124,9 @@ const verifyEmail = ({ verificationToken, verificationUUID, environmentId, }, us
124
124
  catch (e) {
125
125
  const data = yield e.json();
126
126
  logger.error(data.error);
127
+ if (data.code === UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail) {
128
+ throw new UserHasAccountWithEmailError(data.error);
129
+ }
127
130
  throw new EmailVerificationError(data.code);
128
131
  }
129
132
  });
@@ -393,5 +396,17 @@ const sendDynamicProps = (environmentId, settingsToSend) => __awaiter(void 0, vo
393
396
  logger.error(e);
394
397
  }
395
398
  });
399
+ const mergeUserAccounts = (userJwt, environmentId) => __awaiter(void 0, void 0, void 0, function* () {
400
+ try {
401
+ const { jwt } = yield sdkApi(userJwt).mergeUsers({
402
+ environmentId,
403
+ });
404
+ return jwt;
405
+ }
406
+ catch (e) {
407
+ logger.error(e);
408
+ throw e;
409
+ }
410
+ });
396
411
 
397
- export { createEmailVerification, createVisit, fetchNetworkSettings, fetchNonce, fetchProjectSettings, getEmailProvider, getOnrampProviders, linkWallet, mapAuthModeTypeToEnum, mapChainToChainEnum, mapProviderToProviderEnum, retryEmailVerification, revokeSession, sendDynamicProps, signInWithEmailVerification, transferWallet, unlinkOAuth, unlinkWallet, updateUserProfileFields, verifyEmail, verifyOAuth, verifyWallet };
412
+ export { createEmailVerification, createVisit, fetchNetworkSettings, fetchNonce, fetchProjectSettings, getEmailProvider, getOnrampProviders, linkWallet, mapAuthModeTypeToEnum, mapChainToChainEnum, mapProviderToProviderEnum, mergeUserAccounts, retryEmailVerification, revokeSession, sendDynamicProps, signInWithEmailVerification, transferWallet, unlinkOAuth, unlinkWallet, updateUserProfileFields, verifyEmail, verifyOAuth, verifyWallet };
@@ -32,7 +32,7 @@ require('../../../components/Transition/OpacityTransition/OpacityTransition.cjs'
32
32
  require('../../../config/ApiEndpoint.cjs');
33
33
  require('@dynamic-labs/rpc-providers');
34
34
  require('../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
35
- require('../../../context/ErrorContext/ErrorContext.cjs');
35
+ var ErrorContext = require('../../../context/ErrorContext/ErrorContext.cjs');
36
36
  require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
37
37
  var AccountExistsContext = require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
38
38
  var ModalHeader = require('../../../components/ModalHeader/ModalHeader.cjs');
@@ -55,6 +55,7 @@ var index = require('../../../context/FooterAnimationContext/index.cjs');
55
55
 
56
56
  const Header = ({ onClose: handleClose, heading, projectSettings, walletConnector, }) => {
57
57
  const { clearStatesOnBackClick, selectedWalletConnector } = useInternalDynamicContext.useInternalDynamicContext();
58
+ const { setError } = ErrorContext.useErrorContext();
58
59
  const { setShowQrCodeImage } = QrCodeContext.useQrCodeContext();
59
60
  const { isFooterExpanded, setIsFooterExpanded } = index.useFooterAnimationContext();
60
61
  const { view, goToInitialView } = ViewContext.useViewContext();
@@ -63,11 +64,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
63
64
  const handleBackClick = React.useCallback(() => {
64
65
  goToInitialView();
65
66
  setExistentAccountData(undefined);
67
+ setError(undefined);
66
68
  // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
67
69
  if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
68
70
  clearStatesOnBackClick();
69
71
  }
70
- }, [clearStatesOnBackClick, selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, goToInitialView]);
72
+ }, [
73
+ goToInitialView,
74
+ setExistentAccountData,
75
+ setError,
76
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
77
+ clearStatesOnBackClick,
78
+ ]);
71
79
  const leadingButtons = React.useMemo(() => {
72
80
  let buttons = [];
73
81
  if (showBackButton) {
@@ -28,7 +28,7 @@ import '../../../components/Transition/OpacityTransition/OpacityTransition.js';
28
28
  import '../../../config/ApiEndpoint.js';
29
29
  import '@dynamic-labs/rpc-providers';
30
30
  import '../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
31
- import '../../../context/ErrorContext/ErrorContext.js';
31
+ import { useErrorContext } from '../../../context/ErrorContext/ErrorContext.js';
32
32
  import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
33
33
  import { useAccountExistsContext } from '../../../context/AccountExistsContext/AccountExistsContext.js';
34
34
  import { ModalHeader } from '../../../components/ModalHeader/ModalHeader.js';
@@ -51,6 +51,7 @@ import { useFooterAnimationContext } from '../../../context/FooterAnimationConte
51
51
 
52
52
  const Header = ({ onClose: handleClose, heading, projectSettings, walletConnector, }) => {
53
53
  const { clearStatesOnBackClick, selectedWalletConnector } = useInternalDynamicContext();
54
+ const { setError } = useErrorContext();
54
55
  const { setShowQrCodeImage } = useQrCodeContext();
55
56
  const { isFooterExpanded, setIsFooterExpanded } = useFooterAnimationContext();
56
57
  const { view, goToInitialView } = useViewContext();
@@ -59,11 +60,18 @@ const Header = ({ onClose: handleClose, heading, projectSettings, walletConnecto
59
60
  const handleBackClick = useCallback(() => {
60
61
  goToInitialView();
61
62
  setExistentAccountData(undefined);
63
+ setError(undefined);
62
64
  // on back button click in Coinbase wallet clearing state would kill connection and refresh the page
63
65
  if ((selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name) !== 'Coinbase') {
64
66
  clearStatesOnBackClick();
65
67
  }
66
- }, [clearStatesOnBackClick, selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name, goToInitialView]);
68
+ }, [
69
+ goToInitialView,
70
+ setExistentAccountData,
71
+ setError,
72
+ selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.name,
73
+ clearStatesOnBackClick,
74
+ ]);
67
75
  const leadingButtons = useMemo(() => {
68
76
  let buttons = [];
69
77
  if (showBackButton) {
@@ -1,10 +1,10 @@
1
1
  import { FC } from 'react';
2
- import { TransactionReceipt } from 'viem';
2
+ import { Address } from 'viem';
3
3
  type SendBalanceModalProps = {
4
4
  initialRecipientAddress?: string;
5
5
  initialValue?: bigint;
6
6
  onReject: (error: unknown) => void;
7
- onSuccess: (transaction: TransactionReceipt) => void;
7
+ onSuccess: (transaction: Address) => void;
8
8
  };
9
9
  export declare const SendBalanceModal: FC<SendBalanceModalProps>;
10
10
  export {};
@@ -18,6 +18,7 @@ var usePreventPageScroll = require('../../shared/utils/hooks/usePreventPageScrol
18
18
  var index = require('../../shared/consts/index.cjs');
19
19
  require('../../context/DynamicContext/DynamicContext.cjs');
20
20
  require('@dynamic-labs/multi-wallet');
21
+ var isMagicConnector = require('../../utils/functions/isMagicConnector/isMagicConnector.cjs');
21
22
  require('../../components/ShadowDOM/ShadowDOM.cjs');
22
23
  require('../../context/ThemeContext/ThemeContext.cjs');
23
24
  var Portal = require('../../components/Portal/Portal.cjs');
@@ -37,6 +38,7 @@ require('../../components/Alert/Alert.cjs');
37
38
  require('../../context/MockContext/MockContext.cjs');
38
39
  require('../../context/CaptchaContext/CaptchaContext.cjs');
39
40
  require('../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.cjs');
41
+ var useTransactionWithGasPrice = require('../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.cjs');
40
42
  require('../../components/Popper/Popper/Popper.cjs');
41
43
  require('../../components/Popper/PopperContext/PopperContext.cjs');
42
44
  require('formik');
@@ -46,11 +48,17 @@ var ModalCard = require('../../components/ModalCard/ModalCard.cjs');
46
48
  require('../../components/InlineWidget/InlineWidget.cjs');
47
49
  require('../../components/MenuList/Dropdown/Dropdown.cjs');
48
50
 
49
- const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionResponseSuccess, transaction }) => {
51
+ const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionResponseSuccess, transaction, provider, walletConnector, }) => {
50
52
  usePreventPageScroll.usePreventPageScroll(true);
51
53
  const [show, setShow] = React.useState(true);
52
54
  const errorRef = React.useRef(null);
53
55
  const transactionResponseRef = React.useRef(null);
56
+ const transactionWithGasPrice = useTransactionWithGasPrice.useTransactionWithGasPrice({
57
+ enabled: isMagicConnector.isMagicConnector(walletConnector),
58
+ increasePercentage: 5,
59
+ provider,
60
+ transaction,
61
+ });
54
62
  const closeModal = React.useCallback(() => {
55
63
  setShow(false);
56
64
  }, [setShow]);
@@ -62,7 +70,7 @@ const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionR
62
70
  }, [onTransactionResponseSuccess, onReject]);
63
71
  return (jsxRuntime.jsx(Portal.Portal, { handleClose: closeModal, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
64
72
  onUnmount: handleOnModalUnmount,
65
- }, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { transaction: transaction, title: title, mutation: () => handler(transaction), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, onSuccess: (transactionResponse) => {
73
+ }, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { provider: provider, transaction: transactionWithGasPrice, title: title, mutation: () => handler(transactionWithGasPrice), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, onSuccess: (transactionResponse) => {
66
74
  errorRef.current = null;
67
75
  transactionResponseRef.current = transactionResponse;
68
76
  closeModal();
@@ -14,6 +14,7 @@ import { usePreventPageScroll } from '../../shared/utils/hooks/usePreventPageScr
14
14
  import { authModalZIndex } from '../../shared/consts/index.js';
15
15
  import '../../context/DynamicContext/DynamicContext.js';
16
16
  import '@dynamic-labs/multi-wallet';
17
+ import { isMagicConnector } from '../../utils/functions/isMagicConnector/isMagicConnector.js';
17
18
  import '../../components/ShadowDOM/ShadowDOM.js';
18
19
  import '../../context/ThemeContext/ThemeContext.js';
19
20
  import { Portal } from '../../components/Portal/Portal.js';
@@ -33,6 +34,7 @@ import '../../components/Alert/Alert.js';
33
34
  import '../../context/MockContext/MockContext.js';
34
35
  import '../../context/CaptchaContext/CaptchaContext.js';
35
36
  import '../../utils/hooks/useUserUpdateRequest/useUserUpdateRequest.js';
37
+ import { useTransactionWithGasPrice } from '../../utils/hooks/useTransactionWithGasPrice/useTransactionWithGasPrice.js';
36
38
  import '../../components/Popper/Popper/Popper.js';
37
39
  import '../../components/Popper/PopperContext/PopperContext.js';
38
40
  import 'formik';
@@ -42,11 +44,17 @@ import { ModalCard } from '../../components/ModalCard/ModalCard.js';
42
44
  import '../../components/InlineWidget/InlineWidget.js';
43
45
  import '../../components/MenuList/Dropdown/Dropdown.js';
44
46
 
45
- const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionResponseSuccess, transaction }) => {
47
+ const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionResponseSuccess, transaction, provider, walletConnector, }) => {
46
48
  usePreventPageScroll(true);
47
49
  const [show, setShow] = useState(true);
48
50
  const errorRef = useRef(null);
49
51
  const transactionResponseRef = useRef(null);
52
+ const transactionWithGasPrice = useTransactionWithGasPrice({
53
+ enabled: isMagicConnector(walletConnector),
54
+ increasePercentage: 5,
55
+ provider,
56
+ transaction,
57
+ });
50
58
  const closeModal = useCallback(() => {
51
59
  setShow(false);
52
60
  }, [setShow]);
@@ -58,7 +66,7 @@ const TransactionConfirmationModal = ({ title, handler, onReject, onTransactionR
58
66
  }, [onTransactionResponseSuccess, onReject]);
59
67
  return (jsx(Portal, { handleClose: closeModal, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
60
68
  onUnmount: handleOnModalUnmount,
61
- }, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { transaction: transaction, title: title, mutation: () => handler(transaction), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, onSuccess: (transactionResponse) => {
69
+ }, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { provider: provider, transaction: transactionWithGasPrice, title: title, mutation: () => handler(transactionWithGasPrice), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, onSuccess: (transactionResponse) => {
62
70
  errorRef.current = null;
63
71
  transactionResponseRef.current = transactionResponse;
64
72
  closeModal();
@@ -1,10 +1,13 @@
1
1
  import { FC, ReactNode } from 'react';
2
- import { TransactionReceipt, TransactionRequest } from 'viem';
2
+ import { Address, PublicClient, TransactionRequest } from 'viem';
3
+ import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
3
4
  export type TransactionConfirmationModalProps = {
4
- handler: (transaction: TransactionRequest) => Promise<TransactionReceipt>;
5
+ handler: (transaction: TransactionRequest) => Promise<Address>;
5
6
  onReject: (error: unknown) => void;
6
- onTransactionResponseSuccess: (transactionResponse: TransactionReceipt) => void;
7
+ onTransactionResponseSuccess: (transactionResponse: Address) => void;
7
8
  title: ReactNode;
8
9
  transaction: TransactionRequest;
10
+ provider: PublicClient;
11
+ walletConnector: WalletConnector;
9
12
  };
10
13
  export type TransactionConfirmationModalComponent = FC<TransactionConfirmationModalProps>;
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
26
+
27
+ var _path;
28
+ var _excluded = ["title", "titleId"];
29
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
30
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
32
+ var SvgDoubleArrowRight = function SvgDoubleArrowRight(_ref) {
33
+ var title = _ref.title,
34
+ titleId = _ref.titleId,
35
+ props = _objectWithoutProperties(_ref, _excluded);
36
+ return /*#__PURE__*/React__namespace.createElement("svg", _extends({
37
+ width: 16,
38
+ height: 16,
39
+ viewBox: "0 0 16 16",
40
+ fill: "none",
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ "aria-labelledby": titleId
43
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
44
+ id: titleId
45
+ }, title) : null, _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
46
+ fillRule: "evenodd",
47
+ clipRule: "evenodd",
48
+ d: "M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",
49
+ fill: "currentColor"
50
+ })));
51
+ };
52
+
53
+ exports.ReactComponent = SvgDoubleArrowRight;
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ var _path;
4
+ var _excluded = ["title", "titleId"];
5
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
+ var SvgDoubleArrowRight = function SvgDoubleArrowRight(_ref) {
9
+ var title = _ref.title,
10
+ titleId = _ref.titleId,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+ return /*#__PURE__*/React.createElement("svg", _extends({
13
+ width: 16,
14
+ height: 16,
15
+ viewBox: "0 0 16 16",
16
+ fill: "none",
17
+ xmlns: "http://www.w3.org/2000/svg",
18
+ "aria-labelledby": titleId
19
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
20
+ id: titleId
21
+ }, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
22
+ fillRule: "evenodd",
23
+ clipRule: "evenodd",
24
+ d: "M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",
25
+ fill: "currentColor"
26
+ })));
27
+ };
28
+
29
+ export { SvgDoubleArrowRight as ReactComponent };
@@ -34,3 +34,4 @@ export { ReactComponent as SwitchHorizontalIcon } from './switch-horizontal.svg'
34
34
  export { ReactComponent as DotsHorizontalIcon } from './dots-horizontal.svg';
35
35
  export { ReactComponent as SendIcon } from './send.svg';
36
36
  export { ReactComponent as QuestionMarkIcon } from './question-mark.svg';
37
+ export { ReactComponent as DoubleArrowRightIcon } from './double-arrow-right.svg';