pm_utils_cli/
lib.rs

1pub mod client;
2pub mod constants;
3pub mod storage;
4
5pub use client::*;
6pub use constants::*;
7pub use storage::*;
8
9use anyhow::Context;
10
11pub fn str_to_felt(input: &str) -> u64 {
12    input
13        .bytes()
14        .fold(0u64, |acc, byte| (acc << 8) | (byte as u64))
15}
16
17pub fn hex_to_decimal(hex_string: &str) -> anyhow::Result<u64> {
18    // Remove "0x" or "0X" prefix if present
19    let hex_without_prefix = hex_string.trim_start_matches("0x").trim_start_matches("0X");
20
21    // Convert to decimal
22    u64::from_str_radix(hex_without_prefix, 16).context("Converting hex")
23}