Search in sources :

Example 6 with RpcResult

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);
}
Also used : RpcResult(io.nuls.rpc.entity.RpcResult) RpcResult(io.nuls.rpc.entity.RpcResult) Result(io.nuls.core.chain.entity.Result)

Example 7 with RpcResult

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();
}
Also used : RpcResult(io.nuls.rpc.entity.RpcResult)

Example 8 with RpcResult

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;
}
Also used : RpcResult(io.nuls.rpc.entity.RpcResult) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with RpcResult

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;
}
Also used : RpcResult(io.nuls.rpc.entity.RpcResult)

Example 10 with RpcResult

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;
}
Also used : RpcResult(io.nuls.rpc.entity.RpcResult)

Aggregations

RpcResult (io.nuls.rpc.entity.RpcResult)26 HashMap (java.util.HashMap)6 BlockDto (io.nuls.rpc.entity.BlockDto)5 Result (io.nuls.core.chain.entity.Result)4 Map (java.util.Map)4 IOException (java.io.IOException)3 Block (io.nuls.core.chain.entity.Block)2 BlockHeader (io.nuls.core.chain.entity.BlockHeader)2 Transaction (io.nuls.core.chain.entity.Transaction)2 NulsRuntimeException (io.nuls.core.exception.NulsRuntimeException)2 UtxoOutputPo (io.nuls.db.entity.UtxoOutputPo)2 TransactionDto (io.nuls.rpc.entity.TransactionDto)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Page (io.nuls.core.dto.Page)1 ModuleService (io.nuls.core.module.service.ModuleService)1 AgentPo (io.nuls.db.entity.AgentPo)1