use of io.nuls.rpc.entity.RpcResult in project nuls by nuls-io.
the class WalletResouce method transfer.
@POST
@Path("/transfer")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult transfer(TransferForm form) {
AssertUtil.canNotEmpty(form.getToAddress());
AssertUtil.canNotEmpty(form.getAmount());
Result result = this.ledgerService.transfer(form.getAddress(), form.getPassword(), form.getToAddress(), Na.valueOf(form.getAmount()), form.getRemark());
return new RpcResult(result);
}
use of io.nuls.rpc.entity.RpcResult in project nuls by nuls-io.
the class RpcServerFilter method toResponse.
@Override
public Response toResponse(Exception e) {
e.printStackTrace();
RpcResult result = RpcResult.getFailed().setData(e.getMessage());
return Response.ok(result, MediaType.APPLICATION_JSON).build();
}
use of io.nuls.rpc.entity.RpcResult in project nuls by nuls-io.
the class PocConsensusResource method getAgentList.
@GET
@Path("/agent/list")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult getAgentList(@QueryParam("pageNumber") Integer pageNumber, @QueryParam("pageSize") Integer pageSize, @QueryParam("keyword") String keyword, @QueryParam("sortType") String sortType) {
if (null == pageNumber || pageNumber == 0) {
pageNumber = 1;
}
if (null == pageSize || pageSize == 0) {
pageSize = 10;
}
if (pageNumber < 0 || pageSize < 0 || pageSize > 100) {
return RpcResult.getFailed(ErrorCode.PARAMETER_ERROR);
}
RpcResult result = RpcResult.getSuccess();
Page<Map<String, Object>> list = this.consensusService.getAgentList(keyword, null, null, sortType, pageNumber, pageSize);
result.setData(list);
return result;
}
use of io.nuls.rpc.entity.RpcResult in project nuls by nuls-io.
the class PocConsensusResource method getAgentByAddress.
@GET
@Path("/agent/{agentAddress}")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult getAgentByAddress(@PathParam("agentAddress") String agentAddress) {
RpcResult result = RpcResult.getSuccess();
Map<String, Object> data = this.consensusService.getAgent(agentAddress);
result.setData(data);
return result;
}
use of io.nuls.rpc.entity.RpcResult in project nuls by nuls-io.
the class PocConsensusResource method getInfo.
@GET
@Path("/local")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult getInfo() {
RpcResult result = RpcResult.getSuccess();
Map<String, Object> dataMap = consensusService.getConsensusInfo(null);
result.setData(dataMap);
return result;
}
Aggregations