From e15252dd8f4a92990b32f248a63ba0f065b21422 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 29 Nov 2021 15:31:39 +0100 Subject: [PATCH] fix: conditional http support (#632) * fix: conditional http support * chore: update changelog Co-authored-by: Georgios Konstantopoulos --- CHANGELOG.md | 19 ++++++++++++++++--- .../ethers-contract-abigen/src/source.rs | 7 +++++++ .../ethers-contract-abigen/src/util.rs | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29c82cf7..c3bb4800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,18 +2,24 @@ ## ethers-core -- Change types mapping for solidity `bytes` to rust `ethers::core::Bytes` and solidity `uint8[]` to rust `Vec`. +### Unreleased + +- Change types mapping for solidity `bytes` to rust `ethers::core::Bytes` and + solidity `uint8[]` to rust `Vec`. [613](https://github.com/gakonst/ethers-rs/pull/613) - Fix `format_units` to return a `String` of representing a decimal point float such that the decimal places don't get truncated. [597](https://github.com/gakonst/ethers-rs/pull/597) -- Implement hex display format for `ethers::core::Bytes` [#624](https://github.com/gakonst/ethers-rs/pull/624). +- Implement hex display format for `ethers::core::Bytes` + [#624](https://github.com/gakonst/ethers-rs/pull/624). ## ethers-solc -- Return cached artifacts from project `compile` when the cache only contains some files ### Unreleased +- Return cached artifacts from project `compile` when the cache only contains + some files + ### 0.6.0 - move `AbiEncode` `AbiDecode` trait to ethers-core and implement for core types @@ -82,6 +88,13 @@ ## ethers-contract +### Unreleased + +- fix Etherscan conditional HTTP support + [#632](https://github.com/gakonst/ethers-rs/pull/632) +- use `CARGO_MANIFEST_DIR` as root for relative paths in abigen + [#631](https://github.com/gakonst/ethers-rs/pull/631) + ### 0.6.0 - Provide a way to opt out of networking support in abigen proc macro with diff --git a/ethers-contract/ethers-contract-abigen/src/source.rs b/ethers-contract/ethers-contract-abigen/src/source.rs index ec464faa..668154c5 100644 --- a/ethers-contract/ethers-contract-abigen/src/source.rs +++ b/ethers-contract/ethers-contract-abigen/src/source.rs @@ -279,4 +279,11 @@ mod tests { let hardhat_parsed = Source::parse(&hardhat_src).unwrap(); assert_eq!(hardhat_parsed, Source::String(hardhat_src)); } + + #[test] + #[ignore] + fn get_etherscan_contract() { + let source = Source::etherscan("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap(); + let _dai = source.get().unwrap(); + } } diff --git a/ethers-contract/ethers-contract-abigen/src/util.rs b/ethers-contract/ethers-contract-abigen/src/util.rs index 3252e047..f9435a51 100644 --- a/ethers-contract/ethers-contract-abigen/src/util.rs +++ b/ethers-contract/ethers-contract-abigen/src/util.rs @@ -74,7 +74,7 @@ where /// Perform an HTTP GET request and return the contents of the response. pub fn http_get(_url: &str) -> Result { cfg_if! { - if #[cfg(any(not(target_arch = "wasm32"), not(features = "reqwest")))]{ + if #[cfg(any(target_arch = "wasm32", not(feature = "reqwest")))]{ Err(anyhow!("HTTP is unsupported")) } else { Ok(reqwest::blocking::get(_url)?.text()?)