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

Ensure accounts are always derived for privileged apps #370

Merged

Conversation

sdlaver
Copy link
Contributor

@sdlaver sdlaver commented Nov 22, 2024

No description provided.

@sdlaver sdlaver requested review from J909 and ankur2136 November 22, 2024 22:14
@@ -162,23 +162,18 @@ class SeedRepository @Inject constructor(
check(!seeds.value.containsKey(nextSeedId)) { "Seed repository already contains an entry for seed $nextSeedId" }
newSeedRecordBuilder.seedId = nextSeedId
id = nextSeedId
val changeNotification = ChangeNotification(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

None of the changes in this file are strictly necessary, but it cuts down on unnecessary change notifications when nothing actually changed, which improves performance of apps that make use of content notifications.

// Ensure that the seed vault contains appropriate known accounts for this authorization purpose
val seed = seedRepository.seeds.value[seedId]!!
PrepopulateKnownAccountsUseCase(seedRepository).populateKnownAccounts(seed, authorize.purpose)
// Pre-populate known accounts for all purposes
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the fix for the root cause of known accounts not being derived.

@@ -44,6 +45,14 @@ class MainViewModel(
viewModelScope.launch {
observeSeedVaultContentChanges()
refreshUiState()

// Privileged wallets do not manually authorize individual seeds, so check on startup
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes privileged wallets not having any accounts marked as user accounts, and thus an incomplete FakeWallet UI

@sdlaver sdlaver merged commit cf408c7 into solana-mobile:next Nov 23, 2024
3 checks passed
@sdlaver sdlaver deleted the privileged-wallets-derive-known-accounts branch November 23, 2024 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant