use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class OkHttpCosignatureTransactionTest method shouldThrowExceptionWhenTransactionToCosignHasNotBeenAnnunced.
@Test
void shouldThrowExceptionWhenTransactionToCosignHasNotBeenAnnunced() {
AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(NetworkType.MIJIN_TEST, deadline, Collections.emptyList()).build();
assertThrows(IllegalArgumentException.class, () -> {
CosignatureTransaction.create(aggregateTransaction);
}, "Transaction to cosign should be announced before being able to cosign it");
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class OkHttpAggregateTransactionTest method shouldCreateAggregateTransactionAndSignWithMultipleCosignatories.
@Test
void shouldCreateAggregateTransactionAndSignWithMultipleCosignatories() {
Address address = Address.generateRandom(networkType);
TransferTransaction transferTx = TransferTransactionFactory.create(networkType, deadline, address, Collections.emptyList()).message(new PlainMessage("test-message")).build();
AggregateTransaction aggregateTx = AggregateTransactionFactory.createComplete(networkType, deadline, Collections.singletonList(transferTx.toAggregate(new PublicAccount("B694186EE4AB0558CA4AFCFDD43B42114AE71094F5A1FC4A913FE9971CACD21D", networkType)))).build();
Account cosignatoryAccount = Account.generateNewAccount(this.networkType);
Account cosignatoryAccount2 = Account.generateNewAccount(this.networkType);
Account cosignatoryAccount3 = Account.generateNewAccount(this.networkType);
SignedTransaction signedTransaction = cosignatoryAccount.signTransactionWithCosignatories(aggregateTx, Arrays.asList(cosignatoryAccount2, cosignatoryAccount3), generationHash);
BinarySerialization serialization = BinarySerializationImpl.INSTANCE;
AggregateTransaction deserialized = (AggregateTransaction) serialization.deserialize(ConvertUtils.fromHexToBytes(signedTransaction.getPayload()));
Assertions.assertEquals(2, deserialized.getCosignatures().size());
Assertions.assertEquals(cosignatoryAccount2.getPublicAccount(), deserialized.getCosignatures().get(0).getSigner());
Assertions.assertEquals(cosignatoryAccount3.getPublicAccount(), deserialized.getCosignatures().get(1).getSigner());
}
use of io.nem.symbol.sdk.model.transaction.AggregateTransaction in project nem2-sdk-java by nemtech.
the class TransactionMapperOkHttpTest method shouldCreateAggregateLockFundsTransaction.
@Test
void shouldCreateAggregateLockFundsTransaction() {
TransactionInfoDTO aggregateLockFundsTransactionDTO = TestHelperOkHttp.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 TransactionMapperOkHttpTest method shouldCreateAggregateMosaicGlobalRestrictionTransaction.
@Test
void shouldCreateAggregateMosaicGlobalRestrictionTransaction() {
TransactionInfoDTO aggregateMosaicGlobalRestrictionTransactionDTO = TestHelperOkHttp.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 TransactionMapperOkHttpTest method shouldCreateAggregateSecretProofTransaction.
@Test
void shouldCreateAggregateSecretProofTransaction() {
TransactionInfoDTO aggregateSecretProofTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("aggregateSecretProofTransaction.json");
Transaction aggregateSecretProofTransaction = map(aggregateSecretProofTransactionDTO);
validateAggregateTransaction((AggregateTransaction) aggregateSecretProofTransaction, aggregateSecretProofTransactionDTO);
}
Aggregations