-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(balances): adding balance providers weights and retrying
- Loading branch information
1 parent
5c30faa
commit e52e9f1
Showing
10 changed files
with
260 additions
and
87 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,40 @@ | ||
use { | ||
super::BalanceProviderConfig, | ||
crate::{ | ||
providers::{Priority, Weight}, | ||
utils::crypto::CaipNamespaces, | ||
}, | ||
std::collections::HashMap, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct ZerionConfig { | ||
pub api_key: String, | ||
pub supported_namespaces: HashMap<CaipNamespaces, Weight>, | ||
} | ||
|
||
impl ZerionConfig { | ||
pub fn new(api_key: String) -> Self { | ||
Self { | ||
api_key, | ||
supported_namespaces: default_supported_namespaces(), | ||
} | ||
} | ||
} | ||
|
||
impl BalanceProviderConfig for ZerionConfig { | ||
fn supported_namespaces(self) -> HashMap<CaipNamespaces, Weight> { | ||
self.supported_namespaces | ||
} | ||
|
||
fn provider_kind(&self) -> crate::providers::ProviderKind { | ||
crate::providers::ProviderKind::Zerion | ||
} | ||
} | ||
|
||
fn default_supported_namespaces() -> HashMap<CaipNamespaces, Weight> { | ||
HashMap::from([( | ||
CaipNamespaces::Eip155, | ||
Weight::new(Priority::Normal).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
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
Oops, something went wrong.