Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Apr 2, 2024
1 parent 7775003 commit 91fa74e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/args/src/opts/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl DisplayOptions {
self.display_json(
serde_json::to_value(&value)?
.get(field)
.context(format!("No such field exist: {field}"))?,
.context(format!("no such field exist: {field}"))?,
)
} else {
self.display_json(&serde_json::to_value(&value)?)
Expand Down
6 changes: 1 addition & 5 deletions crates/args/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use starknet::core::types::{BlockId, BlockTag};
use starknet::core::types::{FieldElement, FromStrError};
use starknet::core::utils::get_selector_from_name;

#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone)]
pub struct BlockIdParser;

impl TypedValueParser for BlockIdParser {
Expand Down Expand Up @@ -125,10 +125,6 @@ pub fn selector_parser(selector: &str) -> eyre::Result<FieldElement> {
}
}

pub fn calldata_parser(calldata: &str) -> eyre::Result<Vec<FieldElement>> {
todo!()
}

// Expected format for keys : 0x124123,0x14123,0x1342
// where each array is a key
pub fn parse_event_keys(value: &str) -> std::result::Result<Vec<FieldElement>, FromStrError> {
Expand Down
6 changes: 4 additions & 2 deletions crates/args/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::PathBuf;

use eyre::Result;
use eyre::{Context, Result};
use starknet::core::{types::FieldElement, utils::cairo_short_string_to_felt};

pub fn parse_hex_or_str_as_felt(data: &str) -> Result<FieldElement> {
Expand All @@ -11,7 +11,9 @@ pub fn parse_hex_or_str_as_felt(data: &str) -> Result<FieldElement> {
}
}

/// Canonicalizes a path and performs both tilde and environment expansions in the default system context.
pub fn canonicalize_path(path: &str) -> Result<PathBuf> {
let path = PathBuf::from(shellexpand::full(path)?.into_owned());
let expanded = shellexpand::full(path).context(format!("failed to expand path {path}"))?;
let path = PathBuf::from(expanded.into_owned());
Ok(dunce::canonicalize(path)?)
}

0 comments on commit 91fa74e

Please sign in to comment.