Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- changed: Improved EdgeCrashEvent reporting with additional metadata, tags, and name/message information.
- changed: Integrate `installSurvey` endpoint for post-install survey options
- changed: Always show Add Wallet button at bottom of asset list
- changed: Use chain icon for staking cards

## 4.19.0

Expand Down
9 changes: 7 additions & 2 deletions src/util/stakeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { add } from 'biggystring'
import { EdgeAccount, EdgeCurrencyInfo, EdgeCurrencyWallet, EdgeStakingStatus, EdgeTokenId } from 'edge-core-js'
import { sprintf } from 'sprintf-js'

import { SPECIAL_CURRENCY_INFO } from '../constants/WalletAndCurrencyConstants'
import { formatTimeDate } from '../locales/intl'
import { lstrings } from '../locales/strings'
import { PositionAllocation, StakePlugin, StakePolicy, StakePolicyFilter, StakePosition } from '../plugins/stake-plugins/types'
Expand Down Expand Up @@ -84,8 +85,12 @@ export const getPolicyIconUris = (
(rewardAssetName, i) => stakePolicy.rewardAssets[i].cdnName ?? metaTokens.find(metaToken => metaToken.currencyCode === rewardAssetName)?.contractAddress
)

const stakeAssetUris = stakeContractAddresses.map(stakeContractAddress => getCurrencyIconUris(pluginId, stakeContractAddress ?? null).symbolImage)
const rewardAssetUris = rewardContractAddresses.map(rewardContractAddress => getCurrencyIconUris(pluginId, rewardContractAddress ?? null).symbolImage)
const stakeAssetUris = stakeContractAddresses.map(
stakeContractAddress => getCurrencyIconUris(pluginId, stakeContractAddress ?? null, SPECIAL_CURRENCY_INFO[pluginId]?.chainIcon ?? false).symbolImage
)
const rewardAssetUris = rewardContractAddresses.map(
rewardContractAddress => getCurrencyIconUris(pluginId, rewardContractAddress ?? null, SPECIAL_CURRENCY_INFO[pluginId]?.chainIcon ?? false).symbolImage
)
Comment on lines +88 to +93
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty gnarly logic to keep two copies. Can we make a helper function?

const getAssetChainIcon = (contractAddress: string) =>
  getCurrencyIconUris(
    pluginId,
    contractAddress ?? null,
    // We want the chain icon if it makes sense:
    SPECIAL_CURRENCY_INFO[pluginId]?.chainIcon ?? false
  ).symbolImage

const stakeAssetUris = stakeContractAddresses.map(getAssetChainIcon)
const rewardAssetUris = rewardContractAddresses.map(getAssetChainIcon)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will change it


return { stakeAssetUris, rewardAssetUris }
}
Expand Down
Loading