aboutsummaryrefslogtreecommitdiffstats
path: root/examples/serdeser.rs
blob: 60d90b94663eff1363ca1fcb075285f2416c327d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use gradecoin::schema::Transaction;
use serde_json;

pub fn main() {

    let tx = Transaction {
        by: "fingerprint_of_some_guy".to_owned(),
        source: "31415926535897932384626433832795028841971693993751058209749445923".to_owned(),
        target: "fingerprint_of_some_guy".to_owned(),
        amount: 2,
        timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(20, 55, 30),
    };

    let tx_string = serde_json::to_string(&tx).unwrap();

    println!("{}", &tx_string);
}