use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicDefinitionTransactionIntegrationTest method createMosaic.
private MosaicId createMosaic(RepositoryType type) {
MosaicNonce nonce = MosaicNonce.createRandom();
MosaicId mosaicId = MosaicId.createFromNonce(nonce, this.account.getPublicAccount());
MosaicDefinitionTransaction mosaicDefinitionTransaction = MosaicDefinitionTransactionFactory.create(getNetworkType(), getDeadline(), nonce, mosaicId, MosaicFlags.create(true, true, true), 4, new BlockDuration(100)).maxFee(maxFee).build();
MosaicDefinitionTransaction processed = announceAndValidate(type, this.account, mosaicDefinitionTransaction);
Assertions.assertEquals(mosaicId, processed.getMosaicId());
Assertions.assertEquals(mosaicDefinitionTransaction.getMosaicNonce(), processed.getMosaicNonce());
return mosaicId;
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicMetadataIntegrationTest method searchIntegration.
//
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchIntegration(RepositoryType type) {
BigInteger key = MapperUtils.fromHexToBigInteger("000000000000000A");
Address sourceAddress = Address.createFromEncoded("9852D5EAA9AB038151EEBDD34308B3B2B7D82B92955F298E");
Address targetAddress = Address.createFromEncoded("9852D5EAA9AB038151EEBDD34308B3B2B7D82B92955F298E");
MosaicId mosaicId = new MosaicId("213CED6E6BBA6689");
MetadataType metadataType = MetadataType.MOSAIC;
Page<Metadata> metadataPage = get(getRepositoryFactory(type).createMetadataRepository().search(new MetadataSearchCriteria().scopedMetadataKey(key).targetId(mosaicId).sourceAddress(sourceAddress).targetAddress(targetAddress).metadataType(metadataType)));
System.out.println(type + "\n" + toJson(metadataPage));
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicGlobalRestrictionIntegrationTest method assertMosaicGlobalRestriction.
private void assertMosaicGlobalRestriction(MosaicGlobalRestrictionTransaction mosaicGlobalRestrictionTransaction, MosaicGlobalRestriction mosaicGlobalRestriction) {
BigInteger restrictionKey = mosaicGlobalRestrictionTransaction.getRestrictionKey();
BigInteger newRestrictionValue = mosaicGlobalRestrictionTransaction.getNewRestrictionValue();
Assertions.assertEquals(restrictionKey, mosaicGlobalRestrictionTransaction.getRestrictionKey());
Assertions.assertEquals(1, mosaicGlobalRestriction.getRestrictions().size());
Assertions.assertEquals(Collections.singleton(restrictionKey), mosaicGlobalRestriction.getRestrictions().keySet());
Assertions.assertEquals(newRestrictionValue, mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getRestrictionValue());
Assertions.assertEquals(mosaicGlobalRestrictionTransaction.getNewRestrictionType(), mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getRestrictionType());
Assertions.assertEquals(new MosaicId(BigInteger.ZERO), mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getReferenceMosaicId());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class MosaicRestrictionServiceIntegrationTest method assertMosaicGlobalRestriction.
private void assertMosaicGlobalRestriction(MosaicGlobalRestrictionTransaction mosaicGlobalRestrictionTransaction, MosaicGlobalRestriction mosaicGlobalRestriction) {
BigInteger restrictionKey = mosaicGlobalRestrictionTransaction.getRestrictionKey();
BigInteger newRestrictionValue = mosaicGlobalRestrictionTransaction.getNewRestrictionValue();
Assertions.assertEquals(restrictionKey, mosaicGlobalRestrictionTransaction.getRestrictionKey());
Assertions.assertEquals(1, mosaicGlobalRestriction.getRestrictions().size());
Assertions.assertEquals(Collections.singleton(restrictionKey), mosaicGlobalRestriction.getRestrictions().keySet());
Assertions.assertEquals(newRestrictionValue, mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getRestrictionValue());
Assertions.assertEquals(mosaicGlobalRestrictionTransaction.getNewRestrictionType(), mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getRestrictionType());
Assertions.assertEquals(new MosaicId(BigInteger.ZERO), mosaicGlobalRestriction.getRestrictions().get(restrictionKey).getReferenceMosaicId());
}
use of io.nem.symbol.sdk.model.mosaic.MosaicId in project nem2-sdk-java by nemtech.
the class TransactionServiceImpl method resolveTransactionFactory.
private Observable<TransactionFactory<? extends Transaction>> resolveTransactionFactory(MosaicGlobalRestrictionTransaction transaction, ReceiptSource expectedReceiptSource, Observable<List<MosaicResolutionStatement>> mosaicResolutionStatements) {
Observable<MosaicId> resolvedMosaicId = getResolvedMosaicId(transaction, transaction.getMosaicId(), mosaicResolutionStatements, expectedReceiptSource);
Observable<MosaicId> resolvedReferenceMosaicId = getResolvedMosaicId(transaction, transaction.getReferenceMosaicId(), mosaicResolutionStatements, expectedReceiptSource);
return Observable.combineLatest(resolvedMosaicId, resolvedReferenceMosaicId, (mosaicId, referenceMosaicId) -> {
MosaicGlobalRestrictionTransactionFactory factory = MosaicGlobalRestrictionTransactionFactory.create(transaction.getNetworkType(), transaction.getDeadline(), mosaicId, transaction.getRestrictionKey(), transaction.getNewRestrictionValue(), transaction.getNewRestrictionType());
if (referenceMosaicId != null) {
factory.referenceMosaicId(referenceMosaicId);
}
return factory.previousRestrictionValue(transaction.getPreviousRestrictionValue()).previousRestrictionType(transaction.getPreviousRestrictionType());
});
}
Aggregations