Enum ethers_contract_abigen::Source
source · pub enum Source {
String(String),
Local(PathBuf),
Explorer(Explorer, Address),
Npm(String),
Http(Url),
}Expand description
A source of an Ethereum smart contract’s ABI.
See [parse][#method.parse] for more information.
Variants§
String(String)
A raw ABI string.
Local(PathBuf)
An ABI located on the local file system.
Explorer(Explorer, Address)
An address of a smart contract address verified at a supported blockchain explorer.
Npm(String)
The package identifier of an npm package with a path to a Truffle artifact or ABI to be
retrieved from unpkg.io.
Http(Url)
An ABI to be retrieved over HTTP(S).
Implementations§
source§impl Source
impl Source
source§impl Source
impl Source
sourcepub fn parse(source: impl AsRef<str>) -> Result<Self>
pub fn parse(source: impl AsRef<str>) -> Result<Self>
Parses an ABI from a source.
This method accepts the following:
-
{ ... }or[ ... ]: A raw or human-readable ABI object or array of objects. -
relative/path/to/Contract.json: a relative path to an ABI JSON file. This relative path is rooted in the current working directory. -
/absolute/path/to/Contract.jsonorfile:///absolute/path/to/Contract.json: an absolute path or file URL to an ABI JSON file.
If the online feature is enabled:
-
npm:@org/package@1.0.0/path/to/contract.json: A npmjs package with an optional version and path (defaulting to the latest version andindex.js), retrieved throughunpkg.io. -
http://...: an HTTP URL to a contract ABI.
Note: either therustlsoropensslfeature must be enabled to support HTTPS URLs. -
<name>:<address>,<chain>:<address>or<url>/.../<address>: an address or URL of a verified contract on a blockchain explorer.
Supported explorers and their respective chain:etherscan->mainnetbscscan->bscpolygonscan->polygonsnowtrace->avalanche
Trait Implementations§
source§impl PartialEq<Source> for Source
impl PartialEq<Source> for Source
impl Eq for Source
impl StructuralEq for Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl RefUnwindSafe for Source
impl Send for Source
impl Sync for Source
impl Unpin for Source
impl UnwindSafe for Source
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.