use of io.nem.symbol.sdk.model.transaction.TransferTransactionFactory in project nem2-sdk-java by nemtech.
the class TestHelper method basicTransfer.
public void basicTransfer(RepositoryType type, Account nemesisAccount, UnresolvedAddress recipient, BigInteger amount) {
TransferTransactionFactory factory = TransferTransactionFactory.create(getNetworkType(), getDeadline(), recipient, Collections.singletonList(getCurrency().createAbsolute(amount)));
factory.maxFee(maxFee);
TransferTransaction transferTransaction = factory.build();
TransferTransaction processedTransaction = announceAndValidate(type, nemesisAccount, transferTransaction);
Assertions.assertEquals(amount, processedTransaction.getMosaics().get(0).getAmount());
}
use of io.nem.symbol.sdk.model.transaction.TransferTransactionFactory in project nem2-sdk-java by nemtech.
the class TransactionServiceIntegrationTest method transferUsingAliases.
private TransferTransaction transferUsingAliases(Account sender, RepositoryType type, String mosaicAlias, String recipientAlias, BigInteger amount) {
NamespaceId recipientNamespace = NamespaceId.createFromName(recipientAlias);
NamespaceId mosaicNamespace = NamespaceId.createFromName(mosaicAlias);
System.out.println("Sending " + amount + " Mosaic to: " + mosaicAlias);
TransferTransactionFactory factory = TransferTransactionFactory.create(getNetworkType(), getDeadline(), recipientNamespace, Collections.singletonList(new Mosaic(mosaicNamespace, amount))).message(new PlainMessage("E2ETest:TransactionServiceIntegrationTest"));
factory.maxFee(maxFee);
TransferTransaction transferTransaction = factory.build();
Assertions.assertTrue(transferTransaction.getMosaics().get(0).getId() instanceof NamespaceId);
Assertions.assertTrue(transferTransaction.getRecipient() instanceof NamespaceId);
TransferTransaction processedTransferTransaction = announceAndValidate(type, sender, transferTransaction);
Assertions.assertEquals(amount, processedTransferTransaction.getMosaics().get(0).getAmount());
System.out.println(toJson(processedTransferTransaction));
Assertions.assertTrue(processedTransferTransaction.getMosaics().get(0).getId() instanceof NamespaceId);
Assertions.assertTrue(processedTransferTransaction.getRecipient() instanceof NamespaceId);
return processedTransferTransaction;
}
Aggregations