use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TransferHistoryItem {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "amount")]
pub amount: String,
#[serde(rename = "timestamp")]
pub timestamp: i64,
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "from_l1_address")]
pub from_l1_address: String,
#[serde(rename = "to_l1_address")]
pub to_l1_address: String,
#[serde(rename = "from_account_index")]
pub from_account_index: i64,
#[serde(rename = "to_account_index")]
pub to_account_index: i64,
#[serde(rename = "tx_hash")]
pub tx_hash: String,
}
impl TransferHistoryItem {
pub fn new(
id: String,
amount: String,
timestamp: i64,
r#type: Type,
from_l1_address: String,
to_l1_address: String,
from_account_index: i64,
to_account_index: i64,
tx_hash: String,
) -> TransferHistoryItem {
TransferHistoryItem {
id,
amount,
timestamp,
r#type,
from_l1_address,
to_l1_address,
from_account_index,
to_account_index,
tx_hash,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "L2TransferInflow")]
L2TransferInflow,
#[serde(rename = "L2TransferOutflow")]
L2TransferOutflow,
}
impl Default for Type {
fn default() -> Type {
Self::L2TransferInflow
}
}