use of com.github.rosklyar.client.transaction.encode.Signer in project nem-library by rosklyar.
the class SecureTransactionClient method multisigCreateMosaic.
@Override
public NemAnnounceResult multisigCreateMosaic(String privateKey, MosaicId mosaicId, String mosaicDescription, MosaicProperties mosaicProperties, Levy levy, String multisigPublicKey, int timeToLiveInSeconds) {
Signer signer = new DefaultSigner(privateKey);
int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
MosaicDefinitionCreationTransaction mosaicDefinitionCreationTransaction = mosaicDefinitionCreationTransaction(mosaicId, mosaicDescription, mosaicProperties, levy, multisigPublicKey, currentTime, timeToLiveInSeconds);
MultisigTransaction<MosaicDefinitionCreationTransaction> transaction = MultisigTransaction.<MosaicDefinitionCreationTransaction>builder().type(MULTISIG_TRANSACTION.type).version(versionProvider.version(network, MULTISIG_TRANSACTION)).timeStamp(currentTime).signer(signer.publicKey()).fee(feeCalculator.multisigTransactionFee()).deadline(currentTime + timeToLiveInSeconds).otherTrans(mosaicDefinitionCreationTransaction).build();
byte[] data = transactionEncoder.dataMultisigMosaicCreation(transaction);
return feignTransactionClient.prepare(new RequestAnnounce(hexConverter.getString(data), signer.sign(data)));
}
use of com.github.rosklyar.client.transaction.encode.Signer in project nem-library by rosklyar.
the class SecureTransactionClient method changeMosaicSupply.
@Override
public NemAnnounceResult changeMosaicSupply(String privateKey, MosaicId mosaicId, SupplyType supplyType, long amount, int timeToLiveInSeconds) {
Signer signer = new DefaultSigner(privateKey);
int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
String publicKey = signer.publicKey();
MosaicSupplyChangeTransaction transaction = mosaicSupplyChangeTransaction(mosaicId, supplyType, amount, publicKey, currentTime, timeToLiveInSeconds);
byte[] data = transactionEncoder.data(transaction);
return feignTransactionClient.prepare(new RequestAnnounce(hexConverter.getString(data), signer.sign(data)));
}
use of com.github.rosklyar.client.transaction.encode.Signer in project nem-library by rosklyar.
the class SecureTransactionClient method createMultisigAccount.
@Override
public NemAnnounceResult createMultisigAccount(String privateKey, List<String> cosignatories, int minCosignatories, int timeToLiveInSeconds) {
Signer signer = new DefaultSigner(privateKey);
int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
List<Modification> modifications = cosignatories.stream().map(publicKey -> new Modification(1, publicKey)).collect(toList());
Transaction transaction = aggregateModificationTransaction(signer.publicKey(), modifications, minCosignatories, currentTime, timeToLiveInSeconds);
byte[] data = transactionEncoder.data(transaction);
return feignTransactionClient.prepare(new RequestAnnounce(hexConverter.getString(data), signer.sign(data)));
}
use of com.github.rosklyar.client.transaction.encode.Signer in project nem-library by rosklyar.
the class SecureTransactionClient method createNamespace.
@Override
public NemAnnounceResult createNamespace(String privateKey, String parentNamespace, String namespace, int timeToLiveInSeconds) {
Signer signer = new DefaultSigner(privateKey);
int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
ProvisionNamespaceTransaction transaction = provisionNamespaceTransaction(signer.publicKey(), parentNamespace, namespace, currentTime, timeToLiveInSeconds);
byte[] data = transactionEncoder.data(transaction);
return feignTransactionClient.prepare(new RequestAnnounce(hexConverter.getString(data), signer.sign(data)));
}
use of com.github.rosklyar.client.transaction.encode.Signer 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)));
}
Aggregations