Skip to content

Commit

Permalink
Use snake case in Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
pgolovkin committed Mar 5, 2024
1 parent f4a7e31 commit b875a4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
17 changes: 9 additions & 8 deletions cli/src/chains_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ pub(crate) struct InjectedChain {
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ChainJSON {
pub(crate) name: String,
pub(crate) nodes: Vec<ChainNode>,
pub(crate) icon: String,
pub(crate) options: Option<Vec<String>>,
pub(crate) parentId: Option<String>,
pub(crate) parent_id: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down Expand Up @@ -153,8 +154,8 @@ pub(crate) fn update_chains_config(chains_opts: ChainsOpts) -> Result<()> {
}
None => None,
},
relay_chain: match &chain.parentId {
Some(parentId) => Some(String::from(relay_chains.get(parentId).unwrap())),
relay_chain: match &chain.parent_id {
Some(parent_id) => Some(String::from(relay_chains.get(parent_id).unwrap())),
None => None,
},
});
Expand Down Expand Up @@ -188,8 +189,8 @@ pub(crate) fn update_chains_config(chains_opts: ChainsOpts) -> Result<()> {
}
None => None,
},
relay_chain: match &chain.parentId {
Some(parentId) => Some(String::from(relay_chains.get(parentId).unwrap())),
relay_chain: match &chain.parent_id {
Some(parent_id) => Some(String::from(relay_chains.get(parent_id).unwrap())),
None => None,
},
};
Expand Down Expand Up @@ -230,8 +231,8 @@ pub(crate) fn update_chains_config(chains_opts: ChainsOpts) -> Result<()> {
}
None => None,
},
relay_chain: match &chain.parentId {
Some(parentId) => Some(String::from(relay_chains.get(parentId).unwrap())),
relay_chain: match &chain.parent_id {
Some(parent_id) => Some(String::from(relay_chains.get(parent_id).unwrap())),
None => None,
},
});
Expand Down Expand Up @@ -275,4 +276,4 @@ pub(crate) fn update_chains_config(chains_opts: ChainsOpts) -> Result<()> {
}

Ok(())
}
}
10 changes: 1 addition & 9 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,6 @@ impl Chain {
None => self.name.to_string(),
}
}

pub(crate) fn formatted_title(&self) -> String {
let mut title = self.title.as_ref().unwrap_or(&self.name).clone();
if let Some(relay) = &self.relay_chain {
title = format!("{} {}", relay, title);
}
title.to_owned()
}
}

#[cfg(test)]
Expand All @@ -191,4 +183,4 @@ impl Default for Chain {
encryption: None,
}
}
}
}
21 changes: 4 additions & 17 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ data_file = "public/data.json"
public_dir = "public"
qr_dir = "public/qr"

[verifiers.parity]
name = "Parity"
public_key = "c46a22b9da19540a77cbde23197e5fd90485c72b4ecf3c599ecca6998f39bd57"

[verifiers.novasama]
name = "Novasama Technologies"
public_key = "16d5a6266345874d8f5b7f88a6619711b2829b52b2865826b1ecefb62beef34f"
ethereum_public_key = "031b195495f907908aeedd8e9a0ae128dcf23b6a7425dd16d282df7d867855e7f1"

[verifiers.parity]
name = "Parity"
public_key = "c46a22b9da19540a77cbde23197e5fd90485c72b4ecf3c599ecca6998f39bd57"

[[chains]]
name = "polkadot"
title = "Polkadot"
Expand Down Expand Up @@ -749,19 +749,6 @@ rpc_endpoints = ["wss://entrypoint-finney.opentensor.ai:443"]
testnet = false
verifier = "novasama"

[[chains]]
name = "Equilibrium-parachain"
title = "Equilibrium (PAUSED)"
color = "#000000"
icon = "https://raw.githubusercontent.com/novasamatech/nova-utils/master/icons/chains/gradient/Equilibrium.svg"
rpc_endpoints = [
"wss://node.pol.equilibrium.io",
"wss://equilibrium-rpc.dwellir.com",
]
testnet = false
verifier = "novasama"
relay_chain = "polkadot"

[[chains]]
name = "ajuna"
title = "Ajuna"
Expand Down

0 comments on commit b875a4c

Please sign in to comment.