Skip to main content

network_for_chain

Function network_for_chain 

Source
pub fn network_for_chain(chain: &str) -> Option<&'static str>
Expand description

The network name solid_pod_rs::mrc20::bt_address takes for a chain token, or None for a chain whose address prefix the encoder does not know (regtest uses bcrt, which it does not emit).

Mainnet tokens (btc, mainnet, bitcoin, xbt) give bc1p…; the public testnets and txbt4 give tb1p…; gitmark gives gm1p….

§Examples

use solid_pod_rs_forge::gitmark::network_for_chain;

assert_eq!(network_for_chain("tbtc4"), Some("testnet4"));
assert_eq!(network_for_chain("xbt"), Some("mainnet"));
assert_eq!(network_for_chain("gitmark"), Some("gitmark"));
assert_eq!(network_for_chain("regtest"), None);