use crate::error::Error;
#[derive(Debug, Clone)]
pub struct KnownSubgraphs;
impl KnownSubgraphs {
pub const ETHEREUM: [&'static str; 3] = [
"https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-ethereum", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-np-eth", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-npe2-eth", ];
pub const POLYGON: [&'static str; 3] = [
"https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-polygon", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-np-matic", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-npe2-mati", ];
pub const MUMBAI: [&'static str; 3] = [
"https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-np", "https://api.thegraph.com/subgraphs/name/rainlanguage/interpreter-registry-npe2", ];
pub const NPE2: [&'static str; 3] = [Self::ETHEREUM[2], Self::POLYGON[2], Self::MUMBAI[2]];
pub const NP: [&'static str; 3] = [Self::ETHEREUM[1], Self::POLYGON[1], Self::MUMBAI[1]];
pub const LEGACY: [&'static str; 3] = [Self::ETHEREUM[0], Self::POLYGON[0], Self::MUMBAI[0]];
pub const ALL: [&'static str; 9] = [
Self::ETHEREUM[0],
Self::ETHEREUM[1],
Self::ETHEREUM[2],
Self::POLYGON[0],
Self::POLYGON[1],
Self::POLYGON[2],
Self::MUMBAI[0],
Self::MUMBAI[1],
Self::MUMBAI[2],
];
pub fn of_chain(chain_id: u64) -> Result<[&'static str; 3], Error> {
match chain_id {
1 => Ok(Self::ETHEREUM),
137 => Ok(Self::POLYGON),
80001 => Ok(Self::MUMBAI),
_ => Err(Error::UnsupportedNetwork),
}
}
}