some cleanup, get blockchain stuff working

This commit is contained in:
Drazen Urch
2021-08-31 07:38:25 +02:00
parent 5f4fabc0b8
commit eff38c8466
7 changed files with 303 additions and 323 deletions
Generated
+286 -310
View File
File diff suppressed because it is too large Load Diff
@@ -25,7 +25,7 @@ network-defaults = { path = "../../network-defaults" }
async-trait = { version = "0.1.51", optional = true }
bip39 = { version = "1", features = ["rand"], optional = true }
config = { path = "../../config", optional = true}
cosmos_sdk = { git = "https://github.com/cosmos/cosmos-rust/", commit="ba012bd820240d3df2d9a0ab1deabe4ecd9a2f30", features = ["rpc", "bip32", "cosmwasm"], optional = true }
cosmos_sdk = { git = "https://github.com/cosmos/cosmos-rust/", rev="ba012bd820240d3df2d9a0ab1deabe4ecd9a2f30", features = ["rpc", "bip32", "cosmwasm"], optional = true }
prost = { version = "0.7", default-features = false, optional = true }
flate2 = { version = "1.0.20", optional = true }
sha2 = { version = "0.9.5", optional = true }
+2
View File
@@ -25,6 +25,8 @@ bip39 = "1.0"
thiserror = "1.0"
tendermint-rpc = "0.21.0"
cosmos_sdk = { git = "https://github.com/cosmos/cosmos-rust/", rev="ba012bd820240d3df2d9a0ab1deabe4ecd9a2f30", features = ["rpc", "bip32", "cosmwasm"] }
validator-client = { path = "../../common/client-libs/validator-client", features = [
"nymd-client",
] }
+3 -3
View File
@@ -86,9 +86,9 @@ impl Config {
}
}
// pub fn get_mixnet_contract_address(&self) -> String {
// self.base.mixnet_contract_address.clone()
// }
pub fn get_mixnet_contract_address(&self) -> String {
self.base.mixnet_contract_address.clone()
}
// pub fn get_mnemonic(&self) -> String {
// self.base.mnemonic.clone()
+7 -5
View File
@@ -6,10 +6,9 @@
use bip39::Mnemonic;
use error::BackendError;
use std::collections::HashMap;
use std::error::Error;
use std::fmt::Display;
use std::str::FromStr;
use validator_client::nymd::{NymdClient, SigningNymdClient};
use cosmos_sdk::AccountId;
mod config;
mod error;
@@ -71,7 +70,7 @@ async fn connect_with_mnemonic(
);
let mut w_state = state.write().await;
w_state.signing_client = Some(client);
Ok(ret)
}
@@ -100,8 +99,11 @@ async fn get_balance(
}
fn _connect_with_mnemonic(mnemonic: Mnemonic, config: &Config) -> NymdClient<SigningNymdClient> {
match NymdClient::connect_with_mnemonic(config.get_nymd_validator_url().unwrap(), None, mnemonic)
{
match NymdClient::connect_with_mnemonic(
config.get_nymd_validator_url().unwrap(),
Some(AccountId::from_str(&config.get_mixnet_contract_address()).unwrap()),
mnemonic,
) {
Ok(client) => client,
Err(e) => panic!("{}", e),
}
+3 -3
View File
@@ -39,9 +39,9 @@ export const Routes = () => (
<Route path="/undelegate">
<Undelegate />
</Route>
<Route path="/docs">
<InternalDocs />
</Route>
<Route path="/docs">
<InternalDocs />
</Route>
<Route path="*">
<NotFound />
</Route>
@@ -21,7 +21,7 @@ export const ApiList = () => {
return (
<List>
<ListItem><DocEntry function={{ name: 'connect_with_mnemonic', args: [{ name: 'mnemonic', type: 'str' }] }} /></ListItem>
<ListItem><DocEntry function={{ name: 'test-2', args: [] }} /></ListItem>
<ListItem><DocEntry function={{ name: 'get_balance', args: [] }} /></ListItem>
</List>
)