use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class NodeKeyLinkTransactionMapper method createFactory.
@Override
protected TransactionFactory<NodeKeyLinkTransaction> createFactory(NetworkType networkType, Deadline deadline, NodeKeyLinkTransactionDTO transaction) {
PublicKey linkedPublicKey = PublicKey.fromHexString(transaction.getLinkedPublicKey());
LinkAction linkAction = LinkAction.rawValueOf(transaction.getLinkAction().getValue());
return NodeKeyLinkTransactionFactory.create(networkType, deadline, linkedPublicKey, linkAction);
}
use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class BlockRepositoryIntegrationTest method searchBySignerPublicKey.
@ParameterizedTest
@EnumSource(RepositoryType.class)
void searchBySignerPublicKey(RepositoryType type) {
BlockRepository blockRepository = getBlockRepository(type);
BlockInfo block1 = get(blockRepository.getBlockByHeight(BigInteger.ONE));
BlockSearchCriteria criteria = new BlockSearchCriteria();
PublicKey expectedSignerPublicKey = block1.getSignerPublicAccount().getPublicKey();
criteria.setSignerPublicKey(expectedSignerPublicKey);
BlockPaginationStreamer streamer = new BlockPaginationStreamer(blockRepository);
List<BlockInfo> blocks = get(streamer.search(criteria).toList().toObservable());
blocks.forEach(b -> Assertions.assertEquals(expectedSignerPublicKey, b.getSignerPublicAccount().getPublicKey()));
Assertions.assertFalse(blocks.isEmpty());
}
use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class AccountKeyLinkTransactionIntegrationTest method basicAnnounce.
@ParameterizedTest
@EnumSource(RepositoryType.class)
public void basicAnnounce(RepositoryType type) {
Account account = config().getNemesisAccount2();
PublicKey linkedPublicKey = PublicKey.fromHexString("F5D0AAD909CFBC810A3F888C33C57A9051AE1A59D1CDA872A8B90BCA7EF2D34A");
AccountKeyLinkTransaction linkTransaction = AccountKeyLinkTransactionFactory.create(getNetworkType(), getDeadline(), linkedPublicKey, LinkAction.LINK).maxFee(maxFee).build();
announceAndValidate(type, account, linkTransaction);
AccountKeyLinkTransaction unlinkTransaction = AccountKeyLinkTransactionFactory.create(getNetworkType(), getDeadline(), linkedPublicKey, LinkAction.UNLINK).maxFee(maxFee).build();
announceAndValidate(type, account, unlinkTransaction);
}
use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class VotingKeyLinkTransactionMapper method createFactory.
@Override
protected TransactionFactory<VotingKeyLinkTransaction> createFactory(NetworkType networkType, Deadline deadline, VotingKeyLinkTransactionDTO transaction) {
PublicKey linkedPublicKey = PublicKey.fromHexString(transaction.getLinkedPublicKey());
LinkAction linkAction = LinkAction.rawValueOf(transaction.getLinkAction().getValue());
return VotingKeyLinkTransactionFactory.create(networkType, deadline, linkedPublicKey, transaction.getStartEpoch(), transaction.getEndEpoch(), linkAction);
}
use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class VotingKeyLinkTransactionIntegrationTest method basicAnnounce.
@ParameterizedTest
@EnumSource(RepositoryType.class)
public void basicAnnounce(RepositoryType type) {
Account account = config().getNemesisAccount1();
PublicKey linkedPublicKey = PublicKey.generateRandom();
VotingKeyLinkTransaction linkTransaction = VotingKeyLinkTransactionFactory.create(getNetworkType(), getDeadline(), linkedPublicKey, (72), (26280), LinkAction.LINK).maxFee(maxFee).build();
announceAndValidate(type, account, linkTransaction);
VotingKeyLinkTransaction unlinkTransaction = VotingKeyLinkTransactionFactory.create(getNetworkType(), getDeadline(), linkedPublicKey, (72), (26280), LinkAction.UNLINK).maxFee(maxFee).build();
announceAndValidate(type, account, unlinkTransaction);
}
Aggregations