1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::path::Path;
use std::process::Command;
use tracing::debug;

pub struct RegisterCertificate {
    command: Command,
}

impl RegisterCertificate {
    pub fn new(command: Command) -> Self {
        Self { command }
    }

    pub fn stake_verification_key_file<P: AsRef<Path>>(
        mut self,
        stake_verification_key: P,
    ) -> Self {
        self.command
            .arg("--stake-verification-key-file")
            .arg(stake_verification_key.as_ref());
        self
    }

    pub fn out_file<P: AsRef<Path>>(mut self, out_file: P) -> Self {
        self.command.arg("--out-file").arg(out_file.as_ref());
        self
    }

    pub fn build(self) -> Command {
        debug!(
            "Cardano Cli - stake address registration certificate: {:?}",
            self.command
        );
        self.command
    }
}