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)
online
and non-WebAssembly only.An address of a smart contract address verified at a supported blockchain explorer.
Npm(String)
online
and non-WebAssembly only.The package identifier of an npm package with a path to a Truffle artifact or ABI to be
retrieved from unpkg.io
.
Http(Url)
online
and non-WebAssembly only.An ABI to be retrieved over HTTP(S).
Implementations§
source§impl Source
impl Source
sourcepub fn http(url: impl AsRef<str>) -> Result<Self>
Available on crate feature online
and non-WebAssembly only.
pub fn http(url: impl AsRef<str>) -> Result<Self>
online
and non-WebAssembly only.Creates an HTTP source from a URL.
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.json
orfile:///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 therustls
oropenssl
feature 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
->mainnet
bscscan
->bsc
polygonscan
->polygon
snowtrace
->avalanche
Trait Implementations§
source§impl PartialEq for Source
impl PartialEq for Source
impl Eq 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<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.