From d45fcc438105d03b54eae87a6aa16dccb6969ad3 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 14 Dec 2018 10:46:58 -0800 Subject: [PATCH] Move src/wallet.rs into wallet/ crate --- Cargo.lock | 4 ++++ src/lib.rs | 1 - wallet/Cargo.toml | 4 ++++ wallet/src/main.rs | 6 +++++- {src => wallet/src}/wallet.rs | 23 +++-------------------- 5 files changed, 16 insertions(+), 22 deletions(-) rename {src => wallet/src}/wallet.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index 2377baf38a..560848a4c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", ] diff --git a/src/lib.rs b/src/lib.rs index 44072b4304..db885738ee 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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; diff --git a/wallet/Cargo.toml b/wallet/Cargo.toml index 2f3ff335cc..0167a7c980 100644 --- a/wallet/Cargo.toml +++ b/wallet/Cargo.toml @@ -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] diff --git a/wallet/src/main.rs b/wallet/src/main.rs index d122688839..bfacade5ff 100644 --- a/wallet/src/main.rs +++ b/wallet/src/main.rs @@ -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; diff --git a/src/wallet.rs b/wallet/src/wallet.rs similarity index 99% rename from src/wallet.rs rename to wallet/src/wallet.rs index 95d9c07628..338e80199c 100644 --- a/src/wallet.rs +++ b/wallet/src/wallet.rs @@ -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 Result { - 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> { let result = RpcRequest::GetLastId.make_rpc_request(rpc_client, 1, None)?; if result.as_str().is_none() {