Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: networks and tokens opt-in enhancements #1162

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9e17feb
fix: enable checks & unnecessary balance reset
0xKheops Nov 28, 2023
371f463
fix: tokensWithTestnetsState
0xKheops Nov 28, 2023
15667ae
fix: balances in account pickers
0xKheops Nov 28, 2023
64c99e4
feat: debug from specific chaindata branch
0xKheops Nov 29, 2023
89707c8
fix: layout shifts on load
0xKheops Nov 29, 2023
6369215
fix: don't refetch tokens when polling
0xKheops Nov 29, 2023
5b94063
feat: enable/disable all substrate networks
0xKheops Nov 29, 2023
629fbd8
feat: enable/disable all networks
0xKheops Nov 29, 2023
715b179
feat: initial delay for polled balances
0xKheops Nov 30, 2023
397fa82
feat: message if no balance to display
0xKheops Nov 30, 2023
5e6183c
fix: buyable tokens json url
0xKheops Nov 30, 2023
2450d07
fix: ignore account all in query string
0xKheops Nov 30, 2023
7ef1150
fix: delete custom network
0xKheops Dec 1, 2023
45e35bb
fix: reset balances sub if tokens change
0xKheops Dec 1, 2023
16882ed
fix: show balances for import when onboarding
0xKheops Dec 6, 2023
448fbaa
fix: typos in comments
0xKheops Dec 6, 2023
a28e045
feat: initialize empty balances
0xKheops Dec 6, 2023
95424b7
fix: balance status
0xKheops Dec 6, 2023
c64513f
fix: chainId from tokenId
0xKheops Dec 6, 2023
e452e58
fix: cleanup
0xKheops Dec 6, 2023
71922a6
fix: don't display balances until initialized
0xKheops Dec 6, 2023
72fcecb
chore: cleanup
0xKheops Dec 6, 2023
da88041
fix: optimize add missing balances code
0xKheops Dec 7, 2023
81e7d0d
fix: tests
0xKheops Dec 7, 2023
5e93bf5
feat: shimmer when initializing balance
0xKheops Dec 7, 2023
cc7e48d
fix: absolute imports in balances handler
alecdwm Dec 7, 2023
4a0e040
fix: absolute imports in tokenRates handler
alecdwm Dec 7, 2023
ed96e53
fix: show updateTokenRates warning in function docstring
alecdwm Dec 7, 2023
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: 2 additions & 1 deletion apps/extension/src/core/domains/balances/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,13 @@ export class BalanceStore {
// create placeholder rows for all missing balances, so FE knows they are initializing
const missingBalances: BalanceJson[] = []
const existingBalances = await balancesDb.balances.toArray()
const existingBalancesKeys = new Set(existingBalances.map((b) => `${b.tokenId}:${b.address}`))

for (const balanceModule of balanceModules) {
const addressesByToken = addressesByTokenByModule[balanceModule.type] ?? {}
for (const [tokenId, addresses] of Object.entries(addressesByToken))
for (const address of addresses) {
if (!existingBalances.find((b) => b.address === address && b.tokenId === tokenId))
if (!existingBalancesKeys.has(`${tokenId}:${address}`))
Copy link
Member

Choose a reason for hiding this comment

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

🔥🔥🔥

Copy link
Contributor Author

@0xKheops 0xKheops Dec 7, 2023

Choose a reason for hiding this comment

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

x4 faster with a set than with a string array :)

missingBalances.push(balanceModule.getPlaceholderBalance(tokenId, address))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { classNames } from "@talismn/util"
import Fiat from "@ui/domains/Asset/Fiat"
import { useAnalytics } from "@ui/hooks/useAnalytics"
import { useBalancesStatus } from "@ui/hooks/useBalancesStatus"
import { useCallback, useEffect } from "react"
import { useCallback } from "react"
import { Trans, useTranslation } from "react-i18next"
import { useNavigate } from "react-router-dom"

Expand Down Expand Up @@ -163,13 +163,6 @@ export const DashboardAssetsTable = ({ balances }: AssetsTableProps) => {
const { account } = useSelectedAccount()
const { symbolBalances } = usePortfolioSymbolBalances(balances)

useEffect(() => {
console.log({
balances: balances.toJSON(),
symbolBalances: symbolBalances.map(([, b]) => b.toJSON()),
})
}, [balances, symbolBalances])

// assume balance subscription is initializing if there are no balances
if (!balances.count) return null

Expand Down
Loading