use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class ArtifactExpiryReceiptTest method shouldCreateMosaicExpiryReceipt.
@Test
void shouldCreateMosaicExpiryReceipt() {
MosaicId mosaicId = new MosaicId("85BBEA6CC462B244");
ArtifactExpiryReceipt<MosaicId> mosaicExpiryReceipt = new ArtifactExpiryReceipt<>(mosaicId, ReceiptType.MOSAIC_EXPIRED, ReceiptVersion.ARTIFACT_EXPIRY);
assertEquals(ReceiptType.MOSAIC_EXPIRED, mosaicExpiryReceipt.getType());
assertFalse(mosaicExpiryReceipt.getSize().isPresent());
assertEquals(ReceiptVersion.ARTIFACT_EXPIRY, mosaicExpiryReceipt.getVersion());
assertEquals("85BBEA6CC462B244", mosaicExpiryReceipt.getArtifactId().getIdAsHex().toUpperCase());
String hex = ConvertUtils.toHex(mosaicExpiryReceipt.serialize());
Assertions.assertEquals("01004D4144B262C46CEABB85", hex);
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class BalanceTransferReceiptTest method shouldSerializeTheSameAsTypescript.
@Test
void shouldSerializeTheSameAsTypescript() {
Address sender = Address.generateRandom(networkType);
Address recipient = Address.generateRandom(networkType);
BalanceTransferReceipt balanceTransferReceipt = new BalanceTransferReceipt(sender, recipient, new MosaicId("941299B2B7E1291C"), BigInteger.valueOf(1000), ReceiptType.MOSAIC_RENTAL_FEE, ReceiptVersion.BALANCE_TRANSFER);
String hex = ConvertUtils.toHex(balanceTransferReceipt.serialize());
Assertions.assertEquals("01004D121C29E1B7B2991294E803000000000000" + sender.encoded() + recipient.encoded(), hex.toUpperCase());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicRepositoryOkHttpImpl method getMosaics.
@Override
public Observable<List<MosaicInfo>> getMosaics(List<MosaicId> ids) {
MosaicIds mosaicIds = new MosaicIds();
mosaicIds.mosaicIds(ids.stream().map(MosaicId::getIdAsHex).collect(Collectors.toList()));
Callable<List<MosaicInfoDTO>> callback = () -> getClient().getMosaics(mosaicIds);
return exceptionHandling(call(callback).flatMapIterable(item -> item).map(this::createMosaicInfo).toList().toObservable());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class NamespaceRepositoryOkHttpImpl method getMosaicsNames.
@Override
public Observable<List<MosaicNames>> getMosaicsNames(List<MosaicId> ids) {
MosaicIds mosaicIds = new MosaicIds();
mosaicIds.mosaicIds(ids.stream().map(MosaicId::getIdAsHex).collect(Collectors.toList()));
Callable<MosaicsNamesDTO> callback = () -> getClient().getMosaicsNames(mosaicIds);
return exceptionHandling(call(callback).map(MosaicsNamesDTO::getMosaicNames).flatMapIterable(item -> item).map(this::toMosaicNames).toList().toObservable());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class TransferTransactionTest method shouldGenerateBytes.
@Test
void shouldGenerateBytes() {
String expected = "B10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019054410000000000000000010000000000000090F36CA680C35D630662A0C38DC89D4978D10B511B3D241A0100010000000000672B0000CE560000640000000000000000";
TransferTransaction transaction = TransferTransactionFactory.create(networkType, new Deadline(BigInteger.ONE), new Address("SDZWZJUAYNOWGBTCUDBY3SE5JF4NCC2RDM6SIGQ", networkType), Collections.singletonList(new Mosaic(new MosaicId(new BigInteger("95442763262823")), BigInteger.valueOf(100)))).message(new PlainMessage("")).build();
assertSerialization(expected, transaction);
}
Aggregations