Skip to content

Commit

Permalink
Changes for getActiveContracts #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
atriantafyllos-da committed Oct 21, 2024
1 parent 1a00c49 commit 41af65a
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ public static void main(String[] args) {
BiMap<Long, Iou.ContractId> idMap = Maps.synchronizedBiMap(HashBiMap.create());
AtomicReference<String> acsOffset = new AtomicReference<>("");

Optional<Long> ledgerEndO = client.getStateClient().getLedgerEnd().blockingGet();

client
.getStateClient()
.getActiveContracts(Iou.contractFilter(), Collections.singleton(party), true)
.getActiveContracts(
Iou.contractFilter(), Collections.singleton(party), true, ledgerEndO.orElse(0L))
.blockingForEach(
response -> {
response.offset.ifPresent(offset -> acsOffset.set(offset));
Expand All @@ -66,21 +69,15 @@ public static void main(String[] args) {
});
});

String ledgerEnd =
client
.getStateClient()
.getLedgerEnd()
.blockingGet()
.map(num -> String.format("%018x", num))
.orElse("");
String ledgerEndString = ledgerEndO.map(num -> String.format("%018x", num)).orElse("");

Disposable ignore =
client
.getTransactionsClient()
.getTransactions(
Iou.contractFilter(),
acsOffset.get(),
ledgerEnd,
ledgerEndString,
Collections.singleton(party),
true)
.forEach(
Expand Down

0 comments on commit 41af65a

Please sign in to comment.