-
Notifications
You must be signed in to change notification settings - Fork 635
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
userAssetsStore refactor #6015
Merged
Merged
userAssetsStore refactor #6015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…@benisgold/user-assets-refactor
…@benisgold/user-assets-refactor
…@benisgold/user-assets-refactor
…@benisgold/user-assets-refactor
walmat
reviewed
Aug 27, 2024
walmat
reviewed
Aug 27, 2024
walmat
reviewed
Aug 27, 2024
walmat
requested changes
Aug 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smol changes needed i think in order for it to pass e2e
walmat
approved these changes
Aug 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved once CI passes. Do we need a migration strategy?
…@benisgold/user-assets-refactor
christianbaroni
approved these changes
Sep 3, 2024
…@benisgold/user-assets-refactor
…@benisgold/user-assets-refactor
greg-schrammel
pushed a commit
that referenced
this pull request
Sep 11, 2024
* done * change userAssetsStoreCache type * mid refactor * refactor * dont cast to Address * more * more * rm address param * fix caching * select address * comments * hardhat * lint
walmat
added a commit
that referenced
this pull request
Sep 13, 2024
* add degen native asset * remove NATIVE_ASSETS_MAP_PER_CHAIN * remove Address castings * bump iOS and Android version to v1.9.38 (#6081) * Fix e2e flakiness / errors (#6084) * fix * test * revert * @walmat related fixes * @walmat related fixes * okay disabling the test again, the experimental flag didnt fix it * okay disabling the test again, the experimental flag didnt fix it * fix disabled NFTs in testing and rely on remote config for prod * . * add 60 min timeout (#6090) * fix tophat triggers (#6089) * Fix url creation for stale balance param (#6091) * fix wrong id (#6078) * change to id * also fix clicks * Add rc-push script (#6088) * add rc-push script * source .env * Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows (#6072) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v3...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fixes opacity on mwp sign txn sheet (#6083) * change opacity on mwp route source too * switch to includes * update env (#6077) * fix missing dapp metadata for eth actions (#6086) * fix missing dapp metadata for eth actions * use isHandshakeAction helper function * Update src/components/MobileWalletProtocolListener.tsx Co-authored-by: Bruno Barbieri <[email protected]> --------- Co-authored-by: Bruno Barbieri <[email protected]> * Revert "Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows …" (#6095) This reverts commit 431459a. * Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows (#6072) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v3...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows …" (#6095) This reverts commit 431459a. * Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows (#6072) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v3...v4.1.7) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Revert "Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows …" (#6095) This reverts commit 431459a. * fix: send (#6093) * fix * lint * userAssetsStore refactor (#6015) * done * change userAssetsStoreCache type * mid refactor * refactor * dont cast to Address * more * more * rm address param * fix caching * select address * comments * hardhat * lint * Fix wrong messages during MWP Flow (#6094) * add logging for pkey errors * fix keychain error handling * checksum address before keychain lookup * remove invalid chainId param from tx * Update src/keychain/index.ts * Update src/keychain/index.ts Co-authored-by: Jin <[email protected]> * Explicitly return UserCanceled error for code strings 10 and 13 * Remove returning -3 explicit error code * Use enum values instead of primitives for error codes for readability --------- Co-authored-by: Jin <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Ibrahim Taveras <[email protected]> Co-authored-by: brdy <[email protected]> Co-authored-by: Bruno Barbieri <[email protected]> Co-authored-by: Jin <[email protected]> Co-authored-by: Matthew Wall <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Esteban Miño <[email protected]> Co-authored-by: Ben Goldberg <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes APP-####
What changed (plus any additional context for devs)
Context
The current implementation of userAssetsStore only caches assets for 1 wallet at a time. This means every time the user switches wallets, this computationally heavy code is executed. This currently isn't that much of a problem, because userAssetsStore is only used within swaps and the user can't switch wallets within the swaps flow.
Problem
This ticket requires userAssetsStore to be used everywhere in the app, which would cause the above issues to become much more evident. For example, when the user switches wallets there would be a delay while waiting for the selected wallet's assets to appear on the WalletScreen.
Solution
The solution implemented in this PR refactors the singular userAssetsStore into a framework for creating & caching multiple per-wallet stores. See
createUserAssetsStore
,useUserAssetsStore
,getOrCreateStore
,storeManager
insrc/state/assets/userAssets.ts
.There is now a store called
storeManager
(private touserAssets.ts
) that stores & persists all these per-wallet userAssetStores. The individual userAssetStores can be accessed externally by passing in the wallet address as the first param touserAssetsStore.getState()
,userAssetsStore.setState()
anduseUserAssetsStore()
. All other params that you would normally pass in to these functions can still be passed in after.Screen recordings / screenshots
What to test
Swaps
TF coming