Search in sources :

Example 1 with RelativeChange

use of com.github.rosklyar.client.transaction.domain.multisig.RelativeChange in project nem-library by rosklyar.

the class SecureTransactionClient method addCosignatoriesToMultisigAccount.

@Override
public NemAnnounceResult addCosignatoriesToMultisigAccount(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(ADD_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 2 with RelativeChange

use of com.github.rosklyar.client.transaction.domain.multisig.RelativeChange 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)

Aggregations

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