File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 11use crate :: utils:: from_env:: FromEnv ;
2+ use signet_constants:: KnownChains ;
3+ use std:: str:: FromStr ;
24
35/// A slot calculator, which can calculate slot numbers, windows, and offsets
46/// for a given chain.
@@ -273,6 +275,22 @@ impl SlotCalculator {
273275 }
274276}
275277
278+ impl From < KnownChains > for SlotCalculator {
279+ fn from ( value : KnownChains ) -> Self {
280+ match value {
281+ KnownChains :: Pecorino => SlotCalculator :: pecorino_host ( ) ,
282+ }
283+ }
284+ }
285+
286+ impl FromStr for SlotCalculator {
287+ type Err = signet_constants:: ParseChainError ;
288+
289+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
290+ Ok ( SlotCalculator :: from ( KnownChains :: from_str ( s) ?) )
291+ }
292+ }
293+
276294#[ cfg( test) ]
277295mod tests {
278296 use super :: * ;
You can’t perform that action at this time.
0 commit comments