Skip to content

Commit

Permalink
Add dry run mode setters
Browse files Browse the repository at this point in the history
  • Loading branch information
karbyshev committed Apr 25, 2024
1 parent e806aa0 commit 06ad240
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/apps/src/lib/cli/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ impl Context {
.unwrap_or_else(|| safe_exit_on_missing_chain_context())
}

/// Switch the wallet into dry run mode
pub fn set_dry_run(&mut self) -> () {
self.chain
.as_mut()
.unwrap_or_else(|| safe_exit_on_missing_chain_context())
.wallet
.set_dry_run()
.unwrap_or_else(|err| {
eprintln!("Failed to load wallet store: {}", err);
utils::safe_exit(1)
})
}

/// Make an implementation of Namada from this object and parameters.
pub fn to_sdk<C, IO>(self, client: C, io: IO) -> impl Namada
where
Expand Down
4 changes: 4 additions & 0 deletions crates/sdk/src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ impl<U: WalletStorage> Wallet<U> {
self.utils.save(self)
}

pub fn set_dry_run(&mut self) -> Result<(), LoadStoreError> {
self.utils.clone().load_in_mem(self)
}

/// Add validator data to the store
pub fn add_validator_data_atomic(
&mut self,
Expand Down

0 comments on commit 06ad240

Please sign in to comment.