Commit b037bbb8 authored by zeroleak's avatar zeroleak
Browse files

API: add ApiWallet.lastUpdate

parent b186c3c8
......@@ -112,7 +112,8 @@ Response:
utxos: [(utxos detail)],
balance: 0,
zpub: ""
}
},
lastUpdate: 0
}
```
......
......@@ -7,11 +7,13 @@ import java.util.stream.Collectors;
public class ApiWallet {
private Collection<ApiUtxo> utxos;
private long lastUpdate;
private long balance;
private String zpub;
public ApiWallet(
Collection<WhirlpoolUtxo> whirlpoolUtxos,
long lastUpdate,
String zpub,
Comparator<WhirlpoolUtxo> comparator,
int mixsTargetMin) {
......@@ -21,6 +23,7 @@ public class ApiWallet {
.sorted(comparator)
.map(whirlpoolUtxo -> new ApiUtxo(whirlpoolUtxo, mixsTargetMin))
.collect(Collectors.toList());
this.lastUpdate = lastUpdate;
this.balance =
whirlpoolUtxos.stream().mapToLong(whirlpoolUtxo -> whirlpoolUtxo.getUtxo().value).sum();
this.zpub = zpub;
......@@ -30,6 +33,10 @@ public class ApiWallet {
return utxos;
}
public long getLastUpdate() {
return lastUpdate;
}
public long getBalance() {
return balance;
}
......
......@@ -47,9 +47,10 @@ public class ApiWalletUtxosResponse {
WhirlpoolWallet whirlpoolWallet,
Comparator<WhirlpoolUtxo> comparator) {
Collection<WhirlpoolUtxo> utxos = whirlpoolWallet.getUtxoSupplier().findUtxos(account);
long lastUpdate = whirlpoolWallet.getUtxoSupplier().getLastUpdate();
String zpub = whirlpoolWallet.getWalletSupplier().getWallet(account).getZpub();
int mixsTargetMin = whirlpoolWallet.getConfig().getMixsTarget();
return new ApiWallet(utxos, zpub, comparator, mixsTargetMin);
return new ApiWallet(utxos, lastUpdate, zpub, comparator, mixsTargetMin);
}
public ApiWallet getDeposit() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment