-
Notifications
You must be signed in to change notification settings - Fork 976
[Wallet/iOS] Fix #35986: Persist balance in Portfolio Assets #22029
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
Conversation
cd7aa69
to
59ac294
Compare
59ac294
to
597cfbc
Compare
[puLL-Merge] - brave/brave-core@22029 DescriptionThis PR introduces modifications to various Swift source files related to the Brave Wallet feature within the iOS application. It focuses on improving the handling of user assets and their balances, along with some structural cleanups like the removal of unnecessary callback functions and the addition of new functionalities for better management of blockchain assets and NFTs. ChangesChangesios/brave-ios/Sources/BraveWallet/Crypto/Portfolio/AddCustomAssetView.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Portfolio/EditUserAssetsView.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Portfolio/PortfolioView.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Stores/CryptoStore.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Stores/NFTStore.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Stores/NetworkStore.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Stores/PortfolioStore.swift
ios/brave-ios/Sources/BraveWallet/Crypto/Stores/UserAssetsStore.swift
ios/brave-ios/Sources/BraveWallet/WalletUserAssetManager.swift
Various Tests and Model Updates
Security Hotspots
|
Resolves brave/brave-browser#35986
We are now caching asset's balance. They can be easily fetch from CD via token info or account info or both.
Cached balance will be refreshed under certain scenarios. they will be listed in the test plan.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Note: Currently, we have known issues Race condition between fetching token registry and asset discovery on wallet restore brave-browser#35696 and Frontend cannot trigger asset discovery in some situations brave-browser#35697 these two cause auto-discovery assets are not discovered right after restoring. We will use a workaround to verify auto-discovery assets can be discovered and their balances are being fetched correctly. But this issue helps us to verify another scenario I will explain later in other test steps.
WETH
onPolygon Mainnet
WETH
WETH
to mark it as visible assetWETH
now appears and its balance is fetched.NFTs
tab, enable NFT auto-discovery in the promptAssets
also shows up if you navigate toAssets
Assets
that this Wallet A owns with some balance. Please check if their balances were fetched correctly.Account
in PortfolioGroup
Confirmed
In summary, balances in Portfolio (Assets) will be refreshed when
Note: Transactions that are submitted by Dapps via signing request through wallet, since there is no access from Wallet to know the transaction status that is not created by Brave Wallet, it is not possible to determine when to refresh the balance based this transaction's status until we can observe all on-chain activity for an address. In this case, to refresh balance, user has to lock and unlock the wallet.