Search in sources :

Example 11 with DefaultSigner

use of com.github.rosklyar.client.transaction.encode.DefaultSigner in project nem-library by rosklyar.

the class SecureTransactionClient method removeCosignatoriesFromMultisigAccount.

@Override
public NemAnnounceResult removeCosignatoriesFromMultisigAccount(String privateKey, List<String> cosignatories, int relativeChange, String multisigPublicKey, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    List<Modification> modifications = cosignatories.stream().map(cosignatory -> new Modification(REMOVE_COSIGNATORY.type, cosignatory)).collect(toList());
    return modifyMultisigAccountTransaction(signer, modifications, relativeChange, multisigPublicKey, currentTime, timeToLiveInSeconds);
}
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) Action(com.github.rosklyar.client.transaction.domain.importance.Action) ProvisionNamespaceTransaction(com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction) Network(com.github.rosklyar.client.transaction.version.Network) RequestAnnounce(com.github.rosklyar.client.transaction.domain.RequestAnnounce) RelativeChange(com.github.rosklyar.client.transaction.domain.multisig.RelativeChange) HexConverter(com.github.rosklyar.client.transaction.encode.HexConverter) NemAnnounceResult(com.github.rosklyar.client.transaction.domain.NemAnnounceResult) MultisigTransaction(com.github.rosklyar.client.transaction.domain.multisig.MultisigTransaction) Signer(com.github.rosklyar.client.transaction.encode.Signer) TransactionEncoder(com.github.rosklyar.client.transaction.encode.TransactionEncoder) TEN(java.math.BigInteger.TEN) Hash(com.github.rosklyar.client.account.domain.Hash) TransactionType(com.github.rosklyar.client.transaction.TransactionType) FeeCalculator(com.github.rosklyar.client.transaction.fee.FeeCalculator) ImportanceTransferTransaction(com.github.rosklyar.client.transaction.domain.importance.ImportanceTransferTransaction) Transaction(com.github.rosklyar.client.transaction.domain.Transaction) NodeClient(com.github.rosklyar.client.node.NodeClient) Modification(com.github.rosklyar.client.transaction.domain.multisig.Modification) com.github.rosklyar.client.transaction.domain.mosaic(com.github.rosklyar.client.transaction.domain.mosaic) MosaicProperty(com.github.rosklyar.client.mosaic.domain.MosaicProperty) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Lists.newArrayList(com.google.common.collect.Lists.newArrayList) VersionProvider(com.github.rosklyar.client.transaction.version.VersionProvider) Message(com.github.rosklyar.client.account.domain.Message) REMOVE_COSIGNATORY(com.github.rosklyar.client.transaction.domain.multisig.ModificationType.REMOVE_COSIGNATORY) Levy(com.github.rosklyar.client.mosaic.domain.Levy) ADD_COSIGNATORY(com.github.rosklyar.client.transaction.domain.multisig.ModificationType.ADD_COSIGNATORY) Modification(com.github.rosklyar.client.transaction.domain.multisig.Modification) DefaultSigner(com.github.rosklyar.client.transaction.encode.DefaultSigner)

Example 12 with DefaultSigner

use of com.github.rosklyar.client.transaction.encode.DefaultSigner in project nem-library by rosklyar.

the class SecureTransactionClient method importanceTransfer.

@Override
public NemAnnounceResult importanceTransfer(String privateKey, Action action, String remoteAccountPublicKey, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    String publicKey = signer.publicKey();
    ImportanceTransferTransaction transaction = importanceTransferTransaction(action, remoteAccountPublicKey, timeToLiveInSeconds, currentTime, publicKey);
    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) ImportanceTransferTransaction(com.github.rosklyar.client.transaction.domain.importance.ImportanceTransferTransaction)

Example 13 with DefaultSigner

use of com.github.rosklyar.client.transaction.encode.DefaultSigner in project nem-library by rosklyar.

the class SecureTransactionClient method createMosaic.

@Override
public NemAnnounceResult createMosaic(String privateKey, MosaicId mosaicId, String mosaicDescription, MosaicProperties mosaicProperties, Levy levy, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    String publicKey = signer.publicKey();
    MosaicDefinitionCreationTransaction mosaicDefinitionCreationTransaction = mosaicDefinitionCreationTransaction(mosaicId, mosaicDescription, mosaicProperties, levy, publicKey, currentTime, timeToLiveInSeconds);
    byte[] data = transactionEncoder.data(mosaicDefinitionCreationTransaction);
    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)

Example 14 with DefaultSigner

use of com.github.rosklyar.client.transaction.encode.DefaultSigner in project nem-library by rosklyar.

the class SecureTransactionClient method multisigCreateNamespace.

@Override
public NemAnnounceResult multisigCreateNamespace(String privateKey, String parentNamespace, String namespace, String multisigPublicKey, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    ProvisionNamespaceTransaction provisionNamespaceTransaction = provisionNamespaceTransaction(multisigPublicKey, parentNamespace, namespace, currentTime, timeToLiveInSeconds);
    MultisigTransaction<ProvisionNamespaceTransaction> transaction = MultisigTransaction.<ProvisionNamespaceTransaction>builder().type(MULTISIG_TRANSACTION.type).version(versionProvider.version(network, MULTISIG_TRANSACTION)).timeStamp(currentTime).signer(signer.publicKey()).fee(feeCalculator.multisigTransactionFee()).deadline(currentTime + timeToLiveInSeconds).otherTrans(provisionNamespaceTransaction).build();
    byte[] data = transactionEncoder.dataMultisigProvisionNamespace(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) ProvisionNamespaceTransaction(com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction) RequestAnnounce(com.github.rosklyar.client.transaction.domain.RequestAnnounce)

Example 15 with DefaultSigner

use of com.github.rosklyar.client.transaction.encode.DefaultSigner in project nem-library by rosklyar.

the class SecureTransactionClient method multisigTransferNem.

@Override
public NemAnnounceResult multisigTransferNem(String privateKey, String toAddress, long microXemAmount, String message, String multisigPublicKey, int timeToLiveInSeconds) {
    Signer signer = new DefaultSigner(privateKey);
    int currentTime = nodeClient.extendedInfo().nisInfo.currentTime;
    Transaction transferTransaction = transferNemTransaction(multisigPublicKey, toAddress, microXemAmount, message, currentTime, timeToLiveInSeconds);
    MultisigTransaction<Transaction> transaction = MultisigTransaction.<Transaction>builder().type(MULTISIG_TRANSACTION.type).version(versionProvider.version(network, MULTISIG_TRANSACTION)).timeStamp(currentTime).signer(signer.publicKey()).fee(feeCalculator.multisigTransactionFee()).deadline(currentTime + timeToLiveInSeconds).otherTrans(transferTransaction).build();
    byte[] data = transactionEncoder.dataMultisigTransfer(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)

Aggregations

RequestAnnounce (com.github.rosklyar.client.transaction.domain.RequestAnnounce)16 DefaultSigner (com.github.rosklyar.client.transaction.encode.DefaultSigner)16 Signer (com.github.rosklyar.client.transaction.encode.Signer)16 ProvisionNamespaceTransaction (com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction)10 ImportanceTransferTransaction (com.github.rosklyar.client.transaction.domain.importance.ImportanceTransferTransaction)10 Transaction (com.github.rosklyar.client.transaction.domain.Transaction)8 MultisigTransaction (com.github.rosklyar.client.transaction.domain.multisig.MultisigTransaction)8 Hash (com.github.rosklyar.client.account.domain.Hash)4 Message (com.github.rosklyar.client.account.domain.Message)3 Levy (com.github.rosklyar.client.mosaic.domain.Levy)3 MosaicProperty (com.github.rosklyar.client.mosaic.domain.MosaicProperty)3 NodeClient (com.github.rosklyar.client.node.NodeClient)3 TransactionType (com.github.rosklyar.client.transaction.TransactionType)3 NemAnnounceResult (com.github.rosklyar.client.transaction.domain.NemAnnounceResult)3 Action (com.github.rosklyar.client.transaction.domain.importance.Action)3 com.github.rosklyar.client.transaction.domain.mosaic (com.github.rosklyar.client.transaction.domain.mosaic)3 Modification (com.github.rosklyar.client.transaction.domain.multisig.Modification)3 ADD_COSIGNATORY (com.github.rosklyar.client.transaction.domain.multisig.ModificationType.ADD_COSIGNATORY)3 REMOVE_COSIGNATORY (com.github.rosklyar.client.transaction.domain.multisig.ModificationType.REMOVE_COSIGNATORY)3 RelativeChange (com.github.rosklyar.client.transaction.domain.multisig.RelativeChange)3