Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Whirlpool
whirlpool-client-cli
Commits
b037bbb8
Commit
b037bbb8
authored
Jul 02, 2020
by
zeroleak
Browse files
API: add ApiWallet.lastUpdate
parent
b186c3c8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
doc/API.md
doc/API.md
+2
-1
src/main/java/com/samourai/whirlpool/cli/api/protocol/beans/ApiWallet.java
.../samourai/whirlpool/cli/api/protocol/beans/ApiWallet.java
+7
-0
src/main/java/com/samourai/whirlpool/cli/api/protocol/rest/ApiWalletUtxosResponse.java
...irlpool/cli/api/protocol/rest/ApiWalletUtxosResponse.java
+2
-1
No files found.
doc/API.md
View file @
b037bbb8
...
...
@@ -112,7 +112,8 @@ Response:
utxos: [(utxos detail)],
balance: 0,
zpub: ""
}
},
lastUpdate: 0
}
```
...
...
src/main/java/com/samourai/whirlpool/cli/api/protocol/beans/ApiWallet.java
View file @
b037bbb8
...
...
@@ -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
;
}
...
...
src/main/java/com/samourai/whirlpool/cli/api/protocol/rest/ApiWalletUtxosResponse.java
View file @
b037bbb8
...
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment