Search in sources :

Example 1 with OutputDto

use of io.nuls.rpc.entity.OutputDto in project nuls by nuls-io.

the class TransactionResource method list.

@GET
@Path("/locked")
@Produces(MediaType.APPLICATION_JSON)
public RpcResult list(@QueryParam("address") String address, @QueryParam("pageNumber") int pageNumber, @QueryParam("pageSize") int pageSize) {
    if (!Address.validAddress(address)) {
        return RpcResult.getFailed(ErrorCode.PARAMETER_ERROR);
    }
    if (pageNumber < 0 || pageSize < 0) {
        return RpcResult.getFailed(ErrorCode.PARAMETER_ERROR);
    }
    if (pageNumber == 0) {
        pageNumber = 1;
    }
    if (pageSize == 0) {
        pageSize = 10;
    }
    // todo        ledgerService.getLockUtxo
    List<UtxoOutputPo> poList = outputDataService.getLockUtxo(address, TimeService.currentTimeMillis(), pageNumber, pageSize);
    List<OutputDto> dtoList = new ArrayList<>();
    for (UtxoOutputPo po : poList) {
        dtoList.add(new OutputDto(po));
    }
    RpcResult result = RpcResult.getSuccess();
    result.setData(dtoList);
    return result;
}
Also used : OutputDto(io.nuls.rpc.entity.OutputDto) ArrayList(java.util.ArrayList) RpcResult(io.nuls.rpc.entity.RpcResult) UtxoOutputPo(io.nuls.db.entity.UtxoOutputPo)

Aggregations

UtxoOutputPo (io.nuls.db.entity.UtxoOutputPo)1 OutputDto (io.nuls.rpc.entity.OutputDto)1 RpcResult (io.nuls.rpc.entity.RpcResult)1 ArrayList (java.util.ArrayList)1