Skip to content

Commit

Permalink
fix clio latency issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nkramer44 committed Jul 18, 2024
1 parent c2e6b0d commit 56e89b7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ public void sendIssuedCurrency(
Payment.class)
);

this.scanForResult(
() -> getValidatedAccountInfo(issuerAddress),
result -> result.accountData().sequence().equals(issuerAccountInfo.accountData().sequence().plus(UnsignedInteger.ONE))
);
}

//////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,27 @@ void mintAndCreateThenAcceptOffer() throws JsonRpcClientErrorException, JsonProc
);
logger.info("NFT Accept Offer transaction was validated successfully.");

assertThat(xrplClient.accountNfts(keypair.publicKey().deriveAddress()).accountNfts().size()).isEqualTo(0);
assertThat(xrplClient.accountNfts(wallet2.publicKey().deriveAddress()).accountNfts().size()).isEqualTo(1);
this.scanForResult(
() -> {
try {
return xrplClient.accountNfts(keypair.publicKey().deriveAddress()).accountNfts().size();
} catch (JsonRpcClientErrorException e) {
throw new RuntimeException(e);
}
},
size -> size == 0
);

this.scanForResult(
() -> {
try {
return xrplClient.accountNfts(wallet2.publicKey().deriveAddress()).accountNfts().size();
} catch (JsonRpcClientErrorException e) {
throw new RuntimeException(e);
}
},
size -> size == 1
);

logger.info("The NFT ownership was transferred.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,19 @@ public void sendPaymentFromSecp256k1KeyPair() throws JsonRpcClientErrorException

private void assertPaymentCloseTimeMatchesLedgerCloseTime(TransactionResult<Payment> validatedPayment)
throws JsonRpcClientErrorException {
LedgerResult ledger = xrplClient.ledger(
LedgerRequestParams.builder()
.ledgerSpecifier(LedgerSpecifier.of(validatedPayment.ledgerIndex().get()))
.build()

LedgerResult ledger = this.scanForResult(
() -> {
try {
return xrplClient.ledger(
LedgerRequestParams.builder()
.ledgerSpecifier(LedgerSpecifier.of(validatedPayment.ledgerIndex().get()))
.build()
);
} catch (JsonRpcClientErrorException e) {
throw new RuntimeException(e);
}
}
);

assertThat(validatedPayment.closeDateHuman()).isNotEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.xrpl.xrpl4j.model.transactions.metadata.MetaLedgerEntryType;

import java.util.List;
import java.util.Optional;

public class TicketIT extends AbstractIT {

Expand Down Expand Up @@ -91,8 +92,11 @@ void createTicketAndUseSequenceNumber() throws JsonRpcClientErrorException, Json
.map(AffectedNode::ledgerIndex)
.get();

AccountInfoResult accountInfoAfterTicketCreate = getValidatedAccountInfo(sourceKeyPair.publicKey().deriveAddress());
assertThat(accountInfoAfterTicketCreate.accountData().ticketCount()).isNotEmpty().get()
Optional<UnsignedInteger> ticketCount = this.scanForResult(
() -> getValidatedAccountInfo(sourceKeyPair.publicKey().deriveAddress()),
result -> result.accountData().ticketCount().isPresent()
).accountData().ticketCount();
assertThat(ticketCount).isNotEmpty().get()
.isEqualTo(ticketCreate.ticketCount());

List<TicketObject> tickets = getValidatedAccountObjects(
Expand Down

0 comments on commit 56e89b7

Please sign in to comment.