rain_metadata/subgraph/
mod.rs1use crate::error::Error;
2
3#[derive(Debug, Clone)]
5pub struct KnownSubgraphs;
6
7impl KnownSubgraphs {
8 pub const ETHEREUM: [&'static str; 3] = [
10 "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", ];
14
15 pub const POLYGON: [&'static str; 3] = [
17 "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", ];
21
22 pub const MUMBAI: [&'static str; 3] = [
24 "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", ];
28
29 pub const NPE2: [&'static str; 3] = [Self::ETHEREUM[2], Self::POLYGON[2], Self::MUMBAI[2]];
31
32 pub const NP: [&'static str; 3] = [Self::ETHEREUM[1], Self::POLYGON[1], Self::MUMBAI[1]];
34
35 pub const LEGACY: [&'static str; 3] = [Self::ETHEREUM[0], Self::POLYGON[0], Self::MUMBAI[0]];
37
38 pub const ALL: [&'static str; 9] = [
40 Self::ETHEREUM[0],
41 Self::ETHEREUM[1],
42 Self::ETHEREUM[2],
43 Self::POLYGON[0],
44 Self::POLYGON[1],
45 Self::POLYGON[2],
46 Self::MUMBAI[0],
47 Self::MUMBAI[1],
48 Self::MUMBAI[2],
49 ];
50
51 pub fn of_chain(chain_id: u64) -> Result<[&'static str; 3], Error> {
53 match chain_id {
54 1 => Ok(Self::ETHEREUM),
55 137 => Ok(Self::POLYGON),
56 80001 => Ok(Self::MUMBAI),
57 _ => Err(Error::UnsupportedNetwork),
58 }
59 }
60}