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
58
59
60
61
62
63
64
65
66
67
68
69
use num_bigint::BigInt;

#[derive(Debug)]
pub enum SyncItem {
    Block,
    //This is the metric used by Bitcoin and forks. One of the better ways to estimate how much
    //time is left.
    VerificationProgress,
    // @todo in the future we need Eth's State Tries here
}
// @todo for sync stats we need a better way of saying how much time is remaining
//
// One way to do it is to return a generic data point of "remaning", then another struct of
// "remaining_per_second" and that can just be the calculation of how much of whatever we've
// processed in the last time period. So that can be blocks (Nimiq, Eth) or Transactions (bitcoin,
// Raven, Handshake).
#[derive(Debug)]
pub struct SyncStats {
    //We need this to be able to tell how many blocks we've increased by.
    pub current_block: u64,
    pub syncing: bool,
    //@todo I think we should make these live behind an Option, and that way when syncing is false,
    //we don't even have to include them. We just have Option<None>.
    //
    //Could be named something like SyncEstimates
    //or we renaming syncstats to be syncing, and then make the new object syncstats.
    pub sync_item: SyncItem,
    pub estimated_sync_item_remaining: f64,
}

#[derive(Debug)]
pub struct WalletBalance {
    pub confirmed_balance: Amount,
    //@todo both these need to be bigint:q
    //
    pub unconfirmed_balance: Amount,
}

#[derive(Debug)]
pub struct ClientOptions {
    pub(crate) url: String,
    pub(crate) username: Option<String>,
    pub(crate) password: Option<String>,
}

#[derive(Debug)]
pub struct Amount {
    pub value: BigInt,
    pub currency: Currency,
}

//@todo this currency could probs be baked into Symbol as one and the same in that if we use BTC as
//an enum, we know that it is 8 decimals, no need to define it everywhere.
//Let's look into that for a round 2.
#[derive(Debug)]
pub struct Currency {
    pub symbol: Symbol,
    pub decimals: u32,
}

#[derive(Debug)]
pub enum Symbol {
    BTC,
    ETH,
    HNS,
    NIM,
    RVN,
    SIA,
}