From 2f7d16c263f3e224cd4845a0c51a75a80e65182a Mon Sep 17 00:00:00 2001 From: Uniswap Labs Service Account Date: Wed, 26 Jun 2024 18:37:03 +0000 Subject: [PATCH] ci(release): publish latest release --- ...ve-wagmi-charts-npm-2.5.1-c9e2637be7.patch | 42 -- RELEASE | 48 +- VERSION | 2 +- apps/mobile/ios/Modifiers.swift | 41 -- .../ios/Shared/RelativeOffsetView.swift | 46 ++ .../ios/Uniswap.xcodeproj/project.pbxproj | 8 +- .../ios/Uniswap/Icons/AlertTriangleIcon.swift | 2 +- .../Backup/MnemonicDisplayView.swift | 19 +- .../Import/SeedPhraseInputView.swift | 16 +- apps/mobile/package.json | 2 +- apps/mobile/src/app/hooks.ts | 33 +- apps/mobile/src/app/migrations.test.ts | 214 +++++--- apps/mobile/src/app/migrations.ts | 16 +- .../src/app/modals/AccountSwitcherModal.tsx | 5 +- .../src/app/modals/ExperimentsModal.tsx | 4 +- apps/mobile/src/app/modals/ExploreModal.tsx | 2 +- .../src/app/modals/ExtensionPromoModal.tsx | 2 +- .../src/app/modals/TransferTokenModal.tsx | 2 +- .../src/app/modals/ViewOnlyExplainerModal.tsx | 2 +- apps/mobile/src/app/navigation/navigation.tsx | 22 +- apps/mobile/src/app/saga.ts | 14 - apps/mobile/src/app/schema.ts | 6 +- apps/mobile/src/app/store.ts | 10 - .../PriceExplorerAnimatedNumber.tsx | 2 +- .../PriceExplorer/PriceExplorerError.tsx | 2 +- .../RecipientSelect/RecipientScanModal.tsx | 2 +- .../RecipientSelect/RecipientSelect.tsx | 32 +- .../components/RecipientSelect/hooks.test.ts | 100 ++-- .../RemoveWallet/RemoveWalletModal.tsx | 2 +- .../RestoreWalletModal/RestoreWalletModal.tsx | 2 +- .../TokenBalanceList/TokenBalanceList.tsx | 99 ++-- .../TokenDetails/TokenDetailsLinks.tsx | 8 +- .../TokenSelector/TokenFiatOnRampList.tsx | 6 +- .../Trace/TraceUserProperties.test.tsx | 8 +- .../components/Trace/TraceUserProperties.tsx | 4 +- .../DappConnectedNetworksModal.tsx | 6 +- .../ModalWithOverlay/ModalWithOverlay.tsx | 4 +- .../RequestModal/RequestDetails.tsx | 6 +- .../RequestModal/SpendingDetails.tsx | 4 +- .../RequestModal/UwULinkErc20SendModal.tsx | 4 +- .../WalletConnectRequestModalContent.tsx | 2 +- .../WalletConnect/RequestModal/hooks.ts | 10 +- .../ScanSheet/PendingConnectionModal.tsx | 4 +- .../PendingConnectionSwitchAccountModal.tsx | 2 +- .../PendingConnectionSwitchNetworkModal.tsx | 14 +- .../ScanSheet/WalletConnectModal.tsx | 2 +- .../accounts/AccountCardItem.test.tsx | 8 +- .../accounts/AccountHeader.test.tsx | 8 +- .../components/accounts/AccountList.test.tsx | 2 +- .../components/buttons/BackButton.test.tsx | 2 +- .../components/buttons/CloseButton.test.tsx | 2 +- .../components/buttons/LinkButton.test.tsx | 2 +- .../components/explore/ExploreSections.tsx | 6 +- .../explore/FavoriteHeaderRow.test.tsx | 2 +- .../explore/FavoriteTokenCard.test.tsx | 2 +- .../components/explore/FavoriteTokenCard.tsx | 6 +- .../explore/FavoriteWalletCard.test.tsx | 2 +- .../components/explore/FavoriteWalletCard.tsx | 2 +- .../components/explore/RemoveButton.test.tsx | 2 +- .../src/components/explore/TokenItem.test.tsx | 2 +- .../src/components/explore/TokenItem.tsx | 4 +- .../__snapshots__/TokenItem.test.tsx.snap | 1 + apps/mobile/src/components/explore/hooks.ts | 4 +- .../explore/search/SearchResultsSection.tsx | 12 +- .../src/components/explore/search/hooks.ts | 8 +- .../search/items/SearchEtherscanItem.tsx | 6 +- .../forceUpgrade/ForceUpgradeModal.tsx | 6 +- .../src/components/home/ActivityTab.tsx | 2 +- apps/mobile/src/components/home/FeedTab.tsx | 6 +- apps/mobile/src/components/home/NftsTab.tsx | 4 +- apps/mobile/src/components/home/TokensTab.tsx | 17 +- .../components/icons/BlockExplorerIcon.tsx | 21 +- .../src/components/input/PasswordInput.tsx | 2 +- .../src/components/layout/TabHelpers.tsx | 5 +- .../layout/screens/HeaderScrollScreen.tsx | 2 +- .../mnemonic/MnemonicConfirmation.tsx | 12 +- .../components/mnemonic/MnemonicDisplay.tsx | 7 + .../components/unitags/ChangeUnitagModal.tsx | 4 +- .../src/components/unitags/ChooseNftModal.tsx | 2 +- .../unitags/ChoosePhotoOptionsModal.tsx | 2 +- .../components/unitags/DeleteUnitagModal.tsx | 2 +- .../components/unitags/UnitagsIntroModal.tsx | 2 +- .../CloudBackupProcessingAnimation.tsx | 13 +- .../src/features/appRating/selectors.test.ts | 10 +- .../src/features/contracts/useContract.ts | 6 +- .../deepLinking/handleDeepLinkSaga.ts | 3 +- .../deepLinking/handleSwapLinkSaga.test.ts | 34 +- .../deepLinking/handleSwapLinkSaga.ts | 6 +- .../externalProfile/ProfileContextMenu.tsx | 8 +- .../externalProfile/ProfileHeader.tsx | 2 +- .../fiatOnRamp/ExchangeTransferModal.tsx | 2 +- .../fiatOnRamp/FiatOnRampAggregatorModal.tsx | 2 +- .../fiatOnRamp/FiatOnRampAmountSection.tsx | 3 +- .../features/fiatOnRamp/FiatOnRampContext.tsx | 6 +- .../fiatOnRamp/FiatOnRampCountryListModal.tsx | 2 +- .../features/fiatOnRamp/FiatOnRampModal.tsx | 14 +- .../fiatOnRamp/FiatOnRampTokenSelector.tsx | 2 +- .../features/fiatOnRamp/aggregatorHooks.ts | 12 +- apps/mobile/src/features/fiatOnRamp/hooks.ts | 8 +- .../src/features/firebase/firebaseDataSaga.ts | 14 +- .../import/InputWithSuffix.android.tsx | 2 +- .../features/import/InputWithSuffix.ios.tsx | 2 +- .../SafeKeyboardOnboardingScreen.tsx | 2 +- .../scantastic/ExtensionWaitlistModal.tsx | 2 +- .../features/scantastic/ScantasticModal.tsx | 43 +- apps/mobile/src/features/telemetry/saga.ts | 4 +- .../ApproveSummaryItem.stories.tsx | 12 +- .../FiatPurchaseSummaryItem.stories.tsx | 12 +- .../NFTApproveSummaryItem.stories.tsx | 10 +- .../NFTMintSummaryItem.stories.tsx | 8 +- .../NFTTradeSummaryItem.stories.tsx | 16 +- .../ReceiveSummaryItem.stories.tsx | 14 +- .../SummaryItems/SendSummaryItem.stories.tsx | 19 +- .../SummaryItems/SwapSummaryItem.stories.tsx | 14 +- .../UnknownSummaryItem.stories.tsx | 12 +- .../SummaryItems/WCSummaryItem.stories.tsx | 10 +- .../SummaryItems/WrapSummaryItem.stories.tsx | 21 +- .../TransactionPending/TransactionPending.tsx | 4 +- .../transactions/transfer/TransferFlow.tsx | 4 +- .../transactions/transfer/TransferStatus.tsx | 3 +- .../unitags/ChooseProfilePictureScreen.tsx | 4 +- .../features/unitags/ClaimUnitagScreen.tsx | 10 +- .../unitags/EditUnitagProfileScreen.tsx | 8 +- .../mobile/src/features/walletConnect/saga.ts | 16 +- .../walletConnect/signWcRequestSaga.ts | 10 +- .../src/features/walletConnect/utils.test.ts | 10 +- .../src/features/walletConnect/utils.ts | 16 +- .../walletConnect/walletConnectSlice.ts | 8 +- apps/mobile/src/screens/DevScreen.tsx | 1 - .../screens/ExchangeTransferConnecting.tsx | 4 +- apps/mobile/src/screens/ExploreScreen.tsx | 4 +- .../src/screens/ExternalProfileScreen.tsx | 8 +- .../src/screens/FiatOnRampConnecting.tsx | 4 +- apps/mobile/src/screens/FiatOnRampScreen.tsx | 4 +- .../screens/FiatOnRampServiceProviders.tsx | 2 +- apps/mobile/src/screens/HomeScreen.tsx | 60 +- .../src/screens/Import/ImportMethodScreen.tsx | 9 - .../screens/Import/OnDeviceRecoveryScreen.tsx | 9 +- .../RestoreCloudBackupLoadingScreen.tsx | 6 +- .../Import/RestoreCloudBackupScreen.tsx | 9 - .../src/screens/Import/SeedPhraseInput.tsx | 43 +- .../screens/Import/SeedPhraseInputScreen.tsx | 4 +- .../Import/SeedPhraseInputScreenV2.tsx | 14 +- .../src/screens/Import/SelectWalletScreen.tsx | 21 +- .../src/screens/Import/WatchWalletScreen.tsx | 20 +- .../screens/Import/useOnDeviceRecoveryData.ts | 4 + apps/mobile/src/screens/ModalAwareView.tsx | 2 +- .../src/screens/NFTCollectionScreen.tsx | 2 +- apps/mobile/src/screens/NFTItemScreen.tsx | 10 +- .../screens/Onboarding/ManualBackupScreen.tsx | 4 +- .../Onboarding/WelcomeWalletScreen.tsx | 16 +- .../mobile/src/screens/ReceiveCryptoModal.tsx | 2 +- ...ettingsCloudBackupPasswordCreateScreen.tsx | 2 +- .../src/screens/SettingsFiatCurrencyModal.tsx | 2 +- apps/mobile/src/screens/SettingsWallet.tsx | 6 +- .../mobile/src/screens/SettingsWalletEdit.tsx | 2 +- .../mobile/src/screens/TokenDetailsScreen.tsx | 6 +- apps/mobile/src/test/fixtures/explore.ts | 4 +- apps/mobile/src/utils/useNoYoloParser.ts | 6 +- apps/web/.eslintrc.js | 4 + apps/web/cypress/e2e/remove-liquidity.test.ts | 5 +- apps/web/cypress/e2e/swap/swap.test.ts | 5 +- apps/web/cypress/e2e/swap/uniswapx.test.ts | 5 +- apps/web/cypress/e2e/swap/uniswapxv2.test.ts | 5 +- apps/web/cypress/e2e/swap/wrap.test.ts | 6 +- apps/web/cypress/e2e/token-details.test.ts | 5 +- apps/web/cypress/e2e/universal-search.test.ts | 5 +- apps/web/cypress/support/setupTests.ts | 5 +- apps/web/cypress/tsconfig.json | 11 + apps/web/functions/tsconfig.json | 11 + apps/web/public/pools-sitemap.xml | 159 +++++- apps/web/public/tokens-sitemap.xml | 275 ++++++++-- .../Activity/CancelOrdersDialog.test.tsx | 7 +- .../Activity/CancelOrdersDialog.tsx | 7 +- .../Activity/OffchainActivityModal.test.tsx | 9 +- .../Activity/OffchainActivityModal.tsx | 5 +- .../Activity/OffchainOrderLineItem.test.tsx | 7 +- .../CancelOrdersDialog.test.tsx.snap | 4 +- .../Activity/fixtures/activity.ts | 5 +- .../MiniPortfolio/Activity/parseLocal.test.ts | 13 +- .../MiniPortfolio/Activity/parseLocal.ts | 5 +- .../MiniPortfolio/Activity/parseRemote.tsx | 5 +- .../MiniPortfolio/Activity/types.ts | 5 +- .../MiniPortfolio/Activity/utils.ts | 51 +- .../Limits/LimitDetailActivityRow.test.tsx | 11 +- .../MiniPortfolio/Limits/LimitsMenu.test.tsx | 9 +- .../Limits/OpenLimitOrdersButton.test.tsx | 4 +- .../MiniPortfolio/Pools/cache.ts | 15 +- .../MiniPortfolio/Pools/getTokensAsync.ts | 9 +- .../MiniPortfolio/Pools/hooks.ts | 8 +- .../Pools/useMultiChainPositions.tsx | 18 +- .../MiniPortfolio/PortfolioLogo.test.tsx | 7 +- .../MiniPortfolio/PortfolioLogo.tsx | 9 +- .../components/Banner/Outage/OutageBanner.tsx | 4 +- .../src/components/Banner/shared/Banners.tsx | 4 +- .../components/BreadcrumbNav/index.test.tsx | 4 +- .../Charts/LiquidityChart/index.tsx | 5 +- .../src/components/ConfirmSwapModal/Modal.tsx | 2 +- .../ConfirmSwapModal/Pending.test.tsx | 9 +- .../components/ConfirmSwapModal/Pending.tsx | 8 +- .../CurrencyInputPanel/utils.test.ts | 5 +- .../Dialog/__snapshots__/Dialog.test.tsx.snap | 4 +- apps/web/src/components/DoubleLogo/index.tsx | 7 +- .../FeatureFlagModal/FeatureFlagModal.tsx | 5 +- apps/web/src/components/FeeSelector/index.tsx | 3 +- .../web/src/components/FeeSelector/shared.tsx | 12 +- .../src/components/FiatOnrampModal/index.tsx | 62 +-- .../components/FiatOnrampModal/utils.test.ts | 11 +- .../src/components/FiatOnrampModal/utils.ts | 5 +- apps/web/src/components/Logo/AssetLogo.tsx | 5 +- apps/web/src/components/Logo/ChainLogo.tsx | 40 +- .../src/components/Logo/QueryTokenLogo.tsx | 5 +- apps/web/src/components/Modal/index.tsx | 50 +- .../ChainSelector/ChainSelectorRow.test.tsx | 8 +- .../NavBar/ChainSelector/ChainSelectorRow.tsx | 4 +- .../ChainSelectorRow.test.tsx.snap | 347 +----------- .../components/NavBar/ChainSelector/index.tsx | 28 +- .../LEGACY/SearchBar/SearchBarDropdown.tsx | 6 +- .../NavBar/LEGACY/SearchBar/SuggestionRow.tsx | 4 +- apps/web/src/components/NavBar/NavBar.tsx | 14 +- .../NavBar/SearchBar/SearchBarDropdown.tsx | 6 +- .../NavBar/SearchBar/SuggestionRow.tsx | 4 +- .../components/NetworkAlert/NetworkAlert.tsx | 3 +- .../Polling/ChainConnectivityWarning.tsx | 4 +- apps/web/src/components/Polling/index.tsx | 10 +- .../Pools/PoolDetails/ChartSection/index.tsx | 7 +- .../Pools/PoolDetails/PoolDetailsHeader.tsx | 5 +- .../PoolDetails/PoolDetailsLink.test.tsx | 6 +- .../Pools/PoolDetails/PoolDetailsLink.tsx | 4 +- .../PoolDetailsStatsButtons.test.tsx | 5 +- .../PoolDetailsTransactionsTable.tsx | 8 +- .../components/Pools/PoolTable/PoolTable.tsx | 5 +- .../src/components/Popups/PopupContent.tsx | 9 +- .../PositionListItem.test.tsx | 7 +- .../SearchModal/CommonBases.test.tsx | 4 +- .../SearchModal/CurrencySearchModal.tsx | 17 +- .../Settings/MultipleRoutingOptions.test.tsx | 12 +- .../src/components/Settings/index.test.tsx | 5 +- apps/web/src/components/Table/styled.tsx | 4 +- .../TokenSafety/TokenSafetyModal.tsx | 2 +- .../Tokens/TokenDetails/BalanceSummary.tsx | 15 +- .../TokenDetails/InvalidTokenDetails.tsx | 11 +- .../Tokens/TokenDetails/Skeleton.test.tsx | 4 +- .../Tokens/TokenDetails/StatsSection.tsx | 11 +- .../Tokens/TokenDetails/TokenDescription.tsx | 4 +- .../TokenDetails/TokenDetailsHeader.tsx | 4 +- .../components/Tokens/TokenDetails/index.tsx | 5 +- .../tables/TokenDetailsPoolsTable.test.tsx | 17 +- .../Tokens/TokenTable/NetworkFilter.tsx | 6 +- apps/web/src/components/Tokens/constants.ts | 7 +- .../TransactionConfirmationModal/index.tsx | 14 +- apps/web/src/components/Web3Provider/wagmi.ts | 9 +- .../components/Web3Provider/walletConnect.ts | 4 +- .../components/claim/AddressClaimModal.tsx | 2 +- .../src/components/swap/SwapHeader.test.tsx | 6 +- .../swap/UnsupportedCurrencyFooter.tsx | 5 +- .../web/src/components/vote/DelegateModal.tsx | 2 +- apps/web/src/components/vote/ExecuteModal.tsx | 2 +- .../components/vote/ProposalEmptyState.tsx | 4 +- apps/web/src/components/vote/QueueModal.tsx | 2 +- apps/web/src/components/vote/VoteModal.tsx | 2 +- apps/web/src/connection/web3reactShim.ts | 4 +- apps/web/src/constants/chains.test.ts | 252 ++++----- apps/web/src/constants/chains.ts | 201 ++----- apps/web/src/constants/governance.ts | 14 +- apps/web/src/constants/localCurrencies.tsx | 5 + apps/web/src/constants/localCurrencyIcons.tsx | 36 ++ apps/web/src/constants/providers.ts | 13 +- apps/web/src/constants/routing.test.ts | 14 +- apps/web/src/constants/routing.ts | 137 +++-- apps/web/src/constants/tokenSafety.tsx | 4 +- apps/web/src/constants/tokens.ts | 291 +++++++--- .../dynamicConfig/quickRouteChains.ts | 8 +- .../src/featureFlags/flags/outageBanner.ts | 15 +- .../data/apollo/TokenBalancesProvider.tsx | 40 +- .../data/nft/NftUniversalRouterAddress.ts | 4 +- .../graphql/data/pools/usePoolTransactions.ts | 16 +- .../web/src/graphql/data/pools/useTopPools.ts | 2 +- apps/web/src/graphql/data/types.test.ts | 4 +- .../src/graphql/data/useAllTransactions.ts | 10 +- apps/web/src/graphql/data/util.test.tsx | 4 +- apps/web/src/graphql/data/util.tsx | 22 +- apps/web/src/hooks/Tokens.ts | 16 +- apps/web/src/hooks/useContract.ts | 10 +- apps/web/src/hooks/useERC20Permit.ts | 17 +- apps/web/src/hooks/useEthersProvider.ts | 8 +- apps/web/src/hooks/useEthersSigner.ts | 7 +- apps/web/src/hooks/useFetchListCallback.ts | 4 +- apps/web/src/hooks/usePoolTickData.ts | 11 +- apps/web/src/hooks/usePools.ts | 10 +- apps/web/src/hooks/useSelectChain.ts | 4 +- apps/web/src/hooks/useSocksBalance.ts | 7 +- apps/web/src/hooks/useSwapTaxes.ts | 23 +- apps/web/src/hooks/useSwitchChain.ts | 4 +- apps/web/src/hooks/useUSDPrice.ts | 5 +- apps/web/src/i18n/locales/source/en-US.json | 34 +- apps/web/src/lib/hooks/multicall.ts | 4 +- .../routing/clientSideSmartOrderRouter.ts | 10 +- .../hooks/routing/useRoutingAPIArguments.ts | 5 +- apps/web/src/lib/hooks/useBlockNumber.tsx | 10 +- apps/web/src/lib/hooks/useCurrencyLogoURIs.ts | 18 +- apps/web/src/lib/hooks/useNativeCurrency.ts | 7 +- .../lib/hooks/useTokenList/sorting.test.ts | 9 +- .../web/src/lib/hooks/useTokenList/sorting.ts | 7 +- apps/web/src/lib/state/multicall.tsx | 11 +- .../src/nft/components/bag/BagFooter.test.tsx | 15 +- apps/web/src/nft/components/bag/BagFooter.tsx | 11 +- .../components/collection/ActivityCells.tsx | 4 +- apps/web/src/nft/hooks/useUsdPrice.ts | 4 +- apps/web/src/nft/utils/blocklist.ts | 1 - apps/web/src/pages/AddLiquidity/index.tsx | 11 +- apps/web/src/pages/Explore/index.tsx | 9 +- .../Explore/tables/RecentTransactions.tsx | 4 +- .../Landing/components/cards/WebappCard.tsx | 12 +- apps/web/src/pages/Landing/sections/Hero.tsx | 2 +- .../web/src/pages/MigrateV2/MigrateV2Pair.tsx | 5 +- apps/web/src/pages/Pool/CTACards.tsx | 7 +- apps/web/src/pages/Pool/PositionPage.tsx | 13 +- apps/web/src/pages/Pool/v2.tsx | 2 +- apps/web/src/pages/Swap/Buy/BuyForm.tsx | 62 ++- .../pages/Swap/Buy/CountryListModal.test.tsx | 47 ++ .../src/pages/Swap/Buy/CountryListModal.tsx | 120 ++++ .../pages/Swap/Buy/CountryListRow.test.tsx | 25 + .../web/src/pages/Swap/Buy/CountryListRow.tsx | 49 ++ .../CountryListModal.test.tsx.snap | 27 + .../CountryListRow.test.tsx.snap | 200 +++++++ apps/web/src/pages/Swap/Buy/hooks.ts | 57 ++ .../pages/Swap/Send/SendCurrencyInputForm.tsx | 5 +- apps/web/src/pages/Swap/Send/SendForm.tsx | 5 +- .../src/pages/Swap/Send/SendReviewModal.tsx | 10 +- .../NewAddressSpeedBump.test.tsx.snap | 2 +- .../SmartContractSpeedbump.test.tsx.snap | 2 +- apps/web/src/pages/Swap/SwapForm.tsx | 7 +- apps/web/src/pages/Swap/index.tsx | 5 +- apps/web/src/pages/TokenDetails/index.tsx | 10 +- apps/web/src/pages/TokenDetails/utils.ts | 10 +- .../state/activity/polling/transactions.ts | 8 +- apps/web/src/state/activity/subscription.ts | 5 +- apps/web/src/state/application/reducer.ts | 4 +- apps/web/src/state/governance/hooks.ts | 8 +- apps/web/src/state/index.ts | 4 +- apps/web/src/state/migrations.test.ts | 2 +- apps/web/src/state/migrations/3.test.ts | 25 +- apps/web/src/state/migrations/3.ts | 27 +- apps/web/src/state/reducer.ts | 4 +- apps/web/src/state/reducerTypeTest.ts | 6 +- apps/web/src/state/routing/gas.ts | 5 +- apps/web/src/state/routing/types.ts | 11 +- apps/web/src/state/routing/usePreviewTrade.ts | 5 +- apps/web/src/state/routing/utils.test.ts | 5 +- apps/web/src/state/stake/hooks.tsx | 11 +- apps/web/src/state/swap/SwapContext.test.tsx | 9 +- apps/web/src/state/swap/SwapContext.tsx | 9 +- apps/web/src/state/swap/hooks.test.ts | 13 +- apps/web/src/state/swap/hooks.tsx | 12 +- apps/web/src/state/swap/types.ts | 9 +- .../web/src/state/transactions/hooks.test.tsx | 29 +- apps/web/src/state/transactions/hooks.tsx | 5 +- .../src/state/transactions/reducer.test.ts | 58 +- apps/web/src/state/transactions/reducer.ts | 21 +- apps/web/src/state/wallets/reducer.ts | 4 +- apps/web/src/test-utils/constants.ts | 18 +- apps/web/src/test-utils/pools/fixtures.ts | 9 +- apps/web/src/test-utils/tokens/mocks.ts | 17 +- .../RadialGradientByChainUpdater.ts | 24 +- apps/web/src/utils/chains.tsx | 7 +- apps/web/src/utils/currencyKey.ts | 5 +- apps/web/src/utils/fiatCurrency.ts | 60 ++ apps/web/src/utils/getExplorerLink.test.ts | 16 +- apps/web/src/utils/getExplorerLink.ts | 36 +- apps/web/src/utils/transfer.test.ts | 5 +- apps/web/src/utils/transfer.ts | 7 +- config/jest-presets/jest/globals.js | 1 + i18next-parser.config.js | 2 + index.d.ts | 7 + .../__snapshots__/preset.test.ts.snap | 1 + packages/eslint-config/native.js | 2 +- packages/eslint-config/restrictedImports.js | 4 +- .../ui/src/assets/icons/CheckmarkIcon.tsx | 24 - .../ui/src/assets/icons/checkmark-circle.svg | 3 + packages/ui/src/assets/icons/checkmark.svg | 3 - packages/ui/src/assets/icons/wifi.svg | 3 + .../ui/src/assets/logos/png/uniswap-logo.png | Bin 61597 -> 13060 bytes packages/ui/src/components/Unicon/utils.ts | 2 +- .../UniversalImage/UniversalImage.tsx | 3 +- .../internal/PlainImage.native.tsx | 19 +- .../UniversalImage/internal/PlainImage.tsx | 19 +- .../UniversalImage/internal/SvgImage.tsx | 14 +- .../ui/src/components/UniversalImage/types.ts | 1 + .../src/components/icons/CheckmarkCircle.tsx | 17 + packages/ui/src/components/icons/Wifi.tsx | 17 + packages/ui/src/components/icons/exported.ts | 3 +- packages/ui/src/components/input/CheckBox.tsx | 2 +- packages/ui/src/index.ts | 1 + packages/ui/src/loading/Shine.web.tsx | 36 +- packages/ui/src/theme/color/colors.ts | 106 ++-- packages/ui/src/theme/color/types.ts | 7 +- packages/ui/src/theme/fonts.ts | 4 +- packages/ui/src/theme/iconSizes.ts | 2 +- packages/ui/src/theme/shadows.ts | 18 +- .../ui/src/utils/haptics/HapticFeedback.ts | 36 +- .../src/utils/haptics/HapticFeedback.web.ts | 16 - packages/uniswap/package.json | 7 + packages/uniswap/src/assets/chainLogos.tsx | 117 ++++ .../src/components/BaseCard/BaseCard.test.tsx | 26 +- .../src/components/BaseCard/BaseCard.tsx | 3 +- .../__snapshots__/BaseCard.test.tsx.snap | 48 +- .../CurrencyLogo/NetworkLogo.test.tsx | 10 +- .../components/CurrencyLogo/NetworkLogo.tsx | 6 +- .../CurrencyLogo/TokenLogo.test.tsx | 36 +- .../src/components/CurrencyLogo/TokenLogo.tsx | 6 +- .../__snapshots__/TokenLogo.test.tsx.snap | 1 + .../dropdowns/ActionSheetDropdown.test.tsx | 8 +- .../dropdowns/ActionSheetDropdown.tsx | 17 +- .../ActionSheetDropdown.test.tsx.snap | 5 + .../src/components/input/TextInput.tsx | 3 +- .../src/components/misc/Scrollbar.tsx | 0 .../components/modals/ActionSheetModal.tsx | 5 +- .../components/modals/BottomSheetContext.tsx | 0 .../modals/BottomSheetModal.native.tsx | 10 +- .../components/modals/BottomSheetModal.tsx | 5 +- .../modals/BottomSheetModal.web.tsx | 6 +- .../modals/BottomSheetModalProps.tsx | 0 .../components/modals/HandleBar.native.tsx} | 9 +- .../src/components/modals/HandleBar.tsx | 14 + .../src/components/network/NetworkFilter.tsx | 99 ++-- .../src/components/network/NetworkOption.tsx | 16 +- .../src/components/network/hooks.tsx | 15 +- packages/uniswap/src/config.ts | 3 +- packages/uniswap/src/constants/chains.ts | 187 ++++--- packages/uniswap/src/constants/tokens.ts | 22 +- packages/uniswap/src/constants/urls.ts | 2 + .../graphql/uniswap-data-api/queries.graphql | 10 + .../uniswap-data-api/web/portfolios.graphql | 19 +- packages/uniswap/src/features/chains/utils.ts | 2 + .../fiatOnRamp/FiatOnRampCountryPicker.tsx | 21 +- .../uniswap/src/features/fiatOnRamp/types.ts | 7 + packages/uniswap/src/features/gating/flags.ts | 9 +- .../src/features/telemetry/constants/trace.ts | 1 + .../uniswap/src/features/telemetry/types.ts | 22 +- .../src/i18n/locales/source/en-US.json | 42 +- packages/uniswap/src/react-native-dotenv.d.ts | 1 + .../src/test/fixtures/events.ts | 0 packages/uniswap/src/test/fixtures/index.ts | 1 + packages/uniswap/src/test/render.tsx | 1 + packages/uniswap/src/types/chains.ts | 102 +++- .../utils/useKeyboardLayout.android.test.ts | 8 +- .../src/utils/useKeyboardLayout.ios.test.ts | 8 +- .../src/utils/useKeyboardLayout.native.ts} | 4 +- .../uniswap/src/utils/useKeyboardLayout.ts | 7 + packages/wallet/jest-setup.js | 2 +- packages/wallet/package.json | 2 - .../CurrencyLogo/LogoWithTxStatus.test.tsx | 36 +- .../CurrencyLogo/LogoWithTxStatus.tsx | 15 +- .../CurrencyLogo/SplitLogo.test.tsx | 14 +- .../src/components/CurrencyLogo/SplitLogo.tsx | 6 +- .../__snapshots__/CurrencyLogo.test.tsx.snap | 2 + .../LogoWithTxStatus.test.tsx.snap | 1 + .../__snapshots__/SplitLogo.test.tsx.snap | 2 + .../__snapshots__/index.test.tsx.snap | 2 + .../DevelopmentOnly/UniconSampleSheet.tsx | 2 +- .../components/QRCodeScanner/WalletQRCode.tsx | 4 +- .../ViewOnlyRecipientModal.tsx | 2 +- .../src/components/RecipientSearch/hooks.ts | 116 ++-- .../TokenSelector/TokenSelector.tsx | 16 +- .../TokenSelector/TokenSelectorList.tsx | 10 +- .../TokenSelectorSearchResultsList.tsx | 6 +- .../TokenSelector/TokenSelectorSendList.tsx | 8 +- .../TokenSelectorSwapInputList.tsx | 8 +- .../TokenSelectorSwapOutputList.tsx | 10 +- .../components/TokenSelector/filter.test.ts | 22 +- .../src/components/TokenSelector/filter.ts | 6 +- .../components/TokenSelector/hooks.test.ts | 32 +- .../src/components/TokenSelector/hooks.ts | 30 +- .../WalletPreviewCard/WalletPreviewCard.tsx | 5 +- .../WalletPreviewCard.test.tsx.snap | 7 + .../components/buttons/PasteButton.test.tsx | 18 + .../__snapshots__/PasteButton.test.tsx.snap | 244 +++++++++ .../src/components/icons/CheckmarkCircle.tsx | 31 -- .../src/components/input/AmountInput.tsx | 5 +- .../modals/WarningModal/WarningModal.tsx | 23 +- .../components/network/NetworkFee.test.tsx | 10 +- .../src/components/network/NetworkFee.tsx | 4 +- .../src/components/network/NetworkLogos.tsx | 10 +- .../components/network/NetworkPill.test.tsx | 8 +- .../src/components/network/NetworkPill.tsx | 8 +- .../wallet/src/components/nfts/NftsList.tsx | 6 +- .../language/SettingsLanguageModal.native.tsx | 2 +- .../language/SettingsLanguageModal.web.tsx | 4 +- .../components/text/LearnMoreLink.test.tsx | 2 +- .../components/text/RelativeChange.test.tsx | 2 +- packages/wallet/src/constants/addresses.ts | 16 +- packages/wallet/src/constants/chains.ts | 72 --- packages/wallet/src/constants/tokens.ts | 62 ++- .../src/contexts/WalletNavigationContext.tsx | 6 +- packages/wallet/src/data/tradingApi/api.json | 2 +- packages/wallet/src/data/utils.ts | 17 + packages/wallet/src/entities/assets.ts | 4 +- .../src/features/activity/useActivityData.tsx | 10 +- .../wallet/src/features/chains/utils.test.ts | 52 +- packages/wallet/src/features/chains/utils.ts | 131 ++--- .../src/features/contracts/ContractManager.ts | 12 +- .../wallet/src/features/contracts/hooks.ts | 4 +- .../src/features/dataApi/searchTokens.ts | 4 +- .../src/features/dataApi/topTokens.test.ts | 8 +- .../wallet/src/features/dataApi/topTokens.ts | 4 +- .../wallet/src/features/dataApi/utils.test.ts | 16 +- packages/wallet/src/features/dataApi/utils.ts | 10 +- packages/wallet/src/features/ens/api.ts | 30 +- packages/wallet/src/features/ens/useENS.ts | 4 +- .../wallet/src/features/favorites/slice.ts | 4 +- .../wallet/src/features/fiatCurrency/hooks.ts | 7 +- .../wallet/src/features/fiatOnRamp/hooks.ts | 7 +- packages/wallet/src/features/gas/hooks.ts | 12 +- packages/wallet/src/features/nfts/utils.ts | 2 +- .../NetworkChangedNotification.test.tsx | 8 +- .../components/NetworkChangedNotification.tsx | 4 +- .../NotSupportedNetworkNotification.tsx | 3 +- .../components/NotificationToast.tsx | 14 +- .../PasswordChangedNotification.tsx | 14 + .../components/PendingNotificationBadge.tsx | 12 +- .../components/SuccessNotification.tsx | 14 +- ...SupportedNetworkNotification.test.tsx.snap | 226 ++++---- .../notificationWatcherSaga.test.ts | 4 +- .../notifications/notificationWatcherSaga.ts | 4 +- .../src/features/notifications/types.ts | 14 +- .../src/features/notifications/utils.ts | 4 +- .../features/onboarding/OnboardingContext.tsx | 14 +- .../onboarding/createImportedAccounts.ts | 6 +- .../onboarding/createViewOnlyAccount.ts | 17 + .../features/portfolio/PortfolioBalance.tsx | 31 +- packages/wallet/src/features/portfolio/api.ts | 6 +- .../portfolio/useTokenContextMenu.tsx | 4 +- .../src/features/providers/ProviderManager.ts | 12 +- .../providers/createEthersProvider.e2e.js | 2 +- .../providers/createEthersProvider.ts | 12 +- .../wallet/src/features/providers/saga.ts | 7 +- .../wallet/src/features/providers/utils.ts | 32 +- .../src/features/search/SearchResult.ts | 6 +- .../src/features/search/SearchTextInput.tsx | 2 +- .../src/features/tokens/NativeCurrency.ts | 8 +- .../src/features/tokens/TokenWarningModal.tsx | 2 +- packages/wallet/src/features/tokens/hooks.ts | 4 +- .../src/features/tokens/useCurrencyInfo.ts | 6 +- .../InsufficientNativeTokenBaseComponent.tsx | 94 ++++ .../InsufficientNativeTokenWarning.native.tsx | 73 +++ .../InsufficientNativeTokenWarning.tsx | 18 + .../InsufficientNativeTokenWarning.web.tsx | 46 ++ .../useInsufficientNativeTokenWarning.tsx | 109 ++++ .../SummaryCards/DetailsModal/HeaderLogo.tsx | 235 ++++++++ .../DetailsModal/SwapTransactionDetails.tsx | 108 ++++ .../DetailsModal/TransactionDetailsModal.tsx | 174 ++++++ .../SummaryCards/DetailsModal/types.ts | 81 +++ .../OnRampTransferSummaryItem.tsx | 68 +++ .../SummaryItems/TransactionActionsModal.tsx | 59 +- .../SummaryItems/TransactionSummaryLayout.tsx | 36 +- .../SummaryItems/TransactionSummaryTitle.tsx | 43 ++ .../SummaryItems/TransferTokenSummaryItem.tsx | 4 +- .../transactions/SummaryCards/types.ts | 4 +- .../transactions/SummaryCards/utils.ts | 25 + .../TransactionDetails/TransactionDetails.tsx | 4 +- .../TransactionReview/TransactionReview.tsx | 2 +- .../transactions/cancelTransactionSaga.ts | 4 +- .../transactions/contexts/SwapFormContext.tsx | 6 +- .../history/conversion/conversion.test.ts | 10 +- .../extractFiatOnRampTransactionDetails.ts | 9 +- .../extractMoonpayTransactionDetails.ts | 6 +- .../conversion/extractTransactionDetails.ts | 8 +- .../features/transactions/history/utils.ts | 8 +- .../wallet/src/features/transactions/hooks.ts | 28 +- .../hooks/useParsedTransactionWarnings.tsx | 21 +- .../hooks/useSwapWarnings.test.ts | 4 +- .../transactions/hooks/useSwapWarnings.tsx | 1 + .../replaceTransactionSaga.test.ts | 2 + .../transactions/replaceTransactionSaga.ts | 8 +- .../src/features/transactions/selectors.ts | 7 +- .../transactions/sendTransactionSaga.test.ts | 6 +- .../transactions/sendTransactionSaga.ts | 15 +- .../src/features/transactions/slice.test.ts | 45 +- .../swap/BuyNativeTokenCtaRow.tsx | 63 --- .../transactions/swap/DecimalPadInput.tsx | 2 +- .../swap/GasAndWarningRows.native.tsx | 7 +- .../swap/GasAndWarningRows.web.tsx | 52 +- .../features/transactions/swap/SwapFlow.tsx | 6 +- .../swap/TransactionModal.native.tsx | 4 +- .../features/transactions/swap/customRpc.ts | 4 +- .../swap/hooks/useSwapPrefilledState.ts | 4 +- .../swap/modals/SlippageInfoModal.tsx | 2 +- .../settings/SlippageSettingsScreen.tsx | 2 +- .../modals/settings/SwapSettingsModal.tsx | 10 +- .../transactions/swap/swapSaga.test.ts | 8 +- .../features/transactions/swap/swapSaga.ts | 2 + .../swap/trade/hooks/useDerivedSwapInfo.ts | 4 +- .../hooks/useShowSwapNetworkNotification.ts | 4 +- .../swap/trade/hooks/useUSDCPrice.ts | 30 +- .../trade/hooks/useWrapTransactionRequest.ts | 4 +- .../swap/trade/tradingApi/client.ts | 2 + .../tradingApi/hooks/useTokenApprovalInfo.ts | 4 +- .../tradingApi/hooks/useTradingApiTrade.ts | 7 +- .../swap/trade/tradingApi/utils.ts | 7 +- .../features/transactions/swap/trade/types.ts | 13 +- .../features/transactions/swap/trade/utils.ts | 13 +- .../src/features/transactions/swap/types.ts | 4 +- .../transactions/swap/usePermit2Signature.ts | 8 +- .../features/transactions/swap/utils.test.ts | 34 +- .../src/features/transactions/swap/utils.ts | 10 +- .../transactions/swap/wrapSaga.test.ts | 12 +- .../features/transactions/swap/wrapSaga.ts | 4 +- .../transactionState/transactionState.test.ts | 8 +- .../transactionState/transactionState.ts | 6 +- .../transactionWatcherSaga.test.ts | 6 +- .../transactions/transactionWatcherSaga.ts | 31 +- .../transfer/TransferFormWarnings.tsx | 40 +- .../transfer/TransferTokenForm.tsx | 2 +- .../transfer/getSendPrefilledState.ts | 4 +- .../transfer/hooks/useDerivedTransferInfo.ts | 6 +- .../hooks/useIsSmartContractAddress.ts | 4 +- .../hooks/useShowSendNetworkNotification.ts | 4 +- .../transfer/hooks/useTransferCallback.ts | 6 +- .../hooks/useTransferTransactionRequest.ts | 4 +- .../hooks/useTransferWarnings.test.ts | 14 +- .../transfer/hooks/useTransferWarnings.ts | 4 +- .../transfer/transferTokenSaga.test.ts | 8 +- .../features/transactions/transfer/types.ts | 6 +- .../wallet/src/features/transactions/types.ts | 38 +- .../wallet/src/features/transactions/utils.ts | 16 +- packages/wallet/src/features/unitags/hooks.ts | 8 +- .../src/features/wallet/accounts/types.ts | 1 - .../wallet/src/features/wallet/context.tsx | 13 +- .../wallet/create/createAccountsSaga.test.ts | 39 +- .../wallet/create/createAccountsSaga.ts | 5 +- .../wallet/create/pendingAccountsSaga.ts | 73 --- packages/wallet/src/features/wallet/hooks.ts | 13 +- .../wallet/import/importAccountSaga.test.ts | 160 ------ .../wallet/import/importAccountSaga.ts | 201 ------- .../src/features/wallet/import/types.ts | 46 -- .../src/features/wallet/import/utils.ts | 1 - .../wallet/src/features/wallet/selectors.ts | 23 +- .../wallet/signing/NativeSigner.native.ts | 10 +- .../features/wallet/signing/NativeSigner.ts | 6 +- .../src/features/wallet/signing/signing.ts | 7 +- .../wallet/src/features/wallet/slice.test.ts | 20 +- packages/wallet/src/features/wallet/slice.ts | 50 +- packages/wallet/src/state/sharedMigrations.ts | 122 +++++ .../wallet/src/state/sharedMigrationsTests.ts | 518 ++++++++++++++++++ packages/wallet/src/test/fixtures/index.ts | 1 - packages/wallet/src/test/fixtures/lib/sdk.ts | 30 +- .../src/test/fixtures/wallet/currencies.ts | 19 +- .../src/test/fixtures/wallet/notifications.ts | 6 +- .../fixtures/wallet/transactions/fixtures.ts | 12 +- .../fixtures/wallet/transactions/helpers.ts | 8 +- packages/wallet/src/test/mocks/providers.ts | 15 +- packages/wallet/src/test/mocks/sdk.ts | 4 +- packages/wallet/src/utils/balance.ts | 27 +- packages/wallet/src/utils/colors.tsx | 6 +- packages/wallet/src/utils/currencyId.test.ts | 59 +- packages/wallet/src/utils/currencyId.ts | 25 +- packages/wallet/src/utils/linking.test.ts | 18 +- packages/wallet/src/utils/linking.ts | 50 +- packages/wallet/src/utils/mnemonics.ts | 14 +- packages/wallet/src/utils/password.ts | 14 +- yarn.lock | 42 +- 662 files changed, 7845 insertions(+), 4796 deletions(-) delete mode 100644 .yarn/patches/react-native-wagmi-charts-npm-2.5.1-c9e2637be7.patch delete mode 100644 apps/mobile/ios/Modifiers.swift create mode 100644 apps/mobile/ios/Shared/RelativeOffsetView.swift create mode 100644 apps/web/src/pages/Swap/Buy/CountryListModal.test.tsx create mode 100644 apps/web/src/pages/Swap/Buy/CountryListModal.tsx create mode 100644 apps/web/src/pages/Swap/Buy/CountryListRow.test.tsx create mode 100644 apps/web/src/pages/Swap/Buy/CountryListRow.tsx create mode 100644 apps/web/src/pages/Swap/Buy/__snapshots__/CountryListModal.test.tsx.snap create mode 100644 apps/web/src/pages/Swap/Buy/__snapshots__/CountryListRow.test.tsx.snap create mode 100644 apps/web/src/pages/Swap/Buy/hooks.ts create mode 100644 apps/web/src/utils/fiatCurrency.ts delete mode 100644 packages/ui/src/assets/icons/CheckmarkIcon.tsx create mode 100644 packages/ui/src/assets/icons/checkmark-circle.svg delete mode 100644 packages/ui/src/assets/icons/checkmark.svg create mode 100644 packages/ui/src/assets/icons/wifi.svg create mode 100644 packages/ui/src/components/icons/CheckmarkCircle.tsx create mode 100644 packages/ui/src/components/icons/Wifi.tsx delete mode 100644 packages/ui/src/utils/haptics/HapticFeedback.web.ts create mode 100644 packages/uniswap/src/assets/chainLogos.tsx rename packages/{wallet => uniswap}/src/components/BaseCard/BaseCard.test.tsx (90%) rename packages/{wallet => uniswap}/src/components/BaseCard/BaseCard.tsx (97%) rename packages/{wallet => uniswap}/src/components/BaseCard/__snapshots__/BaseCard.test.tsx.snap (90%) rename packages/{wallet => uniswap}/src/components/dropdowns/ActionSheetDropdown.test.tsx (91%) rename packages/{wallet => uniswap}/src/components/dropdowns/ActionSheetDropdown.tsx (94%) rename packages/{wallet => uniswap}/src/components/dropdowns/__snapshots__/ActionSheetDropdown.test.tsx.snap (90%) rename packages/{wallet => uniswap}/src/components/input/TextInput.tsx (86%) rename packages/{wallet => uniswap}/src/components/misc/Scrollbar.tsx (100%) rename packages/{wallet => uniswap}/src/components/modals/ActionSheetModal.tsx (92%) rename packages/{wallet => uniswap}/src/components/modals/BottomSheetContext.tsx (100%) rename packages/{wallet => uniswap}/src/components/modals/BottomSheetModal.native.tsx (97%) rename packages/{wallet => uniswap}/src/components/modals/BottomSheetModal.tsx (77%) rename packages/{wallet => uniswap}/src/components/modals/BottomSheetModal.web.tsx (95%) rename packages/{wallet => uniswap}/src/components/modals/BottomSheetModalProps.tsx (100%) rename packages/{wallet/src/components/modals/HandleBar.tsx => uniswap/src/components/modals/HandleBar.native.tsx} (78%) create mode 100644 packages/uniswap/src/components/modals/HandleBar.tsx rename packages/{wallet => uniswap}/src/components/network/NetworkFilter.tsx (57%) rename packages/{wallet => uniswap}/src/components/network/NetworkOption.tsx (78%) rename packages/{wallet => uniswap}/src/components/network/hooks.tsx (59%) rename packages/{wallet => uniswap}/src/test/fixtures/events.ts (100%) create mode 100644 packages/uniswap/src/test/fixtures/index.ts rename packages/{wallet => uniswap}/src/utils/useKeyboardLayout.android.test.ts (84%) rename packages/{wallet => uniswap}/src/utils/useKeyboardLayout.ios.test.ts (83%) rename packages/{wallet/src/utils/useKeyboardLayout.ts => uniswap/src/utils/useKeyboardLayout.native.ts} (88%) create mode 100644 packages/uniswap/src/utils/useKeyboardLayout.ts create mode 100644 packages/wallet/src/components/buttons/PasteButton.test.tsx create mode 100644 packages/wallet/src/components/buttons/__snapshots__/PasteButton.test.tsx.snap delete mode 100644 packages/wallet/src/components/icons/CheckmarkCircle.tsx delete mode 100644 packages/wallet/src/constants/chains.ts create mode 100644 packages/wallet/src/features/notifications/components/PasswordChangedNotification.tsx create mode 100644 packages/wallet/src/features/onboarding/createViewOnlyAccount.ts create mode 100644 packages/wallet/src/features/transactions/InsufficientNativeTokenWarning/InsufficientNativeTokenBaseComponent.tsx create mode 100644 packages/wallet/src/features/transactions/InsufficientNativeTokenWarning/InsufficientNativeTokenWarning.native.tsx create mode 100644 packages/wallet/src/features/transactions/InsufficientNativeTokenWarning/InsufficientNativeTokenWarning.tsx create mode 100644 packages/wallet/src/features/transactions/InsufficientNativeTokenWarning/InsufficientNativeTokenWarning.web.tsx create mode 100644 packages/wallet/src/features/transactions/InsufficientNativeTokenWarning/useInsufficientNativeTokenWarning.tsx create mode 100644 packages/wallet/src/features/transactions/SummaryCards/DetailsModal/HeaderLogo.tsx create mode 100644 packages/wallet/src/features/transactions/SummaryCards/DetailsModal/SwapTransactionDetails.tsx create mode 100644 packages/wallet/src/features/transactions/SummaryCards/DetailsModal/TransactionDetailsModal.tsx create mode 100644 packages/wallet/src/features/transactions/SummaryCards/DetailsModal/types.ts create mode 100644 packages/wallet/src/features/transactions/SummaryCards/SummaryItems/OnRampTransferSummaryItem.tsx create mode 100644 packages/wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryTitle.tsx delete mode 100644 packages/wallet/src/features/transactions/swap/BuyNativeTokenCtaRow.tsx delete mode 100644 packages/wallet/src/features/wallet/create/pendingAccountsSaga.ts delete mode 100644 packages/wallet/src/features/wallet/import/importAccountSaga.test.ts delete mode 100644 packages/wallet/src/features/wallet/import/importAccountSaga.ts delete mode 100644 packages/wallet/src/features/wallet/import/types.ts delete mode 100644 packages/wallet/src/features/wallet/import/utils.ts create mode 100644 packages/wallet/src/state/sharedMigrationsTests.ts diff --git a/.yarn/patches/react-native-wagmi-charts-npm-2.5.1-c9e2637be7.patch b/.yarn/patches/react-native-wagmi-charts-npm-2.5.1-c9e2637be7.patch deleted file mode 100644 index 77e9ee90a6a..00000000000 --- a/.yarn/patches/react-native-wagmi-charts-npm-2.5.1-c9e2637be7.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/src/charts/line/ChartPath.tsx b/src/charts/line/ChartPath.tsx -index 3807c185c9456d2976c305df94574ff7d948b32a..070df9b7fd4c3b3ad749ecf1ab91fc2851e914fd 100644 ---- a/src/charts/line/ChartPath.tsx -+++ b/src/charts/line/ChartPath.tsx -@@ -152,6 +152,8 @@ export function LineChartPathWrapper({ - width={strokeWidth} - {...pathProps} - /> -+ -+ - {backgroundChildren} - - -@@ -166,6 +168,8 @@ export function LineChartPathWrapper({ - - - -+ -+ - {foregroundChildren} - - -diff --git a/src/charts/line/Dot.tsx b/src/charts/line/Dot.tsx -index db11303fd8dabf3d70a6b40b94e8fb64d925035d..51d1c9563f72ebff2675f874894cbf635a0204d3 100644 ---- a/src/charts/line/Dot.tsx -+++ b/src/charts/line/Dot.tsx -@@ -113,6 +113,7 @@ export function LineChartDot({ - const easing = Easing.out(Easing.sin); - const animatedOpacity = withRepeat( - withSequence( -+ withTiming(0), - withTiming(0.8), - withTiming(0, { - duration: pulseDurationMs, -@@ -124,6 +125,7 @@ export function LineChartDot({ - ); - const scale = withRepeat( - withSequence( -+ withTiming(0), - withTiming(0), - withTiming(outerSize, { - duration: pulseDurationMs, diff --git a/RELEASE b/RELEASE index 141c189dc81..f3eb92428a5 100644 --- a/RELEASE +++ b/RELEASE @@ -1,6 +1,6 @@ IPFS hash of the deployment: -- CIDv0: `Qmcit8DbnQtQk8ZzSa9E4PFXjU1ENfbMQXYv5VwfNLvF1N` -- CIDv1: `bafybeigvwwif77wmthgzo7xqqnjpxbqfsodjbwg3mafmnrwtcojewqpveu` +- CIDv0: `QmW47HPC4SPLcqU9J19iTWNzjsqyaTmbUyhxUyNLcPNqhu` +- CIDv1: `bafybeidsucvs434zirxhib6npfzfqg4jagv6xkccfxjz3gmegib2bu36zq` The latest release is always mirrored at [app.uniswap.org](https://app.uniswap.org). @@ -10,15 +10,49 @@ You can also access the Uniswap Interface from an IPFS gateway. Your Uniswap settings are never remembered across different URLs. IPFS gateways: -- https://bafybeigvwwif77wmthgzo7xqqnjpxbqfsodjbwg3mafmnrwtcojewqpveu.ipfs.dweb.link/ -- https://bafybeigvwwif77wmthgzo7xqqnjpxbqfsodjbwg3mafmnrwtcojewqpveu.ipfs.cf-ipfs.com/ -- [ipfs://Qmcit8DbnQtQk8ZzSa9E4PFXjU1ENfbMQXYv5VwfNLvF1N/](ipfs://Qmcit8DbnQtQk8ZzSa9E4PFXjU1ENfbMQXYv5VwfNLvF1N/) +- https://bafybeidsucvs434zirxhib6npfzfqg4jagv6xkccfxjz3gmegib2bu36zq.ipfs.dweb.link/ +- https://bafybeidsucvs434zirxhib6npfzfqg4jagv6xkccfxjz3gmegib2bu36zq.ipfs.cf-ipfs.com/ +- [ipfs://QmW47HPC4SPLcqU9J19iTWNzjsqyaTmbUyhxUyNLcPNqhu/](ipfs://QmW47HPC4SPLcqU9J19iTWNzjsqyaTmbUyhxUyNLcPNqhu/) -### 5.36.3 (2024-06-26) +## 5.37.0 (2024-06-26) + + +### Features + +* **web:** add fiat currency selection to buy flow (#8868) 25d35a7 +* **web:** country picker for buy flow (+ tests/snapshots) (#8825) a342a3a +* **web:** Enable Avax on /explore (#8965) c9f8ed5 +* **web:** move BaseCard and dependencies to uniswap (#9084) 61c6c15 ### Bug Fixes -* **web:** legacy nav should not transition out of view on scroll (#9538) 435b634 +* **web:** Divide 1 day APR by 100 (#9343) 838a3c7 +* **web:** ensure explore and pools tabs are highlighted when active (#9151) 63673b1 +* **web:** fix a few translations where components need a tag for inte… (#9152) cfe7ed5 +* **web:** fix broken link, translation, and importing v2 positions (#9543) 51335c2 +* **web:** fix height of token safety modal (#9258) f8bb7f4 +* **web:** fix moonpay modal height (#9270) ce92266 +* **web:** ignore GQL errors in SearchTokens query (#9544) e687bd0 +* **web:** language/currency label (#9158) af0c676 +* **web:** legacy nav should not transition out of view on scroll (#9540) 1ae4664 +* **web:** reconcile multichainUx with refreshedNavbar (#9122) 6519f2c +* **web:** unblock ENS namewrapper contract address (#9254) 050fe29 +* **web:** update redux store to v12 to match migrations (#8844) a9c162b +* **web:** use Add/Remove language in Transactions table (#9133) f78bb31 +* **web:** use nullable valueModifiers (#9268) 8ccdf1c +* **web:** use uniswapx-sdk for cancel limits params (#8912) 83d70ab +* **web:** use valueModifiers in web portfolio query (#8942) ff5a840 +* **web:** web config (#9169) 39c336a + + +### Reverts + +* **web:** place hotkeys under feature flag for nav release (#9196) c1fff38 + + +### Continuous Integration + +* **web:** update sitemaps be4b927 diff --git a/VERSION b/VERSION index 57dc7ec3902..c9bc5de3cc1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -web/5.36.3 \ No newline at end of file +web/5.37.0 \ No newline at end of file diff --git a/apps/mobile/ios/Modifiers.swift b/apps/mobile/ios/Modifiers.swift deleted file mode 100644 index b6b05caba96..00000000000 --- a/apps/mobile/ios/Modifiers.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// Modifiers.swift -// Uniswap -// -// Created by Mateusz Łopaciński on 05/06/2024. -// - -import SwiftUI - -struct RelativeOffsetModifier: ViewModifier { - var x: CGFloat - var y: CGFloat - var onOffsetCalculated: (CGFloat, CGFloat) -> Void - - @State private var contentSize: CGSize = .zero - - func body(content: Content) -> some View { - content - .background( - GeometryReader { geometry -> Color in - DispatchQueue.main.async { - // Calculate the offsets based on the size of the content - let offsetX = x * geometry.size.width - let offsetY = y * geometry.size.height - // Update the content size state - contentSize = geometry.size - // Invoke the callback with the calculated offsets - onOffsetCalculated(offsetX, offsetY) - } - return Color.clear - } - ) - .offset(x: x * contentSize.width, y: y * contentSize.height) - } -} - -extension View { - func relativeOffset(x: CGFloat = 0, y: CGFloat = 0, onOffsetCalculated: @escaping (CGFloat, CGFloat) -> Void = { _, _ in }) -> some View { - self.modifier(RelativeOffsetModifier(x: x, y: y, onOffsetCalculated: onOffsetCalculated)) - } -} diff --git a/apps/mobile/ios/Shared/RelativeOffsetView.swift b/apps/mobile/ios/Shared/RelativeOffsetView.swift new file mode 100644 index 00000000000..9c2cd805606 --- /dev/null +++ b/apps/mobile/ios/Shared/RelativeOffsetView.swift @@ -0,0 +1,46 @@ +// +// RelativeOffsetView.swift +// Uniswap +// +// Created by Mateusz Łopaciński on 18/06/2024. +// + +import SwiftUI + +struct RelativeOffsetView: View { + var x: CGFloat + var y: CGFloat + var onOffsetCalculated: (CGFloat, CGFloat) -> Void + var content: Content + + @State private var contentSize: CGSize = .zero + + init(x: CGFloat = 0, y: CGFloat = 0, onOffsetCalculated: @escaping (CGFloat, CGFloat) -> Void = { _, _ in }, @ViewBuilder content: () -> Content) { + self.x = x + self.y = y + self.onOffsetCalculated = onOffsetCalculated + self.content = content() + } + + var body: some View { + content + .background( + GeometryReader { geometry in + Color.clear + .onAppear { + let offsetX = x * geometry.size.width + let offsetY = y * geometry.size.height + contentSize = geometry.size + onOffsetCalculated(offsetX, offsetY) + } + .onChange(of: geometry.size) { newSize in + let offsetX = x * newSize.width + let offsetY = y * newSize.height + contentSize = newSize + onOffsetCalculated(offsetX, offsetY) + } + } + ) + .offset(x: x * contentSize.width, y: y * contentSize.height) + } +} diff --git a/apps/mobile/ios/Uniswap.xcodeproj/project.pbxproj b/apps/mobile/ios/Uniswap.xcodeproj/project.pbxproj index eb5f1394653..78d57aa8749 100644 --- a/apps/mobile/ios/Uniswap.xcodeproj/project.pbxproj +++ b/apps/mobile/ios/Uniswap.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 00E356F31AD99517003FC87E /* UniswapTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* UniswapTests.m */; }; 037C5AAA2C04970B00B1D808 /* CopyIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 037C5AA92C04970B00B1D808 /* CopyIcon.swift */; }; 03C788232C10E7390011E5DC /* ActionButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C788222C10E7390011E5DC /* ActionButtons.swift */; }; - 03C788252C10F2810011E5DC /* Modifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C788242C10F2810011E5DC /* Modifiers.swift */; }; + 03D2F3182C218D390030D987 /* RelativeOffsetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03D2F3172C218D380030D987 /* RelativeOffsetView.swift */; }; 0703EE032A5734A600AED1DA /* UserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0703EE022A5734A600AED1DA /* UserDefaults.swift */; }; 0703EE052A57351800AED1DA /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 072F6C372A44BECC00DA720A /* Logging.swift */; }; 072E238E2A44D5BD006AD6C9 /* WidgetsCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 072E23862A44D5BC006AD6C9 /* WidgetsCore.framework */; }; @@ -304,7 +304,7 @@ 00E356F21AD99517003FC87E /* UniswapTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UniswapTests.m; sourceTree = ""; }; 037C5AA92C04970B00B1D808 /* CopyIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyIcon.swift; sourceTree = ""; }; 03C788222C10E7390011E5DC /* ActionButtons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionButtons.swift; sourceTree = ""; }; - 03C788242C10F2810011E5DC /* Modifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Modifiers.swift; sourceTree = ""; }; + 03D2F3172C218D380030D987 /* RelativeOffsetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelativeOffsetView.swift; sourceTree = ""; }; 065A981F892F7A06A900FCD5 /* Pods-WidgetsCoreTests.dev.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WidgetsCoreTests.dev.xcconfig"; path = "Target Support Files/Pods-WidgetsCoreTests/Pods-WidgetsCoreTests.dev.xcconfig"; sourceTree = ""; }; 0703EE022A5734A600AED1DA /* UserDefaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaults.swift; sourceTree = ""; }; 070480372A58A507009006CE /* WidgetIntentExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WidgetIntentExtension.entitlements; sourceTree = ""; }; @@ -623,6 +623,7 @@ isa = PBXGroup; children = ( 03C788222C10E7390011E5DC /* ActionButtons.swift */, + 03D2F3172C218D380030D987 /* RelativeOffsetView.swift */, ); path = Shared; sourceTree = ""; @@ -925,7 +926,6 @@ BF9176E944C84910B1C0B057 /* SplashScreen.storyboard */, FD7304CD28A364FC0085BDEA /* Colors.xcassets */, FD7304CF28A3650A0085BDEA /* Colors.swift */, - 03C788242C10F2810011E5DC /* Modifiers.swift */, ); name = Uniswap; sourceTree = ""; @@ -1996,7 +1996,7 @@ 6BC7D0802B5FF02400617C95 /* EncryptionUtils.swift in Sources */, 03C788232C10E7390011E5DC /* ActionButtons.swift in Sources */, 8EA8AB3B2AB7ED3C004E7EF3 /* SeedPhraseInputManager.m in Sources */, - 03C788252C10F2810011E5DC /* Modifiers.swift in Sources */, + 03D2F3182C218D390030D987 /* RelativeOffsetView.swift in Sources */, 6CA91BDB2A95223C00C4063E /* RNEthersRS.swift in Sources */, 8EA8AB3C2AB7ED3C004E7EF3 /* SeedPhraseInputViewModel.swift in Sources */, 072F6C2E2A44A32F00DA720A /* TokenPriceWidget.intentdefinition in Sources */, diff --git a/apps/mobile/ios/Uniswap/Icons/AlertTriangleIcon.swift b/apps/mobile/ios/Uniswap/Icons/AlertTriangleIcon.swift index 7ab556de0f6..ab1ecc07ee9 100644 --- a/apps/mobile/ios/Uniswap/Icons/AlertTriangleIcon.swift +++ b/apps/mobile/ios/Uniswap/Icons/AlertTriangleIcon.swift @@ -7,7 +7,7 @@ import SwiftUI -struct AlertTriangeIcon: Shape { +struct AlertTriangleIcon: Shape { func path(in rect: CGRect) -> Path { var path = Path() let width = rect.size.width diff --git a/apps/mobile/ios/Uniswap/Onboarding/Backup/MnemonicDisplayView.swift b/apps/mobile/ios/Uniswap/Onboarding/Backup/MnemonicDisplayView.swift index 42572fa400d..52fd67a2626 100644 --- a/apps/mobile/ios/Uniswap/Onboarding/Backup/MnemonicDisplayView.swift +++ b/apps/mobile/ios/Uniswap/Onboarding/Backup/MnemonicDisplayView.swift @@ -110,16 +110,17 @@ struct MnemonicDisplay: View { .overlay( HStack { Spacer() - CopyButton( - copyButtonText: props.copyText, - copiedButtonText: props.copiedText, - textToCopy: props.mnemonicWords.joined(separator: " ") - ) - Spacer() - } - .relativeOffset(y: -0.5) { _, offsetY in + RelativeOffsetView(y: -0.5, onOffsetCalculated: { _, offsetY in buttonPadding = abs(offsetY) - }, + }) { + CopyButton( + copyButtonText: props.copyText, + copiedButtonText: props.copiedText, + textToCopy: props.mnemonicWords.joined(separator: " ") + ) + } + Spacer() + }, alignment: .top ) } diff --git a/apps/mobile/ios/Uniswap/Onboarding/Import/SeedPhraseInputView.swift b/apps/mobile/ios/Uniswap/Onboarding/Import/SeedPhraseInputView.swift index 239b8b8f82e..f2dda700695 100644 --- a/apps/mobile/ios/Uniswap/Onboarding/Import/SeedPhraseInputView.swift +++ b/apps/mobile/ios/Uniswap/Onboarding/Import/SeedPhraseInputView.swift @@ -122,7 +122,10 @@ struct SeedPhraseInput: View { if (viewModel.input.isEmpty) { Text(viewModel.strings.inputPlaceholder) .font(subtitleFont) + .padding(.horizontal, 6) + .padding(.vertical, 8) .foregroundColor(Colors.neutral3) + .allowsHitTesting(false) // Prevents capturing touch events by the placeholder instead of input } } .fixedSize(horizontal: false, vertical: true) @@ -148,13 +151,14 @@ struct SeedPhraseInput: View { if viewModel.input.isEmpty { HStack { Spacer() - PasteButton( - pasteButtonText: viewModel.strings.pasteButton, - onPaste: handlePastePress - ) + RelativeOffsetView(y: 0.5) { + PasteButton( + pasteButtonText: viewModel.strings.pasteButton, + onPaste: handlePastePress + ) + } Spacer() } - .relativeOffset(y: 0.5) } }, alignment: .bottom @@ -163,7 +167,7 @@ struct SeedPhraseInput: View { if (errorMessage() != nil) { HStack(spacing: 4) { - AlertTriangeIcon() + AlertTriangleIcon() .frame(width: 14, height: 14) .foregroundColor(Colors.statusCritical) Text(errorMessage() ?? "") diff --git a/apps/mobile/package.json b/apps/mobile/package.json index ff437863716..df9c966b12f 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -137,7 +137,7 @@ "react-native-svg": "15.1.0", "react-native-tab-view": "3.5.2", "react-native-url-polyfill": "1.3.0", - "react-native-wagmi-charts": "2.5.1", + "react-native-wagmi-charts": "2.5.2", "react-native-webview": "11.23.1", "react-native-widgetkit": "1.0.9", "react-redux": "8.0.5", diff --git a/apps/mobile/src/app/hooks.ts b/apps/mobile/src/app/hooks.ts index 836a4e5aa58..87f3bcc5dbc 100644 --- a/apps/mobile/src/app/hooks.ts +++ b/apps/mobile/src/app/hooks.ts @@ -1,5 +1,6 @@ +import { useFocusEffect } from '@react-navigation/core' import { ThunkDispatch } from '@reduxjs/toolkit' -import { useState } from 'react' +import { useCallback, useRef, useState } from 'react' import { LayoutChangeEvent } from 'react-native' import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux' import type { MobileState } from 'src/app/reducer' @@ -59,3 +60,33 @@ export function useShouldShowNativeKeyboard(): { isLayoutPending || showNativeKeyboard ? undefined : decimalPadY - MIN_INPUT_DECIMAL_PAD_GAP, } } + +const getNativeComponentKey = (): string => `native-component-${Math.random().toString()}` + +export function useNativeComponentKey(autoUpdate = true): { + key: string + triggerUpdate: () => void +} { + const isInitialRenderRef = useRef(true) + + const [key, setKey] = useState(getNativeComponentKey) + + useFocusEffect( + useCallback(() => { + if (isInitialRenderRef.current || !autoUpdate) { + isInitialRenderRef.current = false + return + } + setKey(getNativeComponentKey()) + }, [autoUpdate]) + ) + + const triggerUpdate = useCallback(() => { + setKey(getNativeComponentKey()) + }, []) + + return { + key, + triggerUpdate, + } +} diff --git a/apps/mobile/src/app/migrations.test.ts b/apps/mobile/src/app/migrations.test.ts index b57995e2be8..0bacd1c5dfa 100644 --- a/apps/mobile/src/app/migrations.test.ts +++ b/apps/mobile/src/app/migrations.test.ts @@ -1,5 +1,6 @@ /* eslint-disable max-lines */ import { BigNumber } from 'ethers' +import { toIncludeSameMembers } from 'jest-extended' import mockdate from 'mockdate' import { migrations, OLD_DEMO_ACCOUNT_ADDRESS } from 'src/app/migrations' import { @@ -63,6 +64,8 @@ import { v61Schema, v62Schema, v63Schema, + v64Schema, + v65Schema, v6Schema, v7Schema, v8Schema, @@ -77,7 +80,7 @@ import { initialTelemetryState } from 'src/features/telemetry/slice' import { initialTweaksState } from 'src/features/tweaks/slice' import { initialWalletConnectState } from 'src/features/walletConnect/walletConnectSlice' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId, WalletChainId } from 'uniswap/src/types/chains' import { ScannerModalState } from 'wallet/src/components/QRCodeScanner/constants' import { ExtensionOnboardingState, @@ -89,15 +92,8 @@ import { initialLanguageState } from 'wallet/src/features/language/slice' import { initialNotificationsState } from 'wallet/src/features/notifications/slice' import { initialSearchHistoryState } from 'wallet/src/features/search/searchHistorySlice' import { initialTokensState } from 'wallet/src/features/tokens/tokensSlice' -import { - initialTransactionsState, - TransactionStateMap, -} from 'wallet/src/features/transactions/slice' -import { - TransactionDetails, - TransactionStatus, - TransactionType, -} from 'wallet/src/features/transactions/types' +import { initialTransactionsState } from 'wallet/src/features/transactions/slice' +import { TransactionStatus, TransactionType } from 'wallet/src/features/transactions/types' import { Account, AccountType, @@ -105,6 +101,7 @@ import { } from 'wallet/src/features/wallet/accounts/types' import { initialWalletState, SwapProtectionSetting } from 'wallet/src/features/wallet/slice' import { createMigrate } from 'wallet/src/state/createMigrate' +import { testActivatePendingAccounts } from 'wallet/src/state/sharedMigrationsTests' import { getAllKeysOfNestedObject } from 'wallet/src/state/testUtils' import { fiatPurchaseTransactionInfo, @@ -112,6 +109,8 @@ import { transactionDetails, } from 'wallet/src/test/fixtures' +expect.extend({ toIncludeSameMembers }) + const account = signerMnemonicAccount() const txDetailsConfirmed = transactionDetails({ @@ -220,8 +219,8 @@ describe('Redux state migrations', () => { }) it('migrates from initialSchema to v0Schema', () => { - const txDetails0: TransactionDetails = { - chainId: ChainId.Mainnet, + const txDetails0 = { + chainId: UniverseChainId.Mainnet, id: '0', from: '0xShadowySuperCoder', options: { @@ -244,8 +243,8 @@ describe('Redux state migrations', () => { hash: '0x123', } - const txDetails1: TransactionDetails = { - chainId: ChainId.Goerli, + const txDetails1 = { + chainId: UniverseChainId.Goerli, id: '1', from: '0xKingHodler', options: { @@ -272,10 +271,10 @@ describe('Redux state migrations', () => { ...initialSchema, transactions: { byChainId: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0': txDetails0, }, - [ChainId.Goerli]: { + [UniverseChainId.Goerli]: { '1': txDetails1, }, }, @@ -287,19 +286,23 @@ describe('Redux state migrations', () => { } const newSchema = migrations[0](initialSchemaStub) - expect(newSchema.transactions[ChainId.Mainnet]).toBeUndefined() + expect(newSchema.transactions[UniverseChainId.Mainnet]).toBeUndefined() expect(newSchema.transactions.lastTxHistoryUpdate).toBeUndefined() - expect(newSchema.transactions['0xShadowySuperCoder'][ChainId.Mainnet]['0'].status).toEqual( - TransactionStatus.Pending + expect( + newSchema.transactions['0xShadowySuperCoder'][UniverseChainId.Mainnet]['0'].status + ).toEqual(TransactionStatus.Pending) + expect(newSchema.transactions['0xKingHodler'][UniverseChainId.Mainnet]).toBeUndefined() + expect(newSchema.transactions['0xKingHodler'][UniverseChainId.Goerli]['0']).toBeUndefined() + expect(newSchema.transactions['0xKingHodler'][UniverseChainId.Goerli]['1'].from).toEqual( + '0xKingHodler' ) - expect(newSchema.transactions['0xKingHodler'][ChainId.Mainnet]).toBeUndefined() - expect(newSchema.transactions['0xKingHodler'][ChainId.Goerli]['0']).toBeUndefined() - expect(newSchema.transactions['0xKingHodler'][ChainId.Goerli]['1'].from).toEqual('0xKingHodler') expect(newSchema.notifications.lastTxNotificationUpdate).toBeDefined() expect( - newSchema.notifications.lastTxNotificationUpdate['0xShadowySuperCoder'][ChainId.Mainnet] + newSchema.notifications.lastTxNotificationUpdate['0xShadowySuperCoder'][ + UniverseChainId.Mainnet + ] ).toEqual(12345678912345) }) @@ -670,8 +673,8 @@ describe('Redux state migrations', () => { it('migrates from v18 to v19', () => { const TEST_ADDRESS = '0xShadowySuperCoder' - const txDetails0: TransactionDetails = { - chainId: ChainId.Mainnet, + const txDetails0 = { + chainId: UniverseChainId.Mainnet, id: '0', from: TEST_ADDRESS, options: { @@ -695,8 +698,8 @@ describe('Redux state migrations', () => { } const TEST_ADDRESS_2 = '0xKingHodler' - const txDetails1: TransactionDetails = { - chainId: ChainId.Goerli, + const txDetails1 = { + chainId: UniverseChainId.Goerli, id: '1', from: TEST_ADDRESS_2, options: { @@ -719,16 +722,16 @@ describe('Redux state migrations', () => { hash: '0x123', } - const ROPSTEN = 3 as ChainId - const RINKEBY = 4 as ChainId - const KOVAN = 42 as ChainId + const ROPSTEN = 3 as WalletChainId + const RINKEBY = 4 as WalletChainId + const KOVAN = 42 as WalletChainId - const transactions: TransactionStateMap = { + const transactions = { [TEST_ADDRESS]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0': txDetails0, }, - [ChainId.Goerli]: { + [UniverseChainId.Goerli]: { '0': txDetails0, '1': txDetails1, }, @@ -744,10 +747,10 @@ describe('Redux state migrations', () => { }, }, [TEST_ADDRESS_2]: { - [ChainId.ArbitrumOne]: { + [UniverseChainId.ArbitrumOne]: { '0': txDetails0, }, - [ChainId.Optimism]: { + [UniverseChainId.Optimism]: { '0': txDetails0, '1': txDetails1, }, @@ -766,23 +769,23 @@ describe('Redux state migrations', () => { const blocks = { byChainId: { - [ChainId.Mainnet]: { latestBlockNumber: 123456789 }, - [ChainId.Goerli]: { latestBlockNumber: 123456789 }, + [UniverseChainId.Mainnet]: { latestBlockNumber: 123456789 }, + [UniverseChainId.Goerli]: { latestBlockNumber: 123456789 }, [ROPSTEN]: { latestBlockNumber: 123456789 }, [RINKEBY]: { latestBlockNumber: 123456789 }, [KOVAN]: { latestBlockNumber: 123456789 }, - [ChainId.Optimism]: { latestBlockNumber: 123456789 }, + [UniverseChainId.Optimism]: { latestBlockNumber: 123456789 }, }, } const chains = { byChainId: { - [ChainId.ArbitrumOne]: { isActive: true }, - [ChainId.Goerli]: { isActive: true }, + [UniverseChainId.ArbitrumOne]: { isActive: true }, + [UniverseChainId.Goerli]: { isActive: true }, [ROPSTEN]: { isActive: true }, [RINKEBY]: { isActive: true }, [KOVAN]: { isActive: true }, - [ChainId.Optimism]: { isActive: true }, + [UniverseChainId.Optimism]: { isActive: true }, }, } @@ -795,28 +798,28 @@ describe('Redux state migrations', () => { const v19 = migrations[19](v18Stub) - expect(v19.transactions[TEST_ADDRESS][ChainId.Mainnet]).toBeDefined() - expect(v19.transactions[TEST_ADDRESS][ChainId.Goerli]).toBeDefined() + expect(v19.transactions[TEST_ADDRESS][UniverseChainId.Mainnet]).toBeDefined() + expect(v19.transactions[TEST_ADDRESS][UniverseChainId.Goerli]).toBeDefined() expect(v19.transactions[TEST_ADDRESS][ROPSTEN]).toBeUndefined() expect(v19.transactions[TEST_ADDRESS][RINKEBY]).toBeUndefined() expect(v19.transactions[TEST_ADDRESS][KOVAN]).toBeUndefined() - expect(v19.transactions[TEST_ADDRESS_2][ChainId.ArbitrumOne]).toBeDefined() - expect(v19.transactions[TEST_ADDRESS_2][ChainId.Optimism]).toBeDefined() + expect(v19.transactions[TEST_ADDRESS_2][UniverseChainId.ArbitrumOne]).toBeDefined() + expect(v19.transactions[TEST_ADDRESS_2][UniverseChainId.Optimism]).toBeDefined() expect(v19.transactions[TEST_ADDRESS_2][ROPSTEN]).toBeUndefined() expect(v19.transactions[TEST_ADDRESS_2][RINKEBY]).toBeUndefined() expect(v19.transactions[TEST_ADDRESS_2][KOVAN]).toBeUndefined() - expect(v19.blocks.byChainId[ChainId.Mainnet]).toBeDefined() - expect(v19.blocks.byChainId[ChainId.Goerli]).toBeDefined() - expect(v19.blocks.byChainId[ChainId.Optimism]).toBeDefined() + expect(v19.blocks.byChainId[UniverseChainId.Mainnet]).toBeDefined() + expect(v19.blocks.byChainId[UniverseChainId.Goerli]).toBeDefined() + expect(v19.blocks.byChainId[UniverseChainId.Optimism]).toBeDefined() expect(v19.blocks.byChainId[ROPSTEN]).toBeUndefined() expect(v19.blocks.byChainId[RINKEBY]).toBeUndefined() expect(v19.blocks.byChainId[KOVAN]).toBeUndefined() - expect(v19.chains.byChainId[ChainId.ArbitrumOne]).toBeDefined() - expect(v19.chains.byChainId[ChainId.Goerli]).toBeDefined() - expect(v19.chains.byChainId[ChainId.Optimism]).toBeDefined() + expect(v19.chains.byChainId[UniverseChainId.ArbitrumOne]).toBeDefined() + expect(v19.chains.byChainId[UniverseChainId.Goerli]).toBeDefined() + expect(v19.chains.byChainId[UniverseChainId.Optimism]).toBeDefined() expect(v19.chains.byChainId[ROPSTEN]).toBeUndefined() expect(v19.chains.byChainId[RINKEBY]).toBeUndefined() expect(v19.chains.byChainId[KOVAN]).toBeUndefined() @@ -925,7 +928,7 @@ describe('Redux state migrations', () => { it('migrates from v29 to v30', () => { const oldFiatOnRampTxDetails = { - chainId: ChainId.Mainnet, + chainId: UniverseChainId.Mainnet, id: '0', from: account.address, options: { @@ -961,31 +964,31 @@ describe('Redux state migrations', () => { } const transactions = { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0': oldFiatOnRampTxDetails, '1': txDetailsConfirmed, }, - [ChainId.Goerli]: { + [UniverseChainId.Goerli]: { '0': { ...oldFiatOnRampTxDetails, status: TransactionStatus.Failed }, '1': txDetailsConfirmed, }, - [ChainId.ArbitrumOne]: { + [UniverseChainId.ArbitrumOne]: { '0': { ...oldFiatOnRampTxDetails, status: TransactionStatus.Failed }, }, }, ['0xshadowySuperCoder']: { - [ChainId.ArbitrumOne]: { + [UniverseChainId.ArbitrumOne]: { '0': oldFiatOnRampTxDetails, '1': txDetailsConfirmed, }, - [ChainId.Optimism]: { + [UniverseChainId.Optimism]: { '0': oldFiatOnRampTxDetails, '1': oldFiatOnRampTxDetails, '2': txDetailsConfirmed, }, }, ['0xdeleteMe']: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0': { ...oldFiatOnRampTxDetails, status: TransactionStatus.Failed }, }, }, @@ -995,28 +998,32 @@ describe('Redux state migrations', () => { const v30 = migrations[30](v29Stub) // expect fiat onramp txdetails to change - expect(v30.transactions[account.address][ChainId.Mainnet]['0'].typeInfo).toEqual( - expectedTypeInfo - ) - expect(v30.transactions[account.address][ChainId.Goerli]['0']).toBeUndefined() - expect(v30.transactions[account.address][ChainId.ArbitrumOne]).toBeUndefined() // does not create an object for chain - expect(v30.transactions['0xshadowySuperCoder'][ChainId.ArbitrumOne]['0'].typeInfo).toEqual( + expect(v30.transactions[account.address][UniverseChainId.Mainnet]['0'].typeInfo).toEqual( expectedTypeInfo ) - expect(v30.transactions['0xshadowySuperCoder'][ChainId.Optimism]['0'].typeInfo).toEqual( + expect(v30.transactions[account.address][UniverseChainId.Goerli]['0']).toBeUndefined() + expect(v30.transactions[account.address][UniverseChainId.ArbitrumOne]).toBeUndefined() // does not create an object for chain + expect( + v30.transactions['0xshadowySuperCoder'][UniverseChainId.ArbitrumOne]['0'].typeInfo + ).toEqual(expectedTypeInfo) + expect(v30.transactions['0xshadowySuperCoder'][UniverseChainId.Optimism]['0'].typeInfo).toEqual( expectedTypeInfo ) - expect(v30.transactions['0xshadowySuperCoder'][ChainId.Optimism]['1'].typeInfo).toEqual( + expect(v30.transactions['0xshadowySuperCoder'][UniverseChainId.Optimism]['1'].typeInfo).toEqual( expectedTypeInfo ) expect(v30.transactions['0xdeleteMe']).toBe(undefined) // expect non-for txDetails to not change - expect(v30.transactions[account.address][ChainId.Mainnet]['1']).toEqual(txDetailsConfirmed) - expect(v30.transactions[account.address][ChainId.Goerli]['1']).toEqual(txDetailsConfirmed) - expect(v30.transactions['0xshadowySuperCoder'][ChainId.ArbitrumOne]['1']).toEqual( + expect(v30.transactions[account.address][UniverseChainId.Mainnet]['1']).toEqual( + txDetailsConfirmed + ) + expect(v30.transactions[account.address][UniverseChainId.Goerli]['1']).toEqual( txDetailsConfirmed ) - expect(v30.transactions['0xshadowySuperCoder'][ChainId.Optimism]['2']).toEqual( + expect(v30.transactions['0xshadowySuperCoder'][UniverseChainId.ArbitrumOne]['1']).toEqual( + txDetailsConfirmed + ) + expect(v30.transactions['0xshadowySuperCoder'][UniverseChainId.Optimism]['2']).toEqual( txDetailsConfirmed ) }) @@ -1068,7 +1075,7 @@ describe('Redux state migrations', () => { const id3 = '789' const transactions = { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { [id1]: { ...fiatOnRampTxDetailsFailed, typeInfo: { @@ -1092,21 +1099,21 @@ describe('Redux state migrations', () => { const v36Stub = { ...v36Schema, transactions } expect( - v36Stub.transactions[account.address]?.[ChainId.Mainnet][id1].typeInfo.id + v36Stub.transactions[account.address]?.[UniverseChainId.Mainnet][id1].typeInfo.id ).toBeUndefined() expect( - v36Stub.transactions[account.address]?.[ChainId.Mainnet][id2].typeInfo.id + v36Stub.transactions[account.address]?.[UniverseChainId.Mainnet][id2].typeInfo.id ).toBeUndefined() const v37 = migrations[37](v36Stub) - expect(v37.transactions[account.address]?.[ChainId.Mainnet][id1].typeInfo.id).toEqual( + expect(v37.transactions[account.address]?.[UniverseChainId.Mainnet][id1].typeInfo.id).toEqual( fiatOnRampTxDetailsFailed.typeInfo.id ) expect( - v36Stub.transactions[account.address]?.[ChainId.Mainnet][id2].typeInfo.id + v36Stub.transactions[account.address]?.[UniverseChainId.Mainnet][id2].typeInfo.id ).toBeUndefined() - expect(v36Stub.transactions[account.address]?.[ChainId.Mainnet][id3]).toEqual( + expect(v36Stub.transactions[account.address]?.[UniverseChainId.Mainnet][id3]).toEqual( txDetailsConfirmed ) }) @@ -1391,4 +1398,59 @@ describe('Redux state migrations', () => { expect(v64.behaviorHistory.hasViewedUniconV2IntroModal).toBe(undefined) }) + + it('migrates from v64 to 65', () => { + const TEST_ADDRESS = '0xTestAddress' + const txDetails0 = { + chainId: UniverseChainId.Mainnet, + id: '0', + from: '0xTestAddress', + options: { + request: { + from: '0x123', + to: '0x456', + value: '0x0', + data: '0x789', + nonce: 10, + gasPrice: BigNumber.from('10000'), + }, + }, + typeInfo: { + type: TransactionType.Approve, + tokenAddress: '0xtokenAddress', + spender: '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', + }, + status: TransactionStatus.Pending, + addedTime: 1487076708000, + hash: '0x123', + } + + const txDetails1 = { + ...txDetails0, + chainId: UniverseChainId.Optimism, + id: '1', + } + + const transactions = { + [TEST_ADDRESS]: { + [UniverseChainId.Mainnet]: { + '0': txDetails0, + }, + [UniverseChainId.Optimism]: { + '1': txDetails1, + }, + }, + } + + const v64Stub = { ...v64Schema, transactions } + + const v65 = migrations[65](v64Stub) + + expect(v65.transactions[TEST_ADDRESS][UniverseChainId.Mainnet]['0'].routing).toBe('CLASSIC') + expect(v65.transactions[TEST_ADDRESS][UniverseChainId.Optimism]['1'].routing).toBe('CLASSIC') + }) + it('migrates from v65 to v66', () => { + const v66 = migrations[66] + testActivatePendingAccounts(v66, v65Schema) + }) }) diff --git a/apps/mobile/src/app/migrations.ts b/apps/mobile/src/app/migrations.ts index 126071ca5c4..d9a62294bf0 100644 --- a/apps/mobile/src/app/migrations.ts +++ b/apps/mobile/src/app/migrations.ts @@ -5,7 +5,7 @@ import dayjs from 'dayjs' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId, WalletChainId } from 'uniswap/src/types/chains' import { ExtensionOnboardingState } from 'wallet/src/features/behaviorHistory/slice' import { toSupportedChainId } from 'wallet/src/features/chains/utils' import { initialFiatCurrencyState } from 'wallet/src/features/fiatCurrency/slice' @@ -20,6 +20,8 @@ import { import { Account, AccountType } from 'wallet/src/features/wallet/accounts/types' import { SwapProtectionSetting } from 'wallet/src/features/wallet/slice' import { + activatePendingAccounts, + addRoutingFieldToTransactions, removeUniconV2BehaviorState, removeWalletIsUnlockedState, } from 'wallet/src/state/sharedMigrations' @@ -49,7 +51,7 @@ export const migrations = { const addresses = Object.keys(oldTransactionState?.lastTxHistoryUpdate || []) for (const address of addresses) { newNotificationState.lastTxNotificationUpdate[address] = { - [ChainId.Mainnet]: oldTransactionState.lastTxHistoryUpdate[address], + [UniverseChainId.Mainnet]: oldTransactionState.lastTxHistoryUpdate[address], } } @@ -251,11 +253,11 @@ export const migrations = { const chainState: | { - byChainId: Partial> + byChainId: Partial> } | undefined = newState?.chains const newChainState = Object.keys(chainState?.byChainId ?? {}).reduce<{ - byChainId: Partial> + byChainId: Partial> }>( (tempState, chainIdString) => { const chainId = toSupportedChainId(chainIdString) @@ -883,6 +885,10 @@ export const migrations = { 63: removeWalletIsUnlockedState, 64: removeUniconV2BehaviorState, + + 65: addRoutingFieldToTransactions, + + 66: activatePendingAccounts, } -export const MOBILE_STATE_VERSION = 64 +export const MOBILE_STATE_VERSION = 66 diff --git a/apps/mobile/src/app/modals/AccountSwitcherModal.tsx b/apps/mobile/src/app/modals/AccountSwitcherModal.tsx index 26d58387860..bc4f405bae5 100644 --- a/apps/mobile/src/app/modals/AccountSwitcherModal.tsx +++ b/apps/mobile/src/app/modals/AccountSwitcherModal.tsx @@ -11,6 +11,8 @@ import { selectModalState } from 'src/features/modals/selectModalState' import { Button, Flex, Text, TouchableArea, useDeviceInsets, useSporeColors } from 'ui/src' import { useDeviceDimensions } from 'ui/src/hooks/useDeviceDimensions' import { spacing } from 'ui/src/theme' +import { ActionSheetModal, MenuItemProp } from 'uniswap/src/components/modals/ActionSheetModal' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, MobileEventName, ModalName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' @@ -18,8 +20,6 @@ import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobi import { isAndroid } from 'utilities/src/platform' import { AddressDisplay } from 'wallet/src/components/accounts/AddressDisplay' import { PlusCircle } from 'wallet/src/components/icons/PlusCircle' -import { ActionSheetModal, MenuItemProp } from 'wallet/src/components/modals/ActionSheetModal' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { createOnboardingAccount } from 'wallet/src/features/onboarding/createOnboardingAccount' import { AccountType, BackupType } from 'wallet/src/features/wallet/accounts/types' import { createAccountsActions } from 'wallet/src/features/wallet/create/createAccountsSaga' @@ -109,7 +109,6 @@ export function AccountSwitcher({ onClose }: { onClose: () => void }): JSX.Eleme dispatch( createAccountsActions.trigger({ accounts: [newAccount], - activateFirst: true, }) ) diff --git a/apps/mobile/src/app/modals/ExperimentsModal.tsx b/apps/mobile/src/app/modals/ExperimentsModal.tsx index 7606c2ee98f..aef0e5674aa 100644 --- a/apps/mobile/src/app/modals/ExperimentsModal.tsx +++ b/apps/mobile/src/app/modals/ExperimentsModal.tsx @@ -8,10 +8,10 @@ import { selectCustomEndpoint } from 'src/features/tweaks/selectors' import { setCustomEndpoint } from 'src/features/tweaks/slice' import { Accordion, Button, Flex, Text, useDeviceInsets } from 'ui/src' import { spacing } from 'ui/src/theme' +import { TextInput } from 'uniswap/src/components/input/TextInput' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { AccordionHeader, GatingOverrides } from 'wallet/src/components/gating/GatingOverrides' -import { TextInput } from 'wallet/src/components/input/TextInput' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function ExperimentsModal(): JSX.Element { const insets = useDeviceInsets() diff --git a/apps/mobile/src/app/modals/ExploreModal.tsx b/apps/mobile/src/app/modals/ExploreModal.tsx index b6ae7094f8d..7c89bb7068d 100644 --- a/apps/mobile/src/app/modals/ExploreModal.tsx +++ b/apps/mobile/src/app/modals/ExploreModal.tsx @@ -3,8 +3,8 @@ import { useAppDispatch } from 'src/app/hooks' import { ExploreStackNavigator } from 'src/app/navigation/navigation' import { closeModal } from 'src/features/modals/modalSlice' import { useSporeColors } from 'ui/src' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function ExploreModal(): JSX.Element { const colors = useSporeColors() diff --git a/apps/mobile/src/app/modals/ExtensionPromoModal.tsx b/apps/mobile/src/app/modals/ExtensionPromoModal.tsx index ea5aa9d66e9..6031fe09ff9 100644 --- a/apps/mobile/src/app/modals/ExtensionPromoModal.tsx +++ b/apps/mobile/src/app/modals/ExtensionPromoModal.tsx @@ -4,8 +4,8 @@ import { StyleSheet } from 'react-native' import 'react-native-reanimated' import { Button, Flex, Image, Text, useIsDarkMode } from 'ui/src' import { EXTENSION_PROMO_MODAL_DARK, EXTENSION_PROMO_MODAL_LIGHT } from 'ui/src/assets' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function ExtensionPromoModal({ onClose }: { onClose: () => void }): JSX.Element { const { t } = useTranslation() diff --git a/apps/mobile/src/app/modals/TransferTokenModal.tsx b/apps/mobile/src/app/modals/TransferTokenModal.tsx index 730ba88fe4b..7f134d51a24 100644 --- a/apps/mobile/src/app/modals/TransferTokenModal.tsx +++ b/apps/mobile/src/app/modals/TransferTokenModal.tsx @@ -5,10 +5,10 @@ import { selectModalState } from 'src/features/modals/selectModalState' import { TransferFlow } from 'src/features/transactions/transfer/TransferFlow' import { TransferFlow as TransferFlowRewrite } from 'src/features/transactions/transfer/transferRewrite/TransferFlow' import { useSporeColors } from 'ui/src' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { FeatureFlags } from 'uniswap/src/features/gating/flags' import { useFeatureFlag } from 'uniswap/src/features/gating/hooks' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function TransferTokenModal(): JSX.Element { const colors = useSporeColors() diff --git a/apps/mobile/src/app/modals/ViewOnlyExplainerModal.tsx b/apps/mobile/src/app/modals/ViewOnlyExplainerModal.tsx index 5f121445156..bb20e62a357 100644 --- a/apps/mobile/src/app/modals/ViewOnlyExplainerModal.tsx +++ b/apps/mobile/src/app/modals/ViewOnlyExplainerModal.tsx @@ -4,10 +4,10 @@ import { closeModal, openModal } from 'src/features/modals/modalSlice' import { Button, Flex, Text, useIsDarkMode } from 'ui/src' import ViewOnlyWalletDark from 'ui/src/assets/graphics/view-only-wallet-dark.svg' import ViewOnlyWalletLight from 'ui/src/assets/graphics/view-only-wallet-light.svg' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobile' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { useActiveAccountAddress, useNativeAccountExists } from 'wallet/src/features/wallet/hooks' import { useAppDispatch } from 'wallet/src/state' diff --git a/apps/mobile/src/app/navigation/navigation.tsx b/apps/mobile/src/app/navigation/navigation.tsx index 345f4d82fa9..c4c9b93a1cd 100644 --- a/apps/mobile/src/app/navigation/navigation.tsx +++ b/apps/mobile/src/app/navigation/navigation.tsx @@ -12,6 +12,7 @@ import { SettingsStackParamList, UnitagStackParamList, } from 'src/app/navigation/types' +import { BackButton } from 'src/components/buttons/BackButton' import { HorizontalEdgeGestureTarget } from 'src/components/layout/screens/EdgeGestureTarget' import { useBiometricCheck } from 'src/features/biometrics/useBiometricCheck' import { FiatOnRampProvider } from 'src/features/fiatOnRamp/FiatOnRampContext' @@ -79,7 +80,7 @@ import { OnboardingContextProvider } from 'wallet/src/features/onboarding/Onboar import { useActiveAccountWithThrow } from 'wallet/src/features/wallet/hooks' import { selectFinishedOnboarding } from 'wallet/src/features/wallet/selectors' -const OnboardingStack = createStackNavigator() +const OnboardingStack = createNativeStackNavigator() const AppStack = createNativeStackNavigator() const ExploreStack = createNativeStackNavigator() const FiatOnRampStack = createNativeStackNavigator() @@ -226,13 +227,10 @@ export function FiatOnRampStackNavigator(): JSX.Element { ) } -const renderHeaderBackImage = (): JSX.Element => ( - -) +const renderHeaderBackButton = (): JSX.Element => export function OnboardingStackNavigator(): JSX.Element { const colors = useSporeColors() - const insets = useDeviceInsets() const seedPhraseRefactorEnabled = useFeatureFlag(FeatureFlags.SeedPhraseRefactorNative) const SeedPhraseInputComponent = seedPhraseRefactorEnabled ? SeedPhraseInputScreenV2 @@ -245,16 +243,12 @@ export function OnboardingStackNavigator(): JSX.Element { {isOnboardingKeyringEnabled && ( ( + +) + export function UnitagStackNavigator(): JSX.Element { const colors = useSporeColors() const insets = useDeviceInsets() diff --git a/apps/mobile/src/app/saga.ts b/apps/mobile/src/app/saga.ts index 96f9a6f8828..0e5f13fa834 100644 --- a/apps/mobile/src/app/saga.ts +++ b/apps/mobile/src/app/saga.ts @@ -36,13 +36,6 @@ import { createAccountsSaga, createAccountsSagaName, } from 'wallet/src/features/wallet/create/createAccountsSaga' -import { pendingAccountSaga } from 'wallet/src/features/wallet/create/pendingAccountsSaga' -import { - importAccountActions, - importAccountReducer, - importAccountSaga, - importAccountSagaName, -} from 'wallet/src/features/wallet/import/importAccountSaga' import { MonitoredSaga, getMonitoredSagaReducers } from 'wallet/src/state/saga' const REHYDRATION_STATUS_POLLING_INTERVAL = 50 @@ -55,7 +48,6 @@ const sagas = [ deepLinkWatcher, firebaseDataWatcher, modalWatcher, - pendingAccountSaga, restoreMnemonicCompleteWatcher, signWcRequestSaga, telemetrySaga, @@ -76,12 +68,6 @@ export const monitoredSagas: Record = { reducer: editAccountReducer, actions: editAccountActions, }, - [importAccountSagaName]: { - name: importAccountSagaName, - wrappedSaga: importAccountSaga, - reducer: importAccountReducer, - actions: importAccountActions, - }, [swapSagaName]: { name: swapSagaName, wrappedSaga: swapSaga, diff --git a/apps/mobile/src/app/schema.ts b/apps/mobile/src/app/schema.ts index 268f7014f45..fce6679ddf9 100644 --- a/apps/mobile/src/app/schema.ts +++ b/apps/mobile/src/app/schema.ts @@ -501,6 +501,10 @@ delete v64SchemaIntermediate.behaviorHistory.hasViewedUniconV2IntroModal export const v64Schema = v64SchemaIntermediate +export const v65Schema = { ...v64Schema } + +export const v66Schema = { ...v65Schema } + // TODO: [MOB-201] use function with typed output when API reducers are removed from rootReducer // export const getSchema = (): RootState => v0Schema -export const getSchema = (): typeof v64Schema => v64Schema +export const getSchema = (): typeof v65Schema => v65Schema diff --git a/apps/mobile/src/app/store.ts b/apps/mobile/src/app/store.ts index de46c060617..9077169a0f8 100644 --- a/apps/mobile/src/app/store.ts +++ b/apps/mobile/src/app/store.ts @@ -10,7 +10,6 @@ import { fiatOnRampAggregatorApi as sharedFiatOnRampAggregatorApi } from 'uniswa import { isNonJestDev } from 'utilities/src/environment' import { logger } from 'utilities/src/logger/logger' import { fiatOnRampAggregatorApi, fiatOnRampApi } from 'wallet/src/features/fiatOnRamp/api' -import { importAccountSagaName } from 'wallet/src/features/wallet/import/importAccountSaga' import { createStore } from 'wallet/src/state' import { createMigrate } from 'wallet/src/state/createMigrate' import { RootReducerNames, sharedPersistedStateWhitelist } from 'wallet/src/state/reducer' @@ -74,15 +73,6 @@ export const persistConfig = { export const persistedReducer = persistReducer(persistConfig, mobileReducer) const sentryReduxEnhancer = Sentry.createReduxEnhancer({ - // Add any restrictions here for when the enhancer should not be used - actionTransformer: (action) => { - if (action.type === `${importAccountSagaName}/trigger`) { - // Return null in the case of importing an account, as the payload could contain the mnemonic - return null - } - - return action - }, stateTransformer: (state: MobileState): Maybe => { // Do not log the state if a user has opted out of analytics. if (state.telemetry.allowAnalytics) { diff --git a/apps/mobile/src/components/PriceExplorer/PriceExplorerAnimatedNumber.tsx b/apps/mobile/src/components/PriceExplorer/PriceExplorerAnimatedNumber.tsx index b25972b82af..fa10bf5cc36 100644 --- a/apps/mobile/src/components/PriceExplorer/PriceExplorerAnimatedNumber.tsx +++ b/apps/mobile/src/components/PriceExplorer/PriceExplorerAnimatedNumber.tsx @@ -16,7 +16,7 @@ import { PriceNumberOfDigits } from 'src/components/PriceExplorer/usePriceHistor import { useSporeColors } from 'ui/src' import { TextLoaderWrapper } from 'ui/src/components/text/Text' import { fonts } from 'ui/src/theme' -import { FiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' +import { FiatCurrencyInfo } from 'uniswap/src/features/fiatOnRamp/types' import { ADDITIONAL_WIDTH_FOR_ANIMATIONS, AnimatedCharStyles, diff --git a/apps/mobile/src/components/PriceExplorer/PriceExplorerError.tsx b/apps/mobile/src/components/PriceExplorer/PriceExplorerError.tsx index a7240680e15..a18b71e8fab 100644 --- a/apps/mobile/src/components/PriceExplorer/PriceExplorerError.tsx +++ b/apps/mobile/src/components/PriceExplorer/PriceExplorerError.tsx @@ -2,7 +2,7 @@ import React, { ComponentProps } from 'react' import { useTranslation } from 'react-i18next' import { useChartDimensions } from 'src/components/PriceExplorer/useChartDimensions' import { Flex, Text } from 'ui/src' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' export function PriceExplorerError({ showRetry, diff --git a/apps/mobile/src/components/RecipientSelect/RecipientScanModal.tsx b/apps/mobile/src/components/RecipientSelect/RecipientScanModal.tsx index e42c2094118..af72743da39 100644 --- a/apps/mobile/src/components/RecipientSelect/RecipientScanModal.tsx +++ b/apps/mobile/src/components/RecipientSelect/RecipientScanModal.tsx @@ -9,8 +9,8 @@ import { Flex, HapticFeedback, Text, TouchableArea, useIsDarkMode, useSporeColor import Scan from 'ui/src/assets/icons/receive.svg' import ScanQRIcon from 'ui/src/assets/icons/scan.svg' import { iconSizes } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { ScannerModalState } from 'wallet/src/components/QRCodeScanner/constants' import { WalletQRCode } from 'wallet/src/components/QRCodeScanner/WalletQRCode' import { selectActiveAccountAddress } from 'wallet/src/features/wallet/selectors' diff --git a/apps/mobile/src/components/RecipientSelect/RecipientSelect.tsx b/apps/mobile/src/components/RecipientSelect/RecipientSelect.tsx index cc9e9445ff7..4573aea1fd5 100644 --- a/apps/mobile/src/components/RecipientSelect/RecipientSelect.tsx +++ b/apps/mobile/src/components/RecipientSelect/RecipientSelect.tsx @@ -1,4 +1,4 @@ -import React, { memo, useCallback, useMemo, useState } from 'react' +import React, { memo, useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { Keyboard } from 'react-native' import { FadeIn, FadeOut } from 'react-native-reanimated' @@ -7,12 +7,10 @@ import { Flex, Text, TouchableArea, useSporeColors } from 'ui/src' import ScanQRIcon from 'ui/src/assets/icons/scan.svg' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { iconSizes } from 'ui/src/theme' +import { useBottomSheetContext } from 'uniswap/src/components/modals/BottomSheetContext' import { ElementName } from 'uniswap/src/features/telemetry/constants' import { RecipientList } from 'wallet/src/components/RecipientSearch/RecipientList' -import { filterRecipientByNameAndAddress } from 'wallet/src/components/RecipientSearch/filter' -import { useRecipients } from 'wallet/src/components/RecipientSearch/hooks' -import { filterSections } from 'wallet/src/components/RecipientSearch/utils' -import { useBottomSheetContext } from 'wallet/src/components/modals/BottomSheetContext' +import { useFilteredRecipientSections } from 'wallet/src/components/RecipientSearch/hooks' import { SearchBar } from 'wallet/src/features/search/SearchBar' interface RecipientSelectProps { @@ -43,17 +41,9 @@ export function _RecipientSelect({ const { t } = useTranslation() const { isSheetReady } = useBottomSheetContext() + const [pattern, setPattern] = useState('') const [showQRScanner, setShowQRScanner] = useState(false) - const { sections, searchableRecipientOptions, pattern, onChangePattern, loading } = - useRecipients() - - const filteredSections = useMemo(() => { - const filteredAddresses = filterRecipientByNameAndAddress( - pattern, - searchableRecipientOptions - ).map((item) => item.data.address) - return filterSections(sections, filteredAddresses) - }, [pattern, searchableRecipientOptions, sections]) + const sections = useFilteredRecipientSections(pattern) const onPressQRScanner = useCallback(() => { Keyboard.dismiss() @@ -64,8 +54,6 @@ export function _RecipientSelect({ setShowQRScanner(false) }, [setShowQRScanner]) - const noResults = pattern && pattern?.length > 0 && !loading && filteredSections.length === 0 - return ( <> - {noResults ? ( + {!sections.length ? ( {t('qrScanner.recipient.results.empty')} @@ -97,11 +85,7 @@ export function _RecipientSelect({ ) : ( // Show either suggested recipients or filtered sections based on query isSheetReady && ( - + ) )} diff --git a/apps/mobile/src/components/RecipientSelect/hooks.test.ts b/apps/mobile/src/components/RecipientSelect/hooks.test.ts index 91e3fdbc53e..6221a1b8e61 100644 --- a/apps/mobile/src/components/RecipientSelect/hooks.test.ts +++ b/apps/mobile/src/components/RecipientSelect/hooks.test.ts @@ -1,10 +1,9 @@ import { PreloadedState } from '@reduxjs/toolkit' import { waitFor } from '@testing-library/react-native' import { toIncludeSameMembers } from 'jest-extended' -import { act } from 'react-test-renderer' import { MobileState } from 'src/app/reducer' import { renderHookWithProviders } from 'src/test/render' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId, WalletChainId } from 'uniswap/src/types/chains' import { useRecipients } from 'wallet/src/components/RecipientSearch/hooks' import { SearchableRecipient } from 'wallet/src/features/address/types' import { TransactionStateMap } from 'wallet/src/features/transactions/slice' @@ -121,13 +120,13 @@ describe(useRecipients, () => { it('returns correct initial values', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), + initialProps: '', }) expect(result.current).toEqual({ sections: [], searchableRecipientOptions: [], - pattern: null, - onChangePattern: expect.any(Function), + debouncedPattern: '', loading: false, }) }) @@ -136,6 +135,7 @@ describe(useRecipients, () => { it('result does not contain Search Results section if there is no pattern', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), + initialProps: '', }) expect(result.current).toEqual( @@ -150,11 +150,7 @@ describe(useRecipients, () => { it('result contains Search Results section if there is a pattern', async () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), - }) - - // Set pattern - await act(() => { - result.current.onChangePattern(SAMPLE_SEED_ADDRESS_1) + initialProps: SAMPLE_SEED_ADDRESS_1, }) await waitFor(() => { @@ -165,11 +161,7 @@ describe(useRecipients, () => { it('searchableRecipientOptions contains validatedAddressRecipient', async () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), - }) - - // Set pattern - await act(() => { - result.current.onChangePattern(SAMPLE_SEED_ADDRESS_1) + initialProps: SAMPLE_SEED_ADDRESS_1, }) expect(result.current.searchableRecipientOptions).toEqual( @@ -187,6 +179,7 @@ describe(useRecipients, () => { it('result does not contain Recent section if there are no recent recipients', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), + initialProps: '', }) expect(result.current).toEqual( @@ -205,6 +198,7 @@ describe(useRecipients, () => { }, }, }), + initialProps: '', }) expect(result.current).toEqual( @@ -229,12 +223,22 @@ describe(useRecipients, () => { preloadedState: getPreloadedState({ transactions: { [activeAccount.address]: { - [ChainId.Base as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], - [ChainId.Mainnet as ChainId]: [sendTxDetailsConfirmed, sendTxDetailsFailed], - [ChainId.Bnb as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], + [UniverseChainId.Base as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], + [UniverseChainId.Mainnet as WalletChainId]: [ + sendTxDetailsConfirmed, + sendTxDetailsFailed, + ], + [UniverseChainId.Bnb as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], }, }, }), + initialProps: '', }) const section = result.current.sections[0]! @@ -269,6 +273,7 @@ describe(useRecipients, () => { }, }, }), + initialProps: '', }) expect(result.current).toEqual( @@ -283,12 +288,22 @@ describe(useRecipients, () => { preloadedState: getPreloadedState({ transactions: { [activeAccount.address]: { - [ChainId.Base as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], - [ChainId.Mainnet as ChainId]: [sendTxDetailsConfirmed, sendTxDetailsFailed], - [ChainId.Bnb as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], + [UniverseChainId.Base as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], + [UniverseChainId.Mainnet as WalletChainId]: [ + sendTxDetailsConfirmed, + sendTxDetailsFailed, + ], + [UniverseChainId.Bnb as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], }, }, }), + initialProps: '', }) expect(result.current.searchableRecipientOptions).toEqual(recentRecipients) @@ -299,6 +314,7 @@ describe(useRecipients, () => { it('result does not contain Your wallets section if there are no inactive accounts', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), + initialProps: '', }) expect(result.current).toEqual( @@ -313,6 +329,7 @@ describe(useRecipients, () => { it('result contains Your wallets section if there are inactive accounts', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState({ hasInactiveAccounts: true }), + initialProps: '', }) expect(result.current).toEqual( @@ -325,6 +342,7 @@ describe(useRecipients, () => { it('searchableRecipientOptions contains inactive accounts', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState({ hasInactiveAccounts: true }), + initialProps: '', }) expect(result.current).toEqual( @@ -339,6 +357,7 @@ describe(useRecipients, () => { it('result does not contain Favorite Wallets section if there are no watched wallets', () => { const { result } = renderHookWithProviders(useRecipients, { preloadedState: getPreloadedState(), + initialProps: '', }) expect(result.current).toEqual( @@ -355,6 +374,7 @@ describe(useRecipients, () => { preloadedState: getPreloadedState({ watchedAddresses, }), + initialProps: '', }) expect(result.current).toEqual( @@ -373,16 +393,22 @@ describe(useRecipients, () => { hasInactiveAccounts: true, transactions: { [activeAccount.address]: { - [ChainId.Base as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], - [ChainId.Mainnet as ChainId]: [sendTxDetailsConfirmed, sendTxDetailsFailed], - [ChainId.Bnb as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], + [UniverseChainId.Base as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], + [UniverseChainId.Mainnet as WalletChainId]: [ + sendTxDetailsConfirmed, + sendTxDetailsFailed, + ], + [UniverseChainId.Bnb as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], }, }, }), - }) - - await act(() => { - result.current.onChangePattern(SAMPLE_SEED_ADDRESS_1) + initialProps: SAMPLE_SEED_ADDRESS_1, }) await waitFor(() => { @@ -406,16 +432,22 @@ describe(useRecipients, () => { hasInactiveAccounts: true, transactions: { [activeAccount.address]: { - [ChainId.Base as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], - [ChainId.Mainnet as ChainId]: [sendTxDetailsConfirmed, sendTxDetailsFailed], - [ChainId.Bnb as ChainId]: [sendTxDetailsPending, sendTxDetailsConfirmed], + [UniverseChainId.Base as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], + [UniverseChainId.Mainnet as WalletChainId]: [ + sendTxDetailsConfirmed, + sendTxDetailsFailed, + ], + [UniverseChainId.Bnb as WalletChainId]: [ + sendTxDetailsPending, + sendTxDetailsConfirmed, + ], }, }, }), - }) - - await act(() => { - result.current.onChangePattern(SAMPLE_SEED_ADDRESS_1) + initialProps: SAMPLE_SEED_ADDRESS_1, }) await waitFor(() => { diff --git a/apps/mobile/src/components/RemoveWallet/RemoveWalletModal.tsx b/apps/mobile/src/components/RemoveWallet/RemoveWalletModal.tsx index 2c607d638f6..35a50e5dc3a 100644 --- a/apps/mobile/src/components/RemoveWallet/RemoveWalletModal.tsx +++ b/apps/mobile/src/components/RemoveWallet/RemoveWalletModal.tsx @@ -14,11 +14,11 @@ import { selectModalState } from 'src/features/modals/selectModalState' import { Button, ColorTokens, Flex, SpinningLoader, Text, ThemeKeys, useSporeColors } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { iconSizes, opacify } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobile' import { logger } from 'utilities/src/logger/logger' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { Keyring } from 'wallet/src/features/wallet/Keyring/Keyring' import { EditAccountAction, diff --git a/apps/mobile/src/components/RestoreWalletModal/RestoreWalletModal.tsx b/apps/mobile/src/components/RestoreWalletModal/RestoreWalletModal.tsx index 6114bbfbc32..30c0f27788c 100644 --- a/apps/mobile/src/components/RestoreWalletModal/RestoreWalletModal.tsx +++ b/apps/mobile/src/components/RestoreWalletModal/RestoreWalletModal.tsx @@ -6,10 +6,10 @@ import { closeAllModals, closeModal } from 'src/features/modals/modalSlice' import { Button, Flex, Text, useSporeColors } from 'ui/src' import LockIcon from 'ui/src/assets/icons/lock.svg' import { iconSizes, opacify } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobile' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function RestoreWalletModal(): JSX.Element | null { const { t } = useTranslation() diff --git a/apps/mobile/src/components/TokenBalanceList/TokenBalanceList.tsx b/apps/mobile/src/components/TokenBalanceList/TokenBalanceList.tsx index 74c84a5079b..83c252c98e4 100644 --- a/apps/mobile/src/components/TokenBalanceList/TokenBalanceList.tsx +++ b/apps/mobile/src/components/TokenBalanceList/TokenBalanceList.tsx @@ -16,10 +16,10 @@ import { import { Flex, Loader, useDeviceInsets, useSporeColors } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { zIndices } from 'ui/src/theme' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { CurrencyId } from 'uniswap/src/types/currency' import { MobileScreens } from 'uniswap/src/types/screens/mobile' import { isAndroid } from 'utilities/src/platform' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { isError, isNonPollingRequestInFlight } from 'wallet/src/data/utils' import { HiddenTokensRow } from 'wallet/src/features/portfolio/HiddenTokensRow' import { TokenBalanceItem } from 'wallet/src/features/portfolio/TokenBalanceItem' @@ -81,6 +81,7 @@ export const TokenBalanceListInner = forwardRef< const insets = useDeviceInsets() const { rows, balancesById, networkStatus, refetch } = useTokenBalanceListContext() + const hasError = isError(networkStatus, !!balancesById) const { onContentSizeChange, adaptiveFooter } = useAdaptiveFooter( containerProps?.contentContainerStyle @@ -146,14 +147,32 @@ export const TokenBalanceListInner = forwardRef< const keyExtractor = useCallback((item: TokenBalanceListRow): string => item, []) const ListEmptyComponent = useMemo(() => { + if (hasError) { + return ( + + refetch?.()} + /> + + ) + } + + if (isNonPollingRequestInFlight(networkStatus)) { + return ( + + + + ) + } + return ( - + {empty} ) - }, [containerProps?.emptyContainerStyle, empty]) - - const hasError = isError(networkStatus, !!balancesById) + }, [hasError, empty, t, networkStatus, refetch]) const ListHeaderComponent = useMemo(() => { return hasError ? ( @@ -182,6 +201,8 @@ export const TokenBalanceListInner = forwardRef< [] ) + const data = balancesById ? (isFocused ? rows : cachedRows) : undefined + // Note: `PerformanceView` must wrap the entire return statement to properly track interactive states. return ( - {!balancesById ? ( - isNonPollingRequestInFlight(networkStatus) ? ( - - - - ) : ( - - refetch?.()} - /> - - ) - ) : ( - - )} + ) }) diff --git a/apps/mobile/src/components/TokenDetails/TokenDetailsLinks.tsx b/apps/mobile/src/components/TokenDetails/TokenDetailsLinks.tsx index 99d05bad0f9..d54f40ec787 100644 --- a/apps/mobile/src/components/TokenDetails/TokenDetailsLinks.tsx +++ b/apps/mobile/src/components/TokenDetails/TokenDetailsLinks.tsx @@ -6,10 +6,10 @@ import { getBlockExplorerIcon } from 'src/components/icons/BlockExplorerIcon' import { Flex, Text } from 'ui/src' import GlobeIcon from 'ui/src/assets/icons/globe-filled.svg' import TwitterIcon from 'ui/src/assets/icons/x-twitter.svg' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { TokenDetailsScreenQuery } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' import { ElementName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' -import { CHAIN_INFO } from 'wallet/src/constants/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { currencyIdToAddress, currencyIdToChain, @@ -27,10 +27,10 @@ export function TokenDetailsLinks({ const { t } = useTranslation() const { homepageUrl, twitterName } = data?.token?.project ?? {} - const chainId = currencyIdToChain(currencyId) ?? ChainId.Mainnet + const chainId = currencyIdToChain(currencyId) ?? UniverseChainId.Mainnet const address = currencyIdToAddress(currencyId) const explorerLink = getExplorerLink(chainId, address, ExplorerDataType.TOKEN) - const explorerName = CHAIN_INFO[chainId].explorer.name + const explorerName = UNIVERSE_CHAIN_INFO[chainId].explorer.name return ( diff --git a/apps/mobile/src/components/TokenSelector/TokenFiatOnRampList.tsx b/apps/mobile/src/components/TokenSelector/TokenFiatOnRampList.tsx index 44878371cc9..634d57b364c 100644 --- a/apps/mobile/src/components/TokenSelector/TokenFiatOnRampList.tsx +++ b/apps/mobile/src/components/TokenSelector/TokenFiatOnRampList.tsx @@ -3,10 +3,10 @@ import React, { memo, useCallback, useMemo, useRef } from 'react' import { useTranslation } from 'react-i18next' import { ListRenderItemInfo } from 'react-native' import { Flex, Inset, Loader } from 'ui/src' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { CurrencyId } from 'uniswap/src/types/currency' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { TokenOptionItem } from 'wallet/src/components/TokenSelector/TokenOptionItem' import { useBottomSheetFocusHook } from 'wallet/src/components/modals/hooks' @@ -42,7 +42,7 @@ function TokenOptionItemWrapper({ return ( diff --git a/apps/mobile/src/components/Trace/TraceUserProperties.test.tsx b/apps/mobile/src/components/Trace/TraceUserProperties.test.tsx index cd463d0fe0d..4b25bad611a 100644 --- a/apps/mobile/src/components/Trace/TraceUserProperties.test.tsx +++ b/apps/mobile/src/components/Trace/TraceUserProperties.test.tsx @@ -73,11 +73,7 @@ describe('TraceUserProperties', () => { }) mockFn(walletHooks, 'useViewOnlyAccounts', ['address1', 'address2']) mockFn(walletHooks, 'useSwapProtectionSetting', SwapProtectionSetting.On) - mockFn(walletHooks, 'useNonPendingSignerAccounts', [ - signerAccount1, - signerAccount2, - signerAccount3, - ]) + mockFn(walletHooks, 'useSignerAccounts', [signerAccount1, signerAccount2, signerAccount3]) mockFn(walletHooks, 'useHideSpamTokensSetting', true) mockFn(walletHooks, 'useHideSmallBalancesSetting', false) mockFn(biometricHooks, 'useBiometricAppSettings', { @@ -163,7 +159,7 @@ describe('TraceUserProperties', () => { mockFn(walletHooks, 'useActiveAccount', null) mockFn(walletHooks, 'useViewOnlyAccounts', []) mockFn(walletHooks, 'useSwapProtectionSetting', SwapProtectionSetting.On) - mockFn(walletHooks, 'useNonPendingSignerAccounts', []) + mockFn(walletHooks, 'useSignerAccounts', []) mockFn(biometricHooks, 'useBiometricAppSettings', { requiredForAppAccess: false, requiredForTransactions: false, diff --git a/apps/mobile/src/components/Trace/TraceUserProperties.tsx b/apps/mobile/src/components/Trace/TraceUserProperties.tsx index 1f997b6588c..91d7de86c83 100644 --- a/apps/mobile/src/components/Trace/TraceUserProperties.tsx +++ b/apps/mobile/src/components/Trace/TraceUserProperties.tsx @@ -22,7 +22,7 @@ import { useActiveAccount, useHideSmallBalancesSetting, useHideSpamTokensSetting, - useNonPendingSignerAccounts, + useSignerAccounts, useSwapProtectionSetting, useViewOnlyAccounts, } from 'wallet/src/features/wallet/hooks' @@ -32,7 +32,7 @@ export function TraceUserProperties(): null { const isDarkMode = useIsDarkMode() const viewOnlyAccounts = useViewOnlyAccounts() const activeAccount = useActiveAccount() - const signerAccounts = useNonPendingSignerAccounts() + const signerAccounts = useSignerAccounts() const biometricsAppSettingsState = useBiometricAppSettings() const { touchId, faceId } = useDeviceSupportsBiometricAuth() const swapProtectionSetting = useSwapProtectionSetting() diff --git a/apps/mobile/src/components/WalletConnect/ConnectedDapps/DappConnectedNetworksModal.tsx b/apps/mobile/src/components/WalletConnect/ConnectedDapps/DappConnectedNetworksModal.tsx index de669de0465..bd472393b1d 100644 --- a/apps/mobile/src/components/WalletConnect/ConnectedDapps/DappConnectedNetworksModal.tsx +++ b/apps/mobile/src/components/WalletConnect/ConnectedDapps/DappConnectedNetworksModal.tsx @@ -9,12 +9,12 @@ import { WalletConnectSession, removeSession } from 'src/features/walletConnect/ import { Button, Flex, Text } from 'ui/src' import { iconSizes } from 'ui/src/theme' import { NetworkLogo } from 'uniswap/src/components/CurrencyLogo/NetworkLogo' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { WalletConnectEvent } from 'uniswap/src/types/walletConnect' import { logger } from 'utilities/src/logger/logger' import { ONE_SECOND_MS } from 'utilities/src/time/time' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' -import { CHAIN_INFO } from 'wallet/src/constants/chains' import { pushNotification } from 'wallet/src/features/notifications/slice' import { AppNotificationType } from 'wallet/src/features/notifications/types' import { useActiveAccountAddressWithThrow } from 'wallet/src/features/wallet/hooks' @@ -88,7 +88,7 @@ export function DappConnectedNetworkModal({ - {CHAIN_INFO[chainId].label} + {UNIVERSE_CHAIN_INFO[chainId].label} { const { name } = useENS(chainId, address, false) const colors = useSporeColors() - const supportedChainId = toSupportedChainId(chainId) ?? ChainId.Mainnet + const supportedChainId = toSupportedChainId(chainId) ?? UniverseChainId.Mainnet return ( {t('uwulink.error.insufficientTokens', { tokenSymbol: symbol, - chain: CHAIN_INFO[chainId].label, + chain: UNIVERSE_CHAIN_INFO[chainId].label, })} )} diff --git a/apps/mobile/src/components/WalletConnect/RequestModal/WalletConnectRequestModalContent.tsx b/apps/mobile/src/components/WalletConnect/RequestModal/WalletConnectRequestModalContent.tsx index 85e8a3ec8d7..77b4a3e0d85 100644 --- a/apps/mobile/src/components/WalletConnect/RequestModal/WalletConnectRequestModalContent.tsx +++ b/apps/mobile/src/components/WalletConnect/RequestModal/WalletConnectRequestModalContent.tsx @@ -15,9 +15,9 @@ import { import { Flex, Text, useSporeColors } from 'ui/src' import AlertTriangle from 'ui/src/assets/icons/alert-triangle.svg' import { iconSizes } from 'ui/src/theme' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { EthMethod, isPrimaryTypePermit } from 'uniswap/src/types/walletConnect' import { logger } from 'utilities/src/logger/logger' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { AccountDetails } from 'wallet/src/components/accounts/AccountDetails' import { NetworkFee } from 'wallet/src/components/network/NetworkFee' import { NetworkPill } from 'wallet/src/components/network/NetworkPill' diff --git a/apps/mobile/src/components/WalletConnect/RequestModal/hooks.ts b/apps/mobile/src/components/WalletConnect/RequestModal/hooks.ts index 3a44c546936..d5b3806c7a5 100644 --- a/apps/mobile/src/components/WalletConnect/RequestModal/hooks.ts +++ b/apps/mobile/src/components/WalletConnect/RequestModal/hooks.ts @@ -1,10 +1,10 @@ import { useMemo } from 'react' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId, WalletChainId } from 'uniswap/src/types/chains' import { GasFeeResult } from 'wallet/src/features/gas/types' import { useOnChainNativeCurrencyBalance } from 'wallet/src/features/portfolio/api' import { NativeCurrency } from 'wallet/src/features/tokens/NativeCurrency' import { hasSufficientFundsIncludingGas } from 'wallet/src/features/transactions/utils' -import { getCurrencyAmount, ValueType } from 'wallet/src/utils/getCurrencyAmount' +import { ValueType, getCurrencyAmount } from 'wallet/src/utils/getCurrencyAmount' export function useHasSufficientFunds({ account, @@ -13,13 +13,13 @@ export function useHasSufficientFunds({ value, }: { account?: string - chainId?: ChainId + chainId?: WalletChainId gasFee: GasFeeResult value?: string }): boolean { - const nativeCurrency = NativeCurrency.onChain(chainId || ChainId.Mainnet) + const nativeCurrency = NativeCurrency.onChain(chainId || UniverseChainId.Mainnet) const { balance: nativeBalance } = useOnChainNativeCurrencyBalance( - chainId ?? ChainId.Mainnet, + chainId ?? UniverseChainId.Mainnet, account ) diff --git a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionModal.tsx b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionModal.tsx index c94f08a7f9d..b9cbc140c10 100644 --- a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionModal.tsx +++ b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionModal.tsx @@ -23,7 +23,7 @@ import { Check, X } from 'ui/src/components/icons' import { iconSizes } from 'ui/src/theme' import { ElementName, MobileEventName, ModalName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' -import { ChainId } from 'uniswap/src/types/chains' +import { WalletChainId } from 'uniswap/src/types/chains' import { WCEventType, WCRequestOutcome, WalletConnectEvent } from 'uniswap/src/types/walletConnect' import { ONE_SECOND_MS } from 'utilities/src/time/time' import { AccountDetails } from 'wallet/src/components/accounts/AccountDetails' @@ -109,7 +109,7 @@ const SitePermissions = (): JSX.Element => { ) } -const NetworksRow = ({ chains }: { chains: ChainId[] }): JSX.Element => { +const NetworksRow = ({ chains }: { chains: WalletChainId[] }): JSX.Element => { const { t } = useTranslation() return ( diff --git a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchAccountModal.tsx b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchAccountModal.tsx index 5aa4ee75c00..f91feaace1a 100644 --- a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchAccountModal.tsx +++ b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchAccountModal.tsx @@ -2,8 +2,8 @@ import React, { useMemo } from 'react' import { useTranslation } from 'react-i18next' import { SwitchAccountOption } from 'src/components/WalletConnect/ScanSheet/SwitchAccountOption' import { Flex, Text } from 'ui/src' +import { ActionSheetModal } from 'uniswap/src/components/modals/ActionSheetModal' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' -import { ActionSheetModal } from 'wallet/src/components/modals/ActionSheetModal' import { Account } from 'wallet/src/features/wallet/accounts/types' import { useSignerAccounts } from 'wallet/src/features/wallet/hooks' diff --git a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchNetworkModal.tsx b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchNetworkModal.tsx index 9fd0dfc13c2..1fb75c2db74 100644 --- a/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchNetworkModal.tsx +++ b/apps/mobile/src/components/WalletConnect/ScanSheet/PendingConnectionSwitchNetworkModal.tsx @@ -4,14 +4,14 @@ import { Flex, Separator, Text, useSporeColors } from 'ui/src' import Check from 'ui/src/assets/icons/check.svg' import { iconSizes } from 'ui/src/theme' import { NetworkLogo } from 'uniswap/src/components/CurrencyLogo/NetworkLogo' +import { ActionSheetModal } from 'uniswap/src/components/modals/ActionSheetModal' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' -import { ActionSheetModal } from 'wallet/src/components/modals/ActionSheetModal' -import { ALL_SUPPORTED_CHAIN_IDS, CHAIN_INFO } from 'wallet/src/constants/chains' +import { WALLET_SUPPORTED_CHAIN_IDS, WalletChainId } from 'uniswap/src/types/chains' type Props = { - selectedChainId: ChainId - onPressChain: (chainId: ChainId) => void + selectedChainId: WalletChainId + onPressChain: (chainId: WalletChainId) => void onClose: () => void } @@ -25,8 +25,8 @@ export const PendingConnectionSwitchNetworkModal = ({ const options = useMemo( () => - ALL_SUPPORTED_CHAIN_IDS.map((chainId) => { - const info = CHAIN_INFO[chainId] + WALLET_SUPPORTED_CHAIN_IDS.map((chainId) => { + const info = UNIVERSE_CHAIN_INFO[chainId] return { key: `${ElementName.NetworkButton}-${chainId}`, onPress: () => onPressChain(chainId), diff --git a/apps/mobile/src/components/WalletConnect/ScanSheet/WalletConnectModal.tsx b/apps/mobile/src/components/WalletConnect/ScanSheet/WalletConnectModal.tsx index 49d0af75d7a..44c7554933c 100644 --- a/apps/mobile/src/components/WalletConnect/ScanSheet/WalletConnectModal.tsx +++ b/apps/mobile/src/components/WalletConnect/ScanSheet/WalletConnectModal.tsx @@ -24,6 +24,7 @@ import { Flex, HapticFeedback, Text, TouchableArea, useIsDarkMode, useSporeColor import Scan from 'ui/src/assets/icons/receive.svg' import ScanQRIcon from 'ui/src/assets/icons/scan.svg' import { iconSizes } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { FeatureFlags } from 'uniswap/src/features/gating/flags' import { useFeatureFlag } from 'uniswap/src/features/gating/hooks' import Trace from 'uniswap/src/features/telemetry/Trace' @@ -32,7 +33,6 @@ import { EthMethod, UwULinkMethod, UwULinkRequest } from 'uniswap/src/types/wall import { logger } from 'utilities/src/logger/logger' import { WalletQRCode } from 'wallet/src/components/QRCodeScanner/WalletQRCode' import { ScannerModalState } from 'wallet/src/components/QRCodeScanner/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { useContractManager, useProviderManager } from 'wallet/src/features/wallet/context' import { useActiveAccount } from 'wallet/src/features/wallet/hooks' diff --git a/apps/mobile/src/components/accounts/AccountCardItem.test.tsx b/apps/mobile/src/components/accounts/AccountCardItem.test.tsx index 02811688a78..cd6431e1417 100644 --- a/apps/mobile/src/components/accounts/AccountCardItem.test.tsx +++ b/apps/mobile/src/components/accounts/AccountCardItem.test.tsx @@ -1,12 +1,8 @@ import { AccountCardItem } from 'src/components/accounts/AccountCardItem' import { fireEvent, render, screen, waitFor } from 'src/test/test-utils' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import * as hooks from 'wallet/src/features/accounts/hooks' -import { - ON_PRESS_EVENT_PAYLOAD, - SAMPLE_SEED_ADDRESS_1, - amount, - portfolio, -} from 'wallet/src/test/fixtures' +import { SAMPLE_SEED_ADDRESS_1, amount, portfolio } from 'wallet/src/test/fixtures' import { queryResolvers } from 'wallet/src/test/utils' describe(AccountCardItem, () => { diff --git a/apps/mobile/src/components/accounts/AccountHeader.test.tsx b/apps/mobile/src/components/accounts/AccountHeader.test.tsx index ef98d85c0bd..6f15d0f0c4a 100644 --- a/apps/mobile/src/components/accounts/AccountHeader.test.tsx +++ b/apps/mobile/src/components/accounts/AccountHeader.test.tsx @@ -4,13 +4,9 @@ import { MobileState } from 'src/app/reducer' import { AccountHeader } from 'src/components/accounts/AccountHeader' import { fireEvent, render, screen, waitFor, within } from 'src/test/test-utils' import { ModalName } from 'uniswap/src/features/telemetry/constants' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import { MobileScreens } from 'uniswap/src/types/screens/mobile' -import { - ACCOUNT, - ON_PRESS_EVENT_PAYLOAD, - preloadedSharedState, - signerMnemonicAccount, -} from 'wallet/src/test/fixtures' +import { ACCOUNT, preloadedSharedState, signerMnemonicAccount } from 'wallet/src/test/fixtures' import { sanitizeAddressText, shortenAddress } from 'wallet/src/utils/addresses' const preloadedState = preloadedSharedState({ account: ACCOUNT }) diff --git a/apps/mobile/src/components/accounts/AccountList.test.tsx b/apps/mobile/src/components/accounts/AccountList.test.tsx index 499e0c45fb3..dba6ade3c96 100644 --- a/apps/mobile/src/components/accounts/AccountList.test.tsx +++ b/apps/mobile/src/components/accounts/AccountList.test.tsx @@ -1,9 +1,9 @@ import { AccountList } from 'src/components/accounts/AccountList' import { cleanup, fireEvent, render, screen } from 'src/test/test-utils' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import { NumberType } from 'utilities/src/format/types' import { ACCOUNT, - ON_PRESS_EVENT_PAYLOAD, amounts, portfolio, readOnlyAccount, diff --git a/apps/mobile/src/components/buttons/BackButton.test.tsx b/apps/mobile/src/components/buttons/BackButton.test.tsx index 3aefbd62716..b2282cdf327 100644 --- a/apps/mobile/src/components/buttons/BackButton.test.tsx +++ b/apps/mobile/src/components/buttons/BackButton.test.tsx @@ -1,7 +1,7 @@ import React from 'react' import { BackButton } from 'src/components/buttons/BackButton' import { fireEvent, render, screen } from 'src/test/test-utils' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' const mockedGoBack = jest.fn() jest.mock('@react-navigation/native', () => { diff --git a/apps/mobile/src/components/buttons/CloseButton.test.tsx b/apps/mobile/src/components/buttons/CloseButton.test.tsx index f291544bec7..9a2c70cce31 100644 --- a/apps/mobile/src/components/buttons/CloseButton.test.tsx +++ b/apps/mobile/src/components/buttons/CloseButton.test.tsx @@ -1,6 +1,6 @@ import { CloseButton } from 'src/components/buttons/CloseButton' import { fireEvent, render } from 'src/test/test-utils' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' describe(CloseButton, () => { it('renders without error', () => { diff --git a/apps/mobile/src/components/buttons/LinkButton.test.tsx b/apps/mobile/src/components/buttons/LinkButton.test.tsx index 514bd82510f..bf069787cc9 100644 --- a/apps/mobile/src/components/buttons/LinkButton.test.tsx +++ b/apps/mobile/src/components/buttons/LinkButton.test.tsx @@ -1,6 +1,6 @@ import { LinkButton } from 'src/components/buttons/LinkButton' import { fireEvent, render } from 'src/test/test-utils' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' jest.mock('wallet/src/utils/linking') diff --git a/apps/mobile/src/components/explore/ExploreSections.tsx b/apps/mobile/src/components/explore/ExploreSections.tsx index 50c16e6b736..d071dde20d2 100644 --- a/apps/mobile/src/components/explore/ExploreSections.tsx +++ b/apps/mobile/src/components/explore/ExploreSections.tsx @@ -17,13 +17,13 @@ import { } from 'src/features/explore/utils' import { usePollOnFocusOnly } from 'src/utils/hooks' import { Flex, Loader, Text, useDeviceInsets } from 'ui/src' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { Chain, ExploreTokensTabQuery, useExploreTokensTabQuery, } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' +import { UniverseChainId } from 'uniswap/src/types/chains' import { getWrappedNativeAddress } from 'wallet/src/constants/addresses' import { PollingInterval } from 'wallet/src/constants/misc' import { fromGraphQLChain } from 'wallet/src/features/chains/utils' @@ -78,7 +78,7 @@ export function ExploreSections({ listRef }: ExploreSectionsProps): JSX.Element // eth will be defined only if all the required data is available // when eth data is not fully available, we do not replace weth with eth const { eth } = data - const wethAddress = getWrappedNativeAddress(ChainId.Mainnet) + const wethAddress = getWrappedNativeAddress(UniverseChainId.Mainnet) const topTokens = data.topTokens .map((token) => { diff --git a/apps/mobile/src/components/explore/FavoriteHeaderRow.test.tsx b/apps/mobile/src/components/explore/FavoriteHeaderRow.test.tsx index bc13282670b..8d5b6801ac0 100644 --- a/apps/mobile/src/components/explore/FavoriteHeaderRow.test.tsx +++ b/apps/mobile/src/components/explore/FavoriteHeaderRow.test.tsx @@ -1,6 +1,6 @@ import { FavoriteHeaderRow } from 'src/components/explore/FavoriteHeaderRow' import { fireEvent, render } from 'src/test/test-utils' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' const defaultProps = { title: 'Title', diff --git a/apps/mobile/src/components/explore/FavoriteTokenCard.test.tsx b/apps/mobile/src/components/explore/FavoriteTokenCard.test.tsx index c8f455a3166..51b99702271 100644 --- a/apps/mobile/src/components/explore/FavoriteTokenCard.test.tsx +++ b/apps/mobile/src/components/explore/FavoriteTokenCard.test.tsx @@ -2,11 +2,11 @@ import { makeMutable } from 'react-native-reanimated' import configureMockStore from 'redux-mock-store' import FavoriteTokenCard, { FavoriteTokenCardProps } from 'src/components/explore/FavoriteTokenCard' import { act, cleanup, fireEvent, render, waitFor } from 'src/test/test-utils' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import { getSymbolDisplayText } from 'uniswap/src/utils/currency' import { FiatCurrency } from 'wallet/src/features/fiatCurrency/constants' import { Language } from 'wallet/src/features/language/constants' import { - ON_PRESS_EVENT_PAYLOAD, SAMPLE_CURRENCY_ID_1, amount, ethToken, diff --git a/apps/mobile/src/components/explore/FavoriteTokenCard.tsx b/apps/mobile/src/components/explore/FavoriteTokenCard.tsx index 4397495df4a..5025a1b61c8 100644 --- a/apps/mobile/src/components/explore/FavoriteTokenCard.tsx +++ b/apps/mobile/src/components/explore/FavoriteTokenCard.tsx @@ -12,13 +12,13 @@ import { usePollOnFocusOnly } from 'src/utils/hooks' import { AnimatedTouchableArea, Flex, ImpactFeedbackStyle, Text } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { borderRadii, imageSizes } from 'ui/src/theme' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { TokenLogo } from 'uniswap/src/components/CurrencyLogo/TokenLogo' import { useFavoriteTokenCardQuery } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' import { SectionName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { getSymbolDisplayText } from 'uniswap/src/utils/currency' import { NumberType } from 'utilities/src/format/types' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { RelativeChange } from 'wallet/src/components/text/RelativeChange' import { PollingInterval } from 'wallet/src/constants/misc' import { isNonPollingRequestInFlight } from 'wallet/src/data/utils' @@ -61,7 +61,7 @@ function FavoriteTokenCard({ const token = data?.token // Mirror behavior in top tokens list, use first chain the token is on for the symbol - const chainId = fromGraphQLChain(token?.chain) ?? ChainId.Mainnet + const chainId = fromGraphQLChain(token?.chain) ?? UniverseChainId.Mainnet const price = convertFiatAmountFormatted( token?.project?.markets?.[0]?.price?.value, diff --git a/apps/mobile/src/components/explore/FavoriteWalletCard.test.tsx b/apps/mobile/src/components/explore/FavoriteWalletCard.test.tsx index 2463a4f20ba..916243e359d 100644 --- a/apps/mobile/src/components/explore/FavoriteWalletCard.test.tsx +++ b/apps/mobile/src/components/explore/FavoriteWalletCard.test.tsx @@ -6,10 +6,10 @@ import FavoriteWalletCard, { import { preloadedMobileState } from 'src/test/fixtures' import { fireEvent, render, waitFor } from 'src/test/test-utils' import * as unitagHooks from 'uniswap/src/features/unitags/hooks' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import { MobileScreens } from 'uniswap/src/types/screens/mobile' import * as ensHooks from 'wallet/src/features/ens/api' import { - ON_PRESS_EVENT_PAYLOAD, SAMPLE_SEED_ADDRESS_1, preloadedWalletState, signerMnemonicAccount, diff --git a/apps/mobile/src/components/explore/FavoriteWalletCard.tsx b/apps/mobile/src/components/explore/FavoriteWalletCard.tsx index 63f985c1f75..a69196f770e 100644 --- a/apps/mobile/src/components/explore/FavoriteWalletCard.tsx +++ b/apps/mobile/src/components/explore/FavoriteWalletCard.tsx @@ -11,7 +11,7 @@ import { disableOnPress } from 'src/utils/disableOnPress' import { Flex, ImpactFeedbackStyle, TouchableArea } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { borderRadii, iconSizes } from 'ui/src/theme' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { AccountIcon } from 'wallet/src/components/accounts/AccountIcon' import { DisplayNameText } from 'wallet/src/components/accounts/DisplayNameText' import { removeWatchedAddress } from 'wallet/src/features/favorites/slice' diff --git a/apps/mobile/src/components/explore/RemoveButton.test.tsx b/apps/mobile/src/components/explore/RemoveButton.test.tsx index 57e596bcc60..1f93e6bca29 100644 --- a/apps/mobile/src/components/explore/RemoveButton.test.tsx +++ b/apps/mobile/src/components/explore/RemoveButton.test.tsx @@ -1,6 +1,6 @@ import RemoveButton from 'src/components/explore/RemoveButton' import { fireEvent, render } from 'src/test/test-utils' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' describe(RemoveButton, () => { it('renders without error', () => { diff --git a/apps/mobile/src/components/explore/TokenItem.test.tsx b/apps/mobile/src/components/explore/TokenItem.test.tsx index 076c84c6f1b..7a73c486e8c 100644 --- a/apps/mobile/src/components/explore/TokenItem.test.tsx +++ b/apps/mobile/src/components/explore/TokenItem.test.tsx @@ -3,8 +3,8 @@ import { TokenItem } from 'src/components/explore/TokenItem' import * as exploreHooks from 'src/components/explore/hooks' import { TOKEN_ITEM_DATA, tokenItemData } from 'src/test/fixtures' import { fireEvent, render, within } from 'src/test/test-utils' +import { ON_PRESS_EVENT_PAYLOAD } from 'uniswap/src/test/fixtures' import { TokenMetadataDisplayType } from 'wallet/src/features/wallet/types' -import { ON_PRESS_EVENT_PAYLOAD } from 'wallet/src/test/fixtures' import { buildCurrencyId } from 'wallet/src/utils/currencyId' describe('TokenItem', () => { diff --git a/apps/mobile/src/components/explore/TokenItem.tsx b/apps/mobile/src/components/explore/TokenItem.tsx index 67d55c4d128..6668973eb10 100644 --- a/apps/mobile/src/components/explore/TokenItem.tsx +++ b/apps/mobile/src/components/explore/TokenItem.tsx @@ -10,7 +10,7 @@ import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { TokenLogo } from 'uniswap/src/components/CurrencyLogo/TokenLogo' import { MobileEventName, SectionName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' -import { ChainId } from 'uniswap/src/types/chains' +import { WalletChainId } from 'uniswap/src/types/chains' import { NumberType } from 'utilities/src/format/types' import { RelativeChange } from 'wallet/src/components/text/RelativeChange' import { useLocalizationContext } from 'wallet/src/features/language/LocalizationContext' @@ -25,7 +25,7 @@ import { export type TokenItemData = { name: string logoUrl: string - chainId: ChainId + chainId: WalletChainId address: Address | null symbol: string price?: number diff --git a/apps/mobile/src/components/explore/__snapshots__/TokenItem.test.tsx.snap b/apps/mobile/src/components/explore/__snapshots__/TokenItem.test.tsx.snap index fb3068433af..9caadde96ce 100644 --- a/apps/mobile/src/components/explore/__snapshots__/TokenItem.test.tsx.snap +++ b/apps/mobile/src/components/explore/__snapshots__/TokenItem.test.tsx.snap @@ -101,6 +101,7 @@ exports[`TokenItem renders without error 1`] = ` > void diff --git a/apps/mobile/src/components/explore/search/SearchResultsSection.tsx b/apps/mobile/src/components/explore/search/SearchResultsSection.tsx index 90eb630df84..1421b99fa41 100644 --- a/apps/mobile/src/components/explore/search/SearchResultsSection.tsx +++ b/apps/mobile/src/components/explore/search/SearchResultsSection.tsx @@ -21,12 +21,12 @@ import { import { Flex, Text } from 'ui/src' import { Coin, Gallery, Person } from 'ui/src/components/icons' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { useExploreSearchQuery } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' import i18n from 'uniswap/src/i18n/i18n' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { logger } from 'utilities/src/logger/logger' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' -import { CHAIN_INFO } from 'wallet/src/constants/chains' import { SearchContext } from 'wallet/src/features/search/SearchContext' import { NFTCollectionSearchResult, @@ -56,7 +56,7 @@ const NFTHeaderItem: SearchResultOrHeader = { const EtherscanHeaderItem: SearchResultOrHeader = { type: SEARCH_RESULT_HEADER_KEY, title: i18n.t('explore.search.action.viewEtherscan', { - blockExplorerName: CHAIN_INFO[ChainId.Mainnet].explorer.name, + blockExplorerName: UNIVERSE_CHAIN_INFO[UniverseChainId.Mainnet].explorer.name, }), } @@ -175,7 +175,9 @@ export function SearchResultsSection({ searchQuery }: { searchQuery: string }): } if (error) { - if (IGNORED_ERRORS.includes(error?.message)) { + const filteredErrors = error.graphQLErrors.filter((e) => !IGNORED_ERRORS.includes(e.message)) + + if (filteredErrors.length === 0) { logger.info('SearchResultSection', 'useExploreSearchQuery', error?.message) } else { return ( diff --git a/apps/mobile/src/components/explore/search/hooks.ts b/apps/mobile/src/components/explore/search/hooks.ts index cad6e97bb78..2706ee3e3be 100644 --- a/apps/mobile/src/components/explore/search/hooks.ts +++ b/apps/mobile/src/components/explore/search/hooks.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react' import { useUnitagByAddress, useUnitagByName } from 'uniswap/src/features/unitags/hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { useENS } from 'wallet/src/features/ens/useENS' import { SearchResultType, WalletSearchResult } from 'wallet/src/features/search/SearchResult' import { useIsSmartContractAddress } from 'wallet/src/features/transactions/transfer/hooks/useIsSmartContractAddress' @@ -25,14 +25,14 @@ export function useWalletSearchResults(query: string): { address: dotEthAddress, name: dotEthName, loading: dotEthLoading, - } = useENS(ChainId.Mainnet, querySkippedIfValidAddress, true) + } = useENS(UniverseChainId.Mainnet, querySkippedIfValidAddress, true) // Search for exact match for ENS if not a valid address const { address: ensAddress, name: ensName, loading: ensLoading, - } = useENS(ChainId.Mainnet, querySkippedIfValidAddress, false) + } = useENS(UniverseChainId.Mainnet, querySkippedIfValidAddress, false) // Search for matching Unitag by name const { unitag: unitagByName, loading: unitagLoading } = useUnitagByName(query) @@ -43,7 +43,7 @@ export function useWalletSearchResults(query: string): { // Search for matching EOA wallet address const { isSmartContractAddress, loading: loadingIsSmartContractAddress } = - useIsSmartContractAddress(validAddress, ChainId.Mainnet) + useIsSmartContractAddress(validAddress, UniverseChainId.Mainnet) const hasENSResult = dotEthName && dotEthAddress const hasEOAResult = validAddress && !isSmartContractAddress diff --git a/apps/mobile/src/components/explore/search/items/SearchEtherscanItem.tsx b/apps/mobile/src/components/explore/search/items/SearchEtherscanItem.tsx index 1e0b4740764..ef3674db679 100644 --- a/apps/mobile/src/components/explore/search/items/SearchEtherscanItem.tsx +++ b/apps/mobile/src/components/explore/search/items/SearchEtherscanItem.tsx @@ -4,7 +4,7 @@ import { getBlockExplorerIcon } from 'src/components/icons/BlockExplorerIcon' import { Flex, ImpactFeedbackStyle, Text, TouchableArea, useSporeColors } from 'ui/src' import { iconSizes } from 'ui/src/theme' import { ElementName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { Arrow } from 'wallet/src/components/icons/Arrow' import { EtherscanSearchResult } from 'wallet/src/features/search/SearchResult' import { addToSearchHistory } from 'wallet/src/features/search/searchHistorySlice' @@ -22,7 +22,7 @@ export function SearchEtherscanItem({ etherscanResult }: SearchEtherscanItemProp const { address } = etherscanResult const onPressViewEtherscan = async (): Promise => { - const explorerLink = getExplorerLink(ChainId.Mainnet, address, ExplorerDataType.ADDRESS) + const explorerLink = getExplorerLink(UniverseChainId.Mainnet, address, ExplorerDataType.ADDRESS) await openUri(explorerLink) dispatch( addToSearchHistory({ @@ -31,7 +31,7 @@ export function SearchEtherscanItem({ etherscanResult }: SearchEtherscanItemProp ) } - const EtherscanIcon = getBlockExplorerIcon(ChainId.Mainnet) + const EtherscanIcon = getBlockExplorerIcon(UniverseChainId.Mainnet) return ( 0 ? (signerAccounts?.[0] as SignerMnemonicAccount)?.mnemonicId diff --git a/apps/mobile/src/components/home/ActivityTab.tsx b/apps/mobile/src/components/home/ActivityTab.tsx index c48683b2217..6e5f25c4fa6 100644 --- a/apps/mobile/src/components/home/ActivityTab.tsx +++ b/apps/mobile/src/components/home/ActivityTab.tsx @@ -65,7 +65,7 @@ export const ActivityTab = memo( owner, authTrigger: requiresBiometrics ? biometricsTrigger : undefined, isExternalProfile, - emptyContainerStyle: containerProps?.emptyContainerStyle, + emptyComponentStyle: containerProps?.emptyComponentStyle, onPressEmptyState: onPressReceive, }) diff --git a/apps/mobile/src/components/home/FeedTab.tsx b/apps/mobile/src/components/home/FeedTab.tsx index c56e11041b9..560f8f43617 100644 --- a/apps/mobile/src/components/home/FeedTab.tsx +++ b/apps/mobile/src/components/home/FeedTab.tsx @@ -11,10 +11,10 @@ import { openModal } from 'src/features/modals/modalSlice' import { removePendingSession } from 'src/features/walletConnect/walletConnectSlice' import { Flex, Text, useDeviceInsets, useSporeColors } from 'ui/src' import { NoTransactions } from 'ui/src/components/icons' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { GQLQueries } from 'uniswap/src/data/graphql/uniswap-data-api/queries' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { isAndroid } from 'utilities/src/platform' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { ScannerModalState } from 'wallet/src/components/QRCodeScanner/constants' import { useFormattedTransactionDataForFeed } from 'wallet/src/features/activity/hooks' import { selectWatchedAddressSet } from 'wallet/src/features/favorites/selectors' @@ -74,7 +74,7 @@ export const FeedTab = memo( } const errorCard = ( - + + } diff --git a/apps/mobile/src/components/home/NftsTab.tsx b/apps/mobile/src/components/home/NftsTab.tsx index b9ecb8c4936..fa8ee6f905a 100644 --- a/apps/mobile/src/components/home/NftsTab.tsx +++ b/apps/mobile/src/components/home/NftsTab.tsx @@ -71,8 +71,8 @@ export const NftsTab = memo( { - if (!containerProps) { - return undefined - } - if (!isExternalProfile) { - return { ...containerProps, emptyContainerStyle: {} } - } - return containerProps - }, [containerProps, isExternalProfile]) - const onPressAction = useCallback((): void => { dispatch( openModal({ name: ModalName.WalletConnectScan, initialState: ScannerModalState.WalletQr }) @@ -123,7 +112,7 @@ export const TokensTab = memo( >() +const iconsCache = new Map>() + +function buildIconComponent(chainId: WalletChainId): React.FC { + const explorer = UNIVERSE_CHAIN_INFO[chainId].explorer + const exlorerLogos = UNIVERSE_CHAIN_LOGO[chainId].explorer -function buildIconComponent(chainId: ChainId): React.FC { - const explorer = CHAIN_INFO[chainId].explorer const Component = ({ size }: IconComponentProps): JSX.Element => { const isDarkMode = useIsDarkMode() - return isDarkMode ? : + return isDarkMode ? ( + + ) : ( + + ) } Component.displayName = `BlockExplorerIcon_${explorer.name}` iconsCache.set(chainId, Component) return Component } -export function getBlockExplorerIcon(chainId: ChainId): React.FC { +export function getBlockExplorerIcon(chainId: WalletChainId): React.FC { return iconsCache.get(chainId) ?? buildIconComponent(chainId) } diff --git a/apps/mobile/src/components/input/PasswordInput.tsx b/apps/mobile/src/components/input/PasswordInput.tsx index de1c1702724..f970e3eac34 100644 --- a/apps/mobile/src/components/input/PasswordInput.tsx +++ b/apps/mobile/src/components/input/PasswordInput.tsx @@ -5,7 +5,7 @@ import EyeOffIcon from 'ui/src/assets/icons/eye-off.svg' import EyeIcon from 'ui/src/assets/icons/eye.svg' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { iconSizes } from 'ui/src/theme' -import { TextInput, TextInputProps } from 'wallet/src/components/input/TextInput' +import { TextInput, TextInputProps } from 'uniswap/src/components/input/TextInput' export const PasswordInput = forwardRef(function _PasswordInput( props, diff --git a/apps/mobile/src/components/layout/TabHelpers.tsx b/apps/mobile/src/components/layout/TabHelpers.tsx index 4e9c715d4a1..3a6a84da877 100644 --- a/apps/mobile/src/components/layout/TabHelpers.tsx +++ b/apps/mobile/src/components/layout/TabHelpers.tsx @@ -88,9 +88,8 @@ export type TabProps = { } export type TabContentProps = Partial> & { - loadingContainerStyle: StyleProp - emptyContainerStyle: StyleProp - contentContainerStyle?: StyleProp + contentContainerStyle: StyleProp + emptyComponentStyle?: StyleProp estimatedItemSize?: number onMomentumScrollEnd?: (event: NativeSyntheticEvent) => void onScrollEndDrag?: (event: NativeSyntheticEvent) => void diff --git a/apps/mobile/src/components/layout/screens/HeaderScrollScreen.tsx b/apps/mobile/src/components/layout/screens/HeaderScrollScreen.tsx index 59664cacb79..8ef7d767bc6 100644 --- a/apps/mobile/src/components/layout/screens/HeaderScrollScreen.tsx +++ b/apps/mobile/src/components/layout/screens/HeaderScrollScreen.tsx @@ -8,7 +8,7 @@ import { ScrollHeader } from 'src/components/layout/screens/ScrollHeader' import { VirtualizedList } from 'src/components/layout/VirtualizedList' import { ColorTokens, Flex, flexStyles, useSporeColors } from 'ui/src' import { iconSizes } from 'ui/src/theme' -import { HandleBar } from 'wallet/src/components/modals/HandleBar' +import { HandleBar } from 'uniswap/src/components/modals/HandleBar' // Distance to scroll to show scrolled state header elements const SHOW_HEADER_SCROLL_Y_DISTANCE = 50 diff --git a/apps/mobile/src/components/mnemonic/MnemonicConfirmation.tsx b/apps/mobile/src/components/mnemonic/MnemonicConfirmation.tsx index 0c76df04133..c84fd27653e 100644 --- a/apps/mobile/src/components/mnemonic/MnemonicConfirmation.tsx +++ b/apps/mobile/src/components/mnemonic/MnemonicConfirmation.tsx @@ -1,8 +1,9 @@ -import React from 'react' import { useTranslation } from 'react-i18next' -import { requireNativeComponent, StyleProp, ViewProps } from 'react-native' -import { FlexProps, flexStyles, HiddenFromScreenReaders } from 'ui/src' +import { StyleProp, ViewProps, requireNativeComponent } from 'react-native' +import { useNativeComponentKey } from 'src/app/hooks' +import { FlexProps, HiddenFromScreenReaders, flexStyles } from 'ui/src' import { useDeviceDimensions } from 'ui/src/hooks/useDeviceDimensions' +import { isAndroid } from 'utilities/src/platform' interface NativeMnemonicConfirmationProps { mnemonicId: Address @@ -28,10 +29,15 @@ export function MnemonicConfirmation(props: MnemonicConfirmationProps): JSX.Elem const { t } = useTranslation() const { fullHeight } = useDeviceDimensions() const shouldShowSmallText = fullHeight < 700 + // Android only (ensures that Jetpack Compose mounts the view again + // after navigating back in the stack navigator) + // (see https://github.com/react-native-community/discussions-and-proposals/issues/446#issuecomment-2041254054) + const { key } = useNativeComponentKey(isAndroid) return ( diff --git a/apps/mobile/src/components/unitags/DeleteUnitagModal.tsx b/apps/mobile/src/components/unitags/DeleteUnitagModal.tsx index 7fa0105735c..bb04b14ae66 100644 --- a/apps/mobile/src/components/unitags/DeleteUnitagModal.tsx +++ b/apps/mobile/src/components/unitags/DeleteUnitagModal.tsx @@ -5,11 +5,11 @@ import { ActivityIndicator } from 'react-native' import { Button, Flex, Text, useSporeColors } from 'ui/src' import { AlertTriangle } from 'ui/src/components/icons' import { fonts } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, ModalName, UnitagEventName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { useUnitagUpdater } from 'uniswap/src/features/unitags/context' import { logger } from 'utilities/src/logger/logger' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { pushNotification } from 'wallet/src/features/notifications/slice' import { AppNotificationType } from 'wallet/src/features/notifications/types' import { deleteUnitag } from 'wallet/src/features/unitags/api' diff --git a/apps/mobile/src/components/unitags/UnitagsIntroModal.tsx b/apps/mobile/src/components/unitags/UnitagsIntroModal.tsx index 8594e48b678..2b2472893a3 100644 --- a/apps/mobile/src/components/unitags/UnitagsIntroModal.tsx +++ b/apps/mobile/src/components/unitags/UnitagsIntroModal.tsx @@ -11,10 +11,10 @@ import { Button, Flex, GeneratedIcon, Image, Text, useIsDarkMode } from 'ui/src' import { UNITAGS_INTRO_BANNER_DARK, UNITAGS_INTRO_BANNER_LIGHT } from 'ui/src/assets' import { Lightning, Ticket, UserSquare } from 'ui/src/components/icons' import { iconSizes } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { MobileScreens, UnitagScreens } from 'uniswap/src/types/screens/mobile' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { setHasCompletedUnitagsIntroModal } from 'wallet/src/features/behaviorHistory/slice' export function UnitagsIntroModal(): JSX.Element { diff --git a/apps/mobile/src/features/CloudBackup/CloudBackupProcessingAnimation.tsx b/apps/mobile/src/features/CloudBackup/CloudBackupProcessingAnimation.tsx index 05e159a8f02..1f5a50c4322 100644 --- a/apps/mobile/src/features/CloudBackup/CloudBackupProcessingAnimation.tsx +++ b/apps/mobile/src/features/CloudBackup/CloudBackupProcessingAnimation.tsx @@ -5,14 +5,14 @@ import { useTranslation } from 'react-i18next' import { ActivityIndicator, Alert } from 'react-native' import { OnboardingStackParamList, SettingsStackParamList } from 'src/app/navigation/types' import { backupMnemonicToCloudStorage } from 'src/features/CloudBackup/RNCloudStorageBackupsManager' -import { Flex, Text, useSporeColors } from 'ui/src' +import { Flex, Text } from 'ui/src' +import { CheckmarkCircle } from 'ui/src/components/icons' import { iconSizes } from 'ui/src/theme' import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobile' import { getCloudProviderName } from 'uniswap/src/utils/cloud-backup/getCloudProviderName' import { logger } from 'utilities/src/logger/logger' import { ONE_SECOND_MS } from 'utilities/src/time/time' import { promiseMinDelay } from 'utilities/src/time/timing' -import { CheckmarkCircle } from 'wallet/src/components/icons/CheckmarkCircle' import { useOnboardingContext } from 'wallet/src/features/onboarding/OnboardingContext' import { EditAccountAction, @@ -45,7 +45,6 @@ export function CloudBackupProcessingAnimation({ const { addBackupMethod, getImportedAccounts, getOnboardingAccount } = useOnboardingContext() const onboardingAccount = getOnboardingAccount() const importedAccounts = getImportedAccounts() - const colors = useSporeColors() const activeAccount = useAccountIfExists(accountAddress) const account = activeAccount || onboardingAccount || importedAccounts?.[0] @@ -143,13 +142,7 @@ export function CloudBackupProcessingAnimation({ ) : ( - + {t('settings.setting.backup.status.complete', { cloudProviderName: getCloudProviderName(), diff --git a/apps/mobile/src/features/appRating/selectors.test.ts b/apps/mobile/src/features/appRating/selectors.test.ts index a2b58508756..becc2b51cbe 100644 --- a/apps/mobile/src/features/appRating/selectors.test.ts +++ b/apps/mobile/src/features/appRating/selectors.test.ts @@ -1,5 +1,5 @@ import { hasConsecutiveRecentSwapsSelector } from 'src/features/appRating/selectors' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { ONE_HOUR_MS, ONE_MINUTE_MS } from 'utilities/src/time/time' import { TransactionDetails, @@ -21,7 +21,7 @@ const state = { }, transactions: { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0x123': { addedTime: MOCK_DATE_PROMPTED + 1000, typeInfo: { type: TransactionType.Swap }, @@ -66,7 +66,7 @@ describe('consecutiveSwapsSelector', () => { ...state, transactions: { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0x123': { addedTime: MOCK_DATE_PROMPTED, typeInfo: { type: TransactionType.Swap }, @@ -95,7 +95,7 @@ describe('consecutiveSwapsSelector', () => { ...state, transactions: { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0x123': { addedTime: MOCK_DATE_PROMPTED + 1000, typeInfo: { type: TransactionType.Swap }, @@ -119,7 +119,7 @@ describe('consecutiveSwapsSelector', () => { ...state, transactions: { [account.address]: { - [ChainId.Mainnet]: { + [UniverseChainId.Mainnet]: { '0x123': { addedTime: MOCK_DATE_PROMPTED - ONE_HOUR_MS, typeInfo: { type: TransactionType.Swap }, diff --git a/apps/mobile/src/features/contracts/useContract.ts b/apps/mobile/src/features/contracts/useContract.ts index e8c29b813ac..a5c92176b68 100644 --- a/apps/mobile/src/features/contracts/useContract.ts +++ b/apps/mobile/src/features/contracts/useContract.ts @@ -4,12 +4,12 @@ import { Contract, ContractInterface } from 'ethers' import { useMemo } from 'react' import ERC20_ABI from 'uniswap/src/abis/erc20.json' import { Erc20 } from 'uniswap/src/abis/types' -import { ChainId } from 'uniswap/src/types/chains' +import { WalletChainId } from 'uniswap/src/types/chains' import { logger } from 'utilities/src/logger/logger' import { useContractManager, useProvider } from 'wallet/src/features/wallet/context' export function useContract( - chainId: ChainId, + chainId: WalletChainId, addressOrAddressMap: string | { [chainId: number]: string } | undefined, ABI: ContractInterface ): T | null { @@ -38,6 +38,6 @@ export function useContract( }, [chainId, addressOrAddressMap, ABI, provider, contractsManager]) as T } -export function useTokenContract(chainId: ChainId, tokenAddress?: Address): Erc20 | null { +export function useTokenContract(chainId: WalletChainId, tokenAddress?: Address): Erc20 | null { return useContract(chainId, tokenAddress, ERC20_ABI) } diff --git a/apps/mobile/src/features/deepLinking/handleDeepLinkSaga.ts b/apps/mobile/src/features/deepLinking/handleDeepLinkSaga.ts index 48f6d9343fd..e954c56e8ac 100644 --- a/apps/mobile/src/features/deepLinking/handleDeepLinkSaga.ts +++ b/apps/mobile/src/features/deepLinking/handleDeepLinkSaga.ts @@ -43,7 +43,6 @@ import { selectAccounts, selectActiveAccount, selectActiveAccountAddress, - selectNonPendingAccounts, selectSignerMnemonicAccounts, } from 'wallet/src/features/wallet/selectors' import { setAccountAsActive } from 'wallet/src/features/wallet/slice' @@ -174,7 +173,7 @@ export function* handleUniswapAppDeepLink(path: string, url: string, linkSource: if (!accountAddress) { return } - const accounts = yield* appSelect(selectNonPendingAccounts) + const accounts = yield* appSelect(selectAccounts) const activeAccountAddress = yield* appSelect(selectActiveAccountAddress) if (accountAddress === activeAccountAddress) { return diff --git a/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.test.ts b/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.test.ts index fbee4f89b22..7a36fa7cbee 100644 --- a/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.test.ts +++ b/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.test.ts @@ -3,7 +3,7 @@ import { expectSaga } from 'redux-saga-test-plan' import { handleSwapLink } from 'src/features/deepLinking/handleSwapLinkSaga' import { openModal } from 'src/features/modals/modalSlice' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId, WalletChainId } from 'uniswap/src/types/chains' import { DAI, UNI } from 'wallet/src/constants/tokens' import { AssetType } from 'wallet/src/entities/assets' import { @@ -16,7 +16,7 @@ const account = signerMnemonicAccount() const formSwapUrl = ( userAddress?: Address, - chain?: ChainId | number, + chain?: WalletChainId | number, inputAddress?: string, outputAddress?: string, currencyField?: string, @@ -32,7 +32,7 @@ const formSwapUrl = ( ) const formTransactionState = ( - chain?: ChainId, + chain?: WalletChainId, inputAddress?: string, outputAddress?: string, currencyField?: string, @@ -40,12 +40,12 @@ const formTransactionState = ( ): { input: { address: string | undefined - chainId: ChainId | undefined + chainId: WalletChainId | undefined type: AssetType } output: { address: string | undefined - chainId: ChainId | undefined + chainId: WalletChainId | undefined type: AssetType } exactCurrencyField: string | undefined @@ -71,16 +71,16 @@ const formTransactionState = ( const swapUrl = formSwapUrl( account.address, - ChainId.Mainnet, + UniverseChainId.Mainnet, DAI.address, - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'input', '100' ) const invalidOutputCurrencySwapUrl = formSwapUrl( account.address, - ChainId.Mainnet, + UniverseChainId.Mainnet, DAI.address, undefined, 'input', @@ -89,9 +89,9 @@ const invalidOutputCurrencySwapUrl = formSwapUrl( const invalidInputTokenSwapURl = formSwapUrl( account.address, - ChainId.Mainnet, + UniverseChainId.Mainnet, '0x00', - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'input', '100' ) @@ -100,33 +100,33 @@ const invalidChainSwapUrl = formSwapUrl( account.address, 23, DAI.address, - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'input', '100' ) const invalidAmountSwapUrl = formSwapUrl( account.address, - ChainId.Mainnet, + UniverseChainId.Mainnet, DAI.address, - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'input', 'not a number' ) const invalidCurrencyFieldSwapUrl = formSwapUrl( account.address, - ChainId.Mainnet, + UniverseChainId.Mainnet, DAI.address, - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'token1', '100' ) const swapFormState = formTransactionState( - ChainId.Mainnet, + UniverseChainId.Mainnet, DAI.address, - UNI[ChainId.Mainnet].address, + UNI[UniverseChainId.Mainnet].address, 'input', '100' ) as TransactionState diff --git a/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.ts b/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.ts index 009a0e78f17..c90d5959fc3 100644 --- a/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.ts +++ b/apps/mobile/src/features/deepLinking/handleSwapLinkSaga.ts @@ -2,8 +2,8 @@ import { BigNumber } from 'ethers' import { openModal } from 'src/features/modals/modalSlice' import { put } from 'typed-redux-saga' import { ModalName } from 'uniswap/src/features/telemetry/constants' +import { WALLET_SUPPORTED_CHAIN_IDS } from 'uniswap/src/types/chains' import { logger } from 'utilities/src/logger/logger' -import { ALL_SUPPORTED_CHAIN_IDS } from 'wallet/src/constants/chains' import { AssetType, CurrencyAsset } from 'wallet/src/entities/assets' import { CurrencyField, @@ -85,11 +85,11 @@ const parseAndValidateSwapParams = (url: URL) => { throw new Error('Invalid tokenAddress provided within outputCurrencyId') } - if (!ALL_SUPPORTED_CHAIN_IDS.includes(inputChain)) { + if (!WALLET_SUPPORTED_CHAIN_IDS.includes(inputChain)) { throw new Error('Invalid inputCurrencyId. Chain ID is not supported') } - if (!ALL_SUPPORTED_CHAIN_IDS.includes(outputChain)) { + if (!WALLET_SUPPORTED_CHAIN_IDS.includes(outputChain)) { throw new Error('Invalid outputCurrencyId. Chain ID is not supported') } diff --git a/apps/mobile/src/features/externalProfile/ProfileContextMenu.tsx b/apps/mobile/src/features/externalProfile/ProfileContextMenu.tsx index 91df9b42a94..11dc9d11938 100644 --- a/apps/mobile/src/features/externalProfile/ProfileContextMenu.tsx +++ b/apps/mobile/src/features/externalProfile/ProfileContextMenu.tsx @@ -7,14 +7,14 @@ import { TripleDot } from 'src/components/icons/TripleDot' import { disableOnPress } from 'src/utils/disableOnPress' import { Flex, HapticFeedback, TouchableArea } from 'ui/src' import { iconSizes } from 'ui/src/theme' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { uniswapUrls } from 'uniswap/src/constants/urls' import { WalletEventName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { useUnitagByAddress } from 'uniswap/src/features/unitags/hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { ShareableEntity } from 'uniswap/src/types/sharing' import { logger } from 'utilities/src/logger/logger' -import { CHAIN_INFO } from 'wallet/src/constants/chains' import { pushNotification } from 'wallet/src/features/notifications/slice' import { AppNotificationType, CopyNotificationType } from 'wallet/src/features/notifications/types' import { setClipboard } from 'wallet/src/utils/clipboard' @@ -43,7 +43,7 @@ export function ProfileContextMenu({ address }: { address: Address }): JSX.Eleme }, [address, dispatch]) const openExplorerLink = useCallback(async () => { - await openUri(getExplorerLink(ChainId.Mainnet, address, ExplorerDataType.ADDRESS)) + await openUri(getExplorerLink(UniverseChainId.Mainnet, address, ExplorerDataType.ADDRESS)) }, [address]) const onReportProfile = useCallback(async () => { @@ -78,7 +78,7 @@ export function ProfileContextMenu({ address }: { address: Address }): JSX.Eleme const options: MenuAction[] = [ { title: t('account.wallet.action.viewExplorer', { - blockExplorerName: CHAIN_INFO[ChainId.Mainnet].explorer.name, + blockExplorerName: UNIVERSE_CHAIN_INFO[UniverseChainId.Mainnet].explorer.name, }), action: openExplorerLink, systemIcon: 'link', diff --git a/apps/mobile/src/features/externalProfile/ProfileHeader.tsx b/apps/mobile/src/features/externalProfile/ProfileHeader.tsx index 954f351911a..f256db1f631 100644 --- a/apps/mobile/src/features/externalProfile/ProfileHeader.tsx +++ b/apps/mobile/src/features/externalProfile/ProfileHeader.tsx @@ -78,7 +78,7 @@ export const ProfileHeader = memo(function ProfileHeader({ const hasAvatar = !!avatar && !avatarLoading // Unicon colors - const { color } = getUniconColors(address) + const { color } = getUniconColors(address, false) // Wait for avatar, then render avatar extracted colors or unicon colors if no avatar const fixedGradientColors: [string, string] = useMemo(() => { diff --git a/apps/mobile/src/features/fiatOnRamp/ExchangeTransferModal.tsx b/apps/mobile/src/features/fiatOnRamp/ExchangeTransferModal.tsx index 36d28e4eda9..88d05d5f7d1 100644 --- a/apps/mobile/src/features/fiatOnRamp/ExchangeTransferModal.tsx +++ b/apps/mobile/src/features/fiatOnRamp/ExchangeTransferModal.tsx @@ -2,8 +2,8 @@ import { useAppDispatch, useAppSelector } from 'src/app/hooks' import { closeModal } from 'src/features/modals/modalSlice' import { selectModalState } from 'src/features/modals/selectModalState' import { ExchangeTransferConnecting } from 'src/screens/ExchangeTransferConnecting' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function ExchangeTransferModal(): JSX.Element | null { const dispatch = useAppDispatch() diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampAggregatorModal.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampAggregatorModal.tsx index 9eeca02e12c..0bb53b9c2ec 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampAggregatorModal.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampAggregatorModal.tsx @@ -3,8 +3,8 @@ import { useAppDispatch } from 'src/app/hooks' import { FiatOnRampStackNavigator } from 'src/app/navigation/navigation' import { closeModal } from 'src/features/modals/modalSlice' import { useSporeColors } from 'ui/src' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' export function FiatOnRampAggregatorModal(): JSX.Element { const colors = useSporeColors() diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampAmountSection.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampAmountSection.tsx index b31a6569a9d..7a239988267 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampAmountSection.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampAmountSection.tsx @@ -15,11 +15,10 @@ import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { fonts, spacing } from 'ui/src/theme' import { Pill } from 'uniswap/src/components/pill/Pill' import { SelectTokenButton } from 'uniswap/src/features/fiatOnRamp/SelectTokenButton' -import { FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' +import { FiatCurrencyInfo, FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' import { usePrevious } from 'utilities/src/react/hooks' import { DEFAULT_DELAY, useDebounce } from 'utilities/src/time/timing' import { AmountInput } from 'wallet/src/components/input/AmountInput' -import { FiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' import { useLocalizationContext } from 'wallet/src/features/language/LocalizationContext' import { errorShakeAnimation } from 'wallet/src/utils/animations' import { useDynamicFontSizing } from 'wallet/src/utils/useDynamicFontSizing' diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampContext.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampContext.tsx index a014b1e169d..d19b8bda0d4 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampContext.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampContext.tsx @@ -7,11 +7,11 @@ import { getCountry } from 'react-native-localize' import { FORQuote, FORServiceProvider, + FiatCurrencyInfo, FiatOnRampCurrency, } from 'uniswap/src/features/fiatOnRamp/types' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { getNativeAddress } from 'wallet/src/constants/addresses' -import { FiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' import { useCurrencyInfo } from 'wallet/src/features/tokens/useCurrencyInfo' import { buildCurrencyId } from 'wallet/src/utils/currencyId' @@ -65,7 +65,7 @@ export function FiatOnRampProvider({ children }: { children: React.ReactNode }): // We hardcode ETH as the starting currency const ethCurrencyInfo = useCurrencyInfo( - buildCurrencyId(ChainId.Mainnet, getNativeAddress(ChainId.Mainnet)) + buildCurrencyId(UniverseChainId.Mainnet, getNativeAddress(UniverseChainId.Mainnet)) ) const [quoteCurrency, setQuoteCurrency] = useState({ currencyInfo: ethCurrencyInfo, diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampCountryListModal.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampCountryListModal.tsx index fd49fddcc13..f2403ae776e 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampCountryListModal.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampCountryListModal.tsx @@ -11,13 +11,13 @@ import Check from 'ui/src/assets/icons/check.svg' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { useDeviceDimensions } from 'ui/src/hooks/useDeviceDimensions' import { fonts, iconSizes, spacing } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { useFiatOnRampAggregatorCountryListQuery } from 'uniswap/src/features/fiatOnRamp/api' import { FORCountry } from 'uniswap/src/features/fiatOnRamp/types' import { getCountryFlagSvgUrl } from 'uniswap/src/features/fiatOnRamp/utils' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { bubbleToTop } from 'utilities/src/primitives/array' import { useDebounce } from 'utilities/src/time/timing' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { useBottomSheetFocusHook } from 'wallet/src/components/modals/hooks' import { SearchTextInput } from 'wallet/src/features/search/SearchTextInput' diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampModal.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampModal.tsx index 5254c70444e..7651eaa62db 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampModal.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampModal.tsx @@ -13,18 +13,18 @@ import { closeModal } from 'src/features/modals/modalSlice' import { Flex, Text, useDeviceInsets, useSporeColors } from 'ui/src' import MoonpayLogo from 'ui/src/assets/logos/svg/moonpay.svg' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' +import { TextInputProps } from 'uniswap/src/components/input/TextInput' +import { useBottomSheetContext } from 'uniswap/src/components/modals/BottomSheetContext' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' +import { HandleBar } from 'uniswap/src/components/modals/HandleBar' import { FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' import { FiatOnRampEventName, ModalName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { UniverseEventProperties } from 'uniswap/src/features/telemetry/types' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { NumberType } from 'utilities/src/format/types' import { useTimeout } from 'utilities/src/time/timing' -import { TextInputProps } from 'wallet/src/components/input/TextInput' import { DecimalPadLegacy } from 'wallet/src/components/legacy/DecimalPadLegacy' -import { useBottomSheetContext } from 'wallet/src/components/modals/BottomSheetContext' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' -import { HandleBar } from 'wallet/src/components/modals/HandleBar' import { getNativeAddress } from 'wallet/src/constants/addresses' import { useLocalFiatToUSDConverter } from 'wallet/src/features/fiatCurrency/hooks' import { useMoonpayFiatCurrencySupportInfo } from 'wallet/src/features/fiatOnRamp/hooks' @@ -84,7 +84,7 @@ function FiatOnRampContent({ onClose }: { onClose: () => void }): JSX.Element { // We hardcode ETH as the starting currency const ethCurrencyInfo = useCurrencyInfo( - buildCurrencyId(ChainId.Mainnet, getNativeAddress(ChainId.Mainnet)) + buildCurrencyId(UniverseChainId.Mainnet, getNativeAddress(UniverseChainId.Mainnet)) ) const [currency, setCurrency] = useState({ @@ -125,7 +125,7 @@ function FiatOnRampContent({ onClose }: { onClose: () => void }): JSX.Element { } = useMoonpayFiatOnRamp({ baseCurrencyAmount: value, quoteCurrencyCode: currency.moonpayCurrencyCode, - quoteChainId: currency.currencyInfo?.currency.chainId ?? ChainId.Mainnet, + quoteChainId: currency.currencyInfo?.currency.chainId ?? UniverseChainId.Mainnet, }) useTimeout( diff --git a/apps/mobile/src/features/fiatOnRamp/FiatOnRampTokenSelector.tsx b/apps/mobile/src/features/fiatOnRamp/FiatOnRampTokenSelector.tsx index efd9a98378f..53669b009f6 100644 --- a/apps/mobile/src/features/fiatOnRamp/FiatOnRampTokenSelector.tsx +++ b/apps/mobile/src/features/fiatOnRamp/FiatOnRampTokenSelector.tsx @@ -5,10 +5,10 @@ import { TokenFiatOnRampList } from 'src/components/TokenSelector/TokenFiatOnRam import { FOR_MODAL_SNAP_POINTS } from 'src/features/fiatOnRamp/constants' import { Flex, Text, useSporeColors } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' import Trace from 'uniswap/src/features/telemetry/Trace' import { ElementName, ModalName, SectionName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' interface Props { onSelectCurrency: (currency: FiatOnRampCurrency) => void diff --git a/apps/mobile/src/features/fiatOnRamp/aggregatorHooks.ts b/apps/mobile/src/features/fiatOnRamp/aggregatorHooks.ts index ca03fab3ec7..90e8d4a1639 100644 --- a/apps/mobile/src/features/fiatOnRamp/aggregatorHooks.ts +++ b/apps/mobile/src/features/fiatOnRamp/aggregatorHooks.ts @@ -7,15 +7,15 @@ import { useFiatOnRampAggregatorCryptoQuoteQuery, useFiatOnRampAggregatorSupportedFiatCurrenciesQuery, } from 'uniswap/src/features/fiatOnRamp/api' -import { FORQuote, FORSupportedFiatCurrency } from 'uniswap/src/features/fiatOnRamp/types' +import { + FORQuote, + FORSupportedFiatCurrency, + FiatCurrencyInfo, +} from 'uniswap/src/features/fiatOnRamp/types' import { NumberType } from 'utilities/src/format/types' import { useDebounce } from 'utilities/src/time/timing' import { FiatCurrency } from 'wallet/src/features/fiatCurrency/constants' -import { - FiatCurrencyInfo, - useAppFiatCurrencyInfo, - useFiatCurrencyInfo, -} from 'wallet/src/features/fiatCurrency/hooks' +import { useAppFiatCurrencyInfo, useFiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' import { isFiatOnRampApiError, isInvalidRequestAmountTooHigh, diff --git a/apps/mobile/src/features/fiatOnRamp/hooks.ts b/apps/mobile/src/features/fiatOnRamp/hooks.ts index 8a6e39c940e..9e8c53b9207 100644 --- a/apps/mobile/src/features/fiatOnRamp/hooks.ts +++ b/apps/mobile/src/features/fiatOnRamp/hooks.ts @@ -9,7 +9,7 @@ import { uniswapUrls } from 'uniswap/src/constants/urls' import { CurrencyInfo } from 'uniswap/src/features/dataApi/types' import { useFiatOnRampAggregatorSupportedTokensQuery } from 'uniswap/src/features/fiatOnRamp/api' import { FORSupportedToken, FiatOnRampCurrency } from 'uniswap/src/features/fiatOnRamp/types' -import { ChainId } from 'uniswap/src/types/chains' +import { WalletChainId } from 'uniswap/src/types/chains' import { logger } from 'utilities/src/logger/logger' import { useDebounce } from 'utilities/src/time/timing' import { @@ -17,6 +17,7 @@ import { useCurrencies, } from 'wallet/src/components/TokenSelector/hooks' import { BRIDGED_BASE_ADDRESSES } from 'wallet/src/constants/addresses' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { fromMoonpayNetwork, toSupportedChainId } from 'wallet/src/features/chains/utils' import { useFiatOnRampBuyQuoteQuery, @@ -71,7 +72,7 @@ export function useFormatExactCurrencyAmount( /** Returns a new externalTransactionId and a callback to store the transaction. */ export function useFiatOnRampTransactionCreator( ownerAddress: string, - chainId: ChainId, + chainId: WalletChainId, initialTypeInfo?: Partial ): { externalTransactionId: string @@ -85,6 +86,7 @@ export function useFiatOnRampTransactionCreator( // adds a dummy transaction detail for now // later, we will attempt to look up information for that id const transactionDetail: TransactionDetails = { + routing: Routing.CLASSIC, chainId, id: externalTransactionId.current, from: ownerAddress, @@ -117,7 +119,7 @@ export function useMoonpayFiatOnRamp({ }: { baseCurrencyAmount: string quoteCurrencyCode: string | undefined - quoteChainId: ChainId + quoteChainId: WalletChainId }): { eligible: boolean quoteAmount: number diff --git a/apps/mobile/src/features/firebase/firebaseDataSaga.ts b/apps/mobile/src/features/firebase/firebaseDataSaga.ts index 9a7b99eb677..b7116f1c91f 100644 --- a/apps/mobile/src/features/firebase/firebaseDataSaga.ts +++ b/apps/mobile/src/features/firebase/firebaseDataSaga.ts @@ -23,9 +23,8 @@ import { Account, AccountType } from 'wallet/src/features/wallet/accounts/types' import { makeSelectAccountNotificationSetting, selectAccounts, - selectNonPendingAccounts, } from 'wallet/src/features/wallet/selectors' -import { editAccount, setAccountsNonPending } from 'wallet/src/features/wallet/slice' +import { addAccounts, editAccount } from 'wallet/src/features/wallet/slice' interface AccountMetadata { name?: string @@ -54,12 +53,12 @@ export function* firebaseDataWatcher() { // Can't merge with `editAccountSaga` because it can't handle simultaneous actions yield* takeEvery(editAccountActions.trigger, editAccountDataInFirebase) yield* takeLatest(setCurrentLanguage, syncLanguageWithFirebase) - yield* takeEvery(setAccountsNonPending, syncAccountWithFirebase) + yield* takeEvery(addAccounts, syncAccountWithFirebase) } function* syncNotificationsWithFirebase() { try { - const accounts = yield* select(selectNonPendingAccounts) + const accounts = yield* select(selectAccounts) const addresses = Object.keys(accounts) for (const address of addresses) { @@ -83,15 +82,16 @@ function* syncNotificationsWithFirebase() { } function* syncLanguageWithFirebase(actionData: ReturnType) { - const accounts = yield* select(selectNonPendingAccounts) + const accounts = yield* select(selectAccounts) const addresses = Object.keys(accounts) yield* call(updateFirebaseLanguage, addresses, actionData.payload) } -function* syncAccountWithFirebase(actionData: ReturnType) { +function* syncAccountWithFirebase(actionData: ReturnType) { const currentLanguage = yield* select(selectCurrentLanguage) - yield* call(updateFirebaseLanguage, actionData.payload, currentLanguage) + const addedAccountsAddresses = actionData.payload.map((account) => account.address) + yield* call(updateFirebaseLanguage, addedAccountsAddresses, currentLanguage) } function* updateFirebaseLanguage(addresses: Address[], language: Language) { diff --git a/apps/mobile/src/features/import/InputWithSuffix.android.tsx b/apps/mobile/src/features/import/InputWithSuffix.android.tsx index 3a9d639485e..b55fba3ab3a 100644 --- a/apps/mobile/src/features/import/InputWithSuffix.android.tsx +++ b/apps/mobile/src/features/import/InputWithSuffix.android.tsx @@ -2,9 +2,9 @@ import { useCallback, useRef, useState } from 'react' import { LayoutChangeEvent } from 'react-native' import { InputWithSuffixProps } from 'src/features/import/InputWIthSuffixProps' import { Flex } from 'ui/src' +import { TextInput } from 'uniswap/src/components/input/TextInput' import { ElementName } from 'uniswap/src/features/telemetry/constants' import { isIOS } from 'utilities/src/platform' -import { TextInput } from 'wallet/src/components/input/TextInput' const EPS = 1 diff --git a/apps/mobile/src/features/import/InputWithSuffix.ios.tsx b/apps/mobile/src/features/import/InputWithSuffix.ios.tsx index aa78df68683..c27abf6915b 100644 --- a/apps/mobile/src/features/import/InputWithSuffix.ios.tsx +++ b/apps/mobile/src/features/import/InputWithSuffix.ios.tsx @@ -1,7 +1,7 @@ import { InputWithSuffixProps } from 'src/features/import/InputWIthSuffixProps' import { Flex } from 'ui/src' +import { TextInput } from 'uniswap/src/components/input/TextInput' import { ElementName } from 'uniswap/src/features/telemetry/constants' -import { TextInput } from 'wallet/src/components/input/TextInput' export default function InputWithSuffix({ alwaysShowInputSuffix = false, diff --git a/apps/mobile/src/features/onboarding/SafeKeyboardOnboardingScreen.tsx b/apps/mobile/src/features/onboarding/SafeKeyboardOnboardingScreen.tsx index f65a214fccc..abac95bf489 100644 --- a/apps/mobile/src/features/onboarding/SafeKeyboardOnboardingScreen.tsx +++ b/apps/mobile/src/features/onboarding/SafeKeyboardOnboardingScreen.tsx @@ -7,8 +7,8 @@ import { Screen } from 'src/components/layout/Screen' import { Flex, SpaceTokens, Text, flexStyles, useMedia, useSporeColors } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { opacify, spacing } from 'ui/src/theme' +import { useKeyboardLayout } from 'uniswap/src/utils/useKeyboardLayout' import { isIOS } from 'utilities/src/platform' -import { useKeyboardLayout } from 'wallet/src/utils/useKeyboardLayout' type OnboardingScreenProps = { subtitle?: string diff --git a/apps/mobile/src/features/scantastic/ExtensionWaitlistModal.tsx b/apps/mobile/src/features/scantastic/ExtensionWaitlistModal.tsx index 4b8c27a5111..65252a6d1de 100644 --- a/apps/mobile/src/features/scantastic/ExtensionWaitlistModal.tsx +++ b/apps/mobile/src/features/scantastic/ExtensionWaitlistModal.tsx @@ -4,9 +4,9 @@ import { closeModal } from 'src/features/modals/modalSlice' import { selectModalState } from 'src/features/modals/selectModalState' import { Button, Flex, Text, TouchableArea } from 'ui/src' import { AlertTriangle, DocumentList } from 'ui/src/components/icons' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { uniswapUrls } from 'uniswap/src/constants/urls' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { useAppDispatch } from 'wallet/src/state' import { openUri } from 'wallet/src/utils/linking' diff --git a/apps/mobile/src/features/scantastic/ScantasticModal.tsx b/apps/mobile/src/features/scantastic/ScantasticModal.tsx index 863b2c72e0d..dd1d30404ed 100644 --- a/apps/mobile/src/features/scantastic/ScantasticModal.tsx +++ b/apps/mobile/src/features/scantastic/ScantasticModal.tsx @@ -6,23 +6,25 @@ import { closeAllModals } from 'src/features/modals/modalSlice' import { selectModalState } from 'src/features/modals/selectModalState' import { getEncryptedMnemonic } from 'src/features/scantastic/ScantasticEncryption' import { Button, Flex, Text, TouchableArea, useSporeColors } from 'ui/src' -import { AlertTriangle, Faceid, Laptop, LinkBrokenHorizontal } from 'ui/src/components/icons' +import { AlertTriangle, Faceid, Laptop, LinkBrokenHorizontal, Wifi } from 'ui/src/components/icons' import { iconSizes } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { uniswapUrls } from 'uniswap/src/constants/urls' import { ModalName } from 'uniswap/src/features/telemetry/constants' import { logger } from 'utilities/src/logger/logger' import { ONE_MINUTE_MS, ONE_SECOND_MS } from 'utilities/src/time/time' import { useInterval } from 'utilities/src/time/timing' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { ExtensionOnboardingState, setExtensionOnboardingState, } from 'wallet/src/features/behaviorHistory/slice' import { pushNotification } from 'wallet/src/features/notifications/slice' import { AppNotificationType } from 'wallet/src/features/notifications/types' -import { useNonPendingSignerAccounts } from 'wallet/src/features/wallet/hooks' +import { useSignerAccounts } from 'wallet/src/features/wallet/hooks' import { getOtpDurationString } from 'wallet/src/utils/duration' +const IP_MISMATCH_STATUS_CODE = 401 + enum OtpState { Pending = 'pending', Redeemed = 'redeemed', @@ -39,7 +41,7 @@ export function ScantasticModal(): JSX.Element | null { const dispatch = useAppDispatch() // Use the first mnemonic account because zero-balance mnemonic accounts will fail to retrieve the mnemonic from rnEthers - const account = useNonPendingSignerAccounts().sort( + const account = useSignerAccounts().sort( (account1, account2) => account1.derivationIndex - account2.derivationIndex )[0] @@ -64,6 +66,9 @@ export function ScantasticModal(): JSX.Element | null { const [redeemed, setRedeemed] = useState(false) const [error, setError] = useState('') + // Warning state if backend response identifies mismatched IPs between devices + const [showIPWarning, setShowIPWarning] = useState(false) + const [expiryText, setExpiryText] = useState('') const setExpirationText = useCallback(() => { const expirationString = getOtpDurationString(expirationTimestamp) @@ -134,6 +139,12 @@ export function ScantasticModal(): JSX.Element | null { blob: encryptedSeedphrase, }), }) + + if (response.status === IP_MISMATCH_STATUS_CODE) { + setShowIPWarning(true) + return + } + if (!response.ok) { throw new Error(`Failed to post blob: ${await response.text()}`) } @@ -214,6 +225,30 @@ export function ScantasticModal(): JSX.Element | null { useInterval(checkOTPState, ONE_SECOND_MS, true) + if (showIPWarning) { + return ( + + + + + + + {t('scantastic.modal.ipMismatch.title')} + + {t('scantastic.modal.ipMismatch.description')} + + + + + + ) + } + if (expired) { return ( getDeviceId() + async () => getUniqueId() ) yield* fork(watchTransactionEvents) } diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ApproveSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ApproveSummaryItem.stories.tsx index 8cc4e3b5463..682b55061b1 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ApproveSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ApproveSummaryItem.stories.tsx @@ -1,11 +1,12 @@ import type { Meta, StoryObj } from '@storybook/react' import { TokenDocument } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { ApproveSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/ApproveSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { ApproveTransactionInfo, - TransactionDetails, + ClassicTransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -82,9 +83,10 @@ const meta: Meta = { export default meta -const baseApproveTx: Omit & { +const baseApproveTx: Omit & { typeInfo: ApproveTransactionInfo } = { + routing: Routing.CLASSIC, from: '', addedTime: Date.now() - 30000, hash: '', @@ -164,7 +166,7 @@ export const Approve: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseApproveUnlimitedTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> @@ -200,7 +202,7 @@ export const Revoke: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseRevokeTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/FiatPurchaseSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/FiatPurchaseSummaryItem.stories.tsx index a9aeb858788..4a947d1be3f 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/FiatPurchaseSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/FiatPurchaseSummaryItem.stories.tsx @@ -4,13 +4,14 @@ import { Chain, TokenDocument, } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { getNativeAddress } from 'wallet/src/constants/addresses' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { FiatPurchaseSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/FiatPurchaseSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, FiatPurchaseTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -56,9 +57,10 @@ const meta: Meta = { export default meta -const baseFiatPurchaseTx: Omit & { +const baseFiatPurchaseTx: Omit & { typeInfo: FiatPurchaseTransactionInfo } = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -75,7 +77,7 @@ const baseFiatPurchaseTx: Omit & { outputCurrency: { type: 'crypto', metadata: { - contractAddress: getNativeAddress(ChainId.Mainnet), + contractAddress: getNativeAddress(UniverseChainId.Mainnet), chainId: Chain.Ethereum, }, }, @@ -148,7 +150,7 @@ export const FiatPurchase: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseFiatPurchaseTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTApproveSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTApproveSummaryItem.stories.tsx index 32b95dbeb24..903e7de0161 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTApproveSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTApproveSummaryItem.stories.tsx @@ -1,11 +1,12 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { NFTApproveSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/NFTApproveSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, NFTApproveTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -16,9 +17,10 @@ const meta: Meta = { export default meta -const baseApproveTx: Omit & { +const baseApproveTx: Omit & { typeInfo: NFTApproveTransactionInfo } = { + routing: Routing.CLASSIC, from: '', addedTime: Date.now() - 30000, hash: '', @@ -66,7 +68,7 @@ export const NFTApprove: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseApproveTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTMintSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTMintSummaryItem.stories.tsx index bd33c815c10..74dc72a45ca 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTMintSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTMintSummaryItem.stories.tsx @@ -1,10 +1,11 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { NFTMintSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/NFTMintSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, NFTMintTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -15,7 +16,10 @@ const meta: Meta = { export default meta -const baseNFTMintTx: Omit & { typeInfo: NFTMintTransactionInfo } = { +const baseNFTMintTx: Omit & { + typeInfo: NFTMintTransactionInfo +} = { + routing: Routing.CLASSIC, from: '', addedTime: Date.now() - 30000, hash: '', diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTTradeSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTTradeSummaryItem.stories.tsx index 831fccaa58b..83c7fbeb53a 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTTradeSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/NFTTradeSummaryItem.stories.tsx @@ -1,12 +1,13 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { NFTTradeSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/NFTTradeSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, NFTTradeTransactionInfo, NFTTradeType, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -18,7 +19,10 @@ const meta: Meta = { export default meta -const baseNFTBuyTx: Omit & { typeInfo: NFTTradeTransactionInfo } = { +const baseNFTBuyTx: Omit & { + typeInfo: NFTTradeTransactionInfo +} = { + routing: Routing.CLASSIC, from: '', addedTime: Date.now() - 30000, hash: '', @@ -35,12 +39,14 @@ const baseNFTBuyTx: Omit & { typeInfo: NFTTradeTra name: 'Froggy Friend #1777', tokenId: '1777', }, - purchaseCurrencyId: buildNativeCurrencyId(ChainId.Mainnet), + purchaseCurrencyId: buildNativeCurrencyId(UniverseChainId.Mainnet), purchaseCurrencyAmountRaw: '1000000000000000000', }, } -const baseNFTSellTx: Omit & { typeInfo: NFTTradeTransactionInfo } = { +const baseNFTSellTx: Omit & { + typeInfo: NFTTradeTransactionInfo +} = { ...baseNFTBuyTx, typeInfo: { ...baseNFTBuyTx.typeInfo, diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ReceiveSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ReceiveSummaryItem.stories.tsx index e5daf9993bd..59c5c99dcd3 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ReceiveSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/ReceiveSummaryItem.stories.tsx @@ -1,13 +1,14 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' import { TokenDocument } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { AssetType } from 'wallet/src/entities/assets' import { ReceiveSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/ReceiveSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, ReceiveTokenTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -82,9 +83,10 @@ const meta: Meta = { export default meta -const baseReceiveTx: Omit & { +const baseReceiveTx: Omit & { typeInfo: ReceiveTokenTransactionInfo } = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -101,7 +103,7 @@ const baseReceiveTx: Omit & { }, } -const baseNFTReceiveTx: Omit & { +const baseNFTReceiveTx: Omit & { typeInfo: ReceiveTokenTransactionInfo } = { ...baseReceiveTx, @@ -134,7 +136,7 @@ export const Receive: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseReceiveTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> @@ -156,7 +158,7 @@ export const NFTReceive: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseNFTReceiveTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SendSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SendSummaryItem.stories.tsx index b98a61bb289..7d54d8e886b 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SendSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SendSummaryItem.stories.tsx @@ -1,17 +1,19 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' import { TokenDocument } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { AssetType } from 'wallet/src/entities/assets' import { SendSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/SendSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, SendTokenTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' + const meta: Meta = { title: 'WIP/Activity Items', parameters: { @@ -82,7 +84,10 @@ const meta: Meta = { export default meta -const baseSendTx: Omit & { typeInfo: SendTokenTransactionInfo } = { +const baseSendTx: Omit & { + typeInfo: SendTokenTransactionInfo +} = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -99,7 +104,9 @@ const baseSendTx: Omit & { typeInfo: SendTokenTran }, } -const baseNFTSendTx: Omit & { typeInfo: SendTokenTransactionInfo } = { +const baseNFTSendTx: Omit & { + typeInfo: SendTokenTransactionInfo +} = { ...baseSendTx, typeInfo: { type: TransactionType.Send, @@ -158,7 +165,7 @@ export const Send: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseSendTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> @@ -208,7 +215,7 @@ export const NFTSend: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseNFTSendTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SwapSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SwapSummaryItem.stories.tsx index 1b05f27be25..6ecc64c8f8c 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SwapSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/SwapSummaryItem.stories.tsx @@ -2,13 +2,14 @@ import type { Meta, StoryObj } from '@storybook/react' import { TradeType } from '@uniswap/sdk-core' import React from 'react' import { TokenDocument } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import { SwapSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/SwapSummaryItem' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { + ClassicTransactionDetails, ExactInputSwapTransactionInfo, ExactOutputSwapTransactionInfo, - TransactionDetails, TransactionStatus, TransactionType, } from 'wallet/src/features/transactions/types' @@ -85,9 +86,10 @@ const meta: Meta = { export default meta -const baseSwapTx: Omit & { +const baseSwapTx: Omit & { typeInfo: ExactOutputSwapTransactionInfo | ExactInputSwapTransactionInfo } = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -100,9 +102,9 @@ const baseSwapTx: Omit & { outputCurrencyAmountRaw: '50000000000000000', expectedInputCurrencyAmountRaw: '50000000000000000', maximumInputCurrencyAmountRaw: '50000000000000000', - inputCurrencyId: buildNativeCurrencyId(ChainId.Mainnet), + inputCurrencyId: buildNativeCurrencyId(UniverseChainId.Mainnet), outputCurrencyId: buildCurrencyId( - ChainId.Mainnet, + UniverseChainId.Mainnet, '0x6b175474e89094c44da98b954eedeac495271d0f' ), transactedUSDValue: 105.21800000000002, @@ -151,7 +153,7 @@ export const Swap: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseSwapTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/UnknownSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/UnknownSummaryItem.stories.tsx index 5bfadc84620..bfcbc1fc45a 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/UnknownSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/UnknownSummaryItem.stories.tsx @@ -1,10 +1,11 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { UnknownSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/UnknownSummaryItem' import { - TransactionDetails, + ClassicTransactionDetails, TransactionStatus, TransactionType, UnknownTransactionInfo, @@ -16,7 +17,10 @@ const meta: Meta = { export default meta -const baseUnknownTx: Omit & { typeInfo: UnknownTransactionInfo } = { +const baseUnknownTx: Omit & { + typeInfo: UnknownTransactionInfo +} = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -56,7 +60,7 @@ export const Unknown: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseUnknownTx, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WCSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WCSummaryItem.stories.tsx index c9d11e5d4ec..2b259fc74b4 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WCSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WCSummaryItem.stories.tsx @@ -1,10 +1,11 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { WCSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/WCSummaryItem' import { - TransactionDetails, + ClassicTransactionDetails, TransactionStatus, TransactionType, WCConfirmInfo, @@ -16,7 +17,8 @@ const meta: Meta = { export default meta -const baseUnknownItem: Omit & { typeInfo: WCConfirmInfo } = { +const baseUnknownItem: Omit & { typeInfo: WCConfirmInfo } = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -62,7 +64,7 @@ export const WalletConnect: StoryObj = { layoutElement={TransactionSummaryLayout} transaction={{ ...baseUnknownItem, - chainId: ChainId.Optimism, + chainId: UniverseChainId.Optimism, status: TransactionStatus.Success, }} /> diff --git a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WrapSummaryItem.stories.tsx b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WrapSummaryItem.stories.tsx index 1a7dd850747..be2d6ef490f 100644 --- a/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WrapSummaryItem.stories.tsx +++ b/apps/mobile/src/features/transactions/SummaryCards/SummaryItems/WrapSummaryItem.stories.tsx @@ -1,10 +1,11 @@ import type { Meta, StoryObj } from '@storybook/react' import React from 'react' import { TokenDocument } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' +import { Routing } from 'wallet/src/data/tradingApi/__generated__/index' import TransactionSummaryLayout from 'wallet/src/features/transactions/SummaryCards/SummaryItems/TransactionSummaryLayout' import { WrapSummaryItem } from 'wallet/src/features/transactions/SummaryCards/SummaryItems/WrapSummaryItem' import { - TransactionDetails, + ClassicTransactionDetails, TransactionStatus, TransactionType, WrapTransactionInfo, @@ -81,7 +82,8 @@ const meta: Meta = { export default meta -const baseWrapTx: Omit & { typeInfo: WrapTransactionInfo } = { +const baseWrapTx: Omit & { typeInfo: WrapTransactionInfo } = { + routing: Routing.CLASSIC, from: '0x76e4de46c21603545eaaf7daf25e54c0d06bafa9', addedTime: Date.now() - 30000, hash: '0x3ba4b82fb3bcb237cff0180b4fb4f94902cde2cfa56c57567b59b5608590d077', @@ -95,13 +97,14 @@ const baseWrapTx: Omit & { typeInfo: WrapTransacti }, } -const baseUnwrapTx: Omit & { typeInfo: WrapTransactionInfo } = { - ...baseWrapTx, - typeInfo: { - ...baseWrapTx.typeInfo, - unwrapped: true, - }, -} +const baseUnwrapTx: Omit & { typeInfo: WrapTransactionInfo } = + { + ...baseWrapTx, + typeInfo: { + ...baseWrapTx.typeInfo, + unwrapped: true, + }, + } export const Wrap: StoryObj = { render: () => ( diff --git a/apps/mobile/src/features/transactions/TransactionPending/TransactionPending.tsx b/apps/mobile/src/features/transactions/TransactionPending/TransactionPending.tsx index e5a1bd0f4bf..c7899be822d 100644 --- a/apps/mobile/src/features/transactions/TransactionPending/TransactionPending.tsx +++ b/apps/mobile/src/features/transactions/TransactionPending/TransactionPending.tsx @@ -4,7 +4,7 @@ import { StatusAnimation } from 'src/features/transactions/TransactionPending/St import { Button, Flex, Text, TouchableArea } from 'ui/src' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { ElementName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { WalletChainId } from 'uniswap/src/types/chains' import { TransactionDetails, TransactionStatus, @@ -14,7 +14,7 @@ import { openTransactionLink } from 'wallet/src/utils/linking' type TransactionStatusProps = { transaction: TransactionDetails | undefined - chainId: ChainId + chainId: WalletChainId title: string description: string onNext: () => void diff --git a/apps/mobile/src/features/transactions/transfer/TransferFlow.tsx b/apps/mobile/src/features/transactions/transfer/TransferFlow.tsx index cc94b7a9573..1d2fd8bda5b 100644 --- a/apps/mobile/src/features/transactions/transfer/TransferFlow.tsx +++ b/apps/mobile/src/features/transactions/transfer/TransferFlow.tsx @@ -14,14 +14,14 @@ import { Flex, useDeviceInsets, useSporeColors } from 'ui/src' import EyeIcon from 'ui/src/assets/icons/eye.svg' import { useDeviceDimensions } from 'ui/src/hooks/useDeviceDimensions' import { iconSizes } from 'ui/src/theme' +import { useBottomSheetContext } from 'uniswap/src/components/modals/BottomSheetContext' +import { HandleBar } from 'uniswap/src/components/modals/HandleBar' import Trace from 'uniswap/src/features/telemetry/Trace' import { ModalName, SectionName } from 'uniswap/src/features/telemetry/constants' import { TokenSelectorModal, TokenSelectorVariation, } from 'wallet/src/components/TokenSelector/TokenSelector' -import { useBottomSheetContext } from 'wallet/src/components/modals/BottomSheetContext' -import { HandleBar } from 'wallet/src/components/modals/HandleBar' import { WarningModal } from 'wallet/src/components/modals/WarningModal/WarningModal' import { useTransactionGasFee } from 'wallet/src/features/gas/hooks' import { GasFeeResult, GasSpeed } from 'wallet/src/features/gas/types' diff --git a/apps/mobile/src/features/transactions/transfer/TransferStatus.tsx b/apps/mobile/src/features/transactions/transfer/TransferStatus.tsx index 237d37caacc..1459053a3ca 100644 --- a/apps/mobile/src/features/transactions/transfer/TransferStatus.tsx +++ b/apps/mobile/src/features/transactions/transfer/TransferStatus.tsx @@ -3,8 +3,9 @@ import { useTranslation } from 'react-i18next' import { goBack } from 'src/app/navigation/rootNavigation' import { TransactionPending } from 'src/features/transactions/TransactionPending/TransactionPending' import { AppTFunction } from 'ui/src/i18n/types' +import { FiatCurrencyInfo } from 'uniswap/src/features/fiatOnRamp/types' import { NumberType } from 'utilities/src/format/types' -import { FiatCurrencyInfo, useAppFiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' +import { useAppFiatCurrencyInfo } from 'wallet/src/features/fiatCurrency/hooks' import { LocalizationContextState, useLocalizationContext, diff --git a/apps/mobile/src/features/unitags/ChooseProfilePictureScreen.tsx b/apps/mobile/src/features/unitags/ChooseProfilePictureScreen.tsx index ffa7068e23e..f7fc81d3b3b 100644 --- a/apps/mobile/src/features/unitags/ChooseProfilePictureScreen.tsx +++ b/apps/mobile/src/features/unitags/ChooseProfilePictureScreen.tsx @@ -13,7 +13,7 @@ import { Pen } from 'ui/src/components/icons' import { fonts, iconSizes, imageSizes, spacing } from 'ui/src/theme' import { ElementName } from 'uniswap/src/features/telemetry/constants' import { UnitagClaimSource } from 'uniswap/src/features/unitags/types' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens, UnitagScreens } from 'uniswap/src/types/screens/mobile' import { useENSName } from 'wallet/src/features/ens/api' @@ -40,7 +40,7 @@ export function ChooseProfilePictureScreen({ const { t } = useTranslation() const colors = useSporeColors() - const { data: ensName } = useENSName(address, ChainId.Mainnet) + const { data: ensName } = useENSName(address, UniverseChainId.Mainnet) const claimUnitag = useClaimUnitag() const isDarkMode = useIsDarkMode() diff --git a/apps/mobile/src/features/unitags/ClaimUnitagScreen.tsx b/apps/mobile/src/features/unitags/ClaimUnitagScreen.tsx index 1fbe0d4ed82..c41d92c1de2 100644 --- a/apps/mobile/src/features/unitags/ClaimUnitagScreen.tsx +++ b/apps/mobile/src/features/unitags/ClaimUnitagScreen.tsx @@ -1,3 +1,4 @@ +/* eslint-disable max-lines */ import { NativeStackScreenProps } from '@react-navigation/native-stack' import { ADDRESS_ZERO } from '@uniswap/v3-sdk' import { default as React, useCallback, useEffect, useState } from 'react' @@ -14,6 +15,7 @@ import { ENS_LOGO } from 'ui/src/assets' import { InfoCircleFilled, LinkHorizontalAlt } from 'ui/src/components/icons' import { AnimatedFlex } from 'ui/src/components/layout/AnimatedFlex' import { fonts, iconSizes, imageSizes, spacing } from 'ui/src/theme' +import { TextInput } from 'uniswap/src/components/input/TextInput' import { Pill } from 'uniswap/src/components/pill/Pill' import { uniswapUrls } from 'uniswap/src/constants/urls' import Trace from 'uniswap/src/features/telemetry/Trace' @@ -23,7 +25,6 @@ import { ImportType, OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens, UnitagScreens } from 'uniswap/src/types/screens/mobile' import { logger } from 'utilities/src/logger/logger' import { ONE_SECOND_MS } from 'utilities/src/time/time' -import { TextInput } from 'wallet/src/components/input/TextInput' import { WarningModal } from 'wallet/src/components/modals/WarningModal/WarningModal' import { LearnMoreLink } from 'wallet/src/components/text/LearnMoreLink' import { @@ -373,7 +374,12 @@ export function ClaimUnitagScreen({ navigation, route }: Props): JSX.Element { )} @@ -98,6 +99,7 @@ export function SeedPhraseInputScreenV2({ navigation, route: { params } }: Props }> { - const beforeRemoveListener = (): void => { - // Remove all pending signer accounts when navigating back - dispatch(pendingAccountActions.trigger(PendingAccountActions.Delete)) - } - navigation.addListener('beforeRemove', beforeRemoveListener) - return () => navigation.removeListener('beforeRemove', beforeRemoveListener) - }, [dispatch, navigation]) - const onSubmit = useCallback(async () => { await selectImportedAccounts(selectedAddresses) diff --git a/apps/mobile/src/screens/Import/WatchWalletScreen.tsx b/apps/mobile/src/screens/Import/WatchWalletScreen.tsx index cbca60c4cf2..55c17460b46 100644 --- a/apps/mobile/src/screens/Import/WatchWalletScreen.tsx +++ b/apps/mobile/src/screens/Import/WatchWalletScreen.tsx @@ -14,15 +14,15 @@ import { Button, Flex, Text } from 'ui/src' import { GraduationCap } from 'ui/src/components/icons' import { ElementName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { OnboardingScreens } from 'uniswap/src/types/screens/mobile' import { normalizeTextInput } from 'utilities/src/primitives/string' import { usePortfolioBalances } from 'wallet/src/features/dataApi/balances' import { useENS } from 'wallet/src/features/ens/useENS' +import { createViewOnlyAccount } from 'wallet/src/features/onboarding/createViewOnlyAccount' import { useIsSmartContractAddress } from 'wallet/src/features/transactions/transfer/hooks/useIsSmartContractAddress' +import { createAccountsActions } from 'wallet/src/features/wallet/create/createAccountsSaga' import { useAccounts } from 'wallet/src/features/wallet/hooks' -import { importAccountActions } from 'wallet/src/features/wallet/import/importAccountSaga' -import { ImportAccountType } from 'wallet/src/features/wallet/import/types' import { areAddressesEqual, getValidAddress } from 'wallet/src/utils/addresses' type Props = NativeStackScreenProps @@ -74,8 +74,8 @@ const getErrorText = ({ } export function WatchWalletScreen({ navigation, route: { params } }: Props): JSX.Element { - const dispatch = useAppDispatch() const { t } = useTranslation() + const dispatch = useAppDispatch() const accounts = useAccounts() const initialAccounts = useRef(accounts) @@ -89,14 +89,14 @@ export function WatchWalletScreen({ navigation, route: { params } }: Props): JSX const normalizedValue = normalizeTextInput(value ?? '') const hasSuffixIncluded = normalizedValue.includes('.') const { address: resolvedAddress, name } = useENS( - ChainId.Mainnet, + UniverseChainId.Mainnet, normalizedValue, !hasSuffixIncluded ) const isAddress = getValidAddress(normalizedValue, true, false) const { isSmartContractAddress, loading } = useIsSmartContractAddress( (isAddress || resolvedAddress) ?? undefined, - ChainId.Mainnet + UniverseChainId.Mainnet ) // Allow smart contracts with non-null balances const { data: balancesById } = usePortfolioBalances({ @@ -129,10 +129,12 @@ export function WatchWalletScreen({ navigation, route: { params } }: Props): JSX const onSubmit = useCallback(async () => { if (isValid && value) { + const viewOnlyAddress = resolvedAddress || normalizedValue + const viewOnlyAccount = createViewOnlyAccount(viewOnlyAddress) + dispatch( - importAccountActions.trigger({ - type: ImportAccountType.Address, - address: resolvedAddress || normalizedValue, + createAccountsActions.trigger({ + accounts: [viewOnlyAccount], }) ) diff --git a/apps/mobile/src/screens/Import/useOnDeviceRecoveryData.ts b/apps/mobile/src/screens/Import/useOnDeviceRecoveryData.ts index 4a3dcba5b78..8ae444e49e0 100644 --- a/apps/mobile/src/screens/Import/useOnDeviceRecoveryData.ts +++ b/apps/mobile/src/screens/Import/useOnDeviceRecoveryData.ts @@ -2,6 +2,8 @@ import { useEffect, useMemo, useState } from 'react' import { useMultiplePortfolioBalancesQuery } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' import { useUnitagByAddress } from 'uniswap/src/features/unitags/hooks' import { logger } from 'utilities/src/logger/logger' +// eslint-disable-next-line no-restricted-imports +import { usePortfolioValueModifiers } from 'wallet/src/features/dataApi/balances' import { useENSName } from 'wallet/src/features/ens/api' import { Keyring } from 'wallet/src/features/wallet/Keyring/Keyring' import { areAddressesEqual } from 'wallet/src/utils/addresses' @@ -81,9 +83,11 @@ export function useOnDeviceRecoveryData(mnemonicId: string | undefined): { useStoredAddressesForMnemonic(mnemonicId) const addresses = addressesWithIndex.map((address) => address.address) + const valueModifiers = usePortfolioValueModifiers(addresses) const { data: balancesData, loading: balancesLoading } = useMultiplePortfolioBalancesQuery({ variables: { ownerAddresses: addresses, + valueModifiers, }, skip: !addresses.length, }) diff --git a/apps/mobile/src/screens/ModalAwareView.tsx b/apps/mobile/src/screens/ModalAwareView.tsx index 0d3cc5f75cd..b2271475022 100644 --- a/apps/mobile/src/screens/ModalAwareView.tsx +++ b/apps/mobile/src/screens/ModalAwareView.tsx @@ -5,8 +5,8 @@ import { useAppSelector } from 'src/app/hooks' import { HorizontalEdgeGestureTarget } from 'src/components/layout/screens/EdgeGestureTarget' import { selectModalState } from 'src/features/modals/selectModalState' import { Flex, flexStyles, useDeviceInsets, useSporeColors } from 'ui/src' +import { HandleBar } from 'uniswap/src/components/modals/HandleBar' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { HandleBar } from 'wallet/src/components/modals/HandleBar' /** * Wrapper view to correctly render screens within BottomSheetModal as needed. This is required * to enable both full screen, and bottom sheet drag gestures on a screen within a modal. diff --git a/apps/mobile/src/screens/NFTCollectionScreen.tsx b/apps/mobile/src/screens/NFTCollectionScreen.tsx index ba18c5c55e4..76eaa647120 100644 --- a/apps/mobile/src/screens/NFTCollectionScreen.tsx +++ b/apps/mobile/src/screens/NFTCollectionScreen.tsx @@ -22,6 +22,7 @@ import { } from 'ui/src/components/AnimatedFlashList/AnimatedFlashList' import { useDeviceDimensions } from 'ui/src/hooks/useDeviceDimensions' import { iconSizes, spacing } from 'ui/src/theme' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { NftCollectionScreenQuery, useNftCollectionScreenQuery, @@ -29,7 +30,6 @@ import { import Trace from 'uniswap/src/features/telemetry/Trace' import { MobileScreens } from 'uniswap/src/types/screens/mobile' import { isIOS } from 'utilities/src/platform' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { isError } from 'wallet/src/data/utils' import { NFTViewer } from 'wallet/src/features/images/NFTViewer' import { NFTItem } from 'wallet/src/features/nfts/types' diff --git a/apps/mobile/src/screens/NFTItemScreen.tsx b/apps/mobile/src/screens/NFTItemScreen.tsx index c87f1af6f8b..cf3ad0eaa96 100644 --- a/apps/mobile/src/screens/NFTItemScreen.tsx +++ b/apps/mobile/src/screens/NFTItemScreen.tsx @@ -29,7 +29,9 @@ import { import EllipsisIcon from 'ui/src/assets/icons/ellipsis.svg' import ShareIcon from 'ui/src/assets/icons/share.svg' import { colorsDark, fonts, iconSizes } from 'ui/src/theme' +import { BaseCard } from 'uniswap/src/components/BaseCard/BaseCard' import { NetworkLogo } from 'uniswap/src/components/CurrencyLogo/NetworkLogo' +import { UNIVERSE_CHAIN_INFO } from 'uniswap/src/constants/chains' import { NftActivityType, NftItemScreenQuery, @@ -37,12 +39,10 @@ import { } from 'uniswap/src/data/graphql/uniswap-data-api/__generated__/types-and-hooks' import Trace from 'uniswap/src/features/telemetry/Trace' import { ModalName } from 'uniswap/src/features/telemetry/constants' -import { ChainId } from 'uniswap/src/types/chains' +import { UniverseChainId } from 'uniswap/src/types/chains' import { MobileScreens } from 'uniswap/src/types/screens/mobile' import { isAndroid, isIOS } from 'utilities/src/platform' -import { BaseCard } from 'wallet/src/components/BaseCard/BaseCard' import { AddressDisplay } from 'wallet/src/components/accounts/AddressDisplay' -import { CHAIN_INFO } from 'wallet/src/constants/chains' import { PollingInterval } from 'wallet/src/constants/misc' import { fromGraphQLChain } from 'wallet/src/features/chains/utils' import { NFTViewer } from 'wallet/src/features/images/NFTViewer' @@ -303,7 +303,7 @@ function NFTItemScreenContents({ collection={asset?.collection} fallbackData={fallbackData} loading={nftLoading} - shouldDisableLink={chainId !== ChainId.Mainnet} // TODO(MOB-3447): Remove once backend has full L2 collection support + shouldDisableLink={chainId !== UniverseChainId.Mainnet} // TODO(MOB-3447): Remove once backend has full L2 collection support onPress={onPressCollection} /> @@ -346,7 +346,7 @@ function NFTItemScreenContents({ valueComponent={ - {CHAIN_INFO[chainId].label} + {UNIVERSE_CHAIN_INFO[chainId].label} diff --git a/apps/mobile/src/screens/Onboarding/ManualBackupScreen.tsx b/apps/mobile/src/screens/Onboarding/ManualBackupScreen.tsx index 1f2080a68eb..3242a4a64e5 100644 --- a/apps/mobile/src/screens/Onboarding/ManualBackupScreen.tsx +++ b/apps/mobile/src/screens/Onboarding/ManualBackupScreen.tsx @@ -12,10 +12,10 @@ import { OnboardingScreen } from 'src/features/onboarding/OnboardingScreen' import { Button, Flex, Text, useMedia, useSporeColors } from 'ui/src' import LockIcon from 'ui/src/assets/icons/lock.svg' import { iconSizes } from 'ui/src/theme' +import { BottomSheetModal } from 'uniswap/src/components/modals/BottomSheetModal' import { ElementName, ModalName } from 'uniswap/src/features/telemetry/constants' import { sendAnalyticsEvent } from 'uniswap/src/features/telemetry/send' import { ManualPageViewScreen, OnboardingScreens } from 'uniswap/src/types/screens/mobile' -import { BottomSheetModal } from 'wallet/src/components/modals/BottomSheetModal' import { WarningModal } from 'wallet/src/components/modals/WarningModal/WarningModal' import { useOnboardingContext } from 'wallet/src/features/onboarding/OnboardingContext' import { BackupType } from 'wallet/src/features/wallet/accounts/types' @@ -66,7 +66,7 @@ export function ManualBackupScreen({ navigation, route: { params } }: Props): JS useEffect(() => { if (continueButtonPressed && onboardingAccount?.backups?.includes(BackupType.Manual)) { - navigation.navigate({ name: OnboardingScreens.Notifications, params, merge: true }) + navigation.replace(OnboardingScreens.Notifications, params) } }, [continueButtonPressed, navigation, params, onboardingAccount?.backups]) diff --git a/apps/mobile/src/screens/Onboarding/WelcomeWalletScreen.tsx b/apps/mobile/src/screens/Onboarding/WelcomeWalletScreen.tsx index 439eb31b7d9..eeecf0314c9 100644 --- a/apps/mobile/src/screens/Onboarding/WelcomeWalletScreen.tsx +++ b/apps/mobile/src/screens/Onboarding/WelcomeWalletScreen.tsx @@ -11,7 +11,6 @@ import LockIcon from 'ui/src/assets/icons/lock.svg' import { fonts, iconSizes, opacify } from 'ui/src/theme' import Trace from 'uniswap/src/features/telemetry/Trace' import { ElementName } from 'uniswap/src/features/telemetry/constants' -import { OnboardingEntryPoint } from 'uniswap/src/types/onboarding' import { MobileScreens, OnboardingScreens } from 'uniswap/src/types/screens/mobile' import { NumberType } from 'utilities/src/format/types' import { AccountIcon } from 'wallet/src/components/accounts/AccountIcon' @@ -24,13 +23,8 @@ import { useOnboardingContext, } from 'wallet/src/features/onboarding/OnboardingContext' import AnimatedNumber from 'wallet/src/features/portfolio/AnimatedNumber' -import { - PendingAccountActions, - pendingAccountActions, -} from 'wallet/src/features/wallet/create/pendingAccountsSaga' import { useDisplayName } from 'wallet/src/features/wallet/hooks' import { DisplayNameType } from 'wallet/src/features/wallet/types' -import { useAppDispatch } from 'wallet/src/state' type Props = CompositeScreenProps< NativeStackScreenProps, @@ -53,8 +47,6 @@ export function WelcomeWalletScreen({ navigation, route: { params } }: Props): J const walletName = useDisplayName(onboardingAccountAddress) const { data: avatar } = useENSAvatar(onboardingAccountAddress) - const dispatch = useAppDispatch() - const onPressNext = (): void => { navigation.navigate({ name: OnboardingScreens.Backup, @@ -63,13 +55,6 @@ export function WelcomeWalletScreen({ navigation, route: { params } }: Props): J }) } - // Ensure pending account is cleared before navigating away - navigation.addListener('beforeRemove', () => { - if (params.entryPoint === OnboardingEntryPoint.Sidebar) { - dispatch(pendingAccountActions.trigger(PendingAccountActions.Delete)) - } - }) - const zeroBalance = convertFiatAmountFormatted(0, NumberType.PortfolioBalance) const displayName = unitagClaim @@ -131,6 +116,7 @@ export function WelcomeWalletScreen({ navigation, route: { params } }: Props): J