forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cast): tx trace in specific chain
- Loading branch information
1 parent
780b248
commit 5692218
Showing
7 changed files
with
135 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use once_cell::sync::Lazy; | ||
use std::collections::HashMap; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
pub enum ChainId { | ||
RoninMainnet = 2020, | ||
RoninTestnet = 2021, | ||
// Add more chains as needed | ||
} | ||
|
||
pub struct ChainInfo { | ||
pub name: &'static str, | ||
pub rpc_url: &'static str, | ||
} | ||
|
||
impl ChainId { | ||
pub fn info(&self) -> &'static ChainInfo { | ||
static CHAIN_INFO: Lazy<HashMap<ChainId, ChainInfo>> = Lazy::new(|| { | ||
let mut m = HashMap::new(); | ||
m.insert( | ||
ChainId::RoninMainnet, | ||
ChainInfo { | ||
name: "Ronin Mainnet", | ||
rpc_url: "https://api-archived.roninchain.com/rpc", | ||
}, | ||
); | ||
m.insert( | ||
ChainId::RoninTestnet, | ||
ChainInfo { | ||
name: "Ronin Testnet", | ||
rpc_url: "https://saigon-archive.roninchain.com/rpc", | ||
}, | ||
); | ||
// Add more chains as needed | ||
m | ||
}); | ||
|
||
CHAIN_INFO.get(self).unwrap() | ||
} | ||
|
||
pub fn from_id(id: u64) -> Option<Self> { | ||
match id { | ||
2020 => Some(ChainId::RoninMainnet), | ||
2021 => Some(ChainId::RoninTestnet), | ||
// Add more matches as needed | ||
_ => None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod run; | ||
pub mod run; | ||
pub mod chain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters