-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tenderly provider and tests from #301
- Loading branch information
1 parent
b8ebcf4
commit 8fa6ef1
Showing
11 changed files
with
405 additions
and
38 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,144 @@ | ||
use { | ||
super::ProviderConfig, | ||
crate::providers::{Priority, Weight}, | ||
std::collections::HashMap, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct TenderlyConfig { | ||
pub supported_chains: HashMap<String, (String, Weight)>, | ||
pub supported_ws_chains: HashMap<String, (String, Weight)>, | ||
} | ||
|
||
impl Default for TenderlyConfig { | ||
fn default() -> Self { | ||
Self { | ||
supported_chains: default_supported_chains(), | ||
supported_ws_chains: default_ws_supported_chains(), | ||
} | ||
} | ||
} | ||
|
||
impl ProviderConfig for TenderlyConfig { | ||
fn supported_chains(self) -> HashMap<String, (String, Weight)> { | ||
self.supported_chains | ||
} | ||
|
||
fn supported_ws_chains(self) -> HashMap<String, (String, Weight)> { | ||
self.supported_ws_chains | ||
} | ||
|
||
fn provider_kind(&self) -> crate::providers::ProviderKind { | ||
crate::providers::ProviderKind::Tenderly | ||
} | ||
} | ||
|
||
fn default_supported_chains() -> HashMap<String, (String, Weight)> { | ||
// Keep in-sync with SUPPORTED_CHAINS.md | ||
|
||
HashMap::from([ | ||
// Ethereum Mainnet | ||
( | ||
"eip155:1".into(), | ||
("mainnet".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Ethereum Görli | ||
( | ||
"eip155:5".into(), | ||
("goerli".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Ethereum Sepolia | ||
( | ||
"eip155:11155111".into(), | ||
("sepolia".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Optimism Mainnet | ||
( | ||
"eip155:10".into(), | ||
("optimism".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Optimism Görli | ||
( | ||
"eip155:420".into(), | ||
( | ||
"optimism-goerli".into(), | ||
Weight::new(Priority::Low).unwrap(), | ||
), | ||
), | ||
// Polygon Mainnet | ||
( | ||
"eip155:137".into(), | ||
("polygon".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Polygon Mumbai | ||
( | ||
"eip155:80001".into(), | ||
("polygon-mumbai".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Base Mainnet | ||
( | ||
"eip155:8453".into(), | ||
("base".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Base Görli | ||
( | ||
"eip155:84531".into(), | ||
("base-goerli".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
]) | ||
} | ||
|
||
fn default_ws_supported_chains() -> HashMap<String, (String, Weight)> { | ||
// Keep in-sync with SUPPORTED_CHAINS.md | ||
|
||
HashMap::from([ | ||
// Ethereum Mainnet | ||
( | ||
"eip155:1".into(), | ||
("mainnet".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Ethereum Görli | ||
( | ||
"eip155:5".into(), | ||
("goerli".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Ethereum Sepolia | ||
( | ||
"eip155:11155111".into(), | ||
("sepolia".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Optimism Mainnet | ||
( | ||
"eip155:10".into(), | ||
("optimism".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Optimism Görli | ||
( | ||
"eip155:420".into(), | ||
( | ||
"optimism-goerli".into(), | ||
Weight::new(Priority::Low).unwrap(), | ||
), | ||
), | ||
// Polygon Mainnet | ||
( | ||
"eip155:137".into(), | ||
("polygon".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Polygon Mumbai | ||
( | ||
"eip155:80001".into(), | ||
("polygon-mumbai".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Base Mainnet | ||
( | ||
"eip155:8453".into(), | ||
("base".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
// Base Görli | ||
( | ||
"eip155:84531".into(), | ||
("base-goerli".into(), Weight::new(Priority::Low).unwrap()), | ||
), | ||
]) | ||
} |
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
Oops, something went wrong.