pub fn find_vaults(&self, token_a: &str, token_b: &str) -> Result<Vec<Vault>, FarmClientError> {
        self.reload_vault_refs_if_stale()?;
        let pattern1 = format!(".{}-{}-", token_a, token_b);
        let pattern2 = format!(".{}-{}-", token_b, token_a);
        let mut res = vec![];
        for (name, _) in self.vault_refs.borrow().data.iter() {
            if name.contains(&pattern1) || name.contains(&pattern2) {
                res.push(self.get_vault(name)?);
            }
        }
        if res.is_empty() {
            Err(FarmClientError::RecordNotFound(format!(
                "Vault with tokens {} and {}",
                token_a, token_b
            )))
        } else {
            res.sort_by(|a, b| b.version.cmp(&a.version));
            Ok(res)
        }
    }
/// Returns all Vaults with tokens A and B sorted by version
Returns all Vaults with tokens A and B sorted by version
Returns all Vaults with tokens A and B sorted by version
pub fn find_vaults(&self, token_a: &str, token_b: &str) -> Result<Vec<Vault>, FarmClientError> {
        self.reload_vault_refs_if_stale()?;
        let pattern1 = format!(".{}-{}-", token_a, token_b);
        let pattern2 = format!(".{}-{}-", token_b, token_a);
        let mut res = vec![];
        for (name, _) in self.vault_refs.borrow().data.iter() {
            if name.contains(&pattern1) || name.contains(&pattern2) {
                res.push(self.get_vault(name)?);
            }
        }
        if res.is_empty() {
            Err(FarmClientError::RecordNotFound(format!(
                "Vault with tokens {} and {}",
                token_a, token_b
            )))
        } else {
            res.sort_by(|a, b| b.version.cmp(&a.version));
            Ok(res)
        }
    }
pub fn find_vaults ( & self , token_a : & str , token_b : & str ) -> Result < Vec < Vault > , FarmClientError > { self . reload_vault_refs_if_stale ( ) ? ; let pattern1 = format ! ( " " token_a token_b ) ; let pattern2 = format ! ( " " token_b token_a ) ; let mut res = vec ! [ ] ; for ( name , _ ) in self . vault_refs . borrow ( ) . data . iter ( ) { if name . contains ( & pattern1 ) || name . contains ( & pattern2 ) { res . push ( self . get_vault ( name ) ? ) ; } } if res . is_empty ( ) { Err ( FarmClientError :: RecordNotFound ( format ! ( " " token_a token_b ) ) ) } else { res . sort_by ( | a , b | b . version . cmp ( & a . version ) ) ; Ok ( res ) } }
Returns all Vaults with tokens A and B sorted by version
Returns all Vaults with tokens A and B sorted by version
&self
token_a
&str
token_b
&str
&self
token_a
&str
token_b
&str