use of io.nuls.db.entity.UtxoOutputPo 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;
}
use of io.nuls.db.entity.UtxoOutputPo in project nuls by nuls-io.
the class UtxoTransferTool method transferCoinData.
private static void transferCoinData(Transaction tx, List<UtxoInputPo> inputPoList, List<UtxoOutputPo> outputPoList) {
if (tx instanceof AbstractCoinTransaction) {
AbstractCoinTransaction coinTx = (AbstractCoinTransaction) tx;
UtxoData utxoData = new UtxoData();
Set<String> addressSet = new HashSet<>();
for (UtxoInputPo inputPo : inputPoList) {
utxoData.getInputs().add(toInput(inputPo));
addressSet.add(inputPo.getFromOutPut().getAddress());
}
for (int i = 0; i < outputPoList.size(); i++) {
UtxoOutputPo outputPo = outputPoList.get(i);
utxoData.getOutputs().add(toOutput(outputPo));
}
coinTx.setCoinData(utxoData);
}
}
Aggregations