Skip to content

Commit bedaa37

Browse files
authored
feat: remove deprecated feeder gateway methods (#516)
1 parent fec81d1 commit bedaa37

File tree

11 files changed

+39
-1338
lines changed

11 files changed

+39
-1338
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
**Complete Starknet library in Rust[](https://www.reddit.com/r/rust/comments/12e7tdb/rust_trademark_policy_feedback_form/)**
77

8-
![starknet-version-v0.12.1](https://img.shields.io/badge/Starknet_Version-v0.12.1-2ea44f?logo=ethereum)
8+
![starknet-version-v0.12.3](https://img.shields.io/badge/Starknet_Version-v0.12.3-2ea44f?logo=ethereum)
99
[![jsonrpc-spec-v0.5.1](https://img.shields.io/badge/JSON--RPC-v0.5.1-2ea44f?logo=ethereum)](https://github.com/starkware-libs/starknet-specs/tree/v0.5.1)
1010
[![linting-badge](https://github.com/xJonathanLEI/starknet-rs/actions/workflows/lint.yaml/badge.svg?branch=master)](https://github.com/xJonathanLEI/starknet-rs/actions/workflows/lint.yaml)
1111
[![crates-badge](https://img.shields.io/crates/v/starknet.svg)](https://crates.io/crates/starknet)

starknet-core/src/types/contract/legacy.rs

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,6 @@ pub struct LegacyParentLocation {
218218
pub remark: String,
219219
}
220220

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-
230221
#[derive(Debug, Clone)]
231222
pub enum RawLegacyAbiEntry {
232223
Constructor(RawLegacyConstructor),
@@ -985,76 +976,4 @@ mod tests {
985976

986977
assert_eq!(original_text, serialized);
987978
}
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-
}
1060979
}

0 commit comments

Comments
 (0)