-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(cast): Add file option for calldata input #10397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cast): Add file option for calldata input #10397
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left couple of comments, please add tests for the new arg. thank you
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
Have pushed test case @grandizzy , please do check them out once free! |
crates/cast/src/args.rs
Outdated
let final_args = if let Some(file_path) = file { | ||
let contents = fs::read_to_string(file_path)?; | ||
let contents = contents.trim(); | ||
vec![contents.to_string()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct as it treats the entire file as a single argument. It should split the string into arguments using .lines().collect()
. This should also be done above in AbiEncode since it's a similar command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool , done
Have made those changes , do check them out @DaniPopes |
let contents = fs::read_to_string(file_path)?; | ||
contents | ||
.lines() | ||
.map(str::trim) | ||
.filter(|line| !line.is_empty()) | ||
.map(String::from) | ||
.collect() | ||
} else { | ||
args | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks alright to me,
having 1 line per arg seems okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, lgtm
This should also be added to abi encode above |
This issue should close #10013 .
Hello @yash-atreya @zerosnacks @grandizzy please review it once free!