1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pub mod application;
pub mod command;
pub mod middleware;
pub mod openzeppelin;

pub mod prelude {
  pub use ethcontract;
  pub use ethcontract::web3;
  pub use ethcontract::web3::ethabi;
  pub use surf;
  pub use tide;
}

pub type WrappedError = Box<dyn std::error::Error>;
pub type WrappedResult<T> = std::result::Result<T, WrappedError>;

mod util {
  use ethcontract::{
    dyns::DynWeb3,
    transport::DynTransport,
    web3::{error::Result, transports::WebSocket},
    Web3,
  };
  use tide::http::Url;

  pub async fn web3_from_url(url: Url) -> Result<DynWeb3> {
    Ok(Web3::new(DynTransport::new(
      WebSocket::new(url.as_str()).await?,
    )))
  }
}