Skip to content

Commit

Permalink
docs: add code doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
gakonst committed Dec 17, 2021
1 parent 8e76373 commit 6d90f0a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,21 @@ where
Ok(self.provider.get_gas_price().await?)
}

/// ```no_run
/// use cast::Cast;
/// use ethers_providers::{Provider, Http};
/// use ethers_core::types::Address;
/// use std::{str::FromStr, convert::TryFrom};
///
/// # async fn foo() -> eyre::Result<()> {
/// let provider = Provider::<Http>::try_from("http://localhost:8545")?;
/// let cast = Cast::new(provider);
/// let addr = Address::from_str("0x00000000219ab540356cbb839cbe05303d7705fa")?;
/// let code = cast.code(addr, None).await?;
/// println!("{}", code);
/// # Ok(())
/// # }
/// ```
pub async fn code<T: Into<NameOrAddress> + Send + Sync>(
&self,
who: T,
Expand Down

0 comments on commit 6d90f0a

Please sign in to comment.