Skip to content

Commit

Permalink
Tidying client code
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Nov 30, 2024
1 parent a4f264d commit fcd0735
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions convex-peer/src/main/java/convex/api/Convex.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ public SignedData<ATransaction> prepareTransaction(ATransaction transaction) thr
* @return A Future for the result of the transaction
*/
public CompletableFuture<Result> transact(String code) {
return transact((ACell)Reader.read(code));
ACell cmd=buildCodeForm(code);
return transact(cmd);
}

/**
Expand All @@ -542,7 +543,8 @@ public synchronized CompletableFuture<Result> transact(ACell code) {
if (isPreCompile()) {
return preCompile(code).thenCompose(r->{
if (r.isError()) return CompletableFuture.completedFuture(r);
ATransaction trans = Invoke.create(getAddress(), ATransaction.UNKNOWN_SEQUENCE, r.getValue());
ACell compiledCode=r.getValue();
ATransaction trans = Invoke.create(getAddress(), ATransaction.UNKNOWN_SEQUENCE, compiledCode);
return transact(trans);
});
} else {
Expand Down Expand Up @@ -570,7 +572,8 @@ private ACell buildCodeForm(String code) {
* @throws InterruptedException in case of interrupt while waiting
*/
public synchronized Result transactSync(String code) throws InterruptedException {
ATransaction trans = Invoke.create(getAddress(), ATransaction.UNKNOWN_SEQUENCE, code);
ACell form=buildCodeForm(code);
ATransaction trans = Invoke.create(getAddress(), ATransaction.UNKNOWN_SEQUENCE, form);
return transactSync(trans);
}

Expand Down

0 comments on commit fcd0735

Please sign in to comment.