Skip to content
Snippets Groups Projects
Commit c4f8f3dd authored by Nicolas80's avatar Nicolas80
Browse files

Fixes after rebase of modified upstream branch

* Fix for display.rs compute_vault_account_json that should not include wallet_type anymore (was removed from upstream branch)
* Also some changes from `cargo fmt`
parent 2843da7b
No related branches found
No related tags found
No related merge requests found
......@@ -155,8 +155,6 @@ pub fn compute_vault_accounts_row_with_g1v1(
pub struct VaultAccountView {
address: String,
crypto_scheme: Option<String>,
//FIXME remove wallet_type
wallet_type: Option<String>,
path: String,
name: String,
g1v1_public_key: Option<String>,
......@@ -169,11 +167,11 @@ pub fn compute_vault_accounts_json(
show_g1v1: bool,
) -> Vec<VaultAccountView> {
let mut result = Vec::new();
for account_tree_node in account_tree_nodes {
result.push(compute_vault_account_json(account_tree_node, show_g1v1));
}
result
}
......@@ -184,51 +182,50 @@ fn compute_vault_account_json(
) -> VaultAccountView {
let empty_string = "".to_string();
let borrowed_node = account_tree_node.borrow();
let name = if let Some(name) = borrowed_node.account.name.clone() {
name
} else if let Some(computed_name) = vault_account::compute_name_account_tree_node(account_tree_node) {
} else if let Some(computed_name) =
vault_account::compute_name_account_tree_node(account_tree_node)
{
format!("<{}>", computed_name)
} else {
empty_string.clone()
};
let (path, crypto_scheme, wallet_type, g1v1_public_key) = if let Some(path) = borrowed_node.account.path.clone() {
(path, None, None, None)
} else {
let crypto_scheme = borrowed_node.account.crypto_scheme.map(|cs| {
let scheme = CryptoScheme::from(cs);
let scheme_str: &str = scheme.into();
scheme_str.to_string()
});
let wallet_type = borrowed_node.account.secret_format.map(|sf| {
match crate::keys::SecretFormat::from(sf) {
crate::keys::SecretFormat::G1v1 => "G1v1".to_string(),
crate::keys::SecretFormat::Substrate => "Mnemonic".to_string(),
crate::keys::SecretFormat::Seed => "Seed".to_string(),
crate::keys::SecretFormat::Predefined => "Predefined".to_string(),
}
});
let g1v1_public_key = if show_g1v1 && crypto_scheme.as_deref() == Some("ed25519") {
Some(cesium::compute_g1v1_public_key_from_ed25519_account_id(&borrowed_node.account.address.0))
let (path, crypto_scheme, g1v1_public_key) =
if let Some(path) = borrowed_node.account.path.clone() {
(path, None, None)
} else {
None
let crypto_scheme = borrowed_node.account.crypto_scheme.map(|cs| {
let scheme = CryptoScheme::from(cs);
let scheme_str: &str = scheme.into();
scheme_str.to_string()
});
let g1v1_public_key = if show_g1v1 && crypto_scheme.as_deref() == Some("ed25519") {
Some(cesium::compute_g1v1_public_key_from_ed25519_account_id(
&borrowed_node.account.address.0,
))
} else {
None
};
(
format!("<{}>", borrowed_node.account.account_type()),
crypto_scheme,
g1v1_public_key,
)
};
(format!("<{}>", borrowed_node.account.account_type()), crypto_scheme, wallet_type, g1v1_public_key)
};
let mut children = Vec::new();
for child in &borrowed_node.children {
children.push(compute_vault_account_json(child, show_g1v1));
}
VaultAccountView {
address: borrowed_node.account.address.to_string(),
crypto_scheme,
wallet_type,
path,
name,
g1v1_public_key,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment