Search in sources :

Example 16 with TransferTransaction

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

the class TransactionMapperOkHttpTest method shouldCreateTransferEmptyMessage.

@Test
void shouldCreateTransferEmptyMessage() {
    TransactionInfoDTO transferTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("transferEmptyMessage.json");
    TransferTransaction transferTransaction = (TransferTransaction) map(transferTransactionDTO);
    validateStandaloneTransaction(transferTransaction, transferTransactionDTO);
    Assertions.assertEquals("", transferTransaction.getMessage().get().getText());
}
Also used : TransactionInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionInfoDTO) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) Test(org.junit.jupiter.api.Test)

Example 17 with TransferTransaction

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

the class TransactionMapperOkHttpTest method shouldCreateStandaloneTransferTransaction.

@Test
void shouldCreateStandaloneTransferTransaction() {
    TransactionInfoDTO transferTransactionDTO = TestHelperOkHttp.loadTransactionInfoDTO("standaloneTransferTransaction.json");
    Transaction transferTransaction = map(transferTransactionDTO);
    validateStandaloneTransaction(transferTransaction, transferTransactionDTO);
}
Also used : SecretProofTransaction(io.nem.symbol.sdk.model.transaction.SecretProofTransaction) HashLockTransaction(io.nem.symbol.sdk.model.transaction.HashLockTransaction) AccountOperationRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountOperationRestrictionTransaction) AccountAddressRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountAddressRestrictionTransaction) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) NamespaceRegistrationTransaction(io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) MosaicDefinitionTransaction(io.nem.symbol.sdk.model.transaction.MosaicDefinitionTransaction) MultisigAccountModificationTransaction(io.nem.symbol.sdk.model.transaction.MultisigAccountModificationTransaction) AccountMosaicRestrictionTransaction(io.nem.symbol.sdk.model.transaction.AccountMosaicRestrictionTransaction) MosaicMetadataTransaction(io.nem.symbol.sdk.model.transaction.MosaicMetadataTransaction) Transaction(io.nem.symbol.sdk.model.transaction.Transaction) AccountKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.AccountKeyLinkTransaction) NamespaceMetadataTransaction(io.nem.symbol.sdk.model.transaction.NamespaceMetadataTransaction) AccountMetadataTransaction(io.nem.symbol.sdk.model.transaction.AccountMetadataTransaction) AddressAliasTransaction(io.nem.symbol.sdk.model.transaction.AddressAliasTransaction) MosaicAliasTransaction(io.nem.symbol.sdk.model.transaction.MosaicAliasTransaction) MosaicSupplyChangeTransaction(io.nem.symbol.sdk.model.transaction.MosaicSupplyChangeTransaction) SecretLockTransaction(io.nem.symbol.sdk.model.transaction.SecretLockTransaction) TransactionInfoDTO(io.nem.symbol.sdk.openapi.okhttp_gson.model.TransactionInfoDTO) Test(org.junit.jupiter.api.Test)

Example 18 with TransferTransaction

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

the class AccountRepositoryIntegrationTest method outgoingTransactions.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void outgoingTransactions(RepositoryType type) {
    TransactionRepository transactionRepository = getRepositoryFactory(type).createTransactionRepository();
    PublicAccount recipient = this.helper().getTestAccount(type).getLeft().getPublicAccount();
    List<Transaction> transactions = get(transactionRepository.search(new TransactionSearchCriteria(TransactionGroup.CONFIRMED).transactionTypes(Collections.singletonList(TransactionType.TRANSFER)).recipientAddress(recipient.getAddress()))).getData();
    System.out.println(transactions.size());
    transactions.forEach(transaction -> {
        assertTransaction(transaction, null);
        TransferTransaction transferTransaction = (TransferTransaction) transaction;
        Assertions.assertEquals(recipient.getAddress(), transferTransaction.getRecipient());
    });
}
Also used : Transaction(io.nem.symbol.sdk.model.transaction.Transaction) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) TransactionRepository(io.nem.symbol.sdk.api.TransactionRepository) PublicAccount(io.nem.symbol.sdk.model.account.PublicAccount) TransactionSearchCriteria(io.nem.symbol.sdk.api.TransactionSearchCriteria) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 19 with TransferTransaction

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

