chore: merge main
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
use std::{collections::HashMap, fs};
|
||||
|
||||
use tycho_core::dto::Chain;
|
||||
|
||||
use crate::encoding::{
|
||||
errors::EncodingError, evm::swap_encoder::builder::SwapEncoderBuilder,
|
||||
errors::EncodingError, evm::swap_encoder::builder::SwapEncoderBuilder, models::Chain,
|
||||
swap_encoder::SwapEncoder,
|
||||
};
|
||||
|
||||
@@ -19,10 +17,10 @@ impl SwapEncoderRegistry {
|
||||
/// executors' addresses in the file at the given path.
|
||||
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
||||
let config_str = fs::read_to_string(executors_file_path)?;
|
||||
let config: HashMap<Chain, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||
let config: HashMap<String, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||
let mut encoders = HashMap::new();
|
||||
let executors = config
|
||||
.get(&blockchain)
|
||||
.get(&blockchain.name)
|
||||
.ok_or(EncodingError::FatalError("No executors found for blockchain".to_string()))?;
|
||||
for (protocol, executor_address) in executors {
|
||||
let builder = SwapEncoderBuilder::new(protocol, executor_address);
|
||||
|
||||
Reference in New Issue
Block a user