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
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ export default [
'src/components/scenes/ChangePasswordScene.tsx',
'src/components/scenes/ChangePinScene.tsx',
'src/components/scenes/ChangeUsernameScene.tsx',
'src/components/scenes/CoinRankingDetailsScene.tsx',

'src/components/scenes/ConfirmScene.tsx',
'src/components/scenes/CreateWalletAccountSelectScene.tsx',
Expand Down Expand Up @@ -383,7 +382,7 @@ export default [
'src/components/themed/Title.tsx',
'src/components/themed/TransactionListComponents.tsx',
'src/components/themed/TransactionListRow.tsx',
'src/components/themed/TransactionListTop.tsx',

'src/components/themed/VectorIcon.tsx',
'src/components/themed/WalletList.tsx',

Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/components/TransactionListTop.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ describe('TransactionListTop', () => {
id: '123',
name: 'wallet name',
stakingStatus: { stakedAmounts: [] },
syncStatus: { totalRatio: 0.5 },
type: 'wallet:bitcoin',
watch() {}
}
Expand All @@ -68,7 +69,6 @@ describe('TransactionListTop', () => {
searching={false}
tokenId={null}
wallet={fakeWallet}
isLightAccount={false}
/>
</FakeProviders>
)
Expand All @@ -87,7 +87,6 @@ describe('TransactionListTop', () => {
searching={false}
tokenId={null}
wallet={fakeWallet}
isLightAccount={false}
/>
</FakeProviders>
)
Expand Down
14 changes: 0 additions & 14 deletions src/actions/scene/StakingActions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { add } from 'biggystring'
import type { EdgeAccount, EdgeCurrencyWallet, EdgeTokenId } from 'edge-core-js'

import { SPECIAL_CURRENCY_INFO } from '../../constants/WalletAndCurrencyConstants'
Expand All @@ -11,7 +10,6 @@ import type {
StakePositionMap
} from '../../reducers/StakingReducer'
import type { ThunkAction } from '../../types/reduxTypes'
import { getPositionAllocations } from '../../util/stakeUtils'
import { datelog } from '../../util/utils'

export const updateStakingState = (
Expand All @@ -37,7 +35,6 @@ export const updateStakingState = (
const stakePlugins = await getStakePlugins(pluginId)
const stakePolicyMap: StakePolicyMap = {}

let lockedNativeAmount = '0'
const stakePositionMap: StakePositionMap = {}
for (const stakePlugin of stakePlugins) {
const stakePolicies = stakePlugin.getPolicies({
Expand All @@ -47,7 +44,6 @@ export const updateStakingState = (
})
for (const stakePolicy of stakePolicies) {
stakePolicyMap[stakePolicy.stakePolicyId] = stakePolicy
let total: string | undefined
try {
const stakePosition = await stakePlugin.fetchStakePosition({
stakePolicyId: stakePolicy.stakePolicyId,
Expand All @@ -56,28 +52,18 @@ export const updateStakingState = (
})

stakePositionMap[stakePolicy.stakePolicyId] = stakePosition
const { staked, earned } = getPositionAllocations(stakePosition)
total = [...staked, ...earned]
.filter(p => p.tokenId === tokenId && p.pluginId === pluginId)
.reduce((prev, curr) => add(prev, curr.nativeAmount), '0')
} catch (err) {
console.error(err)
const { displayName } = stakePolicy.stakeProviderInfo
datelog(`${displayName}: ${lstrings.stake_unable_to_query_locked}`)
continue
}

// Don't show liquid staking positions as locked amount
if (stakePolicy.isLiquidStaking !== true) {
lockedNativeAmount = add(lockedNativeAmount, total)
}
}
}

dispatch({
type: 'STAKING/SETUP',
walletId,
lockedNativeAmount,
stakePolicies: stakePolicyMap,
stakePositionMap
})
Expand Down
11 changes: 6 additions & 5 deletions src/components/scenes/CoinRankingDetailsScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import {
filterStakePolicies,
type StakePolicy
} from '../../plugins/stake-plugins/types'
import { defaultWalletStakingState } from '../../reducers/StakingReducer'
import {
getCoingeckoFiat,
getDefaultFiat
Expand Down Expand Up @@ -140,7 +139,7 @@ const CoinRankingDetailsSceneComponent: React.FC<Props> = props => {
const account = useSelector(state => state.core.account)
const exchangeRates = useSelector(state => state.exchangeRates)
const walletStakingStateMap = useSelector(
state => state.staking.walletStakingMap ?? defaultWalletStakingState
state => state.staking.walletStakingMap ?? {}
)
const countryCode = useSelector(state => state.ui.countryCode)

Expand Down Expand Up @@ -257,9 +256,11 @@ const CoinRankingDetailsSceneComponent: React.FC<Props> = props => {
if (walletState != null && !walletState.isLoading) continue
const tokenId = getTokenId(wallet.currencyConfig, currencyCode)
if (tokenId !== undefined) {
dispatch(updateStakingState(tokenId, wallet)).catch(err => {
showError(err)
})
dispatch(updateStakingState(tokenId, wallet)).catch(
(error: unknown) => {
showError(error)
}
)
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/components/scenes/WalletDetailsScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ const WalletDetailsComponent: React.FC<Props> = (props: Props) => {
getExchangeRate(state.exchangeRates, pluginId, tokenId, defaultIsoFiat)
)
const spamFilterOn = useSelector(state => state.ui.settings.spamFilterOn)
const activeUsername = useSelector(state => state.core.account.username)
const isLightAccount = activeUsername == null

// Watchers:
const enabledTokenIds = useWatch(wallet, 'enabledTokenIds')
Expand Down Expand Up @@ -396,7 +394,6 @@ const WalletDetailsComponent: React.FC<Props> = (props: Props) => {
searching={isSearching}
tokenId={tokenId}
wallet={wallet}
isLightAccount={isLightAccount}
/>
<DividerLineUi4 extendRight />
<InfoCardCarousel
Expand Down
Loading
Loading