alloy_dyn_abi/eip712/
mod.rs1pub mod parser;
11
12mod typed_data;
13pub use typed_data::{Eip712Types, TypedData};
14
15mod resolver;
16pub use resolver::{PropertyDef, Resolver, TypeDef};
17
18pub(crate) mod coerce;
19
20#[cfg(test)]
21mod test {
22 use super::*;
23 use alloy_primitives::B256;
24 use alloy_sol_types::SolStruct;
25
26 #[test]
27 fn repro_i128() {
28 alloy_sol_types::sol! {
29 #[derive(serde::Serialize)]
30 struct Order {
31 bytes32 sender;
32 int128 priceX18;
33 int128 amount;
34 uint64 expiration;
35 uint64 nonce;
36 }
37 }
38
39 let msg = Order {
40 sender: B256::repeat_byte(3),
41 priceX18: -1000000000000000,
42 amount: 2,
43 expiration: 3,
44 nonce: 4,
45 };
46
47 let domain = Default::default();
48
49 let static_sh = msg.eip712_signing_hash(&domain);
50
51 let fromst = TypedData::from_struct(&msg, Some(domain));
52 let dyn_sh = fromst.eip712_signing_hash();
53 assert_eq!(static_sh, dyn_sh.unwrap());
54 }
55}