-
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.
- Loading branch information
Showing
33 changed files
with
912 additions
and
63 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
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
65 changes: 65 additions & 0 deletions
65
src/main/java/com/algorand/algosdk/v2/client/algod/GetBlockTxids.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,65 @@ | ||
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.BlockTxidsResponse; | ||
|
||
|
||
/** | ||
* Get the top level transaction IDs for the block on the given round. | ||
* /v2/blocks/{round}/txids | ||
*/ | ||
public class GetBlockTxids extends Query { | ||
|
||
private Long round; | ||
|
||
/** | ||
* @param round The round from which to fetch block transaction IDs. | ||
*/ | ||
public GetBlockTxids(Client client, Long round) { | ||
super(client, new HttpMethod("get")); | ||
this.round = round; | ||
} | ||
|
||
/** | ||
* Execute the query. | ||
* @return the query response object. | ||
* @throws Exception | ||
*/ | ||
@Override | ||
public Response<BlockTxidsResponse> execute() throws Exception { | ||
Response<BlockTxidsResponse> resp = baseExecute(); | ||
resp.setValueType(BlockTxidsResponse.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<BlockTxidsResponse> execute(String[] headers, String[] values) throws Exception { | ||
Response<BlockTxidsResponse> resp = baseExecute(headers, values); | ||
resp.setValueType(BlockTxidsResponse.class); | ||
return resp; | ||
} | ||
|
||
protected QueryData getRequestString() { | ||
if (this.round == null) { | ||
throw new RuntimeException("round is not set. It is a required parameter."); | ||
} | ||
addPathSegment(String.valueOf("v2")); | ||
addPathSegment(String.valueOf("blocks")); | ||
addPathSegment(String.valueOf(round)); | ||
addPathSegment(String.valueOf("txids")); | ||
|
||
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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/algorand/algosdk/v2/client/model/ApplicationInitialStates.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,54 @@ | ||
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; | ||
|
||
/** | ||
* An application's initial global/local/box states that were accessed during | ||
* simulation. | ||
*/ | ||
public class ApplicationInitialStates extends PathResponse { | ||
|
||
/** | ||
* An application's global/local/box state. | ||
*/ | ||
@JsonProperty("app-boxes") | ||
public ApplicationKVStorage appBoxes; | ||
|
||
/** | ||
* An application's global/local/box state. | ||
*/ | ||
@JsonProperty("app-globals") | ||
public ApplicationKVStorage appGlobals; | ||
|
||
/** | ||
* An application's initial local states tied to different accounts. | ||
*/ | ||
@JsonProperty("app-locals") | ||
public List<ApplicationKVStorage> appLocals = new ArrayList<ApplicationKVStorage>(); | ||
|
||
/** | ||
* Application index. | ||
*/ | ||
@JsonProperty("id") | ||
public java.math.BigInteger id; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
|
||
if (this == o) return true; | ||
if (o == null) return false; | ||
|
||
ApplicationInitialStates other = (ApplicationInitialStates) o; | ||
if (!Objects.deepEquals(this.appBoxes, other.appBoxes)) return false; | ||
if (!Objects.deepEquals(this.appGlobals, other.appGlobals)) return false; | ||
if (!Objects.deepEquals(this.appLocals, other.appLocals)) return false; | ||
if (!Objects.deepEquals(this.id, other.id)) return false; | ||
|
||
return true; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/com/algorand/algosdk/v2/client/model/ApplicationKVStorage.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,52 @@ | ||
package com.algorand.algosdk.v2.client.model; | ||
|
||
import java.security.NoSuchAlgorithmException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import com.algorand.algosdk.crypto.Address; | ||
import com.algorand.algosdk.v2.client.common.PathResponse; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* An application's global/local/box state. | ||
*/ | ||
public class ApplicationKVStorage extends PathResponse { | ||
|
||
/** | ||
* The address of the account associated with the local state. | ||
*/ | ||
@JsonProperty("account") | ||
public void account(String account) throws NoSuchAlgorithmException { | ||
this.account = new Address(account); | ||
} | ||
@JsonProperty("account") | ||
public String account() throws NoSuchAlgorithmException { | ||
if (this.account != null) { | ||
return this.account.encodeAsString(); | ||
} else { | ||
return null; | ||
} | ||
} | ||
public Address account; | ||
|
||
/** | ||
* Key-Value pairs representing application states. | ||
*/ | ||
@JsonProperty("kvs") | ||
public List<AvmKeyValue> kvs = new ArrayList<AvmKeyValue>(); | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
|
||
if (this == o) return true; | ||
if (o == null) return false; | ||
|
||
ApplicationKVStorage other = (ApplicationKVStorage) o; | ||
if (!Objects.deepEquals(this.account, other.account)) return false; | ||
if (!Objects.deepEquals(this.kvs, other.kvs)) return false; | ||
|
||
return true; | ||
} | ||
} |
Oops, something went wrong.