Search in sources :

Example 11 with CosignatureSignedTransaction

use of io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction in project nem2-sdk-java by nemtech.

the class ListenerIntegrationTest method shouldReturnCosignatureAddedViaListener.

@ParameterizedTest
@EnumSource(RepositoryType.class)
@Disabled
void shouldReturnCosignatureAddedViaListener(RepositoryType type) {
    Listener listener = getListener(type);
    RepositoryFactory repositoryFactory = getRepositoryFactory(type);
    TransactionService transactionService = new TransactionServiceImpl(repositoryFactory);
    Pair<SignedTransaction, SignedTransaction> pair = this.createAggregateBondedTransaction(type);
    System.out.println("Announcing HashLock transaction " + pair.getRight().getHash());
    get(transactionService.announce(listener, pair.getRight()));
    SignedTransaction signedTransaction = pair.getLeft();
    AggregateTransaction announcedTransaction = get(transactionService.announceAggregateBonded(listener, signedTransaction));
    assertEquals(signedTransaction.getHash(), announcedTransaction.getTransactionInfo().get().getHash().get());
    TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
    List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Collections.singletonList(TransactionType.AGGREGATE_BONDED)).signerPublicKey(this.cosignatoryAccount.getPublicAccount().getPublicKey()))).getData();
    AggregateTransaction transactionToCosign = (AggregateTransaction) transactions.get(0);
    this.announceCosignatureTransaction(transactionToCosign, type);
    CosignatureSignedTransaction cosignatureSignedTransaction = get(listener.cosignatureAdded(this.cosignatoryAccount.getAddress()).take(1));
    assertEquals(cosignatureSignedTransaction.getSigner(), this.cosignatoryAccount2.getPublicAccount());
}
Also used : CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction) Listener(io.nem.symbol.sdk.api.Listener) TransactionService(io.nem.symbol.sdk.api.TransactionService) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) CosignatureTransaction(io.nem.symbol.sdk.model.transaction.CosignatureTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) TransactionRepository(io.nem.symbol.sdk.api.TransactionRepository) TransactionSearchCriteria(io.nem.symbol.sdk.api.TransactionSearchCriteria) RepositoryFactory(io.nem.symbol.sdk.api.RepositoryFactory) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

CosignatureSignedTransaction (io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)11 Test (org.junit.jupiter.api.Test)6 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)5 CosignatureTransaction (io.nem.symbol.sdk.model.transaction.CosignatureTransaction)5 Account (io.nem.symbol.sdk.model.account.Account)3 Address (io.nem.symbol.sdk.model.account.Address)3 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)3 BigInteger (java.math.BigInteger)3 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 Listener (io.nem.symbol.sdk.api.Listener)2 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)2 TransactionRepository (io.nem.symbol.sdk.api.TransactionRepository)2 TransactionSearchCriteria (io.nem.symbol.sdk.api.TransactionSearchCriteria)2 ListenerSubscribeMessage (io.nem.symbol.sdk.infrastructure.ListenerSubscribeMessage)2 PublicAccount (io.nem.symbol.sdk.model.account.PublicAccount)2 AggregateTransactionCosignature (io.nem.symbol.sdk.model.transaction.AggregateTransactionCosignature)2 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)2 SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)2 TransactionAnnounceResponse (io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse)2 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)2