Skip to content

Commit

Permalink
Merge pull request #5141 from EdgeApp/matthew/activateTokenError
Browse files Browse the repository at this point in the history
3 fixes
  • Loading branch information
peachbits authored Jul 11, 2024
2 parents ab501a9 + 2efb7cc commit 2cec06e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/actions/SettingsActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function checkEnabledExchanges(): ThunkAction<void> {
const exchanges = account.swapConfig
if (exchanges == null) return
for (const exchange of Object.keys(exchanges)) {
if (exchange === 'transfer') continue
if (exchanges[exchange].enabled) {
isAnyExchangeEnabled = true
}
Expand Down
2 changes: 1 addition & 1 deletion src/actions/WalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const activateWalletTokens = async (
const displayFee = div(nativeFee, feeDenom.multiplier, log10(feeDenom.multiplier))
let fiatFee = convertCurrencyFromExchangeRates(state.exchangeRates, paymentCurrencyCode, defaultIsoFiat, exchangeNetworkFee)
if (lt(fiatFee, '0.001')) fiatFee = '<0.001'
fiatFee = round(fiatFee, -3)
else fiatFee = round(fiatFee, -3)
const feeString = `${displayFee} ${feeDenom.name} (${fiatFee} ${defaultFiat})`
let bodyText = lstrings.activate_wallet_token_scene_body

Expand Down
23 changes: 9 additions & 14 deletions src/components/scenes/CreateWalletCompletionScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@ const CreateWalletCompletionComponent = (props: Props) => {
// Create the wallets and enable the tokens
useAsyncEffect(
async () => {
// Create tokens on existing wallets:
let tokenPromise: Promise<void> | undefined
if (tokenKey != null) {
tokenPromise = dispatch(enableTokensAcrossWallets(newTokenItems)).then(
() => setItemStatus(currentState => ({ ...currentState, [tokenKey]: 'complete' })),
error => {
showError(error)
setItemStatus(currentState => ({ ...currentState, [tokenKey]: 'error' }))
}
)
}

// Create new wallets in parallel:
const walletResults = await createWallets(
account,
Expand Down Expand Up @@ -115,8 +103,15 @@ const CreateWalletCompletionComponent = (props: Props) => {
}
}

if (tokenPromise != null) {
await tokenPromise
// Create tokens on existing wallets:
if (tokenKey != null) {
await dispatch(enableTokensAcrossWallets(newTokenItems)).then(
() => setItemStatus(currentState => ({ ...currentState, [tokenKey]: 'complete' })),
error => {
showError(error)
setItemStatus(currentState => ({ ...currentState, [tokenKey]: 'error' }))
}
)
}

// Save the created wallets
Expand Down

0 comments on commit 2cec06e

Please sign in to comment.