pub fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error> {
        let seed_content = self.exec(&[
            "--home",
            self.home_path.as_str(),
            "keys",
            "add",
            wallet_id,
            "--keyring-backend",
            "test",
            "--output",
            "json",
        ])?;

        let json_val: json::Value = json::from_str(&seed_content)?;
        let wallet_address = json_val
            .get("address")
            .ok_or_else(|| eyre!("expect address string field to be present in json result"))?
            .as_str()
            .ok_or_else(|| eyre!("expect address string field to be present in json result"))?
            .to_string();

        let seed_path = format!("{}-seed.json", wallet_id);
        self.write_file(&seed_path, &seed_content)?;

        let hd_path = HDPath::from_str(COSMOS_HD_PATH)
            .map_err(|e| eyre!("failed to create HDPath: {:?}", e))?;

        let key_file: KeyFile = json::from_str(&seed_content)?;

        let key = KeyEntry::from_key_file(key_file, &hd_path)?;

        Ok(Wallet::new(wallet_id.to_string(), wallet_address, key))
    }
/**
       Add a wallet with the given ID to the full node's keyring.
    */
Add a wallet with the given ID to the full node's keyring.
Add a wallet with the given ID to the full node ' s keyring .
pub fn add_wallet(&self, wallet_id: &str) -> Result<Wallet, Error> {
        let seed_content = self.exec(&[
            "--home",
            self.home_path.as_str(),
            "keys",
            "add",
            wallet_id,
            "--keyring-backend",
            "test",
            "--output",
            "json",
        ])?;
        let json_val: json::Value = json::from_str(&seed_content)?;
        let wallet_address = json_val
            .get("address")
            .ok_or_else(|| eyre!("expect address string field to be present in json result"))?
            .as_str()
            .ok_or_else(|| eyre!("expect address string field to be present in json result"))?
            .to_string();
        let seed_path = format!("{}-seed.json", wallet_id);
        self.write_file(&seed_path, &seed_content)?;
        let hd_path = HDPath::from_str(COSMOS_HD_PATH)
            .map_err(|e| eyre!("failed to create HDPath: {:?}", e))?;
        let key_file: KeyFile = json::from_str(&seed_content)?;
        let key = KeyEntry::from_key_file(key_file, &hd_path)?;
        Ok(Wallet::new(wallet_id.to_string(), wallet_address, key))
    }
pub fn add_wallet ( & self , wallet_id : & str ) -> Result < Wallet , Error > { let seed_content = self . exec ( & [ " " , self . home_path . as_str ( ) , " " , " " , wallet_id , " " , " " , " " , " " , ] ) ? ; let json_val : json :: Value = json :: from_str ( & seed_content ) ? ; let wallet_address = json_val . get ( " " ) . ok_or_else ( | | eyre ! ( " " ) ) ? . as_str ( ) . ok_or_else ( | | eyre ! ( " " ) ) ? . to_string ( ) ; let seed_path = format ! ( " " wallet_id ) ; self . write_file ( & seed_path , & seed_content ) ? ; let hd_path = HDPath :: from_str ( COSMOS_HD_PATH ) . map_err ( | e | eyre ! ( " " e ) ) ? ; let key_file : KeyFile = json :: from_str ( & seed_content ) ? ; let key = KeyEntry :: from_key_file ( key_file , & hd_path ) ? ; Ok ( Wallet :: new ( wallet_id . to_string ( ) , wallet_address , key ) ) }
Add a wallet with the given ID to the full node's keyring.
Add a wallet with the given ID to the full node ' s keyring .
&self
wallet_id
&str
&self
wallet_id
&str