1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Commission table struct.
//!
//! Maps to TS `TableCommission` in `wallet-toolbox/src/storage/schema/tables/TableCommission.ts`.
use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
/// A commission record for a transaction.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, FromRow)]
#[serde(rename_all = "camelCase")]
#[sqlx(rename_all = "camelCase")]
pub struct Commission {
/// When this record was created.
#[sqlx(rename = "created_at")]
#[serde(
rename = "created_at",
alias = "createdAt",
with = "crate::serde_datetime"
)]
pub created_at: NaiveDateTime,
/// When this record was last updated.
#[sqlx(rename = "updated_at")]
#[serde(
rename = "updated_at",
alias = "updatedAt",
with = "crate::serde_datetime"
)]
pub updated_at: NaiveDateTime,
/// Primary key.
pub commission_id: i64,
/// Owning user foreign key.
pub user_id: i64,
/// Parent transaction foreign key.
pub transaction_id: i64,
/// Commission amount in satoshis.
pub satoshis: i64,
/// Key offset used for deriving the commission output key.
pub key_offset: String,
/// Whether the commission has been redeemed (spent).
pub is_redeemed: bool,
/// The locking script for the commission output.
pub locking_script: Vec<u8>,
}