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

pub fn main() {

    let tx = Transaction {
        source: "fingerprint_of_some_guy".to_owned(),
        target: "31415926535897932384626433832795028841971693993751058209749445923".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);
}