mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-11 08:19:35 +00:00
refactor(wallet): place private_accounts next to private_account
This commit is contained in:
parent
37b0108c43
commit
15f6306362
@ -218,6 +218,39 @@ impl UserKeyChain {
|
||||
})
|
||||
}
|
||||
|
||||
/// Iterates every owned private account (imported and generated), one
|
||||
/// [`FoundPrivateAccount`] per identity. Excludes shared accounts.
|
||||
pub fn private_accounts(&self) -> impl Iterator<Item = FoundPrivateAccount<'_>> {
|
||||
self.imported_private_accounts
|
||||
.iter()
|
||||
.flat_map(|(key, data)| {
|
||||
data.accounts
|
||||
.iter()
|
||||
.map(|(kind, account)| FoundPrivateAccount {
|
||||
account,
|
||||
key_chain: &key.key_chain,
|
||||
kind,
|
||||
chain_index: key.chain_index.clone(),
|
||||
})
|
||||
})
|
||||
.chain(
|
||||
self.private_key_tree
|
||||
.key_map
|
||||
.iter()
|
||||
.flat_map(|(chain_index, data)| {
|
||||
data.value
|
||||
.1
|
||||
.iter()
|
||||
.map(|(kind, account)| FoundPrivateAccount {
|
||||
account,
|
||||
key_chain: &data.value.0,
|
||||
kind,
|
||||
chain_index: Some(chain_index.clone()),
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn private_account_key_chain_by_index(
|
||||
&self,
|
||||
@ -253,39 +286,6 @@ impl UserKeyChain {
|
||||
)
|
||||
}
|
||||
|
||||
/// Iterates every owned private account (imported and generated), one
|
||||
/// [`FoundPrivateAccount`] per identity. Excludes shared accounts.
|
||||
pub fn private_accounts(&self) -> impl Iterator<Item = FoundPrivateAccount<'_>> {
|
||||
self.imported_private_accounts
|
||||
.iter()
|
||||
.flat_map(|(key, data)| {
|
||||
data.accounts
|
||||
.iter()
|
||||
.map(|(kind, account)| FoundPrivateAccount {
|
||||
account,
|
||||
key_chain: &key.key_chain,
|
||||
kind,
|
||||
chain_index: key.chain_index.clone(),
|
||||
})
|
||||
})
|
||||
.chain(
|
||||
self.private_key_tree
|
||||
.key_map
|
||||
.iter()
|
||||
.flat_map(|(chain_index, data)| {
|
||||
data.value
|
||||
.1
|
||||
.iter()
|
||||
.map(|(kind, account)| FoundPrivateAccount {
|
||||
account,
|
||||
key_chain: &data.value.0,
|
||||
kind,
|
||||
chain_index: Some(chain_index.clone()),
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
/// Re-derives the [`PrivateKeyHolder`] for a shared account `entry`, dispatching on PDA vs
|
||||
/// regular. `None` if the group key holder is absent or a PDA entry lacks its program id.
|
||||
#[must_use]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user