use of io.nem.sdk.model.mosaic.MosaicName in project nem2-sdk-java by nemtech.
the class MosaicHttp method getMosaicNames.
@Override
public Observable<List<MosaicName>> getMosaicNames(List<MosaicId> mosaicIds) {
JsonObject requestBody = new JsonObject();
requestBody.put("mosaicIds", mosaicIds.stream().map(id -> UInt64.bigIntegerToHex(id.getId())).collect(Collectors.toList()));
return this.client.postAbs(this.url + "/mosaic/names").as(BodyCodec.jsonArray()).rxSendJson(requestBody).toObservable().map(HttpResponse::body).map(json -> objectMapper.<List<MosaicNameDTO>>readValue(json.toString(), new TypeReference<List<MosaicNameDTO>>() {
})).flatMapIterable(item -> item).map(mosaicNameDTO -> new MosaicName(new MosaicId(mosaicNameDTO.getMosaicId().extractIntArray()), mosaicNameDTO.getName(), new NamespaceId(mosaicNameDTO.getParentId().extractIntArray()))).toList().toObservable();
}
Aggregations