Skip to content

Commit

Permalink
Optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
arne-fuchs committed Sep 15, 2023
1 parent 50cca40 commit 3046896
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/app/tangle_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::sync::Arc;

use base64::Engine;
use base64::engine::general_purpose;
use bus::BusReader;
use json::JsonValue;
use log::{debug, error, info, warn};
use flate2::Compression;
use flate2::write::ZlibEncoder;

use iota_sdk::crypto::keys::bip44::Bip44;
use iota_sdk::client::constants::SHIMMER_COIN_TYPE;
use iota_sdk::wallet::{Account, ClientOptions};
use iota_sdk::client::secret::SecretManage;
use iota_sdk::client::secret::SecretManager;
use iota_sdk::client::secret::stronghold::StrongholdSecretManager;
use iota_sdk::crypto::keys::bip44::Bip44;
use iota_sdk::wallet::{Account, ClientOptions};
use iota_sdk::Wallet;
use iota_sdk::wallet::account::types::Balance;
use iota_sdk::client::secret::SecretManage;
use json::JsonValue;
use log::{debug, error, info, warn};
use rustc_hex::ToHex;

use serde_json::json;

use crate::app::settings::Settings;
Expand All @@ -30,8 +29,6 @@ pub struct TangleInterpreter {
settings: Arc<Settings>,
account: Account,
stronghold: StrongholdSecretManager,
bech32_hrp: String,
address: String,
}

impl TangleInterpreter {
Expand All @@ -41,8 +38,6 @@ impl TangleInterpreter {
settings: _,
account: _,
stronghold: _,
bech32_hrp,
address,
} = self;

match bus.recv() {
Expand Down Expand Up @@ -206,7 +201,7 @@ pub fn initialize(tangle_bus_reader: BusReader<JsonValue>, settings: Arc<Setting
.unwrap()
.block_on(async {
// Setup Stronghold secret_manager
let mut secret_manager = StrongholdSecretManager::builder()
let secret_manager = StrongholdSecretManager::builder()
.password(settings.iota_settings.password.to_string())
.build(&wallet_path).unwrap();

Expand Down Expand Up @@ -240,7 +235,7 @@ pub fn initialize(tangle_bus_reader: BusReader<JsonValue>, settings: Arc<Setting
});

//get address one time so it doesn't have to be created each time
let address = tokio::runtime::Builder::new_current_thread()
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("Failed creating addresses")
Expand Down Expand Up @@ -271,7 +266,5 @@ pub fn initialize(tangle_bus_reader: BusReader<JsonValue>, settings: Arc<Setting
bus: tangle_bus_reader,
settings,
account,
bech32_hrp,
address,
}
}

0 comments on commit 3046896

Please sign in to comment.