2018-04-05 02:07:09 +00:00
|
|
|
package cy.agorise.graphenej.api.calls;
|
|
|
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import cy.agorise.graphenej.RPC;
|
2018-04-05 22:35:34 +00:00
|
|
|
import cy.agorise.graphenej.api.ApiAccess;
|
2018-04-05 02:07:09 +00:00
|
|
|
import cy.agorise.graphenej.models.ApiCall;
|
|
|
|
|
|
|
|
/**
|
2018-06-05 03:10:03 +00:00
|
|
|
* Wrapper around the "get_block" API call.
|
2018-04-05 02:07:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
public class GetBlock implements ApiCallable {
|
|
|
|
|
2018-04-05 22:35:34 +00:00
|
|
|
public static final int REQUIRED_API = ApiAccess.API_DATABASE;
|
|
|
|
|
2018-04-05 02:07:09 +00:00
|
|
|
private long blockNumber;
|
|
|
|
|
2018-06-11 20:12:48 +00:00
|
|
|
public GetBlock(long blockNum){
|
2018-04-05 02:07:09 +00:00
|
|
|
this.blockNumber = blockNum;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ApiCall toApiCall(int apiId, long sequenceId){
|
|
|
|
ArrayList<Serializable> params = new ArrayList<>();
|
|
|
|
String blockNum = String.format("%d", this.blockNumber);
|
|
|
|
params.add(blockNum);
|
|
|
|
return new ApiCall(apiId, RPC.CALL_GET_BLOCK, params, RPC.VERSION, sequenceId);
|
|
|
|
}
|
|
|
|
}
|