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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use thiserror::Error;

mod ui;
mod vfs;

#[allow(dead_code)]
mod scratch {
  mod constants {
    // https://ipfs.github.io/public-gateway-checker/
    pub(super) const CLOUDFLARE_ETH_GATEWAY: &str = "https://cloudflare-eth.com";
    pub(super) const CLOUDFLARE_IPFS_GATEWAY: &str = "https://cloudflare-ipfs.com";
    pub(super) const INFURA_IPFS_GATEWAY: &str = "https://infura-ipfs.io";
    pub(super) const PROTOCOL_LABS_IPFS_GATEWAY: &str = "https://gateway.ipfs.io";
  }

  #[non_exhaustive]
  enum IpfsProvider {
    Cloudflare,
    ProtocolLabs,
    Infura,
  }

  impl IpfsProvider {
    fn gateway(&self) -> &str {
      match self {
        Self::Cloudflare => constants::CLOUDFLARE_IPFS_GATEWAY,
        Self::ProtocolLabs => constants::PROTOCOL_LABS_IPFS_GATEWAY,
        Self::Infura => constants::INFURA_IPFS_GATEWAY,
      }
    }
  }

  #[non_exhaustive]
  enum EthProvider {
    Cloudflare,
  }

  impl EthProvider {
    fn gateway(&self) -> &str {
      match self {
        Self::Cloudflare => constants::CLOUDFLARE_ETH_GATEWAY,
      }
    }
  }
}

pub(crate) mod constants {
  pub(crate) const DEFAULT_ORIGIN: &str = "https://binaries.soliditylang.org/emscripten-wasm32";
  pub(crate) const DEFAULT_MANIFEST_PATH: &str = "list.json";
}

#[derive(Debug, Error)]
#[error("Parse Error")]
struct ParseError;

mod prelude {
  pub use camino::{Utf8Path, Utf8PathBuf, Utf8Prefix};
  pub use regex::Regex;
  pub use surf::http;
}

mod asset_path;
mod checksum;
mod command;
pub(crate) mod compatibility;
mod compression;
mod download;
mod iter;
mod manager;
mod pattern;
mod solidity;
mod storage;

pub use asset_path::AssetPath;
pub use command::Command;
pub use pattern::*;