niftygate_contract/
lib.rs1use std::str::FromStr;
2
3pub mod command;
4
5pub use command::Command;
6
7#[derive(Debug)]
8pub struct HexData(Vec<u8>);
9
10impl FromStr for HexData {
11 type Err = hex::FromHexError;
12 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
13 hex::decode(s).map(Self)
14 }
15}
16
17mod util {
18 use ethcontract::{
19 dyns::DynWeb3,
20 transport::DynTransport,
21 web3::{error::Result, transports::WebSocket},
22 Web3,
23 };
24 use tide::http::Url;
25
26 pub async fn web3_from_url(url: Url) -> Result<DynWeb3> {
27 Ok(Web3::new(DynTransport::new(
28 WebSocket::new(url.as_str()).await?,
29 )))
30 }
31}