use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class OkHttpAggregateTransactionTest method serialization.
@Test
@DisplayName("Serialization")
void serialization() {
Address address = Address.generateRandom(networkType);
TransferTransaction transferTx = TransferTransactionFactory.create(networkType, deadline, address, Collections.singletonList(createAbsolute(BigInteger.valueOf(10000000)))).message(new PlainMessage("")).build();
PublicAccount signer = Account.generateNewAccount(networkType).getPublicAccount();
AggregateTransaction aggregateTx = AggregateTransactionFactory.createComplete(networkType, deadline, Collections.singletonList(transferTx.toAggregate(signer))).build();
byte[] actual = aggregateTx.serialize();
BinarySerialization serialization = BinarySerializationImpl.INSTANCE;
AggregateTransaction deserialized = (AggregateTransaction) serialization.deserialize(actual);
assertEquals(signer, deserialized.getInnerTransactions().get(0).getSigner().get());
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAggregateSubNamespaceCreationTransaction.
@Test
void shouldCreateAggregateSubNamespaceCreationTransaction() {
TransactionInfoDTO aggregateNamespaceCreationTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("aggregateSubNamespaceCreationTransaction.json");
Transaction aggregateNamespaceCreationTransaction = map(aggregateNamespaceCreationTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateNamespaceCreationTransaction, aggregateNamespaceCreationTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAggregateRootNamespaceCreationTransaction.
@Test
void shouldCreateAggregateRootNamespaceCreationTransaction() {
TransactionInfoDTO aggregateNamespaceCreationTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("aggregateRootNamespaceCreationTransaction.json");
Transaction aggregateNamespaceCreationTransaction = map(aggregateNamespaceCreationTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateNamespaceCreationTransaction, aggregateNamespaceCreationTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAggregateMultisigModificationTransaction.
@Test
void shouldCreateAggregateMultisigModificationTransaction() {
TransactionInfoDTO aggregateMultisigModificationTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("aggregateMultisigModificationTransaction.json");
Transaction aggregateMultisigModificationTransaction = map(aggregateMultisigModificationTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateMultisigModificationTransaction, aggregateMultisigModificationTransactionDTO);
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAggregateAccountKeyLinkTransaction.
@Test
void shouldCreateAggregateAccountKeyLinkTransaction() {
TransactionInfoDTO aggregateTransferTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("aggregateAccountKeyLinkTransaction.json");
Transaction aggregateTransferTransaction = map(aggregateTransferTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateTransferTransaction, aggregateTransferTransactionDTO);
AccountKeyLinkTransaction transaction = (AccountKeyLinkTransaction) ((AggregateTransaction) aggregateTransferTransaction).getInnerTransactions().get(0);
Assertions.assertEquals(LinkAction.LINK, transaction.getLinkAction());
Assertions.assertEquals("SARNASAS2BIAB6LMFA3FPMGBPGIJGK6IJETM3ZQ", PublicAccount.createFromPublicKey(transaction.getLinkedPublicKey().toHex(), transaction.getNetworkType()).getAddress().plain());
}
Aggregations