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
deBeauvoir
samourai-wallet-android
Commits
f042ad4d
Verified
Commit
f042ad4d
authored
Dec 01, 2021
by
Sarath
⚔
Browse files
APIFactory : parse premix transactions
parent
a415ca5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
app/src/main/java/com/samourai/wallet/api/APIFactory.java
app/src/main/java/com/samourai/wallet/api/APIFactory.java
+31
-0
No files found.
app/src/main/java/com/samourai/wallet/api/APIFactory.java
View file @
f042ad4d
...
...
@@ -2098,6 +2098,21 @@ public class APIFactory {
Collections
.
sort
(
ret
,
new
TxMostRecentDateComparator
());
return
ret
;
}
public
synchronized
List
<
Tx
>
getAllPremixTx
()
{
List
<
Tx
>
ret
=
new
ArrayList
<
Tx
>();
for
(
String
key
:
premix_txs
.
keySet
())
{
List
<
Tx
>
txs
=
premix_txs
.
get
(
key
);
if
(
txs
!=
null
){
for
(
Tx
tx
:
txs
)
{
ret
.
add
(
tx
);
}
}
}
Collections
.
sort
(
ret
,
new
TxMostRecentDateComparator
());
return
ret
;
}
public
synchronized
UTXO
getUnspentOutputsForSweep
(
String
address
)
{
...
...
@@ -2340,6 +2355,7 @@ public class APIFactory {
if
(
jsonObject
.
has
(
"txs"
))
{
postmix_txs
.
clear
();
premix_txs
.
clear
();
JSONArray
txArray
=
(
JSONArray
)
jsonObject
.
get
(
"txs"
);
JSONObject
txObj
=
null
;
for
(
int
i
=
0
;
i
<
txArray
.
length
();
i
++)
{
...
...
@@ -2446,6 +2462,21 @@ public class APIFactory {
}
if
(
hasPreMix
||
addr
.
equals
(
BIP84Util
.
getInstance
(
context
).
getWallet
().
getAccount
(
WhirlpoolMeta
.
getInstance
(
context
).
getWhirlpoolPremixAccount
()).
xpubstr
())
||
addr
.
equals
(
BIP84Util
.
getInstance
(
context
).
getWallet
().
getAccount
(
WhirlpoolMeta
.
getInstance
(
context
).
getWhirlpoolPremixAccount
()).
zpubstr
())
)
{
if
(!
premix_txs
.
containsKey
(
addr
))
{
premix_txs
.
put
(
addr
,
new
ArrayList
<
Tx
>());
}
if
(
FormatsUtil
.
getInstance
().
isValidXpub
(
addr
))
{
premix_txs
.
get
(
addr
).
add
(
tx
);
}
else
{
if
(!
xpub_txs
.
containsKey
(
AddressFactory
.
getInstance
().
account2xpub
().
get
(
WhirlpoolMeta
.
getInstance
(
context
).
getWhirlpoolPremixAccount
())))
{
xpub_txs
.
put
(
AddressFactory
.
getInstance
().
account2xpub
().
get
(
AddressFactory
.
getInstance
().
account2xpub
().
get
(
WhirlpoolMeta
.
getInstance
(
context
).
getWhirlpoolPremixAccount
())),
new
ArrayList
<
Tx
>());
}
xpub_txs
.
get
(
AddressFactory
.
getInstance
().
account2xpub
().
get
(
AddressFactory
.
getInstance
().
account2xpub
().
get
(
WhirlpoolMeta
.
getInstance
(
context
).
getWhirlpoolPremixAccount
()))).
add
(
tx
);
}
}
}
}
...
...
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