Skip to content

Commit

Permalink
Remove fiat from routerTypes
Browse files Browse the repository at this point in the history
The scene has been updated to make it obvious what wallet is being activated with icons and wallet name. Spitting out the info of the wallet to be activated including the fiat type in the ugly text block is no longer necessary.
  • Loading branch information
Jon-edge authored and swansontec committed Sep 4, 2023
1 parent 297527e commit a6fe8bb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/__tests__/scenes/CreateWalletAccountSetupScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ describe('CreateWalletAccountSelect', () => {
walletType: 'wallet:bitcoin',
currencyCode: 'BTC'
} as any,
selectedFiat: {
label: 'USD',
value: 'USD'
},
isReactivation: true,
existingWalletId: 'myWallet'
})}
Expand Down
7 changes: 0 additions & 7 deletions src/actions/WalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { MapObject } from '../types/types'
import { getCurrencyCode, getCurrencyInfos, getToken, makeCreateWalletType } from '../util/CurrencyInfoHelpers'
import { getWalletName } from '../util/CurrencyWalletHelpers'
import { fetchInfo } from '../util/network'
import { getSupportedFiats } from '../util/utils'
import { refreshConnectedWallets } from './FioActions'

export interface SelectWalletTokenParams {
Expand Down Expand Up @@ -93,7 +92,6 @@ function selectEOSWallet(navigation: NavigationBase, walletId: string, currencyC
const state = getState()
const wallet = state.core.account.currencyWallets[walletId]
const {
fiatCurrencyCode,
name,
currencyInfo: { currencyCode, pluginId }
} = wallet
Expand All @@ -113,17 +111,13 @@ function selectEOSWallet(navigation: NavigationBase, walletId: string, currencyC
await dispatch(updateWalletsRequest())
// not activated yet
// find fiat and crypto (EOSIO) types and populate scene props
const supportedFiats = getSupportedFiats()
const fiatTypeIndex = supportedFiats.findIndex(fiatType => fiatType.value === fiatCurrencyCode.replace('iso:', ''))
const selectedFiat = supportedFiats[fiatTypeIndex]
const currencyInfos = getCurrencyInfos(state.core.account)
const currencyInfo = currencyInfos.find(info => info.currencyCode === currencyCode)
if (!currencyInfo) throw new Error('CannotFindCurrencyInfo')
const selectedWalletType = makeCreateWalletType(currencyInfo)
const specialCurrencyInfo = getSpecialCurrencyInfo(pluginId)
if (specialCurrencyInfo.skipAccountNameValidation) {
navigation.push('createWalletAccountSelect', {
selectedFiat: selectedFiat,
selectedWalletType,
accountName: walletName,
existingWalletId: walletId
Expand All @@ -132,7 +126,6 @@ function selectEOSWallet(navigation: NavigationBase, walletId: string, currencyC
const createWalletAccountSetupSceneProps = {
accountHandle: '',
selectedWalletType,
selectedFiat,
isReactivation: true,
existingWalletId: walletId
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/scenes/CreateWalletAccountSetupScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props extends EdgeSceneProps<'createWalletAccountSetup'> {}
*/
export function CreateWalletAccountSetupScene(props: Props): JSX.Element {
const { navigation, route } = props
const { accountHandle: initialValue = '', existingWalletId, selectedFiat, selectedWalletType } = route.params
const { accountHandle: initialValue = '', existingWalletId, selectedWalletType } = route.params
const { currencyCode, pluginId } = selectedWalletType

const account = useSelector(state => state.core.account)
Expand All @@ -39,7 +39,6 @@ export function CreateWalletAccountSetupScene(props: Props): JSX.Element {
const data = await currencyPlugin.otherMethods.validateAccount(text)
if (data.result === 'AccountAvailable') {
navigation.navigate('createWalletAccountSelect', {
selectedFiat,
selectedWalletType,
accountName: text,
existingWalletId
Expand Down
4 changes: 1 addition & 3 deletions src/types/routerTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { FiatPluginEnterAmountParams } from '../plugins/gui/scenes/FiatPluginEnt
import { RewardsCardDashboardParams } from '../plugins/gui/scenes/RewardsCardDashboardScene'
import { RewardsCardWelcomeParams } from '../plugins/gui/scenes/RewardsCardWelcomeScene'
import { ChangeQuoteRequest, StakePlugin, StakePolicy, StakePosition } from '../plugins/stake-plugins/types'
import { CreateWalletType, FeeOption, FioConnectionWalletItem, FioDomain, FioRequest, GuiFiatType, GuiMakeSpendInfo, GuiSwapInfo } from './types'
import { CreateWalletType, FeeOption, FioConnectionWalletItem, FioDomain, FioRequest, GuiMakeSpendInfo, GuiSwapInfo } from './types'

/**
* Defines the acceptable route parameters for each scene key.
Expand Down Expand Up @@ -81,14 +81,12 @@ export interface RouteParamList {
createWalletAccountSelect: {
accountName: string
existingWalletId: string
selectedFiat: GuiFiatType
selectedWalletType: CreateWalletType
}
createWalletAccountSetup: {
accountHandle?: string
existingWalletId: string
isReactivation?: boolean
selectedFiat: GuiFiatType
selectedWalletType: CreateWalletType
}
createWalletCompletion: CreateWalletCompletionParams
Expand Down

0 comments on commit a6fe8bb

Please sign in to comment.