Skip to content

Commit

Permalink
feat: adding to_amount implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
geekbrother committed Dec 11, 2024
1 parent 10a7d9c commit 6b1cb8d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/yttrium/src/chain_abstraction/api/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ pub struct InitialTransactionMetadata {
pub decimals: u8,
}

impl InitialTransactionMetadata {
pub fn to_amount(&self) -> Amount {
Amount::new(
self.symbol.clone(),
self.amount,
Unit::new(self.decimals).unwrap(),
)
}
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "uniffi", derive(uniffi_macros::Record))]
#[serde(rename_all = "camelCase")]
Expand Down

0 comments on commit 6b1cb8d

Please sign in to comment.