use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method validateAggregateTransaction.
void validateAggregateTransaction(AggregateTransaction aggregateTransaction, TransactionInfoDTO transactionDTO) {
AggregateTransactionBodyExtendedDTO aggregateTransactionBodyDTO = jsonHelper.convert(transactionDTO.getTransaction(), AggregateTransactionBodyExtendedDTO.class);
TransactionMetaDTO meta = jsonHelper.convert(transactionDTO.getMeta(), TransactionMetaDTO.class);
if (aggregateTransaction.getTransactionInfo().isPresent()) {
TransactionInfo transactionInfo = aggregateTransaction.getTransactionInfo().get();
assertEquals(meta.getHeight(), transactionInfo.getHeight());
if (transactionInfo.getHash().isPresent()) {
assertEquals(meta.getHash(), transactionInfo.getHash().get());
}
if (transactionInfo.getMerkleComponentHash().isPresent()) {
assertEquals(meta.getMerkleComponentHash(), transactionInfo.getMerkleComponentHash().get());
}
if (transactionInfo.getIndex().isPresent()) {
assertEquals(transactionInfo.getIndex().get(), meta.getIndex());
}
}
// if (aggregateTransaction.getTransactionInfo().get().getId().isPresent()) {
// assertEquals(
// transactionDTO.getMeta().getId(),
// aggregateTransaction.getTransactionInfo().get().getId().get());
// }
assertEquals(jsonHelper.getString(transactionDTO.getTransaction(), "signature"), aggregateTransaction.getSignature().get());
assertEquals(jsonHelper.getString(transactionDTO.getTransaction(), "signerPublicKey"), aggregateTransaction.getSigner().get().getPublicKey().toHex());
int version = jsonHelper.getInteger(transactionDTO.getTransaction(), "version");
assertEquals((int) aggregateTransaction.getVersion(), version);
int networkType = jsonHelper.getInteger(transactionDTO.getTransaction(), "network");
assertEquals(aggregateTransaction.getNetworkType().getValue(), networkType);
assertEquals(aggregateTransaction.getType().getValue(), (int) jsonHelper.getInteger(transactionDTO.getTransaction(), "type"));
assertEquals(jsonHelper.getBigInteger(transactionDTO.getTransaction(), "maxFee"), aggregateTransaction.getMaxFee());
assertNotNull(aggregateTransaction.getDeadline());
assertEquals(aggregateTransactionBodyDTO.getCosignatures().get(0).getSignature(), aggregateTransaction.getCosignatures().get(0).getSignature());
assertEquals(aggregateTransactionBodyDTO.getCosignatures().get(0).getSignerPublicKey(), aggregateTransaction.getCosignatures().get(0).getSigner().getPublicKey().toHex());
Transaction innerTransaction = aggregateTransaction.getInnerTransactions().get(0);
validateStandaloneTransaction(innerTransaction, jsonHelper.convert(aggregateTransactionBodyDTO.getTransactions().get(0), TransactionInfoDTO.class), transactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateLockFundsTransaction.
@Test
void shouldCreateAggregateLockFundsTransaction() {
TransactionInfoDTO aggregateLockFundsTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateLockFundsTransaction.json");
Transaction lockFundsTransaction = map(aggregateLockFundsTransactionDTO);
validateAggregateTransaction((AggregateTransaction) lockFundsTransaction, aggregateLockFundsTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateAccountMetadataTransaction.
@Test
void shouldCreateAggregateAccountMetadataTransaction() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateAccountMetadataTransaction.json");
AggregateTransaction aggregateTransferTransaction = (AggregateTransaction) map(aggregateTransferTransactionDTO);
validateAggregateTransaction(aggregateTransferTransaction, aggregateTransferTransactionDTO);
AccountMetadataTransaction transaction = (AccountMetadataTransaction) aggregateTransferTransaction.getInnerTransactions().get(0);
Assertions.assertEquals("90E6FF7755A80B6AA935A5C31B6D3D0CFAF82E06BF2B9CC9", transaction.getTargetAddress().encoded(transaction.getNetworkType()));
Assertions.assertEquals(-1, transaction.getValueSizeDelta());
Assertions.assertEquals(new BigInteger("11529215046069664444"), transaction.getScopedMetadataKey());
Assertions.assertArrayEquals(StringEncoder.getBytes("This is the message for this account! 汉字89664"), transaction.getValue());
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateMosaicGlobalRestrictionTransaction.
@Test
void shouldCreateAggregateMosaicGlobalRestrictionTransaction() {
TransactionInfoDTO aggregateMosaicGlobalRestrictionTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicGlobalRestrictionTransaction.json");
Transaction aggregateMosaicGlobalRestrictionTransaction = map(aggregateMosaicGlobalRestrictionTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateMosaicGlobalRestrictionTransaction, aggregateMosaicGlobalRestrictionTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperVertxTest method shouldCreateAggregateMosaicAliasTransaction.
@Test
void shouldCreateAggregateMosaicAliasTransaction() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperVertx.loadTransactionInfoDTO("aggregateMosaicAliasTransaction.json");
Transaction aggregateTransferTransaction = map(aggregateTransferTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateTransferTransaction, aggregateTransferTransactionDTO);
MosaicAliasTransaction transaction = (MosaicAliasTransaction) ((AggregateTransaction) aggregateTransferTransaction).getInnerTransactions().get(0);
Assertions.assertEquals(new BigInteger("884562898459306"), transaction.getMosaicId().getId());
Assertions.assertEquals(AliasAction.UNLINK, transaction.getAliasAction());
Assertions.assertEquals(new BigInteger("307262000798378"), transaction.getNamespaceId().getId());
}
Aggregations