Search in sources :

Example 1 with VotingKeyLinkTransaction

use of io.nem.symbol.sdk.model.transaction.VotingKeyLinkTransaction 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);
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) PublicKey(io.nem.symbol.core.crypto.PublicKey) VotingKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.VotingKeyLinkTransaction) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with VotingKeyLinkTransaction

use of io.nem.symbol.sdk.model.transaction.VotingKeyLinkTransaction in project nem2-sdk-java by nemtech.

the class TestnetTester method sendVotingKey2.

private static void sendVotingKey2(RepositoryFactory repositoryFactory) throws Exception {
    NetworkType networkType = repositoryFactory.getNetworkType().toFuture().get();
    Account account = Account.createFromPrivateKey(PRIVATE_KEY, networkType);
    System.out.println(account.getAddress().plain());
    Duration duration = repositoryFactory.getEpochAdjustment().toFuture().get();
    Deadline deadline = Deadline.create(duration);
    PublicKey votingKey = PublicKey.fromHexString("463CCC639B5306DD06E56A273E13EF08CAB8D46A8ACA1D3919F19AF89DE116C5");
    VotingKeyLinkTransaction transaction = VotingKeyLinkTransactionFactory.create(networkType, deadline, votingKey, (1), (26280), LinkAction.LINK).maxFee(MAX_FEE).build();
    announceTransaction(repositoryFactory, account, transaction);
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) NetworkType(io.nem.symbol.sdk.model.network.NetworkType) PublicKey(io.nem.symbol.core.crypto.PublicKey) VotingKeyLinkTransaction(io.nem.symbol.sdk.model.transaction.VotingKeyLinkTransaction) Deadline(io.nem.symbol.sdk.model.transaction.Deadline) Duration(java.time.Duration)

Aggregations

PublicKey (io.nem.symbol.core.crypto.PublicKey)2 Account (io.nem.symbol.sdk.model.account.Account)2 VotingKeyLinkTransaction (io.nem.symbol.sdk.model.transaction.VotingKeyLinkTransaction)2 NetworkType (io.nem.symbol.sdk.model.network.NetworkType)1 Deadline (io.nem.symbol.sdk.model.transaction.Deadline)1 Duration (java.time.Duration)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 EnumSource (org.junit.jupiter.params.provider.EnumSource)1