Skip to content

Commit

Permalink
Update for changed interface of 'pricing_mode' enum (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-ch authored Jul 22, 2024
1 parent 3adc5f3 commit 5156a1d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/transaction/creation_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ pub(super) mod pricing_mode {
}

#[derive(Debug, Clone, Copy)]
pub(super) enum PricingMode {
pub enum PricingMode {
Classic,
Reserved,
Fixed,
Expand All @@ -464,6 +464,14 @@ pub(super) mod pricing_mode {
const CLASSIC: &'static str = "classic";
const RESERVED: &'static str = "reserved";
const FIXED: &'static str = "fixed";

pub(crate) fn as_str(&self) -> &str {
match self {
Self::Classic => Self::CLASSIC,
Self::Reserved => Self::RESERVED,
Self::Fixed => Self::FIXED,
}
}
}

impl ValueEnum for PricingMode {
Expand Down Expand Up @@ -1913,7 +1921,7 @@ pub(super) fn build_transaction_str_params(
initiator_addr,
session_args_simple,
session_args_json,
pricing_mode: maybe_pricing_mode,
pricing_mode: maybe_pricing_mode.map(|pm| pm.as_str()).unwrap_or_default(),
output_path: maybe_output_path,
payment_amount,
gas_price_tolerance,
Expand All @@ -1927,7 +1935,7 @@ pub(super) fn build_transaction_str_params(
ttl,
chain_name,
initiator_addr,
pricing_mode: maybe_pricing_mode,
pricing_mode: maybe_pricing_mode.map(|pm| pm.as_str()).unwrap_or_default(),
output_path: maybe_output_path,
payment_amount,
gas_price_tolerance,
Expand Down

0 comments on commit 5156a1d

Please sign in to comment.