Skip to content

Commit

Permalink
feat: add backup and restore functionality
Browse files Browse the repository at this point in the history
doc: add documentation for backup/restore

fmt

fix: simplify backup command
  • Loading branch information
yse committed Apr 20, 2024
1 parent f138f6a commit 2a9bba4
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 63 deletions.
20 changes: 10 additions & 10 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ pub(crate) enum Command {
GetInfo,
/// Empties the encrypted wallet transaction cache
EmptyCache,
/// Backs up the current pending swaps
Backup,
/// Retrieve a list of backups
Restore {
#[arg(short, long)]
backup_path: Option<String>,
},
}

#[derive(Helper, Completer, Hinter, Validator)]
Expand Down Expand Up @@ -151,6 +158,14 @@ pub(crate) fn handle_command(
wallet.empty_wallet_cache()?;
command_result!("Cache emptied successfully")
}
Command::Backup => {
wallet.backup()?;
command_result!("Backup created successfully!")
}
Command::Restore { backup_path } => {
wallet.restore(backup_path)?;
command_result!("Backup restored successfully!")
}
})
}

Expand Down
103 changes: 55 additions & 48 deletions lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ uniffi = "0.27.1"
uniffi_macros = "0.27.1"

[patch.crates-io]
secp256k1-zkp = {git = "https://github.com/BlockstreamResearch/rust-secp256k1-zkp.git", rev = "60e631c24588a0c9e271badd61959294848c665d"}
secp256k1-zkp = {git = "https://github.com/BlockstreamResearch/rust-secp256k1-zkp.git", rev = "60e631c24588a0c9e271badd61959294848c665d"}
4 changes: 2 additions & 2 deletions lib/ls-sdk-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ log = "0.4.20"
lwk_common = "0.3.0"
lwk_signer = "0.3.0"
lwk_wollet = "0.3.0"
rusqlite = "0.29"
rusqlite = { version = "0.31", features = ["backup"] }
rusqlite_migration = "1.0"
serde = { version = "1.0.197", features = ["derive"] }
thiserror = { workspace = true }

[dev-dependencies]
tempdir = "0.3.7"
uuid = { version = "1.8.0", features = ["v4"] }
uuid = { version = "1.8.0", features = ["v4"] }
Loading

0 comments on commit 2a9bba4

Please sign in to comment.