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
45
46
47
48
49
50
51
52
53
54
55
56
57
use std::collections::BTreeMap;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use themelio_stf::melvm::Covenant;
use themelio_structs::{
Address, BlockHeight, CoinData, CoinDataHeight, CoinID, CoinValue, NetID, StakeDoc,
Transaction, TxHash,
};
use tmelcrypt::HashVal;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WalletSummary {
pub total_micromel: CoinValue,
pub detailed_balance: BTreeMap<String, CoinValue>,
pub staked_microsym: CoinValue,
pub network: NetID,
#[serde(with = "stdcode::asstr")]
pub address: Address,
pub locked: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct WalletDump {
pub summary: WalletSummary,
pub full: WalletData,
}
#[serde_as]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WalletData {
#[serde_as(as = "Vec<(_, _)>")]
unspent_coins: BTreeMap<CoinID, CoinDataHeight>,
#[serde_as(as = "Vec<(_, _)>")]
spent_coins: BTreeMap<CoinID, CoinDataHeight>,
tx_in_progress: BTreeMap<HashVal, Transaction>,
tx_confirmed: BTreeMap<HashVal, (Transaction, BlockHeight)>,
my_covenant: Covenant,
#[serde(default)]
stake_list: BTreeMap<TxHash, StakeDoc>,
network: NetID,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct TransactionStatus {
pub raw: Transaction,
pub confirmed_height: Option<u64>,
pub outputs: Vec<AnnCoinID>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct AnnCoinID {
pub coin_data: CoinData,
pub is_change: bool,
pub coin_id: String,
}