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 Nov 7, 2023
1 parent 16c4f0e commit fffe963
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions bindings/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ impl WalletOptions {
self
}

pub fn with_storage_path(mut self, storage_path: impl Into<Option<String>>) -> Self {
self.storage_path = storage_path.into();
pub fn with_alias(mut self, alias: impl Into<Option<String>>) -> Self {
self.alias = alias.into();
self
}

pub fn with_client_options(mut self, client_options: impl Into<Option<ClientOptions>>) -> Self {
self.client_options = client_options.into();
pub fn with_bip_path(mut self, bip_path: impl Into<Option<Bip44>>) -> Self {
self.bip_path = bip_path.into();
self
}

pub fn with_bip_path(mut self, bip_path: impl Into<Option<Bip44>>) -> Self {
self.bip_path = bip_path.into();
pub fn with_client_options(mut self, client_options: impl Into<Option<ClientOptions>>) -> Self {
self.client_options = client_options.into();
self
}

Expand All @@ -78,21 +78,19 @@ impl WalletOptions {
self
}

pub fn with_storage_path(mut self, storage_path: impl Into<Option<String>>) -> Self {
self.storage_path = storage_path.into();
self
}

pub async fn build(self) -> iota_sdk::wallet::Result<Wallet> {
log::debug!("wallet options: {self:?}");
let mut builder = Wallet::builder()
.with_client_options(self.client_options)
.with_bip_path(self.bip_path);
.with_address(self.address)
.with_alias(self.alias)
.with_bip_path(self.bip_path)
.with_client_options(self.client_options);

if let Some(address) = self.address {
builder = builder.with_address(address);
}
if let Some(alias) = self.alias {
builder = builder.with_alias(alias);
}
if let Some(bip_path) = self.bip_path {
builder = builder.with_bip_path(bip_path);
}
#[cfg(feature = "storage")]
if let Some(storage_path) = &self.storage_path {
builder = builder.with_storage_path(storage_path);
Expand Down

0 comments on commit fffe963

Please sign in to comment.