Search in sources :

Example 1 with Hash

use of com.github.rosklyar.client.account.domain.Hash in project nem-library by rosklyar.

the class SecureTransactionClient method cosignTransaction.

@Override
public NemAnnounceResult cosignTransaction(String privateKey, String transactionHash, String multisigAddress, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    Transaction transaction = Transaction.builder().type(MULTISIG_SIGNATURE.type).version(versionProvider.version(network, MULTISIG_SIGNATURE)).timeStamp(currentTime).signer(signer.publicKey()).fee(feeCalculator.cosigningFee()).deadline(currentTime + timeToLiveInSeconds).otherAccount(multisigAddress).otherHash(new Hash(transactionHash)).build();
    byte[] data = transactionEncoder.data(transaction);
    return feignTransactionClient.prepare(new RequestAnnounce(hexConverter.getString(data), signer.sign(data)));
}
Also used : DefaultSigner(com.github.rosklyar.client.transaction.encode.DefaultSigner) Signer(com.github.rosklyar.client.transaction.encode.Signer) DefaultSigner(com.github.rosklyar.client.transaction.encode.DefaultSigner) RequestAnnounce(com.github.rosklyar.client.transaction.domain.RequestAnnounce) ProvisionNamespaceTransaction(com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction) MultisigTransaction(com.github.rosklyar.client.transaction.domain.multisig.MultisigTransaction) ImportanceTransferTransaction(com.github.rosklyar.client.transaction.domain.importance.ImportanceTransferTransaction) Transaction(com.github.rosklyar.client.transaction.domain.Transaction) Hash(com.github.rosklyar.client.account.domain.Hash)

Aggregations

Hash (com.github.rosklyar.client.account.domain.Hash)1 ProvisionNamespaceTransaction (com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction)1 RequestAnnounce (com.github.rosklyar.client.transaction.domain.RequestAnnounce)1 Transaction (com.github.rosklyar.client.transaction.domain.Transaction)1 ImportanceTransferTransaction (com.github.rosklyar.client.transaction.domain.importance.ImportanceTransferTransaction)1 MultisigTransaction (com.github.rosklyar.client.transaction.domain.multisig.MultisigTransaction)1 DefaultSigner (com.github.rosklyar.client.transaction.encode.DefaultSigner)1 Signer (com.github.rosklyar.client.transaction.encode.Signer)1