From 4df2a3067c4e251b2f8982bbe85d1d5fb4f850eb Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Wed, 11 May 2022 14:45:39 -0400 Subject: [PATCH 1/6] generate api client code --- .../algosdk/v2/client/algod/GetProof.java | 1 + .../v2/client/algod/TealDisassemble.java | 68 +++++++++++++++++++ .../algosdk/v2/client/common/AlgodClient.java | 11 +++ .../v2/client/common/IndexerClient.java | 7 +- .../indexer/LookupAccountTransactions.java | 2 +- .../indexer/LookupAssetTransactions.java | 2 +- .../client/indexer/SearchForTransactions.java | 3 +- .../v2/client/model/DisassembleResponse.java | 30 ++++++++ .../v2/client/model/DryrunTxnResult.java | 15 ++-- .../v2/client/model/ProofResponse.java | 2 +- 10 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java create mode 100644 src/main/java/com/algorand/algosdk/v2/client/model/DisassembleResponse.java diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java b/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java index d07043feb..c9b8b61ea 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java @@ -5,6 +5,7 @@ import com.algorand.algosdk.v2.client.common.Query; import com.algorand.algosdk.v2.client.common.QueryData; import com.algorand.algosdk.v2.client.common.Response; +import com.algorand.algosdk.v2.client.model.Enums; import com.algorand.algosdk.v2.client.model.ProofResponse; diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java new file mode 100644 index 000000000..546d8e1ea --- /dev/null +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java @@ -0,0 +1,68 @@ +package com.algorand.algosdk.v2.client.algod; + +import com.algorand.algosdk.v2.client.common.Client; +import com.algorand.algosdk.v2.client.common.HttpMethod; +import com.algorand.algosdk.v2.client.common.Query; +import com.algorand.algosdk.v2.client.common.QueryData; +import com.algorand.algosdk.v2.client.common.Response; +import com.algorand.algosdk.v2.client.model.DisassembleResponse; + + +/** + * Given the base64 encoded program bytes, return the TEAL source code in plain + * text. This endpoint is only enabled when a node's configuration file sets + * EnableDeveloperAPI to true. + * /v2/teal/disassemble + */ +public class TealDisassemble extends Query { + + public TealDisassemble(Client client) { + super(client, new HttpMethod("post")); + } + + /** + * TEAL program binary to be disassembled + */ + public TealDisassemble source(byte[] source) { + addToBody(source); + return this; + } + + /** + * Execute the query. + * @return the query response object. + * @throws Exception + */ + @Override + public Response execute() throws Exception { + Response resp = baseExecute(); + resp.setValueType(DisassembleResponse.class); + return resp; + } + + /** + * Execute the query with custom headers, there must be an equal number of keys and values + * or else an error will be generated. + * @param headers an array of header keys + * @param values an array of header values + * @return the query response object. + * @throws Exception + */ + @Override + public Response execute(String[] headers, String[] values) throws Exception { + Response resp = baseExecute(headers, values); + resp.setValueType(DisassembleResponse.class); + return resp; + } + + protected QueryData getRequestString() { + if (qd.bodySegments.isEmpty()) { + throw new RuntimeException("source is not set. It is a required parameter."); + } + addPathSegment(String.valueOf("v2")); + addPathSegment(String.valueOf("teal")); + addPathSegment(String.valueOf("disassemble")); + + return qd; + } +} 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 e6632efa6..0c017cf40 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 @@ -21,6 +21,7 @@ import com.algorand.algosdk.v2.client.algod.GetApplicationByID; import com.algorand.algosdk.v2.client.algod.GetAssetByID; import com.algorand.algosdk.v2.client.algod.TealCompile; +import com.algorand.algosdk.v2.client.algod.TealDisassemble; import com.algorand.algosdk.v2.client.algod.TealDryrun; import com.algorand.algosdk.crypto.Address; @@ -240,6 +241,16 @@ public TealCompile TealCompile() { return new TealCompile((Client) this); } + /** + * Given the base64 encoded program bytes, return the TEAL source code in plain + * text. This endpoint is only enabled when a node's configuration file sets + * EnableDeveloperAPI to true. + * /v2/teal/disassemble + */ + public TealDisassemble TealDisassemble() { + return new TealDisassemble((Client) this); + } + /** * Executes TEAL program(s) in context and returns debugging information about the * execution. This endpoint is only enabled when a node's configuration file sets diff --git a/src/main/java/com/algorand/algosdk/v2/client/common/IndexerClient.java b/src/main/java/com/algorand/algosdk/v2/client/common/IndexerClient.java index b2486a905..6661c80d5 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/common/IndexerClient.java +++ b/src/main/java/com/algorand/algosdk/v2/client/common/IndexerClient.java @@ -110,7 +110,7 @@ public LookupAccountCreatedApplications lookupAccountCreatedApplications(Address } /** - * Lookup account transactions. + * Lookup account transactions. Transactions are returned newest to oldest. * /v2/accounts/{account-id}/transactions */ public LookupAccountTransactions lookupAccountTransactions(Address accountId) { @@ -166,7 +166,7 @@ public LookupAssetBalances lookupAssetBalances(Long assetId) { } /** - * Lookup transactions for an asset. + * Lookup transactions for an asset. Transactions are returned oldest to newest. * /v2/assets/{asset-id}/transactions */ public LookupAssetTransactions lookupAssetTransactions(Long assetId) { @@ -190,7 +190,8 @@ public LookupTransaction lookupTransaction(String txid) { } /** - * Search for transactions. + * Search for transactions. Transactions are returned oldest to newest unless the + * address parameter is used, in which case results are returned newest to oldest. * /v2/transactions */ public SearchForTransactions searchForTransactions() { diff --git a/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAccountTransactions.java b/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAccountTransactions.java index 0aadb6213..d99ec5b91 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAccountTransactions.java +++ b/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAccountTransactions.java @@ -15,7 +15,7 @@ /** - * Lookup account transactions. + * Lookup account transactions. Transactions are returned newest to oldest. * /v2/accounts/{account-id}/transactions */ public class LookupAccountTransactions extends Query { diff --git a/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAssetTransactions.java b/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAssetTransactions.java index ea0cebef2..ede4367b1 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAssetTransactions.java +++ b/src/main/java/com/algorand/algosdk/v2/client/indexer/LookupAssetTransactions.java @@ -15,7 +15,7 @@ /** - * Lookup transactions for an asset. + * Lookup transactions for an asset. Transactions are returned oldest to newest. * /v2/assets/{asset-id}/transactions */ public class LookupAssetTransactions extends Query { diff --git a/src/main/java/com/algorand/algosdk/v2/client/indexer/SearchForTransactions.java b/src/main/java/com/algorand/algosdk/v2/client/indexer/SearchForTransactions.java index 22c7dace2..3197b89b0 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/indexer/SearchForTransactions.java +++ b/src/main/java/com/algorand/algosdk/v2/client/indexer/SearchForTransactions.java @@ -15,7 +15,8 @@ /** - * Search for transactions. + * Search for transactions. Transactions are returned oldest to newest unless the + * address parameter is used, in which case results are returned newest to oldest. * /v2/transactions */ public class SearchForTransactions extends Query { diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/DisassembleResponse.java b/src/main/java/com/algorand/algosdk/v2/client/model/DisassembleResponse.java new file mode 100644 index 000000000..468a36a07 --- /dev/null +++ b/src/main/java/com/algorand/algosdk/v2/client/model/DisassembleResponse.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; + +/** + * Teal disassembly Result + */ +public class DisassembleResponse extends PathResponse { + + /** + * disassembled Teal code + */ + @JsonProperty("result") + public String result; + + @Override + public boolean equals(Object o) { + + if (this == o) return true; + if (o == null) return false; + + DisassembleResponse other = (DisassembleResponse) o; + if (!Objects.deepEquals(this.result, other.result)) return false; + + return true; + } +} diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java index 1ca53a139..bed91710e 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java @@ -22,10 +22,16 @@ public class DryrunTxnResult extends PathResponse { public List appCallTrace = new ArrayList(); /** - * Execution cost of app call transaction + * Budget consumed during execution of app call transaction. */ - @JsonProperty("cost") - public Long cost; + @JsonProperty("budget-credit") + public Long budgetCredit; + + /** + * Budget added during execution of app call transaction. + */ + @JsonProperty("budget-debit") + public Long budgetDebit; /** * Disassembled program line by line. @@ -81,7 +87,8 @@ public boolean equals(Object o) { DryrunTxnResult other = (DryrunTxnResult) o; if (!Objects.deepEquals(this.appCallMessages, other.appCallMessages)) return false; if (!Objects.deepEquals(this.appCallTrace, other.appCallTrace)) return false; - if (!Objects.deepEquals(this.cost, other.cost)) return false; + if (!Objects.deepEquals(this.budgetCredit, other.budgetCredit)) return false; + if (!Objects.deepEquals(this.budgetDebit, other.budgetDebit)) return false; if (!Objects.deepEquals(this.disassembly, other.disassembly)) return false; if (!Objects.deepEquals(this.globalDelta, other.globalDelta)) return false; if (!Objects.deepEquals(this.localDeltas, other.localDeltas)) return false; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/ProofResponse.java b/src/main/java/com/algorand/algosdk/v2/client/model/ProofResponse.java index 71b4e8c89..6318e77a3 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/ProofResponse.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/ProofResponse.java @@ -13,8 +13,8 @@ public class ProofResponse extends PathResponse { /** * The type of hash function used to create the proof, must be one of: - * sumhash * sha512_256 + * sha256 */ @JsonProperty("hashtype") public Enums.Hashtype hashtype; From cf362771d6a44f23abed3bf7c5c2a13432c8e363 Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Thu, 12 May 2022 21:20:55 -0400 Subject: [PATCH 2/6] noop --- .../v2/client/model/DryrunTxnResult.java | 2 +- .../v2algodclient_responsejsons/app_trace.txt | 17 ++ .../error_app_trace.txt | 45 +++++ .../large_app_trace.txt | 189 ++++++++++++++++++ 4 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/v2algodclient_responsejsons/app_trace.txt create mode 100644 src/test/resources/v2algodclient_responsejsons/error_app_trace.txt create mode 100644 src/test/resources/v2algodclient_responsejsons/large_app_trace.txt diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java index bed91710e..5dae28903 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java @@ -84,7 +84,7 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; - DryrunTxnResult other = (DryrunTxnResult) o; + DryrunTxnResult other = (DryrunTxnResult) o; if (!Objects.deepEquals(this.appCallMessages, other.appCallMessages)) return false; if (!Objects.deepEquals(this.appCallTrace, other.appCallTrace)) return false; if (!Objects.deepEquals(this.budgetCredit, other.budgetCredit)) return false; diff --git a/src/test/resources/v2algodclient_responsejsons/app_trace.txt b/src/test/resources/v2algodclient_responsejsons/app_trace.txt new file mode 100644 index 000000000..c183a89f4 --- /dev/null +++ b/src/test/resources/v2algodclient_responsejsons/app_trace.txt @@ -0,0 +1,17 @@ +pc# |ln# |source |scratch |stack +1 |1 |intcblock 0 4 1 5 2 | |[] +8 |2 |bytecblock 0x43726561746f72 0x... | |[] +72 |3 |intc_0 | |[] +73 |4 |txn ApplicationID | |[0] +75 |5 |== | |[0, 0] +76 |6 |bz label1 | |[1] +79 |7 |bytec_0 | |[] +80 |8 |txn Sender | |[0x43726561746f72] +82 |9 |app_global_put | |[0x43726561746f72, 0xa01e926fb... +83 |10 |txn NumAppArgs | |[] +85 |11 |intc_1 | |[0] +86 |12 |== | |[0, 4] +87 |13 |bz label2 | |[0] +311 |163 |intc_0 | |[] +312 |164 |return | |[0] +315 |168 | | |[0] diff --git a/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt b/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt new file mode 100644 index 000000000..781b06eae --- /dev/null +++ b/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt @@ -0,0 +1,45 @@ +pc# |ln# |source |scratch |stack +1 |1 |intcblock 1 0 10 | |[] +6 |2 |bytecblock 0xd87699ef | |[] +13 |3 |txn ApplicationID | |[] +15 |4 |intc_1 // 0 | |[16] +16 |5 |== | |[16, 0] +17 |6 |bnz label1 | |[0] +20 |7 |txn OnCompletion | |[] +22 |8 |pushint 5 | |[0] +24 |9 |== | |[0, 5] +25 |10 |bnz label2 | |[0] +28 |11 |txn OnCompletion | |[] +30 |12 |pushint 4 | |[0] +32 |13 |== | |[0, 4] +33 |14 |bnz label3 | |[0] +36 |15 |txn OnCompletion | |[] +38 |16 |pushint 2 | |[0] +40 |17 |== | |[0, 2] +41 |18 |bnz label4 | |[0] +44 |19 |txn OnCompletion | |[] +46 |20 |intc_0 // 1 | |[0] +47 |21 |== | |[0, 1] +48 |22 |bnz label5 | |[0] +51 |23 |txna ApplicationArgs 0 | |[] +54 |24 |pushbytes 0xd0c88c8d // 0xd0c8... | |[0xd0c88c8d] +60 |25 |== | |[0xd0c88c8d, 0xd0c88c8d] +61 |26 |bnz label6 | |[1] +81 |38 |callsub label10 | |[] +177 |103 |itxn_begin | |[] +178 |104 |pushint 6 | |[] +180 |105 |itxn_field TypeEnum | |[6] +182 |106 |txna ApplicationArgs 2 | |[] +185 |107 |btoi | |[0x00] +186 |108 |txnas Assets | |[0] +188 |109 |itxn_field Assets | |[0] +190 |110 |txna ApplicationArgs 1 | |[] +193 |111 |btoi | |[0x01] +194 |112 |txnas Applications | |[1] +196 |113 |itxn_field ApplicationID | |[17] +198 |114 |bytec_0 // 0xd87699ef | |[] +199 |115 |itxn_field ApplicationArgs | |[0xd87699ef] +201 |116 |intc_1 // 0 | |[] +202 |117 |itxn_field Fee | |[0] +204 |118 |itxn_submit | |[] +204 |118 |!! logic eval error: concat ar... | |[] diff --git a/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt b/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt new file mode 100644 index 000000000..751d1717d --- /dev/null +++ b/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt @@ -0,0 +1,189 @@ +pc# |ln# |source |scratch |stack +1 |1 |intcblock 0 1337 1 7 | |[] +8 |2 |bytecblock 0x4e474c3a20 0x7369... | |[] +60 |3 |global CurrentApplicationID | |[] +62 |4 |intc_0 // 0 | |[181] +63 |5 |== | |[181, 0] +64 |6 |txn NumAppArgs | |[0] +66 |7 |intc_0 // 0 | |[0, 4] +67 |8 |== | |[0, 4, 0] +68 |9 ||| | |[0, 0] +69 |10 |bnz label1 | |[0] +72 |11 |intc_2 // 1 | |[] +73 |12 |store 0 | |[1] +75 |13 |pushbytes 0x74776f // "two" |0 = 1 |[] +80 |14 |store 1 | |[0x74776f] +82 |15 |pushint 3 |1 = 0x74776f |[] +84 |16 |store 2 | |[3] +86 |17 |pushbytes 0x666f7572 // "four" |2 = 3 |[] +92 |18 |store 3 | |[0x666f7572] +94 |19 |intc_0 // 0 |3 = 0x666f7572 |[] +95 |20 |bytec 5 // "five" | |[0] +97 |21 |pushint 5 | |[0, 0x66697665] +99 |22 |app_local_put | |[0, 0x66697665, 5] +100 |23 |intc_0 // 0 | |[] +101 |24 |bytec_1 // "six" | |[0] +102 |25 |bytec_1 // "six" | |[0, 0x736978] +103 |26 |app_local_put | |[0, 0x736978, 0x736978] +104 |27 |intc_0 // 0 | |[] +105 |28 |bytec 6 // "seven" | |[0] +107 |29 |intc_3 // 7 | |[0, 0x736576656e] +108 |30 |app_local_put | |[0, 0x736576656e, 7] +109 |31 |intc_0 // 0 | |[] +110 |32 |bytec_2 // "eight" | |[0] +111 |33 |bytec_2 // "eight" | |[0, 0x6569676874] +112 |34 |app_local_put | |[0, 0x6569676874, 0x6569676874... +113 |35 |bytec 7 // "nine" | |[] +115 |36 |pushint 9 | |[0x6e696e65] +117 |37 |app_global_put | |[0x6e696e65, 9] +118 |38 |bytec_3 // "ten" | |[] +119 |39 |bytec_3 // "ten" | |[0x74656e] +120 |40 |app_global_put | |[0x74656e, 0x74656e] +121 |41 |bytec 8 // "eleven" | |[] +123 |42 |pushint 11 | |[0x656c6576656e] +125 |43 |app_global_put | |[0x656c6576656e, 11] +126 |44 |bytec 4 // "twelve" | |[] +128 |45 |bytec 4 // "twelve" | |[0x7477656c7665] +130 |46 |app_global_put | |[0x7477656c7665, 0x7477656c766... +131 |47 |load 0 | |[] +133 |48 |intc_1 // 1337 | |[1] +134 |49 |+ | |[1, 1337] +135 |50 |store 0 | |[1338] +137 |51 |bytec_0 // "NGL: " |0 = 1338 |[] +138 |52 |load 1 | |[0x4e474c3a20] +140 |53 |concat | |[0x4e474c3a20, 0x74776f] +141 |54 |store 1 | |[0x4e474c3a2074776f] +143 |55 |load 2 |1 = 0x4e474c3a2074776f |[] +145 |56 |intc_1 // 1337 | |[3] +146 |57 |+ | |[3, 1337] +147 |58 |store 2 | |[1340] +149 |59 |bytec_0 // "NGL: " |2 = 1340 |[] +150 |60 |load 3 | |[0x4e474c3a20] +152 |61 |concat | |[0x4e474c3a20, 0x666f7572] +153 |62 |store 3 | |[0x4e474c3a20666f7572] +155 |63 |intc_0 // 0 |3 = 0x4e474c3a20666f7572 |[] +156 |64 |bytec 5 // "five" | |[0] +158 |65 |intc_1 // 1337 | |[0, 0x66697665] +159 |66 |intc_0 // 0 | |[0, 0x66697665, 1337] +160 |67 |bytec 5 // "five" | |[0, 0x66697665, 1337, 0] +162 |68 |app_local_get | |[0, 0x66697665, 1337, 0, 0x666... +163 |69 |+ | |[0, 0x66697665, 1337, 5] +164 |70 |app_local_put | |[0, 0x66697665, 1342] +165 |71 |intc_0 // 0 | |[] +166 |72 |bytec_1 // "six" | |[0] +167 |73 |bytec_0 // "NGL: " | |[0, 0x736978] +168 |74 |intc_0 // 0 | |[0, 0x736978, 0x4e474c3a20] +169 |75 |bytec_1 // "six" | |[0, 0x736978, 0x4e474c3a20, 0] +170 |76 |app_local_get | |[0, 0x736978, 0x4e474c3a20, 0,... +171 |77 |concat | |[0, 0x736978, 0x4e474c3a20, 0x... +172 |78 |app_local_put | |[0, 0x736978, 0x4e474c3a207369... +173 |79 |intc_0 // 0 | |[] +174 |80 |bytec 6 // "seven" | |[0] +176 |81 |intc_0 // 0 | |[0, 0x736576656e] +177 |82 |bytec 6 // "seven" | |[0, 0x736576656e, 0] +179 |83 |app_local_get | |[0, 0x736576656e, 0, 0x7365766... +180 |84 |app_local_put | |[0, 0x736576656e, 7] +181 |85 |intc_0 // 0 | |[] +182 |86 |bytec_2 // "eight" | |[0] +183 |87 |bytec_0 // "NGL: " | |[0, 0x6569676874] +184 |88 |intc_0 // 0 | |[0, 0x6569676874, 0x4e474c3a20... +185 |89 |bytec_2 // "eight" | |[0, 0x6569676874, 0x4e474c3a20... +186 |90 |app_local_get | |[0, 0x6569676874, 0x4e474c3a20... +187 |91 |concat | |[0, 0x6569676874, 0x4e474c3a20... +188 |92 |app_local_put | |[0, 0x6569676874, 0x4e474c3a20... +189 |93 |bytec 7 // "nine" | |[] +191 |94 |intc_1 // 1337 | |[0x6e696e65] +192 |95 |bytec 7 // "nine" | |[0x6e696e65, 1337] +194 |96 |app_global_get | |[0x6e696e65, 1337, 0x6e696e65] +195 |97 |+ | |[0x6e696e65, 1337, 9] +196 |98 |app_global_put | |[0x6e696e65, 1346] +197 |99 |bytec_3 // "ten" | |[] +198 |100 |bytec_0 // "NGL: " | |[0x74656e] +199 |101 |bytec_3 // "ten" | |[0x74656e, 0x4e474c3a20] +200 |102 |app_global_get | |[0x74656e, 0x4e474c3a20, 0x746... +201 |103 |concat | |[0x74656e, 0x4e474c3a20, 0x746... +202 |104 |app_global_put | |[0x74656e, 0x4e474c3a2074656e] +203 |105 |bytec 8 // "eleven" | |[] +205 |106 |intc_1 // 1337 | |[0x656c6576656e] +206 |107 |bytec 8 // "eleven" | |[0x656c6576656e, 1337] +208 |108 |app_global_get | |[0x656c6576656e, 1337, 0x656c6... +209 |109 |+ | |[0x656c6576656e, 1337, 11] +210 |110 |app_global_put | |[0x656c6576656e, 1348] +211 |111 |bytec 4 // "twelve" | |[] +213 |112 |bytec_0 // "NGL: " | |[0x7477656c7665] +214 |113 |bytec 4 // "twelve" | |[0x7477656c7665, 0x4e474c3a20] +216 |114 |app_global_get | |[0x7477656c7665, 0x4e474c3a20,... +217 |115 |concat | |[0x7477656c7665, 0x4e474c3a20,... +218 |116 |app_global_put | |[0x7477656c7665, 0x4e474c3a207... +219 |117 |txna ApplicationArgs 0 | |[] +222 |118 |btoi | |[0x0000000000000027] +223 |119 |store 13 | |[39] +225 |120 |txna ApplicationArgs 1 |13 = 39 |[] +228 |121 |store 14 | |[0x0000000000000064] +230 |122 |txna ApplicationArgs 2 |14 = 0x0000000000000064 |[] +233 |123 |btoi | |[0x000000000000002a] +234 |124 |store 6 | |[42] +236 |125 |txna ApplicationArgs 3 |6 = 42 |[] +239 |126 |store 7 | |[0x666f757274792074776f] +241 |127 |load 0 |7 = 0x666f757274792074776f |[] +243 |128 |pop | |[1338] +244 |129 |load 1 | |[] +246 |130 |pop | |[0x4e474c3a2074776f] +247 |131 |load 2 | |[] +249 |132 |pop | |[1340] +250 |133 |load 3 | |[] +252 |134 |pop | |[0x4e474c3a20666f7572] +253 |135 |intc_0 // 0 | |[] +254 |136 |bytec 5 // "five" | |[0] +256 |137 |app_local_get | |[0, 0x66697665] +257 |138 |pop | |[1342] +258 |139 |intc_0 // 0 | |[] +259 |140 |bytec_1 // "six" | |[0] +260 |141 |app_local_get | |[0, 0x736978] +261 |142 |pop | |[0x4e474c3a20736978] +262 |143 |intc_0 // 0 | |[] +263 |144 |bytec 6 // "seven" | |[0] +265 |145 |app_local_get | |[0, 0x736576656e] +266 |146 |pop | |[7] +267 |147 |intc_0 // 0 | |[] +268 |148 |bytec_2 // "eight" | |[0] +269 |149 |app_local_get | |[0, 0x6569676874] +270 |150 |pop | |[0x4e474c3a206569676874] +271 |151 |bytec 7 // "nine" | |[] +273 |152 |app_global_get | |[0x6e696e65] +274 |153 |pop | |[1346] +275 |154 |bytec_3 // "ten" | |[] +276 |155 |app_global_get | |[0x74656e] +277 |156 |pop | |[0x4e474c3a2074656e] +278 |157 |bytec 8 // "eleven" | |[] +280 |158 |app_global_get | |[0x656c6576656e] +281 |159 |pop | |[1348] +282 |160 |bytec 4 // "twelve" | |[] +284 |161 |app_global_get | |[0x7477656c7665] +285 |162 |pop | |[0x4e474c3a207477656c7665] +286 |163 |pushint 13 | |[] +288 |164 |store 4 | |[13] +290 |165 |load 4 |4 = 13 |[] +292 |166 |loads | |[13] +293 |167 |itob | |[39] +294 |168 |log | |[0x0000000000000027] +295 |169 |pushint 14 | |[] +297 |170 |store 5 | |[14] +299 |171 |load 5 |5 = 14 |[] +301 |172 |loads | |[14] +302 |173 |log | |[0x0000000000000064] +303 |174 |pushint 6 | |[] +305 |175 |store 4 | |[6] +307 |176 |load 4 |4 = 6 |[] +309 |177 |loads | |[6] +310 |178 |itob | |[42] +311 |179 |log | |[0x000000000000002a] +312 |180 |intc_3 // 7 | |[] +313 |181 |store 5 | |[7] +315 |182 |load 5 |5 = 7 |[] +317 |183 |loads | |[7] +318 |184 |log | |[0x666f757274792074776f] +319 |185 |intc_1 // 1337 | |[] +320 |186 |b label2 | |[1337] +324 |190 |return | |[1337] +325 |191 | | |[1337] From 5a859adcc1259bf67b60af1581de87712233c6bb Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Thu, 12 May 2022 21:22:49 -0400 Subject: [PATCH 3/6] remove generated files --- .../v2algodclient_responsejsons/app_trace.txt | 17 -- .../error_app_trace.txt | 45 ----- .../large_app_trace.txt | 189 ------------------ 3 files changed, 251 deletions(-) delete mode 100644 src/test/resources/v2algodclient_responsejsons/app_trace.txt delete mode 100644 src/test/resources/v2algodclient_responsejsons/error_app_trace.txt delete mode 100644 src/test/resources/v2algodclient_responsejsons/large_app_trace.txt diff --git a/src/test/resources/v2algodclient_responsejsons/app_trace.txt b/src/test/resources/v2algodclient_responsejsons/app_trace.txt deleted file mode 100644 index c183a89f4..000000000 --- a/src/test/resources/v2algodclient_responsejsons/app_trace.txt +++ /dev/null @@ -1,17 +0,0 @@ -pc# |ln# |source |scratch |stack -1 |1 |intcblock 0 4 1 5 2 | |[] -8 |2 |bytecblock 0x43726561746f72 0x... | |[] -72 |3 |intc_0 | |[] -73 |4 |txn ApplicationID | |[0] -75 |5 |== | |[0, 0] -76 |6 |bz label1 | |[1] -79 |7 |bytec_0 | |[] -80 |8 |txn Sender | |[0x43726561746f72] -82 |9 |app_global_put | |[0x43726561746f72, 0xa01e926fb... -83 |10 |txn NumAppArgs | |[] -85 |11 |intc_1 | |[0] -86 |12 |== | |[0, 4] -87 |13 |bz label2 | |[0] -311 |163 |intc_0 | |[] -312 |164 |return | |[0] -315 |168 | | |[0] diff --git a/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt b/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt deleted file mode 100644 index 781b06eae..000000000 --- a/src/test/resources/v2algodclient_responsejsons/error_app_trace.txt +++ /dev/null @@ -1,45 +0,0 @@ -pc# |ln# |source |scratch |stack -1 |1 |intcblock 1 0 10 | |[] -6 |2 |bytecblock 0xd87699ef | |[] -13 |3 |txn ApplicationID | |[] -15 |4 |intc_1 // 0 | |[16] -16 |5 |== | |[16, 0] -17 |6 |bnz label1 | |[0] -20 |7 |txn OnCompletion | |[] -22 |8 |pushint 5 | |[0] -24 |9 |== | |[0, 5] -25 |10 |bnz label2 | |[0] -28 |11 |txn OnCompletion | |[] -30 |12 |pushint 4 | |[0] -32 |13 |== | |[0, 4] -33 |14 |bnz label3 | |[0] -36 |15 |txn OnCompletion | |[] -38 |16 |pushint 2 | |[0] -40 |17 |== | |[0, 2] -41 |18 |bnz label4 | |[0] -44 |19 |txn OnCompletion | |[] -46 |20 |intc_0 // 1 | |[0] -47 |21 |== | |[0, 1] -48 |22 |bnz label5 | |[0] -51 |23 |txna ApplicationArgs 0 | |[] -54 |24 |pushbytes 0xd0c88c8d // 0xd0c8... | |[0xd0c88c8d] -60 |25 |== | |[0xd0c88c8d, 0xd0c88c8d] -61 |26 |bnz label6 | |[1] -81 |38 |callsub label10 | |[] -177 |103 |itxn_begin | |[] -178 |104 |pushint 6 | |[] -180 |105 |itxn_field TypeEnum | |[6] -182 |106 |txna ApplicationArgs 2 | |[] -185 |107 |btoi | |[0x00] -186 |108 |txnas Assets | |[0] -188 |109 |itxn_field Assets | |[0] -190 |110 |txna ApplicationArgs 1 | |[] -193 |111 |btoi | |[0x01] -194 |112 |txnas Applications | |[1] -196 |113 |itxn_field ApplicationID | |[17] -198 |114 |bytec_0 // 0xd87699ef | |[] -199 |115 |itxn_field ApplicationArgs | |[0xd87699ef] -201 |116 |intc_1 // 0 | |[] -202 |117 |itxn_field Fee | |[0] -204 |118 |itxn_submit | |[] -204 |118 |!! logic eval error: concat ar... | |[] diff --git a/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt b/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt deleted file mode 100644 index 751d1717d..000000000 --- a/src/test/resources/v2algodclient_responsejsons/large_app_trace.txt +++ /dev/null @@ -1,189 +0,0 @@ -pc# |ln# |source |scratch |stack -1 |1 |intcblock 0 1337 1 7 | |[] -8 |2 |bytecblock 0x4e474c3a20 0x7369... | |[] -60 |3 |global CurrentApplicationID | |[] -62 |4 |intc_0 // 0 | |[181] -63 |5 |== | |[181, 0] -64 |6 |txn NumAppArgs | |[0] -66 |7 |intc_0 // 0 | |[0, 4] -67 |8 |== | |[0, 4, 0] -68 |9 ||| | |[0, 0] -69 |10 |bnz label1 | |[0] -72 |11 |intc_2 // 1 | |[] -73 |12 |store 0 | |[1] -75 |13 |pushbytes 0x74776f // "two" |0 = 1 |[] -80 |14 |store 1 | |[0x74776f] -82 |15 |pushint 3 |1 = 0x74776f |[] -84 |16 |store 2 | |[3] -86 |17 |pushbytes 0x666f7572 // "four" |2 = 3 |[] -92 |18 |store 3 | |[0x666f7572] -94 |19 |intc_0 // 0 |3 = 0x666f7572 |[] -95 |20 |bytec 5 // "five" | |[0] -97 |21 |pushint 5 | |[0, 0x66697665] -99 |22 |app_local_put | |[0, 0x66697665, 5] -100 |23 |intc_0 // 0 | |[] -101 |24 |bytec_1 // "six" | |[0] -102 |25 |bytec_1 // "six" | |[0, 0x736978] -103 |26 |app_local_put | |[0, 0x736978, 0x736978] -104 |27 |intc_0 // 0 | |[] -105 |28 |bytec 6 // "seven" | |[0] -107 |29 |intc_3 // 7 | |[0, 0x736576656e] -108 |30 |app_local_put | |[0, 0x736576656e, 7] -109 |31 |intc_0 // 0 | |[] -110 |32 |bytec_2 // "eight" | |[0] -111 |33 |bytec_2 // "eight" | |[0, 0x6569676874] -112 |34 |app_local_put | |[0, 0x6569676874, 0x6569676874... -113 |35 |bytec 7 // "nine" | |[] -115 |36 |pushint 9 | |[0x6e696e65] -117 |37 |app_global_put | |[0x6e696e65, 9] -118 |38 |bytec_3 // "ten" | |[] -119 |39 |bytec_3 // "ten" | |[0x74656e] -120 |40 |app_global_put | |[0x74656e, 0x74656e] -121 |41 |bytec 8 // "eleven" | |[] -123 |42 |pushint 11 | |[0x656c6576656e] -125 |43 |app_global_put | |[0x656c6576656e, 11] -126 |44 |bytec 4 // "twelve" | |[] -128 |45 |bytec 4 // "twelve" | |[0x7477656c7665] -130 |46 |app_global_put | |[0x7477656c7665, 0x7477656c766... -131 |47 |load 0 | |[] -133 |48 |intc_1 // 1337 | |[1] -134 |49 |+ | |[1, 1337] -135 |50 |store 0 | |[1338] -137 |51 |bytec_0 // "NGL: " |0 = 1338 |[] -138 |52 |load 1 | |[0x4e474c3a20] -140 |53 |concat | |[0x4e474c3a20, 0x74776f] -141 |54 |store 1 | |[0x4e474c3a2074776f] -143 |55 |load 2 |1 = 0x4e474c3a2074776f |[] -145 |56 |intc_1 // 1337 | |[3] -146 |57 |+ | |[3, 1337] -147 |58 |store 2 | |[1340] -149 |59 |bytec_0 // "NGL: " |2 = 1340 |[] -150 |60 |load 3 | |[0x4e474c3a20] -152 |61 |concat | |[0x4e474c3a20, 0x666f7572] -153 |62 |store 3 | |[0x4e474c3a20666f7572] -155 |63 |intc_0 // 0 |3 = 0x4e474c3a20666f7572 |[] -156 |64 |bytec 5 // "five" | |[0] -158 |65 |intc_1 // 1337 | |[0, 0x66697665] -159 |66 |intc_0 // 0 | |[0, 0x66697665, 1337] -160 |67 |bytec 5 // "five" | |[0, 0x66697665, 1337, 0] -162 |68 |app_local_get | |[0, 0x66697665, 1337, 0, 0x666... -163 |69 |+ | |[0, 0x66697665, 1337, 5] -164 |70 |app_local_put | |[0, 0x66697665, 1342] -165 |71 |intc_0 // 0 | |[] -166 |72 |bytec_1 // "six" | |[0] -167 |73 |bytec_0 // "NGL: " | |[0, 0x736978] -168 |74 |intc_0 // 0 | |[0, 0x736978, 0x4e474c3a20] -169 |75 |bytec_1 // "six" | |[0, 0x736978, 0x4e474c3a20, 0] -170 |76 |app_local_get | |[0, 0x736978, 0x4e474c3a20, 0,... -171 |77 |concat | |[0, 0x736978, 0x4e474c3a20, 0x... -172 |78 |app_local_put | |[0, 0x736978, 0x4e474c3a207369... -173 |79 |intc_0 // 0 | |[] -174 |80 |bytec 6 // "seven" | |[0] -176 |81 |intc_0 // 0 | |[0, 0x736576656e] -177 |82 |bytec 6 // "seven" | |[0, 0x736576656e, 0] -179 |83 |app_local_get | |[0, 0x736576656e, 0, 0x7365766... -180 |84 |app_local_put | |[0, 0x736576656e, 7] -181 |85 |intc_0 // 0 | |[] -182 |86 |bytec_2 // "eight" | |[0] -183 |87 |bytec_0 // "NGL: " | |[0, 0x6569676874] -184 |88 |intc_0 // 0 | |[0, 0x6569676874, 0x4e474c3a20... -185 |89 |bytec_2 // "eight" | |[0, 0x6569676874, 0x4e474c3a20... -186 |90 |app_local_get | |[0, 0x6569676874, 0x4e474c3a20... -187 |91 |concat | |[0, 0x6569676874, 0x4e474c3a20... -188 |92 |app_local_put | |[0, 0x6569676874, 0x4e474c3a20... -189 |93 |bytec 7 // "nine" | |[] -191 |94 |intc_1 // 1337 | |[0x6e696e65] -192 |95 |bytec 7 // "nine" | |[0x6e696e65, 1337] -194 |96 |app_global_get | |[0x6e696e65, 1337, 0x6e696e65] -195 |97 |+ | |[0x6e696e65, 1337, 9] -196 |98 |app_global_put | |[0x6e696e65, 1346] -197 |99 |bytec_3 // "ten" | |[] -198 |100 |bytec_0 // "NGL: " | |[0x74656e] -199 |101 |bytec_3 // "ten" | |[0x74656e, 0x4e474c3a20] -200 |102 |app_global_get | |[0x74656e, 0x4e474c3a20, 0x746... -201 |103 |concat | |[0x74656e, 0x4e474c3a20, 0x746... -202 |104 |app_global_put | |[0x74656e, 0x4e474c3a2074656e] -203 |105 |bytec 8 // "eleven" | |[] -205 |106 |intc_1 // 1337 | |[0x656c6576656e] -206 |107 |bytec 8 // "eleven" | |[0x656c6576656e, 1337] -208 |108 |app_global_get | |[0x656c6576656e, 1337, 0x656c6... -209 |109 |+ | |[0x656c6576656e, 1337, 11] -210 |110 |app_global_put | |[0x656c6576656e, 1348] -211 |111 |bytec 4 // "twelve" | |[] -213 |112 |bytec_0 // "NGL: " | |[0x7477656c7665] -214 |113 |bytec 4 // "twelve" | |[0x7477656c7665, 0x4e474c3a20] -216 |114 |app_global_get | |[0x7477656c7665, 0x4e474c3a20,... -217 |115 |concat | |[0x7477656c7665, 0x4e474c3a20,... -218 |116 |app_global_put | |[0x7477656c7665, 0x4e474c3a207... -219 |117 |txna ApplicationArgs 0 | |[] -222 |118 |btoi | |[0x0000000000000027] -223 |119 |store 13 | |[39] -225 |120 |txna ApplicationArgs 1 |13 = 39 |[] -228 |121 |store 14 | |[0x0000000000000064] -230 |122 |txna ApplicationArgs 2 |14 = 0x0000000000000064 |[] -233 |123 |btoi | |[0x000000000000002a] -234 |124 |store 6 | |[42] -236 |125 |txna ApplicationArgs 3 |6 = 42 |[] -239 |126 |store 7 | |[0x666f757274792074776f] -241 |127 |load 0 |7 = 0x666f757274792074776f |[] -243 |128 |pop | |[1338] -244 |129 |load 1 | |[] -246 |130 |pop | |[0x4e474c3a2074776f] -247 |131 |load 2 | |[] -249 |132 |pop | |[1340] -250 |133 |load 3 | |[] -252 |134 |pop | |[0x4e474c3a20666f7572] -253 |135 |intc_0 // 0 | |[] -254 |136 |bytec 5 // "five" | |[0] -256 |137 |app_local_get | |[0, 0x66697665] -257 |138 |pop | |[1342] -258 |139 |intc_0 // 0 | |[] -259 |140 |bytec_1 // "six" | |[0] -260 |141 |app_local_get | |[0, 0x736978] -261 |142 |pop | |[0x4e474c3a20736978] -262 |143 |intc_0 // 0 | |[] -263 |144 |bytec 6 // "seven" | |[0] -265 |145 |app_local_get | |[0, 0x736576656e] -266 |146 |pop | |[7] -267 |147 |intc_0 // 0 | |[] -268 |148 |bytec_2 // "eight" | |[0] -269 |149 |app_local_get | |[0, 0x6569676874] -270 |150 |pop | |[0x4e474c3a206569676874] -271 |151 |bytec 7 // "nine" | |[] -273 |152 |app_global_get | |[0x6e696e65] -274 |153 |pop | |[1346] -275 |154 |bytec_3 // "ten" | |[] -276 |155 |app_global_get | |[0x74656e] -277 |156 |pop | |[0x4e474c3a2074656e] -278 |157 |bytec 8 // "eleven" | |[] -280 |158 |app_global_get | |[0x656c6576656e] -281 |159 |pop | |[1348] -282 |160 |bytec 4 // "twelve" | |[] -284 |161 |app_global_get | |[0x7477656c7665] -285 |162 |pop | |[0x4e474c3a207477656c7665] -286 |163 |pushint 13 | |[] -288 |164 |store 4 | |[13] -290 |165 |load 4 |4 = 13 |[] -292 |166 |loads | |[13] -293 |167 |itob | |[39] -294 |168 |log | |[0x0000000000000027] -295 |169 |pushint 14 | |[] -297 |170 |store 5 | |[14] -299 |171 |load 5 |5 = 14 |[] -301 |172 |loads | |[14] -302 |173 |log | |[0x0000000000000064] -303 |174 |pushint 6 | |[] -305 |175 |store 4 | |[6] -307 |176 |load 4 |4 = 6 |[] -309 |177 |loads | |[6] -310 |178 |itob | |[42] -311 |179 |log | |[0x000000000000002a] -312 |180 |intc_3 // 7 | |[] -313 |181 |store 5 | |[7] -315 |182 |load 5 |5 = 7 |[] -317 |183 |loads | |[7] -318 |184 |log | |[0x666f757274792074776f] -319 |185 |intc_1 // 1337 | |[] -320 |186 |b label2 | |[1337] -324 |190 |return | |[1337] -325 |191 | | |[1337] From 2d93fd60c012905b2132592751ca6eed70d3ba32 Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Mon, 16 May 2022 10:44:08 -0400 Subject: [PATCH 4/6] remove generated api code for teal disassembly --- .../algorand/algosdk/v2/client/algod/TealDisassemble.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java index 546d8e1ea..3baed7243 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java @@ -20,14 +20,6 @@ public TealDisassemble(Client client) { super(client, new HttpMethod("post")); } - /** - * TEAL program binary to be disassembled - */ - public TealDisassemble source(byte[] source) { - addToBody(source); - return this; - } - /** * Execute the query. * @return the query response object. From 9d9bd1593f8de9166d623c27a12d84b46f662731 Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Wed, 25 May 2022 14:57:25 -0400 Subject: [PATCH 5/6] regen --- .../algosdk/v2/client/algod/TealCompile.java | 9 +++++++ .../v2/client/algod/TealDisassemble.java | 12 ++++++++-- .../algosdk/v2/client/common/AlgodClient.java | 4 ++-- .../v2/client/model/CompileResponse.java | 8 +++++++ .../v2/client/model/DryrunTxnResult.java | 24 ++++++++++++------- .../algosdk/v2/client/model/Enums.java | 18 -------------- 6 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/TealCompile.java b/src/main/java/com/algorand/algosdk/v2/client/algod/TealCompile.java index aadd2b545..5b0d1008f 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/TealCompile.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/TealCompile.java @@ -28,6 +28,15 @@ public TealCompile source(byte[] source) { return this; } + /** + * When set to `true`, returns the source map of the program as a JSON. Defaults to + * `false`. + */ + public TealCompile sourcemap(Boolean sourcemap) { + addQuery("sourcemap", String.valueOf(sourcemap)); + return this; + } + /** * Execute the query. * @return the query response object. diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java index 3baed7243..ef6a4f5f8 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java @@ -9,8 +9,8 @@ /** - * Given the base64 encoded program bytes, return the TEAL source code in plain - * text. This endpoint is only enabled when a node's configuration file sets + * Given the program bytes, return the TEAL source code in plain text. This + * endpoint is only enabled when a node's configuration file sets * EnableDeveloperAPI to true. * /v2/teal/disassemble */ @@ -20,6 +20,14 @@ public TealDisassemble(Client client) { super(client, new HttpMethod("post")); } + /** + * TEAL program binary to be disassembled + */ + public TealDisassemble source(byte[] source) { + addToBody(source); + return this; + } + /** * Execute the query. * @return the query response object. 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 0c017cf40..4d2909782 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 @@ -242,8 +242,8 @@ public TealCompile TealCompile() { } /** - * Given the base64 encoded program bytes, return the TEAL source code in plain - * text. This endpoint is only enabled when a node's configuration file sets + * Given the program bytes, return the TEAL source code in plain text. This + * endpoint is only enabled when a node's configuration file sets * EnableDeveloperAPI to true. * /v2/teal/disassemble */ diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/CompileResponse.java b/src/main/java/com/algorand/algosdk/v2/client/model/CompileResponse.java index f0ed7b74f..35f245637 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/CompileResponse.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/CompileResponse.java @@ -1,5 +1,6 @@ package com.algorand.algosdk.v2.client.model; +import java.util.HashMap; import java.util.Objects; import com.algorand.algosdk.v2.client.common.PathResponse; @@ -22,6 +23,12 @@ public class CompileResponse extends PathResponse { @JsonProperty("result") public String result; + /** + * JSON of the source map + */ + @JsonProperty("sourcemap") + public HashMap sourcemap; + @Override public boolean equals(Object o) { @@ -31,6 +38,7 @@ public boolean equals(Object o) { CompileResponse other = (CompileResponse) o; if (!Objects.deepEquals(this.hash, other.hash)) return false; if (!Objects.deepEquals(this.result, other.result)) return false; + if (!Objects.deepEquals(this.sourcemap, other.sourcemap)) return false; return true; } diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java index 5dae28903..2aeda9a07 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/DryrunTxnResult.java @@ -21,17 +21,24 @@ public class DryrunTxnResult extends PathResponse { @JsonProperty("app-call-trace") public List appCallTrace = new ArrayList(); + /** + * Budget added during execution of app call transaction. + */ + @JsonProperty("budget-added") + public Long budgetAdded; + /** * Budget consumed during execution of app call transaction. */ - @JsonProperty("budget-credit") - public Long budgetCredit; + @JsonProperty("budget-consumed") + public Long budgetConsumed; /** - * Budget added during execution of app call transaction. + * Net cost of app execution. Field is DEPRECATED and is subject for removal. + * Instead, use `budget-added` and `budget-consumed. */ - @JsonProperty("budget-debit") - public Long budgetDebit; + @JsonProperty("cost") + public Long cost; /** * Disassembled program line by line. @@ -84,11 +91,12 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; - DryrunTxnResult other = (DryrunTxnResult) o; + DryrunTxnResult other = (DryrunTxnResult) o; if (!Objects.deepEquals(this.appCallMessages, other.appCallMessages)) return false; if (!Objects.deepEquals(this.appCallTrace, other.appCallTrace)) return false; - if (!Objects.deepEquals(this.budgetCredit, other.budgetCredit)) return false; - if (!Objects.deepEquals(this.budgetDebit, other.budgetDebit)) return false; + if (!Objects.deepEquals(this.budgetAdded, other.budgetAdded)) return false; + if (!Objects.deepEquals(this.budgetConsumed, other.budgetConsumed)) return false; + if (!Objects.deepEquals(this.cost, other.cost)) return false; if (!Objects.deepEquals(this.disassembly, other.disassembly)) return false; if (!Objects.deepEquals(this.globalDelta, other.globalDelta)) return false; if (!Objects.deepEquals(this.localDeltas, other.localDeltas)) return false; diff --git a/src/main/java/com/algorand/algosdk/v2/client/model/Enums.java b/src/main/java/com/algorand/algosdk/v2/client/model/Enums.java index b2515301c..d97c6ad37 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/model/Enums.java +++ b/src/main/java/com/algorand/algosdk/v2/client/model/Enums.java @@ -130,22 +130,4 @@ public String toString() { } } - /** - * Combine with the address parameter to define what type of address to search for. - */ - public enum Hashtype { - @JsonProperty("sumhash") SUMHASH("sumhash"), - @JsonProperty("sha512_256") SHA512_256("sha512_256"); - - final String serializedName; - Hashtype(String name) { - this.serializedName = name; - } - - @Override - public String toString() { - return this.serializedName; - } - } - } From 4234d818d450a8af9f22299d53f2e6193af100e2 Mon Sep 17 00:00:00 2001 From: algoidurovic <91566643+algoidurovic@users.noreply.github.com> Date: Wed, 25 May 2022 15:03:46 -0400 Subject: [PATCH 6/6] regen --- .../com/algorand/algosdk/v2/client/algod/GetProof.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java b/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java index c9b8b61ea..6824d0f4c 100644 --- a/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java +++ b/src/main/java/com/algorand/algosdk/v2/client/algod/GetProof.java @@ -29,6 +29,16 @@ public GetProof(Client client, Long round, String txid) { this.txid = txid; } + /** + * The type of hash function used to create the proof, must be one of: + * sha512_256 + * sha256 + */ + public GetProof hashtype(Enums.Hashtype hashtype) { + addQuery("hashtype", String.valueOf(hashtype)); + return this; + } + /** * Execute the query. * @return the query response object.