@dynamic-labs/sdk-react-core 4.5.0 → 4.5.2

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 (314) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/index.cjs +7 -7
  6. package/src/index.js +2 -2
  7. package/src/lib/components/Alert/Alert.cjs +6 -3
  8. package/src/lib/components/Alert/Alert.d.ts +1 -0
  9. package/src/lib/components/Alert/Alert.js +6 -4
  10. package/src/lib/components/Alert/AlertText/AlertText.cjs +16 -0
  11. package/src/lib/components/Alert/AlertText/AlertText.d.ts +7 -0
  12. package/src/lib/components/Alert/AlertText/AlertText.js +12 -0
  13. package/src/lib/components/Alert/AlertText/index.d.ts +1 -0
  14. package/src/lib/components/NetworkPicker/NetworkPicker.cjs +11 -40
  15. package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +2 -6
  16. package/src/lib/components/NetworkPicker/NetworkPicker.js +12 -41
  17. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.cjs +6 -8
  18. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.d.ts +2 -4
  19. package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.js +6 -8
  20. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.cjs +67 -0
  21. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.d.ts +14 -0
  22. package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.js +63 -0
  23. package/src/lib/components/NetworkPicker/components/NetworkDropdown/index.d.ts +1 -0
  24. package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.cjs → NetworkSwitchControl/NetworkSwitchControl.cjs} +27 -36
  25. package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.d.ts +16 -0
  26. package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.js → NetworkSwitchControl/NetworkSwitchControl.js} +27 -35
  27. package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/index.d.ts +1 -0
  28. package/src/lib/components/Portal/Portal.cjs +3 -2
  29. package/src/lib/components/Portal/Portal.js +3 -2
  30. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
  31. package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +1 -1
  32. package/src/lib/components/ShadowDOM/ShadowDOM.cjs +0 -2
  33. package/src/lib/components/ShadowDOM/ShadowDOM.js +1 -2
  34. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
  35. package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
  36. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.cjs +1 -1
  37. package/src/lib/components/TransactionStatusLayout/TransactionStatusLayout.js +1 -1
  38. package/src/lib/components/UserProfile/UserProfile.cjs +1 -1
  39. package/src/lib/components/UserProfile/UserProfile.js +1 -1
  40. package/src/lib/context/DynamicContext/DynamicContext.cjs +15 -12
  41. package/src/lib/context/DynamicContext/DynamicContext.js +15 -12
  42. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.cjs +2 -2
  43. package/src/lib/context/DynamicContext/hooks/useEmailLoginState/useEmailLoginState.js +3 -3
  44. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -4
  45. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +0 -4
  46. package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.cjs +7 -2
  47. package/src/lib/context/DynamicContext/hooks/useNameService/useNameService.js +7 -2
  48. package/src/lib/context/DynamicContext/hooks/usePasskeySuccessPopup/usePasskeySuccessPopup.cjs +2 -2
  49. package/src/lib/context/DynamicContext/hooks/usePasskeySuccessPopup/usePasskeySuccessPopup.js +3 -3
  50. package/src/lib/context/DynamicContext/types/SettingsOverrides.d.ts +5 -2
  51. package/src/lib/context/ErrorContext/ErrorContext.cjs +7 -6
  52. package/src/lib/context/ErrorContext/ErrorContext.js +8 -7
  53. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +3 -3
  54. package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +3 -3
  55. package/src/lib/context/ViewContext/ViewContext.cjs +7 -2
  56. package/src/lib/context/ViewContext/ViewContext.js +7 -2
  57. package/src/lib/context/ViewContext/types/index.d.ts +1 -1
  58. package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +5 -64
  59. package/src/lib/data/api/embeddedWallets/embeddedWallets.d.ts +2 -18
  60. package/src/lib/data/api/embeddedWallets/embeddedWallets.js +6 -61
  61. package/src/lib/data/api/wallets/wallets.cjs +1 -3
  62. package/src/lib/data/api/wallets/wallets.d.ts +1 -1
  63. package/src/lib/data/api/wallets/wallets.js +2 -4
  64. package/src/lib/events/embeddedWallet.d.ts +0 -4
  65. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.cjs +2 -6
  66. package/src/lib/layout/DynamicAuthLayout/ToSFooter/ToSFooter.js +2 -6
  67. package/src/lib/locale/en/translation.cjs +13 -32
  68. package/src/lib/locale/en/translation.d.ts +12 -31
  69. package/src/lib/locale/en/translation.js +13 -32
  70. package/src/lib/main.global.cjs +1 -1
  71. package/src/lib/main.global.js +1 -1
  72. package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.cjs +8 -8
  73. package/src/lib/modals/SyncWalletPromptModal/SyncWalletPromptModal.js +8 -8
  74. package/src/lib/modals/index.d.ts +0 -2
  75. package/src/lib/shared/assets/index.d.ts +1 -0
  76. package/src/lib/shared/assets/{currency.cjs → wallet-with-sunglasses.cjs} +14 -26
  77. package/src/lib/shared/assets/wallet-with-sunglasses.js +34 -0
  78. package/src/lib/shared/utils/functions/index.d.ts +0 -2
  79. package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs +7 -5
  80. package/src/lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js +8 -6
  81. package/src/lib/styles/index.shadow.cjs +1 -1
  82. package/src/lib/styles/index.shadow.js +1 -1
  83. package/src/lib/utils/functions/index.d.ts +0 -5
  84. package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.cjs +1 -1
  85. package/src/lib/utils/functions/isAllowedToLinkWallet/isAllowedToLinkWallet.js +1 -1
  86. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.cjs +2 -4
  87. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.d.ts +2 -2
  88. package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.js +2 -4
  89. package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.cjs +1 -1
  90. package/src/lib/utils/functions/onrampConfigurationToOnrampOption/onrampConfigurationToOnrampOption.js +1 -1
  91. package/src/lib/utils/hooks/index.d.ts +0 -1
  92. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +0 -2
  93. package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +0 -2
  94. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.cjs +2 -2
  95. package/src/lib/utils/hooks/useClearWalletConnectSessions/useClearWalletConnectSessions.js +3 -3
  96. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +16 -4
  97. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +16 -4
  98. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
  99. package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +3 -3
  100. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +1 -1
  101. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +1 -1
  102. package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +1 -6
  103. package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +1 -6
  104. package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.cjs +1 -1
  105. package/src/lib/utils/hooks/useDynamicModals/useDynamicModals.js +1 -1
  106. package/src/lib/utils/hooks/useElementById/useElementById.cjs +2 -2
  107. package/src/lib/utils/hooks/useElementById/useElementById.js +3 -3
  108. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs +1 -13
  109. package/src/lib/utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js +1 -13
  110. package/src/lib/utils/hooks/useEmbeddedWallet/index.d.ts +0 -1
  111. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +7 -23
  112. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.d.ts +0 -2
  113. package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +7 -23
  114. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +4 -4
  115. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +4 -4
  116. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.cjs +3 -3
  117. package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useTurnkey/useTurnkey.js +3 -3
  118. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.cjs +1 -0
  119. package/src/lib/utils/hooks/useFundWithWallet/useConnectWalletForFunding/useConnectWalletForFunding.js +1 -0
  120. package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.cjs +1 -1
  121. package/src/lib/utils/hooks/useIsTurnkeyWallet/useIsTurnkeyWallet.js +1 -1
  122. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.cjs +2 -2
  123. package/src/lib/utils/hooks/usePasskeyRecovery/usePasskeyRecovery.js +2 -2
  124. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs +1 -1
  125. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js +1 -1
  126. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.cjs +11 -18
  127. package/src/lib/utils/hooks/useSetWalletConnectorFetchers/useSetWalletConnectorFetchers.js +12 -19
  128. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +4 -4
  129. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +4 -4
  130. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.cjs +4 -4
  131. package/src/lib/utils/hooks/useUpgradeEmbeddedWallet/useUpgradeEmbeddedWallet.js +4 -4
  132. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +4 -4
  133. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +4 -4
  134. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +0 -3
  135. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +0 -3
  136. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +0 -3
  137. package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +0 -3
  138. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.cjs +0 -1
  139. package/src/lib/utils/hooks/useWalletOptions/useWalletOptions.js +0 -1
  140. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -24
  141. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -24
  142. package/src/lib/utils/validations/index.d.ts +0 -1
  143. package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -4
  144. package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -4
  145. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +2 -2
  146. package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +2 -2
  147. package/src/lib/views/EmailVerification/EmailVerification.cjs +4 -4
  148. package/src/lib/views/EmailVerification/EmailVerification.js +4 -4
  149. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +12 -34
  150. package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +13 -35
  151. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs +2 -2
  152. package/src/lib/views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js +2 -2
  153. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.cjs +1 -1
  154. package/src/lib/views/MfaDisplayBackupCodesView/MfaDisplayBackupCodesView.js +1 -1
  155. package/src/lib/views/MfaRecoveryView/MfaRecoveryView.cjs +1 -1
  156. package/src/lib/views/MfaRecoveryView/MfaRecoveryView.js +1 -1
  157. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -4
  158. package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -4
  159. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +1 -1
  160. package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +1 -1
  161. package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
  162. package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
  163. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +11 -11
  164. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +11 -11
  165. package/src/lib/views/viewToComponentMap.cjs +0 -4
  166. package/src/lib/views/viewToComponentMap.d.ts +0 -2
  167. package/src/lib/views/viewToComponentMap.js +0 -4
  168. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +10 -15
  169. package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +11 -16
  170. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.cjs +1 -1
  171. package/src/lib/widgets/DynamicWidget/components/Balance/Balance.js +1 -1
  172. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -6
  173. package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -6
  174. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.cjs +3 -3
  175. package/src/lib/widgets/DynamicWidget/components/EmailOTPConnectorPendingSignModalContent/EmailOTPConnectorPendingSignModalContent.js +3 -3
  176. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +1 -1
  177. package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +1 -1
  178. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.cjs +1 -1
  179. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.js +1 -1
  180. package/src/lib/widgets/DynamicWidget/context/DynamicWidgetContext.types.d.ts +1 -1
  181. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.cjs +1 -1
  182. package/src/lib/widgets/DynamicWidget/prompts/PendingConnectionModal/PendingConnectionModal.js +1 -1
  183. package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.cjs +4 -1
  184. package/src/lib/widgets/DynamicWidget/views/ChooseOnrampProviderView/ChooseOnrampProviderView.js +4 -1
  185. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.cjs +1 -1
  186. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/ChooseWalletFundingMethod.js +1 -1
  187. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.cjs +19 -11
  188. package/src/lib/widgets/DynamicWidget/views/ChooseWalletFundingMethod/useFundingMethods/useFundingMethods.js +19 -11
  189. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs +2 -2
  190. package/src/lib/widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js +2 -2
  191. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs +103 -50
  192. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js +99 -46
  193. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.cjs +21 -10
  194. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.d.ts +2 -0
  195. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.js +21 -10
  196. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.cjs +3 -3
  197. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.d.ts +2 -0
  198. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.js +3 -3
  199. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/types.d.ts +2 -0
  200. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.cjs +27 -0
  201. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.d.ts +2 -0
  202. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.js +23 -0
  203. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/index.d.ts +1 -0
  204. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.cjs +4 -0
  205. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.js +4 -0
  206. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.cjs +33 -0
  207. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.d.ts +8 -0
  208. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.js +29 -0
  209. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/index.d.ts +1 -0
  210. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.cjs +27 -22
  211. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.d.ts +6 -0
  212. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.js +27 -22
  213. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.cjs +2 -0
  214. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.d.ts +1 -0
  215. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.js +2 -1
  216. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/index.d.ts +1 -0
  217. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.cjs +32 -0
  218. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.d.ts +9 -0
  219. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.js +28 -0
  220. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useSubmitExternalWalletFunding/useSubmitExternalWalletFunding.cjs +14 -2
  221. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useSubmitExternalWalletFunding/useSubmitExternalWalletFunding.js +14 -2
  222. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.cjs +27 -15
  223. package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.js +27 -15
  224. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.cjs +20 -0
  225. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.d.ts +2 -0
  226. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.js +16 -0
  227. package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/index.d.ts +1 -0
  228. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +10 -23
  229. package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +11 -24
  230. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.d.ts +0 -23
  231. package/src/lib/components/NetworkPicker/components/EvmNetworkControl/index.d.ts +0 -1
  232. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.cjs +0 -113
  233. package/src/lib/components/ToggleVisibilityButton/ToggleVisibilityButton.js +0 -109
  234. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.cjs +0 -106
  235. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.d.ts +0 -3
  236. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.js +0 -102
  237. package/src/lib/modals/CreatePasswordModal/CreatePasswordModal.types.d.ts +0 -5
  238. package/src/lib/modals/CreatePasswordModal/index.d.ts +0 -1
  239. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.cjs +0 -106
  240. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.d.ts +0 -3
  241. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.js +0 -102
  242. package/src/lib/modals/EnterPasswordModal/EnterPasswordModal.types.d.ts +0 -6
  243. package/src/lib/modals/EnterPasswordModal/index.d.ts +0 -1
  244. package/src/lib/shared/assets/alt-key.cjs +0 -55
  245. package/src/lib/shared/assets/alt-key.js +0 -31
  246. package/src/lib/shared/assets/currency.js +0 -46
  247. package/src/lib/shared/assets/lock.cjs +0 -55
  248. package/src/lib/shared/assets/lock.js +0 -31
  249. package/src/lib/shared/assets/save-password-hero.cjs +0 -128
  250. package/src/lib/shared/assets/save-password-hero.js +0 -104
  251. package/src/lib/shared/assets/wallet-claim-hero.cjs +0 -128
  252. package/src/lib/shared/assets/wallet-claim-hero.js +0 -104
  253. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.cjs +0 -15
  254. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.d.ts +0 -1
  255. package/src/lib/shared/utils/functions/generateRandomPassword/generateRandomPassword.js +0 -11
  256. package/src/lib/shared/utils/functions/generateRandomPassword/index.d.ts +0 -1
  257. package/src/lib/shared/utils/functions/validatePassword/index.d.ts +0 -1
  258. package/src/lib/shared/utils/functions/validatePassword/validatePassword.cjs +0 -60
  259. package/src/lib/shared/utils/functions/validatePassword/validatePassword.d.ts +0 -13
  260. package/src/lib/shared/utils/functions/validatePassword/validatePassword.js +0 -56
  261. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.cjs +0 -8
  262. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.d.ts +0 -2
  263. package/src/lib/utils/functions/findCoinbaseMPCWallet/findCoinbaseMPCWallet.js +0 -4
  264. package/src/lib/utils/functions/findCoinbaseMPCWallet/index.d.ts +0 -1
  265. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.cjs +0 -53
  266. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.d.ts +0 -9
  267. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/getCoinbaseMPCConnectorFetchers.js +0 -49
  268. package/src/lib/utils/functions/getCoinbaseMPCConnectorFetchers/index.d.ts +0 -1
  269. package/src/lib/utils/functions/isCoinbaseWaasEnabled/isCoinbaseWaasEnabled.cjs +0 -14
  270. package/src/lib/utils/functions/isCoinbaseWaasEnabled/isCoinbaseWaasEnabled.js +0 -10
  271. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/index.d.ts +0 -1
  272. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.cjs +0 -16
  273. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.d.ts +0 -2
  274. package/src/lib/utils/functions/requiresPasswordForEmbeddedWallet/requiresPasswordForEmbeddedWallet.js +0 -12
  275. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/index.d.ts +0 -1
  276. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.cjs +0 -39
  277. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.d.ts +0 -2
  278. package/src/lib/utils/functions/requiresPasswordForEmbeddedWalletOnSignup/requiresPasswordForEmbeddedWalletOnSignup.js +0 -35
  279. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/index.d.ts +0 -2
  280. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/index.d.ts +0 -1
  281. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.cjs +0 -229
  282. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.d.ts +0 -5
  283. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useCoinbaseMPC/useCoinbaseMPC.js +0 -225
  284. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.cjs +0 -191
  285. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.d.ts +0 -18
  286. package/src/lib/utils/hooks/useEmbeddedWallet/useMPCEmbeddedWallet/useMPCEmbeddedWallet.js +0 -187
  287. package/src/lib/utils/hooks/useEmbeddedWalletPassword/index.d.ts +0 -1
  288. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +0 -141
  289. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.d.ts +0 -4
  290. package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +0 -137
  291. package/src/lib/utils/validations/validateMPCProviderEnabled/index.d.ts +0 -1
  292. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.cjs +0 -18
  293. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.d.ts +0 -2
  294. package/src/lib/utils/validations/validateMPCProviderEnabled/validateMPCProviderEnabled.js +0 -14
  295. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.cjs +0 -116
  296. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.d.ts +0 -2
  297. package/src/lib/views/CoinbaseMPCClaimIntro/CoinbaseMPCClaimIntro.js +0 -112
  298. package/src/lib/views/CoinbaseMPCClaimIntro/index.d.ts +0 -1
  299. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.cjs +0 -197
  300. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.d.ts +0 -12
  301. package/src/lib/views/CreatePasswordView/CreatePasswordStep/CreatePasswordStep.js +0 -193
  302. package/src/lib/views/CreatePasswordView/CreatePasswordStep/index.d.ts +0 -1
  303. package/src/lib/views/CreatePasswordView/CreatePasswordView.cjs +0 -169
  304. package/src/lib/views/CreatePasswordView/CreatePasswordView.d.ts +0 -9
  305. package/src/lib/views/CreatePasswordView/CreatePasswordView.js +0 -165
  306. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.cjs +0 -141
  307. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.d.ts +0 -12
  308. package/src/lib/views/CreatePasswordView/SavePasswordStep/SavePasswordStep.js +0 -137
  309. package/src/lib/views/CreatePasswordView/SavePasswordStep/index.d.ts +0 -1
  310. package/src/lib/views/CreatePasswordView/index.d.ts +0 -1
  311. package/src/lib/views/EnterPasswordView/EnterPasswordView.cjs +0 -141
  312. package/src/lib/views/EnterPasswordView/EnterPasswordView.d.ts +0 -8
  313. package/src/lib/views/EnterPasswordView/EnterPasswordView.js +0 -137
  314. package/src/lib/views/EnterPasswordView/index.d.ts +0 -1
@@ -6,6 +6,8 @@ const convertToFiat = (amount, token, exchangeRates) => {
6
6
  if (amount === '')
7
7
  return '';
8
8
  const value = parseFloat(amount);
9
+ if (isNaN(value))
10
+ return '';
9
11
  return exchangeRates[token] !== undefined
10
12
  ? roundToMaxDisplayLength(value * exchangeRates[token])
11
13
  : undefined;
@@ -14,6 +16,8 @@ const convertFromFiat = (amount, token, exchangeRates) => {
14
16
  if (amount === '')
15
17
  return '';
16
18
  const value = parseFloat(amount);
19
+ if (isNaN(value))
20
+ return '';
17
21
  return exchangeRates[token] !== undefined
18
22
  ? roundToMaxDisplayLength(value / exchangeRates[token])
19
23
  : undefined;
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Converts a scientific notation number to a decimal number.
8
+ *
9
+ * It might be simpler to just call "toFixed", however, "toFixed" will return
10
+ * incorrect values for numbers that are too large or too small.
11
+ * Try (9.1).toFixed(16) and see for yourself.
12
+ */
13
+ const convertScientificToDecimal = (value) => {
14
+ const str = value.toString();
15
+ // If the number is already in standard form (no 'e'), return it
16
+ if (!str.includes('e'))
17
+ return str;
18
+ const [base, exponent] = str.split('e').map(parseFloat);
19
+ const isNegativeExp = exponent < 0;
20
+ const absoluteExponent = Math.abs(exponent);
21
+ const absoluteBase = Math.abs(base).toString();
22
+ if (isNegativeExp) {
23
+ // Move the decimal point to the left
24
+ const newNumber = '0.' + '0'.repeat(absoluteExponent - 1) + absoluteBase.replace('.', '');
25
+ return value < 0 ? '-' + newNumber : newNumber;
26
+ }
27
+ // Move the decimal point to the right
28
+ const [intPart, decimalPart = ''] = absoluteBase.split('.');
29
+ const newNumber = intPart + decimalPart.padEnd(absoluteExponent, '0');
30
+ return value < 0 ? '-' + newNumber : newNumber;
31
+ };
32
+
33
+ exports.convertScientificToDecimal = convertScientificToDecimal;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a scientific notation number to a decimal number.
3
+ *
4
+ * It might be simpler to just call "toFixed", however, "toFixed" will return
5
+ * incorrect values for numbers that are too large or too small.
6
+ * Try (9.1).toFixed(16) and see for yourself.
7
+ */
8
+ export declare const convertScientificToDecimal: (value: number) => string;
@@ -0,0 +1,29 @@
1
+ 'use client'
2
+ /**
3
+ * Converts a scientific notation number to a decimal number.
4
+ *
5
+ * It might be simpler to just call "toFixed", however, "toFixed" will return
6
+ * incorrect values for numbers that are too large or too small.
7
+ * Try (9.1).toFixed(16) and see for yourself.
8
+ */
9
+ const convertScientificToDecimal = (value) => {
10
+ const str = value.toString();
11
+ // If the number is already in standard form (no 'e'), return it
12
+ if (!str.includes('e'))
13
+ return str;
14
+ const [base, exponent] = str.split('e').map(parseFloat);
15
+ const isNegativeExp = exponent < 0;
16
+ const absoluteExponent = Math.abs(exponent);
17
+ const absoluteBase = Math.abs(base).toString();
18
+ if (isNegativeExp) {
19
+ // Move the decimal point to the left
20
+ const newNumber = '0.' + '0'.repeat(absoluteExponent - 1) + absoluteBase.replace('.', '');
21
+ return value < 0 ? '-' + newNumber : newNumber;
22
+ }
23
+ // Move the decimal point to the right
24
+ const [intPart, decimalPart = ''] = absoluteBase.split('.');
25
+ const newNumber = intPart + decimalPart.padEnd(absoluteExponent, '0');
26
+ return value < 0 ? '-' + newNumber : newNumber;
27
+ };
28
+
29
+ export { convertScientificToDecimal };
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var consts = require('../../consts.cjs');
7
+ var convertScientificToDecimal = require('./convertScientificToDecimal/convertScientificToDecimal.cjs');
7
8
 
8
9
  /* eslint-disable prefer-destructuring */
9
10
  const categorizeValue = (value) => {
@@ -32,32 +33,36 @@ const formatValue = ({ value, symbol, withFixedZeros = false, maxDecimals, }) =>
32
33
  if (value === undefined)
33
34
  return undefined;
34
35
  const parsed = value === '' ? 0 : parseFloat(value.toString());
36
+ // Deal with 0 values so we can assume value is not zero from here on
37
+ if (parsed === 0)
38
+ return addSymbol(withFixedZeros && maxDecimals ? (0).toFixed(maxDecimals) : '0', symbol);
35
39
  const categorized = categorizeValue(parsed);
36
40
  const categorySymbol = typeof categorized === 'object' ? categorized.symbol : '';
37
- let formattedValue;
38
- if (typeof categorized === 'object') {
39
- const fixedValue = withFixedZeros
40
- ? categorized.value.toFixed(2)
41
- : categorized.value.toString();
42
- const [integerPart, decimalPart] = fixedValue.split('.');
43
- // Add commas
44
- const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
45
- if (maxDecimals !== undefined &&
46
- decimalPart &&
47
- decimalPart.length > maxDecimals) {
48
- const rounded = parseFloat(`0.${decimalPart}`)
49
- .toFixed(maxDecimals)
50
- .split('.')[1];
51
- formattedValue = `${formattedInteger}.${rounded}`;
52
- }
53
- else {
54
- formattedValue = decimalPart
55
- ? `${formattedInteger}.${decimalPart}`
56
- : formattedInteger;
41
+ if (typeof categorized === 'string')
42
+ return addSymbol(categorized + categorySymbol, symbol);
43
+ const expandedValue = convertScientificToDecimal.convertScientificToDecimal(categorized.value);
44
+ let [integerPart, decimalPart] = expandedValue.split('.');
45
+ if (maxDecimals !== undefined) {
46
+ const [roundedInteger, roundedDecimal] = parseFloat(`0.${decimalPart}`)
47
+ .toFixed(maxDecimals)
48
+ .split('.');
49
+ decimalPart = withFixedZeros
50
+ ? roundedDecimal
51
+ : roundedDecimal.replace(/0+$/, '');
52
+ if (roundedInteger !== '0') {
53
+ integerPart = convertScientificToDecimal.convertScientificToDecimal(parseFloat(integerPart) + parseFloat(roundedInteger));
57
54
  }
58
55
  }
59
- else
60
- formattedValue = categorized;
56
+ // Add commas
57
+ integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
58
+ const formattedValue = decimalPart
59
+ ? `${integerPart}.${decimalPart}`
60
+ : integerPart;
61
+ // If we ended up with 0 after all rounding, show less than symbol
62
+ if (maxDecimals && parseFloat(formattedValue) === 0) {
63
+ const number = `${(0).toFixed(maxDecimals - 1)}1`;
64
+ return `<${addSymbol(number, symbol)}`;
65
+ }
61
66
  return addSymbol(formattedValue + categorySymbol, symbol);
62
67
  };
63
68
 
@@ -1,7 +1,13 @@
1
1
  type FormatValueProps = {
2
2
  value: string | number | undefined;
3
3
  symbol: string | undefined;
4
+ /**
5
+ * When maxDecimals is defined, this being true will display leading zeros up until the maxDecimals case
6
+ */
4
7
  withFixedZeros?: boolean;
8
+ /**
9
+ * Rounds off any extra decimals to the maxDecimals value
10
+ */
5
11
  maxDecimals?: number;
6
12
  };
7
13
  export declare const formatValue: ({ value, symbol, withFixedZeros, maxDecimals, }: FormatValueProps) => string | undefined;
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { UNAVAILABLE_VALUE } from '../../consts.js';
3
+ import { convertScientificToDecimal } from './convertScientificToDecimal/convertScientificToDecimal.js';
3
4
 
4
5
  /* eslint-disable prefer-destructuring */
5
6
  const categorizeValue = (value) => {
@@ -28,32 +29,36 @@ const formatValue = ({ value, symbol, withFixedZeros = false, maxDecimals, }) =>
28
29
  if (value === undefined)
29
30
  return undefined;
30
31
  const parsed = value === '' ? 0 : parseFloat(value.toString());
32
+ // Deal with 0 values so we can assume value is not zero from here on
33
+ if (parsed === 0)
34
+ return addSymbol(withFixedZeros && maxDecimals ? (0).toFixed(maxDecimals) : '0', symbol);
31
35
  const categorized = categorizeValue(parsed);
32
36
  const categorySymbol = typeof categorized === 'object' ? categorized.symbol : '';
33
- let formattedValue;
34
- if (typeof categorized === 'object') {
35
- const fixedValue = withFixedZeros
36
- ? categorized.value.toFixed(2)
37
- : categorized.value.toString();
38
- const [integerPart, decimalPart] = fixedValue.split('.');
39
- // Add commas
40
- const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
41
- if (maxDecimals !== undefined &&
42
- decimalPart &&
43
- decimalPart.length > maxDecimals) {
44
- const rounded = parseFloat(`0.${decimalPart}`)
45
- .toFixed(maxDecimals)
46
- .split('.')[1];
47
- formattedValue = `${formattedInteger}.${rounded}`;
48
- }
49
- else {
50
- formattedValue = decimalPart
51
- ? `${formattedInteger}.${decimalPart}`
52
- : formattedInteger;
37
+ if (typeof categorized === 'string')
38
+ return addSymbol(categorized + categorySymbol, symbol);
39
+ const expandedValue = convertScientificToDecimal(categorized.value);
40
+ let [integerPart, decimalPart] = expandedValue.split('.');
41
+ if (maxDecimals !== undefined) {
42
+ const [roundedInteger, roundedDecimal] = parseFloat(`0.${decimalPart}`)
43
+ .toFixed(maxDecimals)
44
+ .split('.');
45
+ decimalPart = withFixedZeros
46
+ ? roundedDecimal
47
+ : roundedDecimal.replace(/0+$/, '');
48
+ if (roundedInteger !== '0') {
49
+ integerPart = convertScientificToDecimal(parseFloat(integerPart) + parseFloat(roundedInteger));
53
50
  }
54
51
  }
55
- else
56
- formattedValue = categorized;
52
+ // Add commas
53
+ integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
54
+ const formattedValue = decimalPart
55
+ ? `${integerPart}.${decimalPart}`
56
+ : integerPart;
57
+ // If we ended up with 0 after all rounding, show less than symbol
58
+ if (maxDecimals && parseFloat(formattedValue) === 0) {
59
+ const number = `${(0).toFixed(maxDecimals - 1)}1`;
60
+ return `<${addSymbol(number, symbol)}`;
61
+ }
57
62
  return addSymbol(formattedValue + categorySymbol, symbol);
58
63
  };
59
64
 
@@ -4,5 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  const isFiatToken = (symbol) => symbol === 'USD';
7
+ const isFiatOrStablecoin = (symbol) => isFiatToken(symbol) || symbol === 'USDC' || symbol === 'USDT';
7
8
 
9
+ exports.isFiatOrStablecoin = isFiatOrStablecoin;
8
10
  exports.isFiatToken = isFiatToken;
@@ -1 +1,2 @@
1
1
  export declare const isFiatToken: (symbol: string) => symbol is "USD";
2
+ export declare const isFiatOrStablecoin: (symbol: string) => boolean;
@@ -1,4 +1,5 @@
1
1
  'use client'
2
2
  const isFiatToken = (symbol) => symbol === 'USD';
3
+ const isFiatOrStablecoin = (symbol) => isFiatToken(symbol) || symbol === 'USDC' || symbol === 'USDT';
3
4
 
4
- export { isFiatToken };
5
+ export { isFiatOrStablecoin, isFiatToken };
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+ var exchangeRates = require('../../../../../../data/api/exchangeRates/exchangeRates.cjs');
8
+ var usePromise = require('../../../../../../utils/hooks/usePromise/usePromise.cjs');
9
+
10
+ const overrideBalances = (exchangeRates, tokenBalances) => {
11
+ const updatedExchangeRates = Object.assign({}, exchangeRates);
12
+ if (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length) {
13
+ tokenBalances.forEach(({ symbol, price }) => {
14
+ if (price) {
15
+ updatedExchangeRates[symbol] = price;
16
+ }
17
+ });
18
+ }
19
+ // Fix stablecoin exchange rates for better UX
20
+ updatedExchangeRates['USDC'] = 1;
21
+ updatedExchangeRates['USDT'] = 1;
22
+ return updatedExchangeRates;
23
+ };
24
+ const useExchangeRatesForFunding = ({ onFetch, tokenBalances, }) => {
25
+ const { data: exchangeRates$1 } = usePromise.usePromise(exchangeRates.getExchangeRates, {
26
+ initialData: {},
27
+ onResolve: (rates) => onFetch(overrideBalances(rates, tokenBalances)),
28
+ });
29
+ return React.useMemo(() => overrideBalances(exchangeRates$1, tokenBalances), [tokenBalances, exchangeRates$1]);
30
+ };
31
+
32
+ exports.useExchangeRatesForFunding = useExchangeRatesForFunding;
@@ -0,0 +1,9 @@
1
+ import { FundingTokenData } from '../../types';
2
+ type UseExchangeRatesForFundingProps = {
3
+ onFetch: (exchangeRates: Record<string, number>) => void;
4
+ tokenBalances: FundingTokenData[];
5
+ };
6
+ export declare const useExchangeRatesForFunding: ({ onFetch, tokenBalances, }: UseExchangeRatesForFundingProps) => {
7
+ [x: string]: number;
8
+ };
9
+ export {};
@@ -0,0 +1,28 @@
1
+ 'use client'
2
+ import { useMemo } from 'react';
3
+ import { getExchangeRates } from '../../../../../../data/api/exchangeRates/exchangeRates.js';
4
+ import { usePromise } from '../../../../../../utils/hooks/usePromise/usePromise.js';
5
+
6
+ const overrideBalances = (exchangeRates, tokenBalances) => {
7
+ const updatedExchangeRates = Object.assign({}, exchangeRates);
8
+ if (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length) {
9
+ tokenBalances.forEach(({ symbol, price }) => {
10
+ if (price) {
11
+ updatedExchangeRates[symbol] = price;
12
+ }
13
+ });
14
+ }
15
+ // Fix stablecoin exchange rates for better UX
16
+ updatedExchangeRates['USDC'] = 1;
17
+ updatedExchangeRates['USDT'] = 1;
18
+ return updatedExchangeRates;
19
+ };
20
+ const useExchangeRatesForFunding = ({ onFetch, tokenBalances, }) => {
21
+ const { data: exchangeRates } = usePromise(getExchangeRates, {
22
+ initialData: {},
23
+ onResolve: (rates) => onFetch(overrideBalances(rates, tokenBalances)),
24
+ });
25
+ return useMemo(() => overrideBalances(exchangeRates, tokenBalances), [tokenBalances, exchangeRates]);
26
+ };
27
+
28
+ export { useExchangeRatesForFunding };
@@ -4,14 +4,19 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../../../../_virtual/_tslib.cjs');
7
+ var jsxRuntime = require('react/jsx-runtime');
7
8
  var React = require('react');
9
+ var reactI18next = require('react-i18next');
10
+ var Typography = require('../../../../../../components/Typography/Typography.cjs');
8
11
  var logger = require('../../../../../../shared/logger.cjs');
12
+ var pixelToRem = require('../../../../../../utils/functions/pixelToRem/pixelToRem.cjs');
9
13
  var useFundWithWallet = require('../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.cjs');
10
14
  var DynamicWidgetContext = require('../../../../context/DynamicWidgetContext.cjs');
11
15
 
12
16
  const useSubmitExternalWalletFunding = () => {
13
17
  const { fund } = useFundWithWallet.useFundWithWallet();
14
18
  const { goToInitialDynamicWidgetView, setHeaderAlert } = DynamicWidgetContext.useWidgetContext();
19
+ const { t } = reactI18next.useTranslation();
15
20
  return React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ tokenAmount, externalWallet, tokenSymbol, tokenBalances, }) {
16
21
  var _b;
17
22
  if (!tokenAmount)
@@ -29,16 +34,23 @@ const useSubmitExternalWalletFunding = () => {
29
34
  token: token === 'native' ? undefined : token,
30
35
  });
31
36
  logger.logger.info(`Funding with external wallet succeeded with transaction id: ${txId}`);
37
+ const blockExplorerUrl = (yield externalWallet.connector.getBlockExplorerUrlsForCurrentNetwork())[0];
38
+ const TxnSuccessAlert = (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'current-color', children: [t('dyn_wallet_funding.success'), blockExplorerUrl && (jsxRuntime.jsx(Typography.Typography, { as: 'a', href: `${blockExplorerUrl}/tx/${txId}`, target: '_blank', rel: 'noreferrer', style: {
39
+ marginLeft: pixelToRem.pixelToRem(4),
40
+ textDecoration: 'underline',
41
+ textDecorationThickness: pixelToRem.pixelToRem(1),
42
+ textUnderlineOffset: pixelToRem.pixelToRem(2),
43
+ }, weight: 'bold', color: 'current-color', children: t('dyn_wallet_funding.success_txn_link') }))] }));
32
44
  goToInitialDynamicWidgetView();
33
45
  setHeaderAlert({
34
- copykey: 'dyn_wallet_funding.success',
46
+ content: TxnSuccessAlert,
35
47
  variant: 'success',
36
48
  });
37
49
  }
38
50
  catch (error) {
39
51
  logger.logger.error('Failed to fund with external wallet', error);
40
52
  }
41
- }), [fund, goToInitialDynamicWidgetView, setHeaderAlert]);
53
+ }), [fund, goToInitialDynamicWidgetView, setHeaderAlert, t]);
42
54
  };
43
55
 
44
56
  exports.useSubmitExternalWalletFunding = useSubmitExternalWalletFunding;
@@ -1,13 +1,18 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../../../_virtual/_tslib.js';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
4
  import { useCallback } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Typography } from '../../../../../../components/Typography/Typography.js';
4
7
  import { logger } from '../../../../../../shared/logger.js';
8
+ import { pixelToRem } from '../../../../../../utils/functions/pixelToRem/pixelToRem.js';
5
9
  import { useFundWithWallet } from '../../../../../../utils/hooks/useFundWithWallet/useFundWithWallet.js';
6
10
  import { useWidgetContext } from '../../../../context/DynamicWidgetContext.js';
7
11
 
8
12
  const useSubmitExternalWalletFunding = () => {
9
13
  const { fund } = useFundWithWallet();
10
14
  const { goToInitialDynamicWidgetView, setHeaderAlert } = useWidgetContext();
15
+ const { t } = useTranslation();
11
16
  return useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ tokenAmount, externalWallet, tokenSymbol, tokenBalances, }) {
12
17
  var _b;
13
18
  if (!tokenAmount)
@@ -25,16 +30,23 @@ const useSubmitExternalWalletFunding = () => {
25
30
  token: token === 'native' ? undefined : token,
26
31
  });
27
32
  logger.info(`Funding with external wallet succeeded with transaction id: ${txId}`);
33
+ const blockExplorerUrl = (yield externalWallet.connector.getBlockExplorerUrlsForCurrentNetwork())[0];
34
+ const TxnSuccessAlert = (jsxs(Typography, { variant: 'body_normal', color: 'current-color', children: [t('dyn_wallet_funding.success'), blockExplorerUrl && (jsx(Typography, { as: 'a', href: `${blockExplorerUrl}/tx/${txId}`, target: '_blank', rel: 'noreferrer', style: {
35
+ marginLeft: pixelToRem(4),
36
+ textDecoration: 'underline',
37
+ textDecorationThickness: pixelToRem(1),
38
+ textUnderlineOffset: pixelToRem(2),
39
+ }, weight: 'bold', color: 'current-color', children: t('dyn_wallet_funding.success_txn_link') }))] }));
28
40
  goToInitialDynamicWidgetView();
29
41
  setHeaderAlert({
30
- copykey: 'dyn_wallet_funding.success',
42
+ content: TxnSuccessAlert,
31
43
  variant: 'success',
32
44
  });
33
45
  }
34
46
  catch (error) {
35
47
  logger.error('Failed to fund with external wallet', error);
36
48
  }
37
- }), [fund, goToInitialDynamicWidgetView, setHeaderAlert]);
49
+ }), [fund, goToInitialDynamicWidgetView, setHeaderAlert, t]);
38
50
  };
39
51
 
40
52
  export { useSubmitExternalWalletFunding };
@@ -93,9 +93,10 @@ require('../../../../../../../index.cjs');
93
93
  var useTokenBalances = require('../../../../../../utils/hooks/useTokenBalances/useTokenBalances.cjs');
94
94
  require('../../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
95
95
  var useInternalDynamicContext = require('../../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
96
+ var isFiatToken = require('../isFiatToken/isFiatToken.cjs');
96
97
 
97
98
  const useTokensForFunding = ({ wallet, }) => {
98
- var _a, _b, _c, _d, _e;
99
+ var _a, _b;
99
100
  const { network } = useInternalDynamicContext.useInternalDynamicContext();
100
101
  const { tokenBalances, isLoading: tokenBalancesLoading } = useTokenBalances.useTokenBalances({
101
102
  accountAddress: wallet.address,
@@ -115,23 +116,33 @@ const useTokensForFunding = ({ wallet, }) => {
115
116
  tokens: [],
116
117
  };
117
118
  }
118
- const evmNetworks = (_a = wallet.connector.evmNetworks) !== null && _a !== void 0 ? _a : [];
119
- const solNetworks = (_b = wallet.connector.solNetworks) !== null && _b !== void 0 ? _b : [];
119
+ const enabledNetworks = wallet.connector.getEnabledNetworks();
120
120
  let parsedTokens = [];
121
121
  if (!tokenBalancesLoading) {
122
122
  parsedTokens = tokenBalances
123
123
  // Contrary to what the type says, symbol and name may be undefined
124
124
  .filter(({ symbol, balance, address }) => symbol && balance && address)
125
- .map(({ symbol, balance, name, logoURI, address, decimals }) => ({
126
- balance: parseFloat(balance.toString()),
127
- logoURI,
128
- name: name !== null && name !== void 0 ? name : symbol,
129
- symbol: symbol,
130
- token: {
131
- address,
132
- decimals,
133
- },
134
- }));
125
+ .map(({ symbol, balance, name, logoURI, address, decimals, price, marketValue, }) => {
126
+ const parsedBalance = parseFloat(balance.toString());
127
+ // We use token balance for stablecoins to improve readability (user expectation is to be 1:1)
128
+ let fiatBalance = isFiatToken.isFiatOrStablecoin(symbol)
129
+ ? parsedBalance
130
+ : marketValue;
131
+ if (fiatBalance === undefined && price)
132
+ fiatBalance = price * parsedBalance;
133
+ return {
134
+ balance: parsedBalance,
135
+ fiatBalance,
136
+ logoURI,
137
+ name: name !== null && name !== void 0 ? name : symbol,
138
+ price,
139
+ symbol,
140
+ token: {
141
+ address,
142
+ decimals,
143
+ },
144
+ };
145
+ });
135
146
  }
136
147
  if ((currency === null || currency === void 0 ? void 0 : currency.symbol) && parseFloat(balance !== null && balance !== void 0 ? balance : '0')) {
137
148
  const nativeToken = parsedTokens.find((token) => token.symbol === currency.symbol);
@@ -142,11 +153,12 @@ const useTokensForFunding = ({ wallet, }) => {
142
153
  tokens: parsedTokens,
143
154
  };
144
155
  }
145
- const logoURI = (_d = (_c = [...evmNetworks, ...solNetworks]) === null || _c === void 0 ? void 0 : _c.find(({ chainId }) => chainId === network)) === null || _d === void 0 ? void 0 : _d.iconUrls[0];
156
+ const logoURI = (_a = enabledNetworks.find(({ chainId }) => chainId === network)) === null || _a === void 0 ? void 0 : _a.iconUrls[0];
146
157
  const fetchedToken = {
147
158
  balance: parseFloat(balance !== null && balance !== void 0 ? balance : '0'),
159
+ fiatBalance: undefined,
148
160
  logoURI,
149
- name: (_e = currency.name) !== null && _e !== void 0 ? _e : currency.symbol,
161
+ name: (_b = currency.name) !== null && _b !== void 0 ? _b : currency.symbol,
150
162
  symbol: currency.symbol,
151
163
  token: 'native',
152
164
  };
@@ -89,9 +89,10 @@ import '../../../../../../../index.js';
89
89
  import { useTokenBalances } from '../../../../../../utils/hooks/useTokenBalances/useTokenBalances.js';
90
90
  import '../../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
91
91
  import { useInternalDynamicContext } from '../../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
92
+ import { isFiatOrStablecoin } from '../isFiatToken/isFiatToken.js';
92
93
 
93
94
  const useTokensForFunding = ({ wallet, }) => {
94
- var _a, _b, _c, _d, _e;
95
+ var _a, _b;
95
96
  const { network } = useInternalDynamicContext();
96
97
  const { tokenBalances, isLoading: tokenBalancesLoading } = useTokenBalances({
97
98
  accountAddress: wallet.address,
@@ -111,23 +112,33 @@ const useTokensForFunding = ({ wallet, }) => {
111
112
  tokens: [],
112
113
  };
113
114
  }
114
- const evmNetworks = (_a = wallet.connector.evmNetworks) !== null && _a !== void 0 ? _a : [];
115
- const solNetworks = (_b = wallet.connector.solNetworks) !== null && _b !== void 0 ? _b : [];
115
+ const enabledNetworks = wallet.connector.getEnabledNetworks();
116
116
  let parsedTokens = [];
117
117
  if (!tokenBalancesLoading) {
118
118
  parsedTokens = tokenBalances
119
119
  // Contrary to what the type says, symbol and name may be undefined
120
120
  .filter(({ symbol, balance, address }) => symbol && balance && address)
121
- .map(({ symbol, balance, name, logoURI, address, decimals }) => ({
122
- balance: parseFloat(balance.toString()),
123
- logoURI,
124
- name: name !== null && name !== void 0 ? name : symbol,
125
- symbol: symbol,
126
- token: {
127
- address,
128
- decimals,
129
- },
130
- }));
121
+ .map(({ symbol, balance, name, logoURI, address, decimals, price, marketValue, }) => {
122
+ const parsedBalance = parseFloat(balance.toString());
123
+ // We use token balance for stablecoins to improve readability (user expectation is to be 1:1)
124
+ let fiatBalance = isFiatOrStablecoin(symbol)
125
+ ? parsedBalance
126
+ : marketValue;
127
+ if (fiatBalance === undefined && price)
128
+ fiatBalance = price * parsedBalance;
129
+ return {
130
+ balance: parsedBalance,
131
+ fiatBalance,
132
+ logoURI,
133
+ name: name !== null && name !== void 0 ? name : symbol,
134
+ price,
135
+ symbol,
136
+ token: {
137
+ address,
138
+ decimals,
139
+ },
140
+ };
141
+ });
131
142
  }
132
143
  if ((currency === null || currency === void 0 ? void 0 : currency.symbol) && parseFloat(balance !== null && balance !== void 0 ? balance : '0')) {
133
144
  const nativeToken = parsedTokens.find((token) => token.symbol === currency.symbol);
@@ -138,11 +149,12 @@ const useTokensForFunding = ({ wallet, }) => {
138
149
  tokens: parsedTokens,
139
150
  };
140
151
  }
141
- const logoURI = (_d = (_c = [...evmNetworks, ...solNetworks]) === null || _c === void 0 ? void 0 : _c.find(({ chainId }) => chainId === network)) === null || _d === void 0 ? void 0 : _d.iconUrls[0];
152
+ const logoURI = (_a = enabledNetworks.find(({ chainId }) => chainId === network)) === null || _a === void 0 ? void 0 : _a.iconUrls[0];
142
153
  const fetchedToken = {
143
154
  balance: parseFloat(balance !== null && balance !== void 0 ? balance : '0'),
155
+ fiatBalance: undefined,
144
156
  logoURI,
145
- name: (_e = currency.name) !== null && _e !== void 0 ? _e : currency.symbol,
157
+ name: (_b = currency.name) !== null && _b !== void 0 ? _b : currency.symbol,
146
158
  symbol: currency.symbol,
147
159
  token: 'native',
148
160
  };
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var reactI18next = require('react-i18next');
8
+ var LinearGradientFrame = require('../../../../../components/LinearGradientFrame/LinearGradientFrame.cjs');
9
+ require('react');
10
+ var walletWithSunglasses = require('../../../../../shared/assets/wallet-with-sunglasses.cjs');
11
+ require('@dynamic-labs/iconic');
12
+ require('../../../../../context/ViewContext/ViewContext.cjs');
13
+ var Typography = require('../../../../../components/Typography/Typography.cjs');
14
+
15
+ const EmptyScreen = () => {
16
+ const { t } = reactI18next.useTranslation();
17
+ return (jsxRuntime.jsxs("div", { className: 'empty-screen', children: [jsxRuntime.jsx(LinearGradientFrame.LinearGradientFrame, { Icon: jsxRuntime.jsx(walletWithSunglasses.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'secondary', className: 'empty-screen__title', children: t('dyn_settings.empty_screen.title') })] }));
18
+ };
19
+
20
+ exports.EmptyScreen = EmptyScreen;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const EmptyScreen: FC;
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { LinearGradientFrame } from '../../../../../components/LinearGradientFrame/LinearGradientFrame.js';
5
+ import 'react';
6
+ import { ReactComponent as SvgWalletWithSunglasses } from '../../../../../shared/assets/wallet-with-sunglasses.js';
7
+ import '@dynamic-labs/iconic';
8
+ import '../../../../../context/ViewContext/ViewContext.js';
9
+ import { Typography } from '../../../../../components/Typography/Typography.js';
10
+
11
+ const EmptyScreen = () => {
12
+ const { t } = useTranslation();
13
+ return (jsxs("div", { className: 'empty-screen', children: [jsx(LinearGradientFrame, { Icon: jsx(SvgWalletWithSunglasses, {}) }), jsx(Typography, { variant: 'title', color: 'secondary', className: 'empty-screen__title', children: t('dyn_settings.empty_screen.title') })] }));
14
+ };
15
+
16
+ export { EmptyScreen };
@@ -0,0 +1 @@
1
+ export * from './EmptyScreen';