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.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§
impl Eq for Source
impl StructuralPartialEq for Source
Auto Trait Implementations§
impl Freeze for Source
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.