Starting to modify things into container structs
This commit is contained in:
31
side-node/src/node.rs
Normal file
31
side-node/src/node.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use bft_json_crdt::json_crdt::BaseCrdt;
|
||||
use fastcrypto::ed25519::Ed25519KeyPair;
|
||||
|
||||
use crate::{keys, list_transaction_crdt::TransactionList, utils, websocket::WebSocketClient};
|
||||
|
||||
pub(crate) struct SideNode {
|
||||
crdt: BaseCrdt<TransactionList>,
|
||||
keys: Ed25519KeyPair,
|
||||
websocket_client: WebSocketClient,
|
||||
}
|
||||
|
||||
impl SideNode {
|
||||
pub(crate) fn new(
|
||||
websocket_client: WebSocketClient,
|
||||
crdt: BaseCrdt<TransactionList>,
|
||||
name: String,
|
||||
) -> Self {
|
||||
let side_dir = utils::home(&name);
|
||||
let keys = keys::load_from_file(side_dir);
|
||||
|
||||
Self {
|
||||
crdt,
|
||||
keys,
|
||||
websocket_client,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn start(&mut self) {
|
||||
self.websocket_client.start().await;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user