Enum ethers_contract_abigen::Source
source · pub enum Source {
String(String),
Local(String),
Http(Url),
Etherscan(Address),
Polygonscan(Address),
Snowtrace(Address),
Npm(String),
}
Expand description
A source of a Truffle artifact JSON.
Variants§
String(String)
A raw ABI string
Local(String)
An ABI located on the local file system.
Http(Url)
An ABI to be retrieved over HTTP(S).
Etherscan(Address)
An address of a mainnet contract that has been verified on Etherscan.io.
Polygonscan(Address)
An address of a mainnet contract that has been verified on Polygonscan.com.
Snowtrace(Address)
An address of a mainnet contract that has been verified on snowtrace.io.
Npm(String)
The package identifier of an npm package with a path to a Truffle
artifact or ABI to be retrieved from unpkg.io
.
Implementations§
source§impl Source
impl Source
sourcepub fn parse<S>(source: S) -> Result<Self>where
S: AsRef<str>,
pub fn parse<S>(source: S) -> Result<Self>where
S: AsRef<str>,
Parses an ABI from a source
Contract ABIs can be retrieved from the local filesystem or online
from etherscan.io
. They can also be provided in-line. This method parses
ABI source URLs and accepts the following:
-
raw ABI JSON
-
relative/path/to/Contract.json
: a relative path to an ABI JSON file. This relative path is rooted in the current working directory. To specify the root for relative paths, useSource::with_root
. -
/absolute/path/to/Contract.json
orfile:///absolute/path/to/Contract.json
: an absolute path or file URL to an ABI JSON file. -
http(s)://...
an HTTP url to a contract ABI. -
etherscan:0xXX..XX
orhttps://etherscan.io/address/0xXX..XX
: a address or URL of a verified contract on Etherscan. -
npm:@org/package@1.0.0/path/to/contract.json
an npmjs package with an optional version and path (defaulting to the latest version andindex.js
). The contract ABI will be retrieved throughunpkg.io
.
sourcepub fn local(path: impl Into<String>) -> Self
pub fn local(path: impl Into<String>) -> Self
Creates a local filesystem source from a path string.
sourcepub fn etherscan<S>(address: S) -> Result<Self>where
S: AsRef<str>,
pub fn etherscan<S>(address: S) -> Result<Self>where
S: AsRef<str>,
Creates an Etherscan source from an address string.
sourcepub fn polygonscan<S>(address: S) -> Result<Self>where
S: AsRef<str>,
pub fn polygonscan<S>(address: S) -> Result<Self>where
S: AsRef<str>,
Creates an Polygonscan source from an address string.
sourcepub fn snowtrace<S>(address: S) -> Result<Self>where
S: AsRef<str>,
pub fn snowtrace<S>(address: S) -> Result<Self>where
S: AsRef<str>,
Creates an Snowtrace source from an address string.
Trait Implementations§
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.