-
Notifications
You must be signed in to change notification settings - Fork 362
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
introduce wallet store, decoupling of account user's data (name, starred,..) from the account's blockchain data #6534
Closed
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Ignored Deployments
|
gre
force-pushed
the
LIVE-11767
branch
2 times, most recently
from
March 26, 2024 09:52
6df55e8
to
4e2d089
Compare
gre
changed the title
chore: WIP LLD split accounts data into accounts+wallet stores
introduce wallet store, decoupling of account user's data (name, starred,..) from the account's blockchain data
Mar 26, 2024
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
live-github-bot
bot
added
common
Has changes in live-common
ledgerjs
Has changes in the ledgerjs open source libs
labels
Mar 28, 2024
This was referenced Apr 26, 2024
Closed
closing in favor of #6796 |
3 tasks
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.
✅ Checklist
npx changeset
was attached.📝 Description
Goals
initial specification: https://ledgerhq.atlassian.net/wiki/spaces/WXP/pages/4574642221/move+Account+user+data+states+out+of+Account+model
The main goal is to make the type
Account
exclusively having "blockchain data" and no longer any "user data" fields. (example of user data field includes: starred, name, unit,... those are editable by the end user and typically can't be restored from the blockchain). By splitting these user data fields out, we simplify the logic of the Account[] lifecycle as well as allowing ourself a future where we can work on different ways to "export/import" user data (aka "wallet sync") more easily and no longer with data "nested" among the blockchain public/immutable data.The fields that are dropped by this PR are:
The secondary goal includes the modularisation of live-common by exporting all logic related to account name management as well as lifecycle of some account data that need the
account.name
to work (the UI logic for addAccounts, ordering of accounts, importAccounts). We have therefore created a librarylive-wallet
to allow this modularization.Backward compatible!
✅ There are no migration involved!
this is why you can see in the code that we have moved from
to
To make this work, the underlying function
toAccountRaw
has been reworked to include a userData as a second parameter, as seen in the implementation:live-wallet
breakdownThe
live-wallet
library currently includes:liveqr
: all the logic around the "live qr" which is this animated qr code that we today uses to scan-import accounts from desktop to mobile appcross
: it's under "liveqr" because it's only needed for this. (historically was in live-common)importAccounts
: the high level logic (used by the UI) to do the import accounts (during the qr scan) (historically was in live-common)ordering
: manage the account sorting logic (historically was in coin-framework)accountName
: manage the logic around account name defaulting and validation (historically was in coin-framework)addAccounts
: manage the logic used by the Add Accounts flow to deduplicate, rename and import accounts in the model (historically was in live-common)store
: export a reducer, actions and other logic to create a store that contains the wallet data (currently haveaccountNames
andstarredAccountIds
)Main library changes
Each time we used to be able to do
account.name
oraccount.starred
we will no longer be able to access it as a simple field. Instead, the data needs to be looked up from the "WalletState" store.So code like
will be replaced by one of these (depending on the context)
If you only need the "default account name", you can also use
❓ Context
🧐 Checklist for the PR Reviewers