Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix(abigen): make compatible with older rust versions #1868

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ethers-contract/ethers-contract-abigen/src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,11 @@ impl MultiBindingsInner {
let data = std::fs::read_to_string(cargo_dir)?;
let toml = data.parse::<Value>()?;

let Some(ethers) = toml.get("dependencies")
.and_then (|v| v.get("ethers").or_else(|| v.get("ethers-contract")))
else { eyre::bail!("couldn't find ethers or ethers-contract dependency")};
let ethers = toml
.get("dependencies")
.and_then(|v| v.get("ethers").or_else(|| v.get("ethers-contract")))
.ok_or_else(|| eyre::eyre!("couldn't find ethers or ethers-contract dependency"))?;

if let Some(rev) = ethers.get("rev") {
Ok(format!("ethers = {{ git = \"https://github.com/gakonst/ethers-rs\", rev = {}, default-features = false, features = [\"abigen\"] }}", rev))
} else if let Some(version) = ethers.get("version") {
Expand Down