Skip to content

Commit

Permalink
Add helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
abizjak committed Feb 1, 2024
1 parent 7d92715 commit c039d88
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/contract_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,16 @@ pub enum DryRunModuleDeployError {
},
}

impl DryRunModuleDeployError {
/// Check whether dry-run failed because the module already exists.
pub fn already_exists(&self) -> bool {
let Self::Failed(reason) = self else {
return false;
};
matches!(reason, RejectReason::ModuleHashAlreadyExists { .. })
}
}

impl From<RejectReason> for DryRunModuleDeployError {
fn from(value: RejectReason) -> Self { Self::Failed(value) }
}
Expand Down

0 comments on commit c039d88

Please sign in to comment.