Skip to content
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

chore: clearer error message when function signature does not contain parentheses #9478

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/cli/src/utils/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ pub async fn parse_function_args<T: Transport + Clone, P: Provider<T, AnyNetwork
let args = resolve_name_args(&args, provider).await;

if let Ok(data) = hex::decode(sig) {
return Ok((data, None))
return Ok((data, None));
}

let func = if sig.contains('(') {
// a regular function signature with parentheses
get_func(sig)?
} else {
let etherscan_api_key = etherscan_api_key.ok_or_eyre(
"If you wish to fetch function data from EtherScan, please provide an API key.",
"Function signature does not contain parentheses. If you wish to fetch function data from EtherScan, please provide an API key.",
yipu3 marked this conversation as resolved.
Show resolved Hide resolved
)?;
let to = to.ok_or_eyre("A 'to' address must be provided to fetch function data.")?;
get_func_etherscan(sig, to, &args, chain, etherscan_api_key).await?
Expand Down
Loading