1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::signer::AnySigner;
use crate::{
    AccountId,
    PublicKey,
    TransactionId,
};

#[derive(Debug)]
pub(crate) struct Operator {
    pub(crate) account_id: AccountId,
    pub(crate) signer: AnySigner,
}

impl Operator {
    #[must_use]
    pub(crate) fn sign(&self, body_bytes: &[u8]) -> (PublicKey, Vec<u8>) {
        self.signer.sign(body_bytes)
    }

    #[must_use]
    pub(crate) fn generate_transaction_id(&self) -> TransactionId {
        TransactionId::generate(self.account_id)
    }
}