@@ -28,16 +28,15 @@ import {
2828 SPECIAL_CURRENCY_INFO
2929} from '../constants/WalletAndCurrencyConstants'
3030import { lstrings } from '../locales/strings'
31- import { selectDisplayDenomByCurrencyCode } from '../selectors/DenominationSelectors'
31+ import {
32+ getExchangeDenom ,
33+ selectDisplayDenom
34+ } from '../selectors/DenominationSelectors'
3235import { convertCurrency } from '../selectors/WalletSelectors'
3336import type { ThunkAction } from '../types/reduxTypes'
3437import type { NavigationBase } from '../types/routerTypes'
3538import type { MapObject } from '../types/types'
36- import {
37- getCurrencyCode ,
38- getCurrencyCodeMultiplier ,
39- isKeysOnlyPlugin
40- } from '../util/CurrencyInfoHelpers'
39+ import { getCurrencyCode , isKeysOnlyPlugin } from '../util/CurrencyInfoHelpers'
4140import { getWalletName } from '../util/CurrencyWalletHelpers'
4241import { fetchInfo } from '../util/network'
4342
@@ -77,9 +76,6 @@ export function selectWalletToken({
7776 const currencyCode = getCurrencyCode ( wallet , tokenId )
7877 dispatch ( updateMostRecentWalletsSelected ( walletId , tokenId ) )
7978
80- const currentWalletId = state . ui . wallets . selectedWalletId
81- const currentWalletCurrencyCode = state . ui . wallets . selectedCurrencyCode
82-
8379 if ( tokenId != null ) {
8480 const { unactivatedTokenIds } = wallet
8581 if (
@@ -90,15 +86,7 @@ export function selectWalletToken({
9086 await dispatch ( activateWalletTokens ( navigation , wallet , [ tokenId ] ) )
9187 return false
9288 }
93- if (
94- walletId !== currentWalletId ||
95- currencyCode !== currentWalletCurrencyCode
96- ) {
97- dispatch ( {
98- type : 'UI/WALLETS/SELECT_WALLET' ,
99- data : { walletId, currencyCode }
100- } )
101- }
89+
10290 return true
10391 }
10492
@@ -107,27 +95,14 @@ export function selectWalletToken({
10795 )
10896 if ( isAccountActivationRequired ) {
10997 // activation-required wallets need different path in case not activated yet
110- if (
111- alwaysActivate ||
112- walletId !== currentWalletId ||
113- currencyCode !== currentWalletCurrencyCode
114- ) {
98+ if ( alwaysActivate ) {
11599 return await dispatch (
116100 selectActivationRequiredWallet ( navigation , walletId , currencyCode )
117101 )
118102 }
119103 return true
120104 }
121105
122- if (
123- walletId !== currentWalletId ||
124- currencyCode !== currentWalletCurrencyCode
125- ) {
126- dispatch ( {
127- type : 'UI/WALLETS/SELECT_WALLET' ,
128- data : { walletId, currencyCode }
129- } )
130- }
131106 return true
132107 }
133108}
@@ -146,10 +121,6 @@ function selectActivationRequiredWallet(
146121
147122 if ( publicAddress !== '' ) {
148123 // already activated
149- dispatch ( {
150- type : 'UI/WALLETS/SELECT_WALLET' ,
151- data : { walletId, currencyCode }
152- } )
153124 return true
154125 } else {
155126 // not activated yet
@@ -185,16 +156,14 @@ export function updateMostRecentWalletsSelected(
185156 return ( dispatch , getState ) => {
186157 const state = getState ( )
187158 const { account } = state . core
188- const wallet = account . currencyWallets [ walletId ]
189- const currencyCode = getCurrencyCode ( wallet , tokenId )
190159 const { mostRecentWallets } = state . ui . settings
191160 const currentMostRecentWallets = mostRecentWallets . filter ( wallet => {
192- return wallet . id !== walletId || wallet . currencyCode !== currencyCode
161+ return wallet . id !== walletId || wallet . tokenId !== tokenId
193162 } )
194163 if ( currentMostRecentWallets . length === 100 ) {
195164 currentMostRecentWallets . pop ( )
196165 }
197- currentMostRecentWallets . unshift ( { id : walletId , currencyCode } )
166+ currentMostRecentWallets . unshift ( { id : walletId , tokenId } )
198167
199168 writeMostRecentWalletsSelected ( account , currentMostRecentWallets )
200169 . then ( ( ) => {
@@ -257,17 +226,12 @@ export function activateWalletTokens(
257226 if ( currencyPluginId !== pluginId )
258227 throw new Error ( 'Internal Error: Fee asset mismatch.' )
259228
260- const paymentCurrencyCode = getCurrencyCode ( wallet , feeTokenId )
261-
262- const multiplier = getCurrencyCodeMultiplier (
263- wallet . currencyConfig ,
264- paymentCurrencyCode
265- )
229+ const { multiplier } = getExchangeDenom ( wallet . currencyConfig , feeTokenId )
266230 const exchangeNetworkFee = div ( nativeFee , multiplier , multiplier . length )
267- const feeDenom = selectDisplayDenomByCurrencyCode (
231+ const feeDenom = selectDisplayDenom (
268232 state ,
269233 wallet . currencyConfig ,
270- paymentCurrencyCode
234+ feeTokenId
271235 )
272236 const displayFee = div (
273237 nativeFee ,
0 commit comments