use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class VrfKeyLinkTransactionMapper method createFactory.
@Override
protected TransactionFactory<VrfKeyLinkTransaction> createFactory(NetworkType networkType, Deadline deadline, VrfKeyLinkTransactionDTO transaction) {
PublicKey linkedPublicKey = PublicKey.fromHexString(transaction.getLinkedPublicKey());
LinkAction linkAction = LinkAction.rawValueOf(transaction.getLinkAction().getValue());
return VrfKeyLinkTransactionFactory.create(networkType, deadline, linkedPublicKey, linkAction);
}
use of io.nem.symbol.core.crypto.PublicKey in project nem2-sdk-java by nemtech.
the class AbstractTransactionMapper method mapTransaction.
private D mapTransaction(Transaction transaction, boolean embedded) {
TransactionDTO dto = new TransactionDTO();
dto.setSignerPublicKey(transaction.getSigner().map(PublicAccount::getPublicKey).map(PublicKey::toHex).orElse(null));
dto.setVersion(transaction.getVersion());
dto.setType(transaction.getType().getValue());
dto.setNetwork(NetworkTypeEnum.fromValue(transaction.getNetworkType().getValue()));
if (!embedded) {
dto.setSize(transaction.getSize());
dto.setMaxFee(transaction.getMaxFee());
dto.setDeadline(transaction.getDeadline().toBigInteger());
dto.setSignature(transaction.getSignature().orElse(null));
}
D specificDto = getJsonHelper().parse(getJsonHelper().print(dto), transactionDtoClass);
copyToDto((T) transaction, specificDto);
return specificDto;
}
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 AccountRepositoryOkHttpImpl method toDto.
private SupplementalAccountKeys toDto(SupplementalPublicKeysDTO dto) {
if (dto == null) {
return new SupplementalAccountKeys(null, null, null, Collections.emptyList());
}
PublicKey linked = toPublicKey(dto.getLinked());
PublicKey node = toPublicKey(dto.getNode());
PublicKey vrf = toPublicKey(dto.getVrf());
List<AccountLinkVotingKey> voting = dto.getVoting() == null || dto.getVoting().getPublicKeys() == null ? Collections.emptyList() : dto.getVoting().getPublicKeys().stream().map(p -> new AccountLinkVotingKey(p.getPublicKey(), (p.getStartEpoch()), (p.getEndEpoch()))).collect(Collectors.toList());
return new SupplementalAccountKeys(linked, node, vrf, voting);
}
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);
}
Aggregations