use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicVectorTester method testMosaics.
@ParameterizedTest
@MethodSource("testMosaics")
void testMosaics(NetworkType networkType, long mosaicNonce, String plain, String mosaicHex) {
Address address = Address.createFromRawAddress(plain);
Assertions.assertEquals(networkType, address.getNetworkType());
MosaicNonce nonce = MosaicNonce.createFromBigInteger(BigInteger.valueOf(mosaicNonce));
MosaicNonce nonce2 = MosaicNonce.createFromInteger((int) mosaicNonce);
Assertions.assertEquals(mosaicNonce, nonce.getNonceAsLong());
Assertions.assertEquals(mosaicNonce, nonce2.getNonceAsLong());
Assertions.assertEquals(nonce2, nonce);
MosaicId mosaicId = MosaicId.createFromNonce(nonce, address);
Assertions.assertEquals(mosaicHex, mosaicId.getIdAsHex());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class ResolutionStatementTest method setup.
@BeforeAll
public static void setup() {
address = new Address("SDZWZJUAYNOWGBTCUDBY3SE5JF4NCC2RDM6SIGQ", networkType);
mosaicId = new MosaicId("85BBEA6CC462B244");
namespaceId = NamespaceId.createFromName("money");
receiptSource = new ReceiptSource(1, 1);
addressResolutionEntry = new ResolutionEntry<>(address, receiptSource, ReceiptType.ADDRESS_ALIAS_RESOLUTION);
mosaicResolutionEntry = new ResolutionEntry<>(mosaicId, receiptSource, ReceiptType.MOSAIC_ALIAS_RESOLUTION);
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class NamespaceInfoTest method createANamespaceInfoViaConstructor.
@Test
void createANamespaceInfoViaConstructor() {
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 MosaicAlias(new MosaicId(new BigInteger("100"))));
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.MOSAIC, namespaceInfo.getAlias().getType());
assertEquals(new BigInteger("100"), ((MosaicId) namespaceInfo.getAlias().getAliasValue()).getId());
byte[] serialize = namespaceInfo.serialize(Arrays.asList(createSubNamespaceInfo(namespaceId)));
assertEquals("01004BFA5F372D55B38490EEAEB70253A409E9A243F08261BDFB7B7255A2CF4080390100000000000000FFFFFFFFFFFFFFFF01640000000000000001000000000000000129CF2728A91AE7F0016400000000000000", ConvertUtils.toHex(serialize));
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class NamespaceInfoTest method createSubNamespaceInfo.
NamespaceInfo createSubNamespaceInfo(NamespaceId parentId) {
NamespaceId level0 = NamespaceId.createFromId(new BigInteger("17358872602548358953"));
NamespaceId level1 = NamespaceId.createFromId(new BigInteger("-1087871471161192663"));
return new NamespaceInfo("bcd", 1, true, 0, NamespaceRegistrationType.SUB_NAMESPACE, 1, Arrays.asList(level0, level1), parentId, new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST).getAddress(), new BigInteger("1"), new BigInteger("-1"), new MosaicAlias(new MosaicId(new BigInteger("100"))));
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class ArtifactExpiryReceiptTest method shouldThrowIllegalArgumentExceptionWithWrongReceiptType.
@Test
void shouldThrowIllegalArgumentExceptionWithWrongReceiptType() {
assertThrows(IllegalArgumentException.class, () -> {
MosaicId mosaicId = new MosaicId("85BBEA6CC462B244");
new ArtifactExpiryReceipt<>(mosaicId, ReceiptType.LOCK_HASH_COMPLETED, ReceiptVersion.ARTIFACT_EXPIRY, null);
});
}
Aggregations