@@ -218,15 +218,6 @@ pub struct LegacyParentLocation {
218
218
pub remark : String ,
219
219
}
220
220
221
- #[ serde_as]
222
- #[ derive( Debug , Clone , Deserialize ) ]
223
- #[ cfg_attr( feature = "no_unknown_fields" , serde( deny_unknown_fields) ) ]
224
- pub struct LegacyContractCode {
225
- #[ serde_as( as = "Vec<UfeHex>" ) ]
226
- pub bytecode : Vec < FieldElement > ,
227
- pub abi : Option < Vec < RawLegacyAbiEntry > > ,
228
- }
229
-
230
221
#[ derive( Debug , Clone ) ]
231
222
pub enum RawLegacyAbiEntry {
232
223
Constructor ( RawLegacyConstructor ) ,
@@ -985,76 +976,4 @@ mod tests {
985
976
986
977
assert_eq ! ( original_text, serialized) ;
987
978
}
988
-
989
- #[ test]
990
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen_test:: wasm_bindgen_test) ]
991
- fn test_contract_code_deser ( ) {
992
- let raw = include_str ! ( "../../../test-data/raw_gateway_responses/get_code/1_code.txt" ) ;
993
-
994
- let cc: LegacyContractCode = serde_json:: from_str ( raw) . unwrap ( ) ;
995
- let abi = cc. abi . unwrap ( ) ;
996
-
997
- assert_eq ! ( cc. bytecode. len( ) , 1347 ) ;
998
- if let RawLegacyAbiEntry :: Constructor ( c) = & abi[ 0 ] {
999
- assert_eq ! ( c. name, "constructor" ) ;
1000
- assert_eq ! ( c. inputs. len( ) , 2 ) ;
1001
- } else {
1002
- panic ! ( "Did not deserialize AbiEntry::Constructor properly" )
1003
- }
1004
-
1005
- if let RawLegacyAbiEntry :: Function ( f) = & abi[ 1 ] {
1006
- assert_eq ! ( f. name, "execute" ) ;
1007
- assert_eq ! ( f. inputs. len( ) , 5 ) ;
1008
- assert_eq ! ( f. state_mutability, None ) ;
1009
- } else {
1010
- panic ! ( "Did not deserialize AbiEntry::Function properly" ) ;
1011
- }
1012
-
1013
- if let RawLegacyAbiEntry :: Function ( f) = & abi[ 9 ] {
1014
- assert_eq ! ( f. name, "is_valid_signature" ) ;
1015
- assert_eq ! ( f. inputs. len( ) , 3 ) ;
1016
- assert_eq ! ( f. state_mutability, Some ( FunctionStateMutability :: View ) ) ;
1017
- } else {
1018
- panic ! ( "Did not deserialize AbiEntry::Function properly" ) ;
1019
- }
1020
- }
1021
-
1022
- #[ test]
1023
- #[ cfg_attr( target_arch = "wasm32" , wasm_bindgen_test:: wasm_bindgen_test) ]
1024
- fn test_contract_code_deser_all_abi_types ( ) {
1025
- // $ curl "https://alpha4.starknet.io/feeder_gateway/get_code?contractAddress=0x06ef97a90be1c0458f6e7bd1faf05021f2d81211f658155df0c5c97a39eb2d12"
1026
- // Contract built from: https://github.com/starkware-libs/cairo-lang/blob/3d33c4e829a87bc3d88cf04ed6a489e788918b8b/src/starkware/starknet/compiler/starknet_preprocessor_test.py#L143
1027
- let raw =
1028
- include_str ! ( "../../../test-data/raw_gateway_responses/get_code/2_all_abi_types.txt" ) ;
1029
- let cc: LegacyContractCode = serde_json:: from_str ( raw) . unwrap ( ) ;
1030
- let abi = cc. abi . unwrap ( ) ;
1031
-
1032
- if let RawLegacyAbiEntry :: Struct ( s) = & abi[ 0 ] {
1033
- assert_eq ! ( s. name, "ExternalStruct3" ) ;
1034
- assert_eq ! ( s. size, 1 ) ;
1035
- } else {
1036
- panic ! ( "Did not deserialize AbiEntry::Struct properly" ) ;
1037
- }
1038
-
1039
- if let RawLegacyAbiEntry :: Constructor ( c) = & abi[ 3 ] {
1040
- assert_eq ! ( c. name, "constructor" ) ;
1041
- } else {
1042
- panic ! ( "Did not deserialize AbiEntry::Constructor properly" ) ;
1043
- }
1044
-
1045
- if let RawLegacyAbiEntry :: Function ( f) = & abi[ 5 ] {
1046
- assert_eq ! ( f. name, "g" ) ;
1047
- assert_eq ! ( f. outputs. len( ) , 1 ) ;
1048
- assert_eq ! ( f. state_mutability, Some ( FunctionStateMutability :: View ) ) ;
1049
- } else {
1050
- panic ! ( "Did not deserialize AbiEntry::Function properly" ) ;
1051
- }
1052
-
1053
- if let RawLegacyAbiEntry :: L1Handler ( h) = & abi[ 6 ] {
1054
- assert_eq ! ( h. name, "handler" ) ;
1055
- assert_eq ! ( h. inputs. len( ) , 2 ) ;
1056
- } else {
1057
- panic ! ( "Did not deserialize AbiEntry::L1Handler properly" ) ;
1058
- }
1059
- }
1060
979
}
0 commit comments