Search in sources :

Example 6 with Address

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());
}
Also used : Address(io.nem.sdk.model.account.Address) Test(org.junit.jupiter.api.Test)

Example 7 with Address

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());
}
Also used : Address(io.nem.sdk.model.account.Address) Test(org.junit.jupiter.api.Test)

Example 8 with Address

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;
}
Also used : Address(io.nem.sdk.model.account.Address)

Example 9 with Address

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;
}
Also used : Address(io.nem.sdk.model.account.Address)

Example 10 with Address

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());
}
Also used : Address(io.nem.sdk.model.account.Address) PublicAccount(io.nem.sdk.model.account.PublicAccount) Test(org.junit.jupiter.api.Test)

Aggregations

Address (io.nem.sdk.model.account.Address)14 Test (org.junit.jupiter.api.Test)10 PublicAccount (io.nem.sdk.model.account.PublicAccount)5 Mosaic (io.nem.sdk.model.mosaic.Mosaic)4 BigInteger (java.math.BigInteger)4 MosaicId (io.nem.sdk.model.mosaic.MosaicId)3 DisplayName (org.junit.jupiter.api.DisplayName)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 Account (io.nem.sdk.model.account.Account)1 NetworkType (io.nem.sdk.model.blockchain.NetworkType)1 NamespaceId (io.nem.sdk.model.namespace.NamespaceId)1 NamespaceInfo (io.nem.sdk.model.namespace.NamespaceInfo)1 NamespaceName (io.nem.sdk.model.namespace.NamespaceName)1 NamespaceType (io.nem.sdk.model.namespace.NamespaceType)1 UInt64 (io.nem.sdk.model.transaction.UInt64)1 Observable (io.reactivex.Observable)1 JsonObject (io.vertx.core.json.JsonObject)1 HttpResponse (io.vertx.reactivex.ext.web.client.HttpResponse)1 BodyCodec (io.vertx.reactivex.ext.web.codec.BodyCodec)1 MalformedURLException (java.net.MalformedURLException)1