xmtp_configuration/common/scw.rs
1/// Local chain address when no worktree environment is loaded.
2pub const ANVIL_URL_DEFAULT: &str = "http://127.0.0.1:8545";
3
4/// Local chain used for smart-contract-wallet verification.
5pub struct DockerUrls;
6impl DockerUrls {
7 /// Anvil's address. Each worktree publishes it on its own port, so the
8 /// value comes from `ANVIL_URL`, which `dev/worktree-env` writes.
9 pub fn anvil() -> String {
10 #[cfg(not(target_arch = "wasm32"))]
11 {
12 std::env::var("ANVIL_URL").unwrap_or_else(|_| ANVIL_URL_DEFAULT.to_string())
13 }
14 #[cfg(target_arch = "wasm32")]
15 {
16 option_env!("ANVIL_URL")
17 .unwrap_or(ANVIL_URL_DEFAULT)
18 .to_string()
19 }
20 }
21}