Move src/wallet.rs into wallet/ crate

This commit is contained in:
Michael Vines 2018-12-14 10:46:58 -08:00
parent a22e1199cf
commit d45fcc4381
5 changed files with 16 additions and 22 deletions

4
Cargo.lock generated
View File

@ -2191,10 +2191,14 @@ dependencies = [
name = "solana-wallet"
version = "0.11.0"
dependencies = [
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bs58 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"solana 0.11.0",
"solana-drone 0.11.0",
"solana-sdk 0.11.0",
]

View File

@ -71,7 +71,6 @@ pub mod tpu;
pub mod tpu_forwarder;
pub mod tvu;
pub mod vote_stage;
pub mod wallet;
pub mod window;
pub mod window_service;

View File

@ -8,10 +8,14 @@ license = "Apache-2.0"
homepage = "https://solana.com/"
[dependencies]
bincode = "1.0.0"
bs58 = "0.2.0"
clap = "2.32.0"
chrono = { version = "0.4.0", features = ["serde"] }
dirs = "1.0.2"
serde_json = "1.0.10"
solana = { path = "..", version = "0.11.0" }
solana-drone = { path = "../drone", version = "0.11.0" }
solana-sdk = { path = "../sdk", version = "0.11.0" }
[features]

View File

@ -3,10 +3,14 @@ extern crate clap;
use dirs;
#[macro_use]
extern crate solana;
#[macro_use]
extern crate serde_json;
mod wallet;
use crate::wallet::{parse_command, process_command, WalletConfig, WalletError};
use clap::{App, Arg, ArgMatches, SubCommand};
use solana::logger;
use solana::wallet::{parse_command, process_command, WalletConfig, WalletError};
use solana_sdk::signature::{gen_keypair_file, read_keypair, KeypairUtil};
use std::error;
use std::net::SocketAddr;

View File

@ -1,12 +1,11 @@
use crate::fullnode::Config;
use crate::rpc::RpcSignatureStatus;
use crate::rpc_request::{get_rpc_request_str, RpcClient, RpcRequest};
use crate::thin_client::poll_gossip_for_leader;
use bincode::serialize;
use bs58;
use chrono::prelude::*;
use clap::ArgMatches;
use serde_json;
use solana::rpc::RpcSignatureStatus;
use solana::rpc_request::{get_rpc_request_str, RpcClient, RpcRequest};
use solana::thin_client::poll_gossip_for_leader;
use solana_drone::drone::{request_airdrop_transaction, DRONE_PORT};
use solana_sdk::bpf_loader;
use solana_sdk::budget_program;
@ -643,22 +642,6 @@ pub fn process_command(config: &WalletConfig) -> Result<String, Box<dyn error::E
}
}
pub fn read_leader(path: &str) -> Result<Config, WalletError> {
let file = File::open(path.to_string()).or_else(|err| {
Err(WalletError::BadParameter(format!(
"{}: Unable to open leader file: {}",
err, path
)))
})?;
serde_json::from_reader(file).or_else(|err| {
Err(WalletError::BadParameter(format!(
"{}: Failed to parse leader file: {}",
err, path
)))
})
}
fn get_last_id(rpc_client: &RpcClient) -> Result<Hash, Box<dyn error::Error>> {
let result = RpcRequest::GetLastId.make_rpc_request(rpc_client, 1, None)?;
if result.as_str().is_none() {