Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v1.742.0 #8647

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/assets/translations/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@
"importFromKeystore": "Import from keystore",
"whatIsShapeshiftWallet": "What is ShapeShift Wallet?",
"yourDecentralizedGateway": "Your decentralization gateway. Trade and earn Bitcoin, Ethereum, Solana and more from a single, secure wallet.",
"crossChainFreedom": "Cross chain freedom. Access the best rates across multiple decentralized exchanges, no middleman required",
"crossChainFreedom": "Cross chain freedom. Access the best rates across multiple decentralized exchanges, no middleman required.",
"selfCustody": {
"title": "Your ShapeShift Wallet is Self-Custody",
"subTitle": "You hold the keys and you're the only one who can access it.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import {
useColorModeValue,
useToast,
} from '@chakra-ui/react'
import { useQuery } from '@tanstack/react-query'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { isMobile } from 'react-device-detect'
import { useTranslate } from 'react-polyglot'
import { reactQueries } from 'react-queries'
import type { StaticContext } from 'react-router'
import type { RouteComponentProps } from 'react-router-dom'
import { Route, Switch, useHistory } from 'react-router-dom'
Expand Down Expand Up @@ -103,11 +105,17 @@ export const NewWalletViewsSwitch = () => {
disconnectOnCloseModal,
deviceState: { disposition },
initialRoute,
nativeWalletPendingDeviceId,
},
dispatch,
disconnect,
} = useWallet()

const nativeVaultsQuery = useQuery({
...reactQueries.common.hdwalletNativeVaultsList(),
refetchOnMount: true,
})

const cancelWalletRequests = useCallback(async () => {
await wallet?.cancel().catch(e => {
console.error(e)
Expand All @@ -133,6 +141,9 @@ export const NewWalletViewsSwitch = () => {

const handleRouteReset = useCallback(() => {
history.replace(INITIAL_WALLET_MODAL_ROUTE)

setSelectedWalletId(null)
setError(null)
}, [history])

const onClose = useCallback(async () => {
Expand Down Expand Up @@ -161,8 +172,10 @@ export const NewWalletViewsSwitch = () => {

const handleWalletSelect = useCallback(
(walletId: string, _initialRoute: string) => {
setSelectedWalletId(walletId)
if (_initialRoute) history.push(_initialRoute)

setSelectedWalletId(walletId)
setError(null)
},
[history],
)
Expand All @@ -171,6 +184,13 @@ export const NewWalletViewsSwitch = () => {
if (initialRoute) history.push(initialRoute)
}, [history, initialRoute])

// Set the native wallet pending unlock as selected on refresh
useEffect(() => {
if (!(nativeWalletPendingDeviceId && nativeVaultsQuery.data)) return

setSelectedWalletId(nativeWalletPendingDeviceId)
}, [nativeVaultsQuery.data, nativeWalletPendingDeviceId])

// Reset history on modal open/unmount
useEffect(() => {
if (!initialRoute) history.replace('/')
Expand Down Expand Up @@ -246,6 +266,7 @@ export const NewWalletViewsSwitch = () => {
size='sm'
isRound
position='static'
isDisabled={isLoading}
onClick={isConnectRoute ? handleRouteReset : handleBack}
/>
</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/context/WalletProvider/WalletViewsRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MemoryRouter } from 'react-router-dom'
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag'
import { useWallet } from 'hooks/useWallet/useWallet'
import { isMobile as isMobileApp } from 'lib/globals'

import { NewWalletViewsSwitch } from './NewWalletViews/NewWalletViewsSwitch'
import { WalletViewsSwitch } from './WalletViewsSwitch'
Expand All @@ -17,7 +18,7 @@ export const WalletViewsRouter = () => {

return (
<MemoryRouter initialIndex={0}>
{isNewWalletFlowEnabled ? <NewWalletViewsSwitch /> : <WalletViewsSwitch />}
{isNewWalletFlowEnabled && !isMobileApp ? <NewWalletViewsSwitch /> : <WalletViewsSwitch />}
</MemoryRouter>
)
}
Loading