use of io.nem.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class E2ETest method standaloneTransferTransaction.
@Test
void standaloneTransferTransaction() throws ExecutionException, InterruptedException {
TransferTransaction transferTransaction = TransferTransaction.create(new Deadline(2, HOURS), new Address("SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY", NetworkType.MIJIN_TEST), Collections.singletonList(XEM.createAbsolute(BigInteger.valueOf(1))), new PlainMessage("message"), NetworkType.MIJIN_TEST);
SignedTransaction signedTransaction = this.account.sign(transferTransaction);
transactionHttp.announce(signedTransaction).toFuture().get();
this.validateTransactionAnnounceCorrectly(this.account.getAddress(), signedTransaction.getHash());
}
use of io.nem.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class E2ETest method aggregateTransferTransaction.
@Test
void aggregateTransferTransaction() throws ExecutionException, InterruptedException {
TransferTransaction transferTransaction = TransferTransaction.create(new Deadline(2, HOURS), new Address("SDRDGFTDLLCB67D4HPGIMIHPNSRYRJRT7DOBGWZY", NetworkType.MIJIN_TEST), Collections.singletonList(XEM.createAbsolute(BigInteger.valueOf(1))), new PlainMessage("messageloooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" + // Use long message to test if size of inner transaction is calculated correctly
"oooooooong"), NetworkType.MIJIN_TEST);
AggregateTransaction aggregateTransaction = AggregateTransaction.createComplete(new Deadline(2, HOURS), Collections.singletonList(transferTransaction.toAggregate(this.account.getPublicAccount())), NetworkType.MIJIN_TEST);
SignedTransaction signedTransaction = this.account.sign(aggregateTransaction);
transactionHttp.announce(signedTransaction).toFuture().get();
this.validateTransactionAnnounceCorrectly(this.account.getAddress(), signedTransaction.getHash());
}
use of io.nem.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class ListenerTest method announceStandaloneTransferTransaction.
private SignedTransaction announceStandaloneTransferTransaction() throws ExecutionException, InterruptedException {
TransferTransaction transferTransaction = TransferTransaction.create(new Deadline(2, HOURS), new Address("SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC", NetworkType.MIJIN_TEST), Arrays.asList(), PlainMessage.create("test-message"), NetworkType.MIJIN_TEST);
SignedTransaction signedTransaction = this.account.sign(transferTransaction);
transactionHttp.announce(signedTransaction).toFuture().get();
return signedTransaction;
}
use of io.nem.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class ListenerTest method announceAggregateBondedTransaction.
private SignedTransaction announceAggregateBondedTransaction() throws ExecutionException, InterruptedException {
TransferTransaction transferTransaction = TransferTransaction.create(new Deadline(2, HOURS), new Address("SBILTA367K2LX2FEXG5TFWAS7GEFYAGY7QLFBYKC", NetworkType.MIJIN_TEST), Arrays.asList(), PlainMessage.create("test-message"), NetworkType.MIJIN_TEST);
AggregateTransaction aggregateTransaction = AggregateTransaction.createComplete(new Deadline(2, HOURS), Collections.singletonList(transferTransaction.toAggregate(this.multisigAccount.getPublicAccount())), NetworkType.MIJIN_TEST);
SignedTransaction signedTransaction = this.cosignatoryAccount.sign(aggregateTransaction);
transactionHttp.announceAggregateBonded(signedTransaction).toFuture().get();
return signedTransaction;
}
use of io.nem.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class AggregateTransactionTest method createAAggregateTransactionViaStaticConstructor.
@Test
void createAAggregateTransactionViaStaticConstructor() {
TransferTransaction transferTx = TransferTransaction.create(new Deadline(2, ChronoUnit.HOURS), new Address("SDGLFW-DSHILT-IUHGIB-H5UGX2-VYF5VN-JEKCCD-BR26", NetworkType.MIJIN_TEST), Collections.emptyList(), PlainMessage.Empty, NetworkType.MIJIN_TEST);
AggregateTransaction aggregateTx = AggregateTransaction.createComplete(new Deadline(2, ChronoUnit.HOURS), Arrays.asList(transferTx.toAggregate(new PublicAccount("9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", NetworkType.MIJIN_TEST))), NetworkType.MIJIN_TEST);
assertEquals(NetworkType.MIJIN_TEST, aggregateTx.getNetworkType());
assertTrue(2 == aggregateTx.getVersion());
assertTrue(LocalDateTime.now().isBefore(aggregateTx.getDeadline().getLocalDateTime()));
assertEquals(BigInteger.valueOf(0), aggregateTx.getFee());
assertEquals(1, aggregateTx.getInnerTransactions().size());
}
Aggregations