fix(abigen): support functions with different casing (#972)
This commit is contained in:
parent
133c32d64a
commit
10fcf60791
|
@ -342,7 +342,7 @@ impl Context {
|
||||||
let mut all_functions = HashMap::new();
|
let mut all_functions = HashMap::new();
|
||||||
for function in self.abi.functions() {
|
for function in self.abi.functions() {
|
||||||
all_functions
|
all_functions
|
||||||
.entry(function.name.to_lowercase())
|
.entry(util::safe_snake_case_ident(&function.name))
|
||||||
.or_insert_with(Vec::new)
|
.or_insert_with(Vec::new)
|
||||||
.push(function);
|
.push(function);
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,6 +427,23 @@ fn can_generate_nested_types() {
|
||||||
assert_eq!(call, decoded_call);
|
assert_eq!(call, decoded_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_handle_different_calls() {
|
||||||
|
abigen!(
|
||||||
|
Test,
|
||||||
|
r#"[
|
||||||
|
function fooBar()
|
||||||
|
function FOO_BAR()
|
||||||
|
]"#,
|
||||||
|
);
|
||||||
|
|
||||||
|
let (client, _mock) = Provider::mocked();
|
||||||
|
let contract = Test::new(Address::default(), Arc::new(client));
|
||||||
|
|
||||||
|
let _ = contract.fooBar();
|
||||||
|
let _ = contract.FOO_BAR();
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_handle_case_sensitive_calls() {
|
fn can_handle_case_sensitive_calls() {
|
||||||
abigen!(
|
abigen!(
|
||||||
|
|
Loading…
Reference in New Issue