Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Aug 28, 2023
1 parent b5fa32d commit 938cdda
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
account::{AccountDetails, AccountDetailsDto},
migration::{
chrysalis::{key_to_chrysalis_key, migrate_from_chrysalis_data},
latest_backup_migration_version, migrate, MigrationVersion, MIGRATION_VERSION_KEY,
latest_backup_migration_version, migrate, MigrationData, MIGRATION_VERSION_KEY,
},
storage::constants::{CHRYSALIS_STORAGE_KEY, WALLET_INDEXATION_KEY},
ClientOptions, Wallet,
Expand Down Expand Up @@ -200,11 +200,7 @@ async fn migrate_snapshot_from_chrysalis_to_stardust(
}

// set db migration version
let migration_version = MigrationVersion {
id: 4,
sdk_version: "1.0.0-rc.0".to_string(),
date: time::macros::date!(2023 - 07 - 19),
};
let migration_version = crate::wallet::migration::migrate_4::Migrate::version();
stronghold_adapter
.set(MIGRATION_VERSION_KEY, &migration_version)
.await?;
Expand Down
12 changes: 4 additions & 8 deletions sdk/src/wallet/migration/chrysalis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
collections::{HashMap, HashSet},
convert::TryInto,
io::Read,
path::Path,
path::{Path, PathBuf},
str::FromStr,
};

Expand All @@ -22,7 +22,7 @@ use crate::{
client::{constants::IOTA_COIN_TYPE, Password},
types::block::address::Bech32Address,
wallet::{
migration::{MigrationVersion, MIGRATION_VERSION_KEY},
migration::{MigrationData, MIGRATION_VERSION_KEY},
storage::constants::{
ACCOUNTS_INDEXATION_KEY, ACCOUNT_INDEXATION_KEY, CHRYSALIS_STORAGE_KEY, SECRET_MANAGER_KEY,
WALLET_INDEXATION_KEY,
Expand Down Expand Up @@ -59,7 +59,7 @@ pub(crate) struct AccountDetailsDto {
}

pub async fn migrate_db_chrysalis_to_stardust(
storage_path: impl Into<String> + Send,
storage_path: impl Into<PathBuf> + Send,
password: Option<Password>,
) -> Result<()> {
let storage_path_string = storage_path.into();
Expand Down Expand Up @@ -118,11 +118,7 @@ pub async fn migrate_db_chrysalis_to_stardust(
}

// set db migration version
let migration_version = MigrationVersion {
id: 4,
sdk_version: "1.0.0-rc.0".to_string(),
date: time::macros::date!(2023 - 07 - 19),
};
let migration_version = crate::wallet::migration::migrate_4::Migrate::version();
stardust_db.put(MIGRATION_VERSION_KEY, serde_json::to_string(&migration_version)?)?;

drop(stardust_db);
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/wallet/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod migrate_0;
mod migrate_1;
mod migrate_2;
mod migrate_3;
mod migrate_4;
pub(crate) mod migrate_4;

use std::collections::HashMap;

Expand Down

0 comments on commit 938cdda

Please sign in to comment.