use of io.nem.symbol.sdk.model.transaction.CosignatureTransaction in project nem2-sdk-java by nemtech.
the class VertxCosignatureTransactionTest method createACosignatureTransactionViaConstructor.
@Test
void createACosignatureTransactionViaConstructor() {
TransactionInfoDTO transactionInfoDTO = TestHelperVertx.loadTransactionInfoDTO("cosignatureTransactionViaConstructor.json");
AggregateTransaction aggregateTransaction = (AggregateTransaction) new GeneralTransactionMapper(jsonHelper).mapFromDto(transactionInfoDTO);
CosignatureTransaction cosignatureTransaction = CosignatureTransaction.create(aggregateTransaction);
CosignatureSignedTransaction cosignatureSignedTransaction = account.signCosignatureTransaction(cosignatureTransaction);
assertTrue(aggregateTransaction.getTransactionInfo().get().getHash().isPresent());
assertEquals(aggregateTransaction.getTransactionInfo().get().getHash().get(), cosignatureSignedTransaction.getParentHash());
assertEquals("5EA75D1A2C8AD25DA4F400C1BD2DA84449FAF583AFD813E1179E72AF0CDF5AC1C0F7404AF6FC7268EE416204240DD3D5B11420D80215F19AA314FC86D6E03E0D", cosignatureSignedTransaction.getSignature());
assertEquals("671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96", cosignatureTransaction.getTransactionToCosign().getTransactionInfo().get().getHash().get());
}
use of io.nem.symbol.sdk.model.transaction.CosignatureTransaction in project nem2-sdk-java by nemtech.
the class MultisignIntegrationTest method shouldReturnCosignatureAddedViaListener2.
@Disabled
@ParameterizedTest
@EnumSource(RepositoryType.class)
void shouldReturnCosignatureAddedViaListener2(RepositoryType type) {
Listener listener = getListener(type);
RepositoryFactory repositoryFactory = getRepositoryFactory(type);
TransactionRepository transactionRepository = repositoryFactory.createTransactionRepository();
SignedTransaction signedAggregatedTx = createSignedAggregatedBondTransaction(multisigAccount, cosignAccount1, account2.getAddress());
Object finalObject = get(createHashLockTransactionAndAnnounce(type, signedAggregatedTx, cosignAccount1).flatMap(t -> {
System.out.println("hash lock finished");
TransactionServiceImpl transactionService = new TransactionServiceImpl(getRepositoryFactory(type));
return transactionService.announceAggregateBonded(listener, signedAggregatedTx).flatMap(a -> {
System.out.println("Aggregate bonded finished");
return repositoryFactory.createTransactionRepository().search(new TransactionSearchCriteria(TransactionGroup.PARTIAL).signerPublicKey(cosignAccount1.getPublicAccount().getPublicKey())).flatMap((page) -> {
List<Transaction> transactions = page.getData();
System.out.println("partialTransactions " + transactions.size());
AggregateTransaction transactionToCosign = (AggregateTransaction) transactions.get(0);
CosignatureTransaction cosignatureTransaction = CosignatureTransaction.create(transactionToCosign);
CosignatureSignedTransaction cosignatureSignedTransaction = cosignAccount2.signCosignatureTransaction(cosignatureTransaction);
return transactionRepository.announceAggregateBondedCosignature(cosignatureSignedTransaction).flatMap(r -> {
System.out.println("announceAggregateBondedCosignature " + r);
return listener.cosignatureAdded(cosignAccount1.getAddress());
});
});
});
}));
System.out.println(finalObject.getClass());
Assertions.assertNull(finalObject);
}
use of io.nem.symbol.sdk.model.transaction.CosignatureTransaction in project nem2-sdk-java by nemtech.
the class OkHttpCosignatureTransactionTest method createACosignatureTransactionViaConstructor.
@Test
void createACosignatureTransactionViaConstructor() {
TransactionInfoDTO transactionInfoDTO = TestHelperOkHttp.loadTransactionInfoDTO("cosignatureTransactionViaConstructor.json");
AggregateTransaction aggregateTransaction = (AggregateTransaction) new GeneralTransactionMapper(jsonHelper).mapFromDto(transactionInfoDTO);
CosignatureTransaction cosignatureTransaction = CosignatureTransaction.create(aggregateTransaction);
CosignatureSignedTransaction cosignatureSignedTransaction = account.signCosignatureTransaction(cosignatureTransaction);
assertTrue(aggregateTransaction.getTransactionInfo().get().getHash().isPresent());
assertEquals(aggregateTransaction.getTransactionInfo().get().getHash().get(), cosignatureSignedTransaction.getParentHash());
assertEquals("5EA75D1A2C8AD25DA4F400C1BD2DA84449FAF583AFD813E1179E72AF0CDF5AC1C0F7404AF6FC7268EE416204240DD3D5B11420D80215F19AA314FC86D6E03E0D", cosignatureSignedTransaction.getSignature());
assertEquals("671653C94E2254F2A23EFEDB15D67C38332AED1FBD24B063C0A8E675582B6A96", cosignatureTransaction.getTransactionToCosign().getTransactionInfo().get().getHash().get());
}
use of io.nem.symbol.sdk.model.transaction.CosignatureTransaction in project nem2-sdk-java by nemtech.
the class ListenerIntegrationTest method announceCosignatureTransaction.
private CosignatureSignedTransaction announceCosignatureTransaction(AggregateTransaction transactionToCosign, RepositoryType type) {
CosignatureTransaction cosignatureTransaction = new CosignatureTransaction(transactionToCosign);
CosignatureSignedTransaction cosignatureSignedTransaction = this.cosignatoryAccount2.signCosignatureTransaction(cosignatureTransaction);
get(getRepositoryFactory(type).createTransactionRepository().announceAggregateBondedCosignature(cosignatureSignedTransaction));
return cosignatureSignedTransaction;
}
Aggregations