fixes: correct etherscan url address, remove double quotes in solc error (#1130)
This commit is contained in:
parent
119956925d
commit
9206efa46c
|
@ -107,6 +107,7 @@
|
||||||
some files
|
some files
|
||||||
- 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
|
||||||
|
|
||||||
### 0.6.0
|
### 0.6.0
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use errors::EtherscanError;
|
use errors::EtherscanError;
|
||||||
use ethers_core::{
|
use ethers_core::{
|
||||||
abi::{Abi, Address},
|
abi::{Abi, Address},
|
||||||
types::Chain,
|
types::{Chain, H256},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod account;
|
pub mod account;
|
||||||
|
@ -247,17 +247,17 @@ impl Client {
|
||||||
|
|
||||||
/// Return the URL for the given address
|
/// Return the URL for the given address
|
||||||
pub fn address_url(&self, address: Address) -> String {
|
pub fn address_url(&self, address: Address) -> String {
|
||||||
format!("{}address/{}", self.etherscan_url, address)
|
format!("{}address/{:?}", self.etherscan_url, address)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the URL for the given transaction hash
|
/// Return the URL for the given transaction hash
|
||||||
pub fn transaction_url(&self, tx_hash: impl AsRef<str>) -> String {
|
pub fn transaction_url(&self, tx_hash: H256) -> String {
|
||||||
format!("{}tx/{}", self.etherscan_url, tx_hash.as_ref())
|
format!("{}tx/{:?}", self.etherscan_url, tx_hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the URL for the given token hash
|
/// Return the URL for the given token hash
|
||||||
pub fn token_url(&self, token_hash: impl AsRef<str>) -> String {
|
pub fn token_url(&self, token_hash: Address) -> String {
|
||||||
format!("{}token/{}", self.etherscan_url, token_hash.as_ref())
|
format!("{}token/{:?}", self.etherscan_url, token_hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute an API POST request with a form
|
/// Execute an API POST request with a form
|
||||||
|
@ -347,7 +347,7 @@ mod tests {
|
||||||
time::{Duration, SystemTime},
|
time::{Duration, SystemTime},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ethers_core::types::{Address, Chain};
|
use ethers_core::types::{Address, Chain, H256};
|
||||||
|
|
||||||
use crate::{Client, EtherscanError};
|
use crate::{Client, EtherscanError};
|
||||||
|
|
||||||
|
@ -372,23 +372,23 @@ mod tests {
|
||||||
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
||||||
let addr: Address = Address::zero();
|
let addr: Address = Address::zero();
|
||||||
let address_url: String = etherscan.address_url(addr);
|
let address_url: String = etherscan.address_url(addr);
|
||||||
assert_eq!(address_url, format!("https://etherscan.io/address/{}", addr));
|
assert_eq!(address_url, format!("https://etherscan.io/address/{:?}", addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stringifies_transaction_url() {
|
fn stringifies_transaction_url() {
|
||||||
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
||||||
let tx_hash = "0x0";
|
let tx_hash = H256::zero();
|
||||||
let tx_url: String = etherscan.transaction_url(tx_hash);
|
let tx_url: String = etherscan.transaction_url(tx_hash);
|
||||||
assert_eq!(tx_url, format!("https://etherscan.io/tx/{}", tx_hash));
|
assert_eq!(tx_url, format!("https://etherscan.io/tx/{:?}", tx_hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stringifies_token_url() {
|
fn stringifies_token_url() {
|
||||||
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
let etherscan = Client::new_from_env(Chain::Mainnet).unwrap();
|
||||||
let token_hash = "0x0";
|
let token_hash = Address::zero();
|
||||||
let token_url: String = etherscan.token_url(token_hash);
|
let token_url: String = etherscan.token_url(token_hash);
|
||||||
assert_eq!(token_url, format!("https://etherscan.io/token/{}", token_hash));
|
assert_eq!(token_url, format!("https://etherscan.io/token/{:?}", token_hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -432,7 +432,7 @@ impl<T: ArtifactOutput> Project<T> {
|
||||||
tracing::trace!("Building standard-json-input");
|
tracing::trace!("Building standard-json-input");
|
||||||
let graph = Graph::resolve(&self.paths)?;
|
let graph = Graph::resolve(&self.paths)?;
|
||||||
let target_index = graph.files().get(target).ok_or_else(|| {
|
let target_index = graph.files().get(target).ok_or_else(|| {
|
||||||
SolcError::msg(format!("cannot resolve file at \"{:?}\"", target.display()))
|
SolcError::msg(format!("cannot resolve file at {:?}", target.display()))
|
||||||
})?;
|
})?;
|
||||||
let mut sources = Vec::new();
|
let mut sources = Vec::new();
|
||||||
let (path, source) = graph.node(*target_index).unpack();
|
let (path, source) = graph.node(*target_index).unpack();
|
||||||
|
|
Loading…
Reference in New Issue