use crate::cardano_cli::wrapper::cli::api::{Address, Query, StakeAddress, Transaction};
use crate::cardano_cli::wrapper::cli::command::Root;
use std::path::PathBuf;
use std::process::Command;
pub mod api;
pub mod command;
pub struct Api {
cardano_cli: PathBuf,
}
impl Api {
#[must_use]
pub fn new(cardano_cli: PathBuf) -> Self {
Self { cardano_cli }
}
#[must_use]
pub fn address(&self) -> Address {
let command = Command::new(self.cardano_cli.clone());
let cardano_cli_command = Root::new(command);
Address::new(cardano_cli_command.address())
}
#[must_use]
pub fn stake_address(&self) -> StakeAddress {
let command = Command::new(self.cardano_cli.clone());
let cardano_cli_command = Root::new(command);
StakeAddress::new(cardano_cli_command.stake_address())
}
#[must_use]
pub fn transaction(&self) -> Transaction {
let command = Command::new(self.cardano_cli.clone());
let cardano_cli_command = Root::new(command);
Transaction::new(cardano_cli_command.transaction())
}
#[must_use]
pub fn query(&self) -> Query {
let command = Command::new(self.cardano_cli.clone());
let cardano_cli_command = Root::new(command);
Query::new(cardano_cli_command.query())
}
}