Skip to content

Commit

Permalink
serialize f64 to string
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Feb 23, 2024
1 parent dce747f commit 7e50b03
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ain-ocean/src/model/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
use bitcoin::{BlockHash, Txid};
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};

use super::BlockContext;

pub type TransactionByBlockHashKey = (BlockHash, usize);

#[serde_as]
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Transaction {
pub id: Txid,
pub order: usize,
pub id: Txid, // unique id of the transaction, same as the txid
pub order: usize, // tx order
pub block: BlockContext,
pub hash: String,
pub version: u32,
pub size: u64,
pub v_size: u64,
pub weight: u64,
#[serde_as(as = "DisplayFromStr")]
pub total_vout_value: f64,
pub lock_time: u64,
pub vin_count: usize,
Expand Down

0 comments on commit 7e50b03

Please sign in to comment.