fix: conditional http support (#632)

* fix: conditional http support

* chore: update changelog

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
Matthias Seitz 2021-11-29 15:31:39 +01:00 committed by GitHub
parent f6e803b4eb
commit e15252dd8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View File

@ -2,18 +2,24 @@
## ethers-core ## ethers-core
- Change types mapping for solidity `bytes` to rust `ethers::core::Bytes` and solidity `uint8[]` to rust `Vec<u8>`. ### Unreleased
- Change types mapping for solidity `bytes` to rust `ethers::core::Bytes` and
solidity `uint8[]` to rust `Vec<u8>`.
[613](https://github.com/gakonst/ethers-rs/pull/613) [613](https://github.com/gakonst/ethers-rs/pull/613)
- Fix `format_units` to return a `String` of representing a decimal point float - Fix `format_units` to return a `String` of representing a decimal point float
such that the decimal places don't get truncated. such that the decimal places don't get truncated.
[597](https://github.com/gakonst/ethers-rs/pull/597) [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 ## ethers-solc
- Return cached artifacts from project `compile` when the cache only contains some files
### Unreleased ### Unreleased
- Return cached artifacts from project `compile` when the cache only contains
some files
### 0.6.0 ### 0.6.0
- move `AbiEncode` `AbiDecode` trait to ethers-core and implement for core types - move `AbiEncode` `AbiDecode` trait to ethers-core and implement for core types
@ -82,6 +88,13 @@
## ethers-contract ## 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 ### 0.6.0
- Provide a way to opt out of networking support in abigen proc macro with - Provide a way to opt out of networking support in abigen proc macro with

View File

@ -279,4 +279,11 @@ mod tests {
let hardhat_parsed = Source::parse(&hardhat_src).unwrap(); let hardhat_parsed = Source::parse(&hardhat_src).unwrap();
assert_eq!(hardhat_parsed, Source::String(hardhat_src)); 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();
}
} }

View File

@ -74,7 +74,7 @@ where
/// Perform an HTTP GET request and return the contents of the response. /// Perform an HTTP GET request and return the contents of the response.
pub fn http_get(_url: &str) -> Result<String> { pub fn http_get(_url: &str) -> Result<String> {
cfg_if! { 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")) Err(anyhow!("HTTP is unsupported"))
} else { } else {
Ok(reqwest::blocking::get(_url)?.text()?) Ok(reqwest::blocking::get(_url)?.text()?)