diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/serdeser.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/serdeser.rs b/examples/serdeser.rs new file mode 100644 index 0000000..60d90b9 --- /dev/null +++ b/examples/serdeser.rs | |||
@@ -0,0 +1,17 @@ | |||
1 | use gradecoin::schema::Transaction; | ||
2 | use serde_json; | ||
3 | |||
4 | pub fn main() { | ||
5 | |||
6 | let tx = Transaction { | ||
7 | by: "fingerprint_of_some_guy".to_owned(), | ||
8 | source: "31415926535897932384626433832795028841971693993751058209749445923".to_owned(), | ||
9 | target: "fingerprint_of_some_guy".to_owned(), | ||
10 | amount: 2, | ||
11 | timestamp: chrono::NaiveDate::from_ymd(2021, 04, 13).and_hms(20, 55, 30), | ||
12 | }; | ||
13 | |||
14 | let tx_string = serde_json::to_string(&tx).unwrap(); | ||
15 | |||
16 | println!("{}", &tx_string); | ||
17 | } | ||