Search in sources :

Example 1 with AccountLinkVotingKey

use of io.nem.symbol.sdk.model.account.AccountLinkVotingKey in project nem2-sdk-java by nemtech.

the class AccountRepositoryVertxImpl 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);
}
Also used : SupplementalAccountKeys(io.nem.symbol.sdk.model.account.SupplementalAccountKeys) AccountLinkVotingKey(io.nem.symbol.sdk.model.account.AccountLinkVotingKey) PublicKey(io.nem.symbol.core.crypto.PublicKey)

Example 2 with AccountLinkVotingKey

use of io.nem.symbol.sdk.model.account.AccountLinkVotingKey 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);
}
Also used : SupplementalAccountKeys(io.nem.symbol.sdk.model.account.SupplementalAccountKeys) AccountLinkVotingKey(io.nem.symbol.sdk.model.account.AccountLinkVotingKey) PublicKey(io.nem.symbol.core.crypto.PublicKey)

Aggregations

PublicKey (io.nem.symbol.core.crypto.PublicKey)2 AccountLinkVotingKey (io.nem.symbol.sdk.model.account.AccountLinkVotingKey)2 SupplementalAccountKeys (io.nem.symbol.sdk.model.account.SupplementalAccountKeys)2