[−][src]Enum ethcontract_generate::Source
A source of a Truffle artifact JSON.
Variants
Local(PathBuf)
A Truffle artifact or ABI located on the local file system.
Http(Url)
A truffle artifact or ABI to be retrieved over HTTP(S).
Etherscan(Address)
An address of a mainnet contract that has been verified on Etherscan.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
impl Source
[src]
pub fn parse<S>(source: S) -> Result<Self> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Parses an artifact source from a string.
Contract artifacts can be retrieved from the local filesystem or online
from etherscan.io
, this method parses artifact source URLs and accepts
the following:
relative/path/to/Contract.json
: a relative path to a truffle artifact 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 a truffle artifact JSON file.http(s)://...
an HTTP url to a contract ABI or Truffle artifact.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 artifact or ABI will be retrieved throughunpkg.io
.
pub fn with_root<P, S>(root: P, source: S) -> Result<Self> where
P: AsRef<Path>,
S: AsRef<str>,
[src]
P: AsRef<Path>,
S: AsRef<str>,
Parses an artifact source from a string and a specified root directory
for resolving relative paths. See Source::with_root
for more details
on supported source strings.
pub fn local<P>(path: P) -> Self where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Creates a local filesystem source from a path string.
pub fn http<S>(url: S) -> Result<Self> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Creates an HTTP source from a URL.
pub fn etherscan<S>(address: S) -> Result<Self> where
S: AsRef<str>,
[src]
S: AsRef<str>,
Creates an Etherscan source from an address string.
pub fn npm<S>(package_path: S) -> Self where
S: Into<String>,
[src]
S: Into<String>,
Creates an Etherscan source from an address string.
pub fn artifact_json(&self) -> Result<String>
[src]
Retrieves the source JSON of the artifact this will either read the JSON from the file system or retrieve a contract ABI from the network dependending on the source type.
Trait Implementations
impl Clone for Source
[src]
impl Debug for Source
[src]
impl Eq for Source
[src]
impl FromStr for Source
[src]
type Err = Error
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Self>
[src]
impl PartialEq<Source> for Source
[src]
impl StructuralEq for Source
[src]
impl StructuralPartialEq for Source
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,