-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rerun code generation based on new models
- Loading branch information
1 parent
6eae55f
commit 7658af9
Showing
12 changed files
with
166 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/main/java/com/algorand/algosdk/v2/client/algod/TealDisassemble.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 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<DisassembleResponse> execute() throws Exception { | ||
Response<DisassembleResponse> 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<DisassembleResponse> execute(String[] headers, String[] values) throws Exception { | ||
Response<DisassembleResponse> 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/com/algorand/algosdk/v2/client/model/DisassembleResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters