fix(abi): change abiarraytype trait bounds for tuple (#1079)
This commit is contained in:
parent
3c0d8c36dd
commit
a43a9b8806
|
@ -572,3 +572,14 @@ fn can_derive_ethcall_for_bytes() {
|
||||||
|
|
||||||
assert_ethcall::<BatchCall>();
|
assert_ethcall::<BatchCall>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_derive_array_tuples() {
|
||||||
|
#[derive(Clone, Debug, Default, Eq, PartialEq, EthEvent, EthDisplay)]
|
||||||
|
#[ethevent(name = "DiamondCut", abi = "DiamondCut((address,uint8,bytes4[])[],address,bytes)")]
|
||||||
|
pub struct DiamondCutFilter {
|
||||||
|
pub diamond_cut: Vec<(Address, u8, Vec<[u8; 4]>)>,
|
||||||
|
pub init: Address,
|
||||||
|
pub calldata: Bytes,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -252,4 +252,12 @@ mod tests {
|
||||||
let v = vec![bytes];
|
let v = vec![bytes];
|
||||||
assert_codec(v);
|
assert_codec(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tuple_array() {
|
||||||
|
let nested: Vec<[u8; 4]> = vec![[0, 0, 0, 1]];
|
||||||
|
assert_codec(nested.clone());
|
||||||
|
let tuple: Vec<(Address, u8, Vec<[u8; 4]>)> = vec![(Address::random(), 0, nested)];
|
||||||
|
assert_codec(tuple);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ macro_rules! impl_abi_type_tuple {
|
||||||
|
|
||||||
impl<$($ty, )+> AbiArrayType for ($($ty,)+) where
|
impl<$($ty, )+> AbiArrayType for ($($ty,)+) where
|
||||||
$(
|
$(
|
||||||
$ty: AbiArrayType,
|
$ty: AbiType,
|
||||||
)+ {}
|
)+ {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue