File tree Expand file tree Collapse file tree
ecashkit/src/main/kotlin/io/horizontalsystems/ecash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,26 +15,35 @@ class ChronikApi : IInitialSyncApi {
1515
1616 for (address in addresses) {
1717 try {
18- val get = apiManager.get(" script/p2pkh/$address /history" )
19- val txHistoryPage = Chronik .TxHistoryPage .parseFrom(get)
20- transactionItems.addAll(
21- txHistoryPage.txsList.map {
22- TransactionItem (
23- blockHash = it.block.hash.toByteArray().toReversedHex(),
24- blockHeight = it.block.height,
25- txOutputs = it.outputsList.map { txOutput ->
26- TransactionOutputItem (
27- script = txOutput.outputScript.toByteArray().toReversedHex(),
28- address = " "
29- )
30- }
31- )
32- }
33- )
18+ var page = 0
19+
20+ while (true ) {
21+ Thread .sleep(10 )
22+ val get = apiManager.get(" script/p2pkh/$address /history?page=$page " )
23+ val txHistoryPage = Chronik .TxHistoryPage .parseFrom(get)
24+ transactionItems.addAll(
25+ txHistoryPage.txsList.map {
26+ TransactionItem (
27+ blockHash = it.block.hash.toByteArray().toReversedHex(),
28+ blockHeight = it.block.height,
29+ txOutputs = it.outputsList.map { txOutput ->
30+ TransactionOutputItem (
31+ script = txOutput.outputScript.toByteArray().toReversedHex(),
32+ address = " "
33+ )
34+ }
35+ )
36+ }
37+ )
38+
39+ page++
40+
41+ if (txHistoryPage.numPages < page + 1 )
42+ break
43+ }
3444 } catch (e: Throwable ) {
3545 continue
3646 }
37- Thread .sleep(10 )
3847 }
3948
4049 return transactionItems
You can’t perform that action at this time.
0 commit comments