Search in sources :

Example 1 with PublicAccount

use of io.nem.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.

the class BlockInfoTest method createANewBlockInfo.

@Test
void createANewBlockInfo() {
    BlockInfo blockInfo = new BlockInfo("24E92B511B54EDB48A4850F9B42485FDD1A30589D92C775632DDDD71D7D1D691", "57F7DA205008026C776CB6AED843393F04CD458E0AA2D9F1D5F31A402072B2D6", Optional.of(UInt64.fromIntArray(new int[] { 0, 0 })), Optional.of(25), "37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1" + "FFEE401E933EB801824373E7537E51733E0F", new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), NetworkType.MIJIN_TEST, 3, 32768, UInt64.fromIntArray(new int[] { 1, 0 }), UInt64.fromIntArray(new int[] { 0, 0 }), UInt64.fromIntArray(new int[] { 276447232, 23283 }), "702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0", "0000000000000000000000000000000000000000000000000000000000000000");
    assertEquals("24E92B511B54EDB48A4850F9B42485FDD1A30589D92C775632DDDD71D7D1D691", blockInfo.getHash());
    assertEquals("57F7DA205008026C776CB6AED843393F04CD458E0AA2D9F1D5F31A402072B2D6", blockInfo.getGenerationHash());
    assertEquals(UInt64.fromIntArray(new int[] { 0, 0 }), blockInfo.getTotalFee().get());
    assertEquals(new Integer(25), blockInfo.getNumTransactions().get());
    assertEquals("37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1" + "FFEE401E933EB801824373E7537E51733E0F", blockInfo.getSignature());
    Assertions.assertEquals(new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), blockInfo.getSigner());
    assertEquals(NetworkType.MIJIN_TEST, blockInfo.getNetworkType());
    assertTrue(3 == blockInfo.getVersion());
    assertEquals(32768, blockInfo.getType());
    assertEquals(UInt64.fromIntArray(new int[] { 1, 0 }), blockInfo.getHeight());
    assertEquals(UInt64.fromIntArray(new int[] { 0, 0 }), blockInfo.getTimestamp());
    assertEquals(UInt64.fromIntArray(new int[] { 276447232, 23283 }), blockInfo.getDifficulty());
    assertEquals("702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0", blockInfo.getPreviousBlockHash());
    assertEquals("0000000000000000000000000000000000000000000000000000000000000000", blockInfo.getBlockTransactionsHash());
}
Also used : PublicAccount(io.nem.sdk.model.account.PublicAccount) Test(org.junit.jupiter.api.Test)

Example 2 with PublicAccount

use of io.nem.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.

the class MosaicInfoTest method shouldReturnIsTransferableWhenLevyIsImmutable.

@Test
void shouldReturnIsTransferableWhenLevyIsImmutable() {
    MosaicProperties mosaicProperties = new MosaicProperties(true, true, false, 3, BigInteger.valueOf(10));
    MosaicInfo mosaicInfo = new MosaicInfo(true, 0, "5A3CD9B09CD1E8000159249B", new NamespaceId(new BigInteger("-8884663987180930485")), new MosaicId(new BigInteger("-3087871471161192663")), new BigInteger("100"), new BigInteger("0"), new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), mosaicProperties);
    assertFalse(mosaicInfo.isLevyMutable());
}
Also used : PublicAccount(io.nem.sdk.model.account.PublicAccount) BigInteger(java.math.BigInteger) NamespaceId(io.nem.sdk.model.namespace.NamespaceId) Test(org.junit.jupiter.api.Test)

Example 3 with PublicAccount

use of io.nem.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.

the class MosaicInfoTest method shouldReturnIsSupplyMutableWhenIsImmutable.

@Test
void shouldReturnIsSupplyMutableWhenIsImmutable() {
    MosaicProperties mosaicProperties = new MosaicProperties(false, true, true, 3, BigInteger.valueOf(10));
    MosaicInfo mosaicInfo = new MosaicInfo(true, 0, "5A3CD9B09CD1E8000159249B", new NamespaceId(new BigInteger("-8884663987180930485")), new MosaicId(new BigInteger("-3087871471161192663")), new BigInteger("100"), new BigInteger("0"), new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), mosaicProperties);
    assertFalse(mosaicInfo.isSupplyMutable());
}
Also used : PublicAccount(io.nem.sdk.model.account.PublicAccount) BigInteger(java.math.BigInteger) NamespaceId(io.nem.sdk.model.namespace.NamespaceId) Test(org.junit.jupiter.api.Test)

Example 4 with PublicAccount

use of io.nem.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.

the class MosaicInfoTest method shouldReturnIsTransferableWhenItsNotTransferable.

@Test
void shouldReturnIsTransferableWhenItsNotTransferable() {
    MosaicProperties mosaicProperties = new MosaicProperties(true, false, true, 3, BigInteger.valueOf(10));
    MosaicInfo mosaicInfo = new MosaicInfo(true, 0, "5A3CD9B09CD1E8000159249B", new NamespaceId(new BigInteger("-8884663987180930485")), new MosaicId(new BigInteger("-3087871471161192663")), new BigInteger("100"), new BigInteger("0"), new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), mosaicProperties);
    assertFalse(mosaicInfo.isTransferable());
}
Also used : PublicAccount(io.nem.sdk.model.account.PublicAccount) BigInteger(java.math.BigInteger) NamespaceId(io.nem.sdk.model.namespace.NamespaceId) Test(org.junit.jupiter.api.Test)

Example 5 with PublicAccount

use of io.nem.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.

the class MosaicInfoTest method shouldReturnIsTransferableWhenLevyIsMutable.

@Test
void shouldReturnIsTransferableWhenLevyIsMutable() {
    MosaicProperties mosaicProperties = new MosaicProperties(true, true, true, 3, BigInteger.valueOf(10));
    MosaicInfo mosaicInfo = new MosaicInfo(true, 0, "5A3CD9B09CD1E8000159249B", new NamespaceId(new BigInteger("-8884663987180930485")), new MosaicId(new BigInteger("-3087871471161192663")), new BigInteger("100"), new BigInteger("0"), new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST), mosaicProperties);
    assertTrue(mosaicInfo.isLevyMutable());
}
Also used : PublicAccount(io.nem.sdk.model.account.PublicAccount) BigInteger(java.math.BigInteger) NamespaceId(io.nem.sdk.model.namespace.NamespaceId) Test(org.junit.jupiter.api.Test)

Aggregations

PublicAccount (io.nem.sdk.model.account.PublicAccount)18 Test (org.junit.jupiter.api.Test)14 NamespaceId (io.nem.sdk.model.namespace.NamespaceId)10 BigInteger (java.math.BigInteger)10 Address (io.nem.sdk.model.account.Address)6 NetworkType (io.nem.sdk.model.blockchain.NetworkType)4 JsonObject (io.vertx.core.json.JsonObject)4 Mosaic (io.nem.sdk.model.mosaic.Mosaic)3 MosaicId (io.nem.sdk.model.mosaic.MosaicId)3 List (java.util.List)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 MosaicProperties (io.nem.sdk.model.mosaic.MosaicProperties)2 NamespaceType (io.nem.sdk.model.namespace.NamespaceType)2 UInt64 (io.nem.sdk.model.transaction.UInt64)2 Observable (io.reactivex.Observable)2 HttpResponse (io.vertx.reactivex.ext.web.client.HttpResponse)2 BodyCodec (io.vertx.reactivex.ext.web.codec.BodyCodec)2 MalformedURLException (java.net.MalformedURLException)2