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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
use Address;
/*
// getaddressbalance
// getaddressdeltas
// getaddressmempool
// getaddresstxids
// getaddressutxos
// getsnapshot
getaddressbalance '{"addresses":["Rxxx"]}'
{
"balance": 70015354651,
"received": 48815719160525
}
// Returns all changes for an address
getaddressdeltas '{"addresses":["Rxxx"]}'
[
...
{
"satoshis": 2500064992,
"txid": "2f8a94c102ddb6ffc8fc8e1d4e212f93b9b33afa590872edb072a55bd47db5c4",
"index": 0,
"blockindex": 0,
"height": 28545,
"address": "Rxxx"
}
...
]
getaddressmempool '{"addresses":["Rxxx"]}'
[
{
"address" (string) The base58check encoded address
"txid" (string) The related txid
"index" (number) The related input or output index
"satoshis" (number) The difference of satoshis
"timestamp" (number) The time the transaction entered the mempool (seconds)
"prevtxid" (string) The previous txid (if spending)
"prevout" (string) The previous transaction output index (if spending)
}
]
getaddresstxids '{"addresses":["Rxxx"]}'
[
"transactionid" (string) The transaction id
,...
]
getaddressutxos '{"addresses":["Rxxx"]}'
[
{
"address" (string) The address base58check encoded
"txid" (string) The output txid
"height" (number) The block height
"outputIndex" (number) The output index
"script" (strin) The script hex encoded
"satoshis" (number) The number of satoshis of the output
}
]
getsnapshot (top)
{
"addresses": [
{
"addr": "address",
"amount": "100.0"
},
{
"addr": "address",
"amount": "23.45"
}
],
"total": 123.45 (numeric) Total amount in snapshot
"average": 61.7, (numeric) Average amount in each address
"utxos": 14, (number) Total number of UTXOs in snapshot
"total_addresses": 2, (number) Total number of addresses in snapshot,
"start_height": 91, (number) Block height snapshot began
"ending_height": 91 (number) Block height snapsho finished,
"start_time": 1531982752, (number) Unix epoch time snapshot started
"end_time": 1531982752 (number) Unix epoch time snapshot finished
}
*/
#[derive(Debug, Deserialize)]
pub struct AddressBalance {
pub balance: u64,
pub received: u64,
}
#[derive(Debug, Deserialize)]
pub struct AddressDeltas {
pub vec: Vec<AddressDelta>,
}
#[derive(Debug, Deserialize)]
pub struct AddressDelta {
pub satoshis: i64,
pub txid: String,
pub index: u32,
pub blockindex: u64,
pub height: u64,
pub address: String,
}
#[derive(Debug, Deserialize)]
pub struct AddressMempool(Vec<AddressMempoolDelta>);
#[derive(Debug, Deserialize)]
pub struct AddressMempoolDelta {
address: String,
txid: String,
index: u32,
satoshis: i64,
timestamp: u64,
prevtxid: String,
prevout: u32,
}
#[derive(Debug, Deserialize)]
pub struct AddressTxIDs(Vec<String>); // todo: a vec with txids, needs work.
#[derive(Debug, Deserialize)]
pub struct AddressUtxos {
pub vec: Vec<AddressUtxo>
}
#[derive(Debug, Deserialize)]
pub struct AddressUtxo {
pub address: String,
pub txid: String,
pub height: u64,
pub outputIndex: u32,
pub script: String,
pub satoshis: u64 // output always positive, no signing needed
}
#[derive(Debug, Deserialize)]
pub struct Snapshot {
pub addresses: Vec<Address>,
pub total: f64,
pub average: f64,
pub utxos: u64,
pub total_addresses: u64,
pub start_height: u64,
pub ending_height: u64,
pub start_time: u64,
pub end_time: u64,
}