[][src]Enum ethers_contract_abigen::Source

pub enum Source {
    String(String),
    Local(PathBuf),
    Http(Url),
    Etherscan(Address),
    Npm(String),
}

A source of a Truffle artifact JSON.

Variants

String(String)

A raw ABI string

Local(PathBuf)

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.

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]

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, use Source::with_root.

  • /absolute/path/to/Contract.json or file:///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 or https://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 and index.js). The contract ABI will be retrieved through unpkg.io.

pub fn get(&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.

impl PartialEq<Source> for Source[src]

impl StructuralEq for Source[src]

impl StructuralPartialEq for Source[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,