the class AggregateTransactionServiceIntegrationTest method isTransferFromMultisigNotComplete.

@ParameterizedTest
@EnumSource(RepositoryType.class)
void isTransferFromMultisigNotComplete(RepositoryType type) {
    Account multisigAccount = helper().getMultisigAccount(type).getLeft();
    TransferTransaction transferTransaction = TransferTransactionFactory.create(getNetworkType(), getDeadline(), getRecipient(), Collections.emptyList()).message(new PlainMessage("")).maxFee(maxFee).build();
    AggregateTransaction aggregateTransaction = AggregateTransactionFactory.createComplete(getNetworkType(), getDeadline(), Collections.singletonList(transferTransaction.toAggregate(multisigAccount.getPublicAccount()))).maxFee(maxFee).build();
    SignedTransaction signedAggregateTransaction = aggregateTransaction.signTransactionWithCosigners(multisigAccount, Collections.singletonList(config().getTestAccount()), getGenerationHash());
    AggregateTransactionService aggregateTransactionService = new AggregateTransactionServiceImpl(getRepositoryFactory(type));
    Assertions.assertFalse(get(aggregateTransactionService.isComplete(signedAggregateTransaction)));
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) PlainMessage(io.nem.symbol.sdk.model.message.PlainMessage) AggregateTransaction(io.nem.symbol.sdk.model.transaction.AggregateTransaction) AggregateTransactionService(io.nem.symbol.sdk.api.AggregateTransactionService) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 20 with TransferTransaction

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

the class ListenerIntegrationTest method announceStandaloneTransferTransactionWithInsufficientBalance.

private SignedTransaction announceStandaloneTransferTransactionWithInsufficientBalance(RepositoryType type) {
    TransferTransaction transferTransaction = TransferTransactionFactory.create(getNetworkType(), getDeadline(), Address.generateRandom(getNetworkType()), Collections.singletonList(getNetworkCurrency().createRelative(new BigInteger("100000000000")))).message(new PlainMessage("test-message")).maxFee(maxFee).build();
    SignedTransaction signedTransaction = this.account.sign(transferTransaction, getGenerationHash());
    get(getTransactionRepository(type).announce(signedTransaction));
    return signedTransaction;
}
Also used : PlainMessage(io.nem.symbol.sdk.model.message.PlainMessage) BigInteger(java.math.BigInteger) TransferTransaction(io.nem.symbol.sdk.model.transaction.TransferTransaction) SignedTransaction(io.nem.symbol.sdk.model.transaction.SignedTransaction) CosignatureSignedTransaction(io.nem.symbol.sdk.model.transaction.CosignatureSignedTransaction)

Aggregations

TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)63 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)48 Test (org.junit.jupiter.api.Test)37 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)35 SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)31 Deadline (io.nem.symbol.sdk.model.transaction.Deadline)28 Account (io.nem.symbol.sdk.model.account.Account)18 Mosaic (io.nem.symbol.sdk.model.mosaic.Mosaic)17 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)14 EnumSource (org.junit.jupiter.params.provider.EnumSource)14 Address (io.nem.symbol.sdk.model.account.Address)13 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)13 PublicAccount (io.nem.symbol.sdk.model.account.PublicAccount)10 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)8 BigInteger (java.math.BigInteger)8 ArrayList (java.util.ArrayList)8 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)7 HashLockTransaction (io.nem.symbol.sdk.model.transaction.HashLockTransaction)7 TransactionRepository (io.nem.symbol.sdk.api.TransactionRepository)5 TransactionSearchCriteria (io.nem.symbol.sdk.api.TransactionSearchCriteria)5