Search in sources :

Example 36 with SignedTransaction

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

the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionAdditionNotComplete.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionAdditionNotComplete(RepositoryType type) {
    Account testAccount = helper().getTestAccount(type).getLeft();
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    Account cosignatoryAccount = config().getCosignatoryAccount();
    Account cosignatory2Account = config().getCosignatory2Account();
    List<Account> accounts = Arrays.asList(cosignatoryAccount, cosignatory2Account);
    List<UnresolvedAddress> additions = accounts.stream().map(Account::getAddress).collect(Collectors.toList());
    MultisigAccountModificationTransaction multisigAccountModificationTransaction = MultisigAccountModificationTransactionFactory.create(getNetworkType(), getDeadline(), (byte) 1, (byte) 1, additions, Collections.emptyList()).maxFee(maxFee).build();
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(multisigAccountModificationTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
    SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Collections.singletonList(testAccount), getGenerationHash());
    AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
    Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) UnresolvedAddress(io.nem.symbol.sdk.model.account.UnresolvedAddress) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) AggregateTransactionService(io.nem.symbol.sdk.api.AggregateTransactionService) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 37 with SignedTransaction

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

the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionDeletionNotComplete.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionDeletionNotComplete(RepositoryType type) {
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    Account cosignatoryAccount = config().getCosignatoryAccount();
    Account cosignatory2Account = config().getCosignatory2Account();
    List<Account> accounts = Arrays.asList(cosignatoryAccount, cosignatory2Account);
    MultisigAccountModificationTransaction multisigAccountModificationTransaction = MultisigAccountModificationTransactionFactory.create(getNetworkType(), getDeadline(), (byte) 1, (byte) 1, Collections.emptyList(), Collections.singletonList(accounts.get(0).getAddress())).maxFee(maxFee).build();
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(multisigAccountModificationTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
    SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, // Random
    Collections.singletonList(config().getTestAccount()), // account
    getGenerationHash());
    AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
    Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) AggregateTransactionService(io.nem.symbol.sdk.api.AggregateTransactionService) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 38 with SignedTransaction

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

the class AggregateTransactionServiceIntegrationTest method isMultisigAccountModificationTransactionDeletionComplete.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void isMultisigAccountModificationTransactionDeletionComplete(RepositoryType type) {
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    Account cosignatoryAccount = config().getCosignatoryAccount();
    Account cosignatory2Account = config().getCosignatory2Account();
    List<Account> accounts = Arrays.asList(cosignatoryAccount, cosignatory2Account);
    MultisigAccountModificationTransaction multisigAccountModificationTransaction = MultisigAccountModificationTransactionFactory.create(getNetworkType(), getDeadline(), (byte) 1, (byte) 1, Collections.emptyList(), Collections.singletonList(accounts.get(0).getAddress())).maxFee(maxFee).build();
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(multisigAccountModificationTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
    SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Collections.singletonList(accounts.get(1)), getGenerationHash());
    AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
    Assertions.assertTrue(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) AggregateTransactionService(io.nem.symbol.sdk.api.AggregateTransactionService) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 39 with SignedTransaction

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

the class TransactionRepositoryVertxImplTest method getSignedTransaction.

private SignedTransaction getSignedTransaction() {
    String generationHash = "A94B1BE81F1D4C95D6D252AD7BA3FFFB1674991FD880B7A57DC3180AF8D69C32";
    Account account = Account.generateNewAccount(this.networkType);
    Address recipientAddress = Address.generateRandom(this.networkType);
    TransferTransaction transferTransaction = TransferTransactionFactory.create(NetworkType.MIJIN_TEST, new Deadline(BigInteger.ONE), recipientAddress, Collections.singletonList(createAbsolute(BigInteger.valueOf(1)))).message(new PlainMessage("E2ETest:standaloneTransferTransaction:message")).build();
    SignedTransaction signedTransaction = account.sign(transferTransaction, generationHash);
    String payload = signedTransaction.getPayload();
    assertEquals(444, payload.length());
    return signedTransaction;
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) PublicAccount(io.nem.symbol.sdk.model.account.PublicAccount) Address(io.nem.symbol.sdk.model.account.Address) PlainMessage(io.nem.symbol.sdk.model.message.PlainMessage) Deadline(io.nem.symbol.sdk.model.transaction.Deadline) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)

Example 40 with SignedTransaction

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

the class TransactionRepositoryVertxImplTest method shouldAnnounce.

@Test
public void shouldAnnounce() throws Exception {
    SignedTransaction signedTransaction = getSignedTransaction();
    AnnounceTransactionInfoDTO announceTransactionInfoDTO = new AnnounceTransactionInfoDTO();
    announceTransactionInfoDTO.setMessage("SomeMessage");
    mockRemoteCall(announceTransactionInfoDTO);
    TransactionAnnounceResponse response = repository.announce(signedTransaction).toFuture().get();
    Assertions.assertNotNull(response);
    Assertions.assertEquals(announceTransactionInfoDTO.getMessage(), announceTransactionInfoDTO.getMessage());
}
Also used : AnnounceTransactionInfoDTO(io.nem.symbol.sdk.openapi.vertx.model.AnnounceTransactionInfoDTO) TransactionAnnounceResponse(io.nem.symbol.sdk.model.transaction.TransactionAnnounceResponse) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction) Test(org.junit.jupiter.api.Test)

Aggregations

SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)57 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)40 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)40 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)31 Test (org.junit.jupiter.api.Test)24 Deadline (io.nem.symbol.sdk.model.transaction.Deadline)21 CosignatureSignedTransaction (io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)20 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 EnumSource (org.junit.jupiter.params.provider.EnumSource)20 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)18 Account (io.nem.symbol.sdk.model.account.Account)17 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)16 Listener (io.nem.symbol.sdk.api.Listener)12 MultisigAccountModificationTransaction (io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction)12 BigInteger (java.math.BigInteger)11 Address (io.nem.symbol.sdk.model.account.Address)10 TransactionService (io.nem.symbol.sdk.api.TransactionService)8 AggregateTransactionService (io.nem.symbol.sdk.api.AggregateTransactionService)7 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)7 Mosaic (io.nem.symbol.sdk.model.mosaic.Mosaic)6