diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/GetApplicationBoxByName.java b/src/main/java/com/algorand/algosdk/v2/client/algod/GetApplicationBoxByName.java index 2eab16704..61b6a079d 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/GetApplicationBoxByName.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/GetApplicationBoxByName.java @@ -9,8 +9,8 @@ /** - * Given an application ID and box name, it returns the box name and value (each - * base64 encoded). Box names must be in the goal app call arg encoding form + * Given an application ID and box name, it returns the round, box name, and value + * (each base64 encoded). Box names must be in the goal app call arg encoding form * 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form * 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use * the form 'addr:XYZ...'. diff --git a/src/main/java/com/algorand/algosdk/v2/client/common/AlgodClient.java b/src/main/java/com/algorand/algosdk/v2/client/common/AlgodClient.java index 5e86f4c24..08f90299c 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/common/AlgodClient.java +++ b/src/main/java/com/algorand/algosdk/v2/client/common/AlgodClient.java @@ -314,8 +314,8 @@ public GetApplicationBoxes GetApplicationBoxes(Long applicationId) { } /** - * Given an application ID and box name, it returns the box name and value (each - * base64 encoded). Box names must be in the goal app call arg encoding form + * Given an application ID and box name, it returns the round, box name, and value + * (each base64 encoded). Box names must be in the goal app call arg encoding form * 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form * 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use * the form 'addr:XYZ...'. diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/Box.java b/src/main/java/com/algorand/algosdk/v2/client/model/Box.java index 326593c4a..3498ceedf 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/Box.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/Box.java @@ -23,6 +23,12 @@ public String name() { } public byte[] name; + /** + * The round for which this information is relevant + */ + @JsonProperty("round") + public Long round; + /** * (value) box value, base64 encoded. */ @@ -43,6 +49,7 @@ public boolean equals(Object o) { Box other = (Box) o; if (!Objects.deepEquals(this.name, other.name)) return false; + if (!Objects.deepEquals(this.round, other.round)) return false; if (!Objects.deepEquals(this.value, other.value)) return false; return true; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateRequest.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateRequest.java index 5e56ac6f5..68b69bed1 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateRequest.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateRequest.java @@ -25,6 +25,12 @@ public class SimulateRequest extends PathResponse { @JsonProperty("allow-more-logging") public Boolean allowMoreLogging; + /** + * An object that configures simulation execution trace. + */ + @JsonProperty("exec-trace-config") + public SimulateTraceConfig execTraceConfig; + /** * Applies extra opcode budget during simulation for each transaction group. */ @@ -46,6 +52,7 @@ public boolean equals(Object o) { SimulateRequest other = (SimulateRequest) o; if (!Objects.deepEquals(this.allowEmptySignatures, other.allowEmptySignatures)) return false; if (!Objects.deepEquals(this.allowMoreLogging, other.allowMoreLogging)) return false; + if (!Objects.deepEquals(this.execTraceConfig, other.execTraceConfig)) return false; if (!Objects.deepEquals(this.extraOpcodeBudget, other.extraOpcodeBudget)) return false; if (!Objects.deepEquals(this.txnGroups, other.txnGroups)) return false; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateResponse.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateResponse.java index 213713d35..0dad12b91 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateResponse.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateResponse.java @@ -20,6 +20,12 @@ public class SimulateResponse extends PathResponse { @JsonProperty("eval-overrides") public SimulationEvalOverrides evalOverrides; + /** + * An object that configures simulation execution trace. + */ + @JsonProperty("exec-trace-config") + public SimulateTraceConfig execTraceConfig; + /** * The round immediately preceding this simulation. State changes through this * round were used to run this simulation. @@ -47,6 +53,7 @@ public boolean equals(Object o) { SimulateResponse other = (SimulateResponse) o; if (!Objects.deepEquals(this.evalOverrides, other.evalOverrides)) return false; + if (!Objects.deepEquals(this.execTraceConfig, other.execTraceConfig)) return false; if (!Objects.deepEquals(this.lastRound, other.lastRound)) return false; if (!Objects.deepEquals(this.txnGroups, other.txnGroups)) return false; if (!Objects.deepEquals(this.version, other.version)) return false; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTraceConfig.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTraceConfig.java new file mode 100644 index 000000000..9e7266810 --- /dev/null +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTraceConfig.java @@ -0,0 +1,30 @@ +package com.algorand.algosdk.v2.client.model; + +import java.util.Objects; + +import com.algorand.algosdk.v2.client.common.PathResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object that configures simulation execution trace. + */ +public class SimulateTraceConfig extends PathResponse { + + /** + * A boolean option for opting in execution trace features simulation endpoint. + */ + @JsonProperty("enable") + public Boolean enable; + + @Override + public boolean equals(Object o) { + + if (this == o) return true; + if (o == null) return false; + + SimulateTraceConfig other = (SimulateTraceConfig) o; + if (!Objects.deepEquals(this.enable, other.enable)) return false; + + return true; + } +} diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTransactionResult.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTransactionResult.java index 783cb6435..280084656 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTransactionResult.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulateTransactionResult.java @@ -17,6 +17,13 @@ public class SimulateTransactionResult extends PathResponse { @JsonProperty("app-budget-consumed") public Long appBudgetConsumed; + /** + * The execution trace of calling an app or a logic sig, containing the inner app + * call trace in a recursive way. + */ + @JsonProperty("exec-trace") + public SimulationTransactionExecTrace execTrace; + /** * Budget used during execution of a logic sig transaction. */ @@ -38,6 +45,7 @@ public boolean equals(Object o) { SimulateTransactionResult other = (SimulateTransactionResult) o; if (!Objects.deepEquals(this.appBudgetConsumed, other.appBudgetConsumed)) return false; + if (!Objects.deepEquals(this.execTrace, other.execTrace)) return false; if (!Objects.deepEquals(this.logicSigBudgetConsumed, other.logicSigBudgetConsumed)) return false; if (!Objects.deepEquals(this.txnResult, other.txnResult)) return false; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulationOpcodeTraceUnit.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulationOpcodeTraceUnit.java new file mode 100644 index 000000000..609b808cd --- /dev/null +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulationOpcodeTraceUnit.java @@ -0,0 +1,39 @@ +package com.algorand.algosdk.v2.client.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import com.algorand.algosdk.v2.client.common.PathResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of trace information and effect from evaluating a single opcode. + */ +public class SimulationOpcodeTraceUnit extends PathResponse { + + /** + * The program counter of the current opcode being evaluated. + */ + @JsonProperty("pc") + public Long pc; + + /** + * The indexes of the traces for inner transactions spawned by this opcode, if any. + */ + @JsonProperty("spawned-inners") + public List spawnedInners = new ArrayList(); + + @Override + public boolean equals(Object o) { + + if (this == o) return true; + if (o == null) return false; + + SimulationOpcodeTraceUnit other = (SimulationOpcodeTraceUnit) o; + if (!Objects.deepEquals(this.pc, other.pc)) return false; + if (!Objects.deepEquals(this.spawnedInners, other.spawnedInners)) return false; + + return true; + } +} diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/SimulationTransactionExecTrace.java b/src/main/java/com/algorand/algosdk/v2/client/model/SimulationTransactionExecTrace.java new file mode 100644 index 000000000..71219959d --- /dev/null +++ b/src/main/java/com/algorand/algosdk/v2/client/model/SimulationTransactionExecTrace.java @@ -0,0 +1,55 @@ +package com.algorand.algosdk.v2.client.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import com.algorand.algosdk.v2.client.common.PathResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The execution trace of calling an app or a logic sig, containing the inner app + * call trace in a recursive way. + */ +public class SimulationTransactionExecTrace extends PathResponse { + + /** + * Program trace that contains a trace of opcode effects in an approval program. + */ + @JsonProperty("approval-program-trace") + public List approvalProgramTrace = new ArrayList(); + + /** + * Program trace that contains a trace of opcode effects in a clear state program. + */ + @JsonProperty("clear-state-program-trace") + public List clearStateProgramTrace = new ArrayList(); + + /** + * An array of SimulationTransactionExecTrace representing the execution trace of + * any inner transactions executed. + */ + @JsonProperty("inner-trace") + public List innerTrace = new ArrayList(); + + /** + * Program trace that contains a trace of opcode effects in a logic sig. + */ + @JsonProperty("logic-sig-trace") + public List logicSigTrace = new ArrayList(); + + @Override + public boolean equals(Object o) { + + if (this == o) return true; + if (o == null) return false; + + SimulationTransactionExecTrace other = (SimulationTransactionExecTrace) o; + if (!Objects.deepEquals(this.approvalProgramTrace, other.approvalProgramTrace)) return false; + if (!Objects.deepEquals(this.clearStateProgramTrace, other.clearStateProgramTrace)) return false; + if (!Objects.deepEquals(this.innerTrace, other.innerTrace)) return false; + if (!Objects.deepEquals(this.logicSigTrace, other.logicSigTrace)) return false; + + return true; + } +}