fix(solc): when compiler-out metadata is empty and there's no `internalType` (#1182)

* add another compiler-out with fixes

* update changelog
This commit is contained in:
joshieDo 2022-04-27 16:37:09 +04:00 committed by GitHub
parent 6faceb20d7
commit a0f41c51af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56279 additions and 2 deletions

View File

@ -111,6 +111,7 @@
- Add support for library linking and make `Bytecode`'s `object` filed an - Add support for library linking and make `Bytecode`'s `object` filed an
`enum BytecodeObject` [#656](https://github.com/gakonst/ethers-rs/pull/656). `enum BytecodeObject` [#656](https://github.com/gakonst/ethers-rs/pull/656).
- Nit: remove accidentally doubled double-quotes in an error message - Nit: remove accidentally doubled double-quotes in an error message
- Fix when compiler-out metadata is empty and there's no internalType [#1182](https://github.com/gakonst/ethers-rs/pull/1182)
### 0.6.0 ### 0.6.0

View File

@ -761,7 +761,7 @@ pub struct SolcAbi {
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Item { pub struct Item {
#[serde(rename = "internalType")] #[serde(rename = "internalType")]
pub internal_type: String, pub internal_type: Option<String>,
pub name: String, pub name: String,
#[serde(rename = "type")] #[serde(rename = "type")]
pub put_type: String, pub put_type: String,
@ -1081,7 +1081,13 @@ pub struct UserDoc {
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub kind: Option<String>, pub kind: Option<String>,
#[serde(default, skip_serializing_if = "::std::collections::BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "::std::collections::BTreeMap::is_empty")]
pub methods: BTreeMap<String, BTreeMap<String, String>>, pub methods: BTreeMap<String, MethodNotice>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub notice: Option<String>,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq)]
pub struct MethodNotice {
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
pub notice: Option<String>, pub notice: Option<String>,
} }

View File

@ -63,6 +63,10 @@ pub mod json_string_opt {
T: DeserializeOwned, T: DeserializeOwned,
{ {
if let Some(s) = Option::<String>::deserialize(deserializer)? { if let Some(s) = Option::<String>::deserialize(deserializer)? {
if s.is_empty() {
return Ok(None)
}
serde_json::from_str(&s).map_err(de::Error::custom).map(Some) serde_json::from_str(&s).map_err(de::Error::custom).map(Some)
} else { } else {
Ok(None) Ok(None)

File diff suppressed because one or more lines are too long