use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class NamespaceInfoTest method createANamespaceInfoViaConstructorEmptyAlias.
@Test
void createANamespaceInfoViaConstructorEmptyAlias() {
NamespaceId namespaceId = NamespaceId.createFromId(new BigInteger("-8884663987180930485"));
Address address = Address.createFromRawAddress("SDXK5NYCKOSAT2NCIPYIEYN57N5XEVNCZ5AIAOI");
NamespaceInfo namespaceInfo = new NamespaceInfo("abc", 1, true, 0, NamespaceRegistrationType.ROOT_NAMESPACE, 1, Arrays.asList(namespaceId), NamespaceId.createFromId(new BigInteger("0")), address, new BigInteger("1"), new BigInteger("-1"), new EmptyAlias());
assertEquals("abc", namespaceInfo.getRecordId().get());
assertTrue(namespaceInfo.isActive());
assertEquals(0, (int) namespaceInfo.getIndex());
assertSame(namespaceInfo.getRegistrationType(), NamespaceRegistrationType.ROOT_NAMESPACE);
assertEquals(1, (int) namespaceInfo.getDepth());
assertEquals(namespaceId, namespaceInfo.getLevels().get(0));
Assertions.assertEquals(address, namespaceInfo.getOwnerAddress());
assertEquals(new BigInteger("1"), namespaceInfo.getStartHeight());
assertEquals(new BigInteger("-1"), namespaceInfo.getEndHeight());
assertEquals(AliasType.NONE, namespaceInfo.getAlias().getType());
byte[] serialize = namespaceInfo.serialize(Arrays.asList(createSubNamespaceInfo(namespaceId)));
assertEquals("01004BFA5F372D55B38490EEAEB70253A409E9A243F08261BDFB7B7255A2CF4080390100000000000000FFFFFFFFFFFFFFFF0001000000000000000129CF2728A91AE7F0016400000000000000", ConvertUtils.toHex(serialize));
}
use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class BalanceTransferReceiptTest method shouldSerializeTheSameAsTypescript.
@Test
void shouldSerializeTheSameAsTypescript() {
Address sender = Address.generateRandom(networkType);
Address recipient = Address.generateRandom(networkType);
BalanceTransferReceipt balanceTransferReceipt = new BalanceTransferReceipt(sender, recipient, new MosaicId("941299B2B7E1291C"), BigInteger.valueOf(1000), ReceiptType.MOSAIC_RENTAL_FEE, ReceiptVersion.BALANCE_TRANSFER);
String hex = ConvertUtils.toHex(balanceTransferReceipt.serialize());
Assertions.assertEquals("01004D121C29E1B7B2991294E803000000000000" + sender.encoded() + recipient.encoded(), hex.toUpperCase());
}
use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class MosaicIdTest method testCurrency.
@Test
void testCurrency() {
String nemesisSignerPublicKey = "E0AC0720AA389B8DBF9DB9D2672991CDA7DEC284737984702CE7FD7C6E07A5E2";
Address nemesisAddress = Address.createFromPublicKey(nemesisSignerPublicKey, NetworkType.TEST_NET);
MosaicId mosaicId = MosaicId.createFromNonce(MosaicNonce.createFromInteger(0), nemesisAddress);
assertEquals("61B0856247BD3A71", mosaicId.getIdAsHex());
}
use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class MosaicIdTest method testHarvestCurrency.
@Test
void testHarvestCurrency() {
String nemesisSignerPublicKey = "AA4174DBA4C6CABFF16DEDA628ACE549701FD1618BC6CE89E10BEFE33459CD12";
Address nemesisAddress = Address.createFromPublicKey(nemesisSignerPublicKey, NetworkType.TEST_NET);
MosaicNonce nonce = MosaicNonce.createFromInteger(1);
Assertions.assertEquals(1, nonce.getNonceAsLong());
MosaicId mosaicId = MosaicId.createFromNonce(nonce, nemesisAddress);
assertEquals("1646351CC29EBDCB", mosaicId.getIdAsHex());
}
use of io.nem.symbol.sdk.model.account.Address in project nem2-sdk-java by nemtech.
the class MosaicIdTest method testCurrencyTestnet.
@Test
void testCurrencyTestnet() {
String nemesisSignerPublicKey = "871B2F2F9D825252FFF43543066EE8D9141A3373F2F013BB449C6425A03362D8";
Address nemesisAddress = Address.createFromPublicKey(nemesisSignerPublicKey, NetworkType.TEST_NET);
MosaicId mosaicId = MosaicId.createFromNonce(MosaicNonce.createFromInteger(0), nemesisAddress);
assertEquals("5E62990DCAC5BE8A", mosaicId.getIdAsHex());
}
Aggregations