fix: convert tuple arguments to tuples (#363)
This commit is contained in:
parent
59de685455
commit
9d38d1a412
|
@ -1,5 +1,6 @@
|
||||||
use super::{types, util, Context};
|
use super::{types, util, Context};
|
||||||
use anyhow::{anyhow, Context as _, Result};
|
use anyhow::{anyhow, Context as _, Result};
|
||||||
|
use ethers_core::abi::ParamType;
|
||||||
use ethers_core::{
|
use ethers_core::{
|
||||||
abi::{Function, FunctionExt, Param, StateMutability},
|
abi::{Function, FunctionExt, Param, StateMutability},
|
||||||
types::Selector,
|
types::Selector,
|
||||||
|
@ -76,7 +77,16 @@ pub(crate) fn expand_inputs_call_arg(inputs: &[Param]) -> TokenStream {
|
||||||
let names = inputs
|
let names = inputs
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(i, param)| util::expand_input_name(i, ¶m.name))
|
.map(|(i, param)| {
|
||||||
|
let name = util::expand_input_name(i, ¶m.name);
|
||||||
|
match param.kind {
|
||||||
|
ParamType::Tuple(_) => {
|
||||||
|
// make sure the tuple gets converted to `Token::Tuple`
|
||||||
|
quote! {(#name,)}
|
||||||
|
}
|
||||||
|
_ => name,
|
||||||
|
}
|
||||||
|
})
|
||||||
.collect::<Vec<TokenStream>>();
|
.collect::<Vec<TokenStream>>();
|
||||||
match names.len() {
|
match names.len() {
|
||||||
0 => quote! { () },
|
0 => quote! { () },
|
||||||
|
|
Loading…
Reference in New Issue