Consts: Add Dymension to rust sdk consts (#3764)

This commit is contained in:
Ben Guidarelli 2024-02-01 17:23:39 -05:00 committed by GitHub
parent 7f0a2a29c9
commit 696cb909b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,7 @@ pub enum Chain {
Celestia,
Stargaze,
Seda,
Dymension,
Sepolia,
// Allow arbitrary u16s to support future chains.
@ -104,6 +105,7 @@ impl From<u16> for Chain {
4004 => Chain::Celestia,
4005 => Chain::Stargaze,
4006 => Chain::Seda,
4007 => Chain::Dymension,
10002 => Chain::Sepolia,
c => Chain::Unknown(c),
}
@ -155,6 +157,7 @@ impl From<Chain> for u16 {
Chain::Celestia => 4004,
Chain::Stargaze => 4005,
Chain::Seda => 4006,
Chain::Dymension => 4007,
Chain::Sepolia => 10002,
Chain::Unknown(c) => c,
}
@ -207,6 +210,7 @@ impl fmt::Display for Chain {
Self::Celestia => f.write_str("Celestia"),
Self::Stargaze => f.write_str("Stargaze"),
Self::Seda => f.write_str("Seda"),
Self::Dymension => f.write_str("Dymension"),
Self::Unknown(v) => write!(f, "Unknown({v})"),
}
}
@ -264,6 +268,7 @@ impl FromStr for Chain {
"Celestia" | "celestia" | "CELESTIA" => Ok(Chain::Celestia),
"Stargaze" | "stargaze" | "STARGAZE" => Ok(Chain::Stargaze),
"Seda" | "seda" | "SEDA" => Ok(Chain::Seda),
"Dymension" | "dymension" | "DYMENSION" => Ok(Chain::Dymension),
_ => {
let mut parts = s.split(&['(', ')']);
let _ = parts