Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aspectron/rusty-kaspa into kng
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect committed Nov 1, 2023
2 parents 22f2d1f + d66bd6c commit a3a95d3
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 79 deletions.
151 changes: 89 additions & 62 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ serde-wasm-bindgen = "0.6.1"
sha1 = "0.10.6"
sha2 = "0.10.8"
sha3 = "0.10.8"
slugify-rs = "0.0.3"
smallvec = { version = "1.11.1", features = ["serde"] }
sorted-insert = "0.2.3"
statest = "0.2.2"
Expand Down Expand Up @@ -234,16 +235,16 @@ zeroize = { version = "1.6.0", default-features = false, features = ["alloc"] }
workflow-perf-monitor = { version = "0.0.2" }

# workflow dependencies
# workflow-d3 = { version = "0.8.0" }
# workflow-nw = { version = "0.8.0" }
# workflow-log = { version = "0.8.0" }
# workflow-core = { version = "0.8.0" }
# workflow-wasm = { version = "0.8.0" }
# workflow-dom = { version = "0.8.0" }
# workflow-rpc = { version = "0.8.0" }
# workflow-node = { version = "0.8.0" }
# workflow-store = { version = "0.8.0" }
# workflow-terminal = { version = "0.8.0" }
# workflow-d3 = { version = "0.8.1" }
# workflow-nw = { version = "0.8.1" }
# workflow-log = { version = "0.8.1" }
# workflow-core = { version = "0.8.1" }
# workflow-wasm = { version = "0.8.1" }
# workflow-dom = { version = "0.8.1" }
# workflow-rpc = { version = "0.8.1" }
# workflow-node = { version = "0.8.1" }
# workflow-store = { version = "0.8.1" }
# workflow-terminal = { version = "0.8.1" }
nw-sys = "0.1.6"

# if below is enabled, this means that there is an ongoing work
Expand Down
8 changes: 7 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ description = "Kaspa CLI library"
version.workspace = true
edition.workspace = true
authors.workspace = true
include.workspace = true
license.workspace = true
include = [
"src/**/*.rs",
"src/**/*.txt",
"src/**/*.css",
"Cargo.toml",
"Cargo.lock",
]

[features]
legacy-rpc = ["kaspa-wallet-core/legacy-rpc"]
Expand Down
7 changes: 5 additions & 2 deletions cli/src/modules/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ impl Wallet {
} else {
let name = argv.remove(0);
let name = name.trim().to_string();
if name.as_str() == "wallet" {
let name_check = name.to_lowercase();
if name_check.as_str() == "wallet" {
return Err(Error::custom("Wallet name cannot be 'wallet'"));
}
Some(name)
Expand All @@ -49,7 +50,9 @@ impl Wallet {
}
"open" => {
let name = if let Some(name) = argv.first().cloned() {
if name.as_str() == "wallet" {
let name_check = name.to_lowercase();

if name_check.as_str() == "wallet" {
tprintln!(ctx, "you can not have a wallet named 'wallet'...");
tprintln!(ctx, "perhaps you are looking to use 'open <name>'");
return Ok(());
Expand Down
8 changes: 7 additions & 1 deletion kos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ description = "Kaspa Node & Wallet Manager"
version = "0.0.2"
edition.workspace = true
authors.workspace = true
include.workspace = true
license.workspace = true
repository = "https://github.com/kaspanet/rusty-kaspa"
include = [
"src/**/*.rs",
"src/**/*.txt",
"src/**/*.css",
"Cargo.toml",
"Cargo.lock",
]

[features]
metrics = []
Expand Down
1 change: 1 addition & 0 deletions metrics/perf_monitor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "kaspa-perf-monitor"
description = "Kaspa process performance monitoring tools"
version.workspace = true
authors.workspace = true
license.workspace = true
Expand Down
1 change: 1 addition & 0 deletions mining/errors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
name = "kaspa-mining-errors"
description = "Kaspa mining error definitions"
version.workspace = true
edition.workspace = true
authors.workspace = true
Expand Down
1 change: 1 addition & 0 deletions wallet/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ serde-wasm-bindgen.workspace = true
serde.workspace = true
sha1.workspace = true
sha2.workspace = true
slugify-rs.workspace = true
sorted-insert.workspace = true
thiserror.workspace = true
wasm-bindgen-futures.workspace = true
Expand Down
16 changes: 13 additions & 3 deletions wallet/core/src/storage/local/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ use crate::storage::local::wallet::Wallet;
use crate::storage::local::Payload;
use crate::storage::local::Storage;
use crate::storage::*;
use slugify_rs::slugify;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;
use workflow_core::runtime::is_web;
use workflow_store::fs;

fn make_filename(title: &Option<String>, filename: &Option<String>) -> String {
if let Some(filename) = filename {
filename.to_string()
} else if let Some(title) = title {
slugify!(title)
} else {
super::DEFAULT_WALLET_FILE.to_string()
}
}

pub enum Store {
Resident,
Storage(Storage),
Expand All @@ -38,8 +49,7 @@ impl LocalStoreInner {
// log_info!("LocalStoreInner::try_create: folder: {}, args: {:?}, is_resident: {}", folder, args, is_resident);

let title = args.title.clone();

let filename = args.filename.clone().unwrap_or(super::DEFAULT_WALLET_FILE.to_string());
let filename = make_filename(&title, &args.filename);

let storage = Storage::try_new_with_folder(folder, &format!("{filename}.wallet"))?;
if storage.exists().await? && !args.overwrite_wallet {
Expand All @@ -62,7 +72,7 @@ impl LocalStoreInner {
}

pub async fn try_load(ctx: &Arc<dyn AccessContextT>, folder: &str, args: OpenArgs) -> Result<Self> {
let filename = args.filename.unwrap_or(super::DEFAULT_WALLET_FILE.to_string());
let filename = make_filename(&None, &args.filename);
let storage = Storage::try_new_with_folder(folder, &format!("{filename}.wallet"))?;

let secret = ctx.wallet_secret().await;
Expand Down

0 comments on commit a3a95d3

Please sign in to comment.