@@ -20,7 +20,7 @@ lazy_static! {
2020 static ref ARWEAVE_REGEX : regex:: Regex =
2121 regex:: Regex :: new( r"^ar://(.+)" ) . expect( "should be a valid regex" ) ;
2222 static ref EIP155_REGEX : regex:: Regex =
23- regex:: Regex :: new( r"eip155:([0-9]+)/(erc1155|erc721):0x([0-9a-fA-F]{40})/([0-9]+)" )
23+ regex:: Regex :: new( r"(?i: eip155) :([0-9]+)/(?i:( erc1155|erc721) ):0x([0-9a-fA-F]{40})/([0-9]+)" )
2424 . expect( "should be a valid regex" ) ;
2525}
2626#[ derive( Error , Debug ) ]
@@ -71,12 +71,15 @@ pub async fn decode(data: &[u8], state: &LookupState) -> Result<String, ENSLooku
7171 return Ok ( value. to_string ( ) ) ;
7272 } ;
7373
74+ info ! ( "EIP155: {captures:?}" ) ;
75+
7476 let ( Some ( chain_id) , Some ( contract_type) , Some ( contract_address) , Some ( token_id) ) = (
7577 captures. get ( 1 ) ,
7678 captures. get ( 2 ) ,
7779 captures. get ( 3 ) ,
7880 captures. get ( 4 ) ,
7981 ) else {
82+ info ! ( "Failed to decode EIP155: {value}" ) ;
8083 return Err ( ENSLookupError :: AbiDecodeError ) ;
8184 } ;
8285
@@ -88,7 +91,7 @@ pub async fn decode(data: &[u8], state: &LookupState) -> Result<String, ENSLooku
8891 let token_id = U256 :: from_dec_str ( token_id. as_str ( ) )
8992 . map_err ( |err| ImageLookupError :: FormatError ( err. to_string ( ) ) ) ?;
9093
91- let contract_type = match contract_type. as_str ( ) {
94+ let contract_type = match contract_type. as_str ( ) . to_lowercase ( ) . as_str ( ) {
9295 "erc721" => EIP155ContractType :: ERC721 ,
9396 "erc1155" => EIP155ContractType :: ERC1155 ,
9497 _ => return Err ( ImageLookupError :: FormatError ( "invalid contract type" . to_string ( ) ) . into ( ) ) ,
0 commit comments