Renamed binaries to make things a bit more general

This commit is contained in:
Dave Hrycyszyn
2024-10-19 16:50:45 +01:00
parent 4cf3d03349
commit e821ed2a57
30 changed files with 91 additions and 69 deletions

View File

@@ -0,0 +1,31 @@
use bft_crdt_derive::add_crdt_fields;
use bft_json_crdt::{
json_crdt::{CrdtNode, IntoCrdtNode},
list_crdt::ListCrdt,
};
use serde::{Deserialize, Serialize};
pub mod keys;
pub mod stdin;
pub mod websocket;
#[add_crdt_fields]
#[derive(Clone, CrdtNode, Serialize, Deserialize, Debug)]
pub struct TransactionList {
pub list: ListCrdt<Transaction>,
}
impl TransactionList {
pub fn view_sha(&self) -> String {
sha256::digest(serde_json::to_string(&self.list.view()).unwrap().as_bytes()).to_string()
}
}
/// A fake Transaction struct we can use as a simulated payload
#[add_crdt_fields]
#[derive(Clone, CrdtNode, Serialize, Deserialize, PartialEq, Debug)]
pub struct Transaction {
from: String,
to: String,
amount: f64,
}