1- use alloy:: primitives:: { Address , AddressError } ;
21use chrono:: { DateTime , FixedOffset } ;
32use sea_orm:: entity:: prelude:: * ;
4- use sea_orm_newtype:: DeriveNewType ;
53use serde:: { Deserialize , Serialize } ;
64
5+ use crate :: types:: AddressWrapper ;
6+
77#[ derive( Clone , Debug , PartialEq , DeriveEntityModel , Eq , Serialize , Deserialize ) ]
88#[ sea_orm( table_name = "autoallocations" ) ]
99pub struct Model {
@@ -16,26 +16,3 @@ pub struct Model {
1616pub enum Relation { }
1717
1818impl ActiveModelBehavior for ActiveModel { }
19-
20- #[ derive( Clone , Debug , PartialEq , DeriveNewType , Eq , Serialize , Deserialize ) ]
21- #[ sea_orm_newtype( try_from_into = "String" , primary_key) ]
22- pub struct AddressWrapper ( pub Address ) ;
23-
24- impl TryFrom < String > for AddressWrapper {
25- type Error = AddressError ;
26- fn try_from ( value : String ) -> Result < Self , Self :: Error > {
27- Ok ( AddressWrapper ( Address :: parse_checksummed ( value, None ) ?) )
28- }
29- }
30-
31- impl From < AddressWrapper > for String {
32- fn from ( value : AddressWrapper ) -> Self {
33- value. 0 . to_checksum ( None )
34- }
35- }
36-
37- impl From < Address > for AddressWrapper {
38- fn from ( value : Address ) -> Self {
39- AddressWrapper ( value)
40- }
41- }
0 commit comments