Search in sources :

Example 1 with ProvisionNamespaceTransaction

use of com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction 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)));
}
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 2 with ProvisionNamespaceTransaction

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

Aggregations

ProvisionNamespaceTransaction (com.github.rosklyar.client.transaction.domain.ProvisionNamespaceTransaction)2 RequestAnnounce (com.github.rosklyar.client.transaction.domain.RequestAnnounce)2 DefaultSigner (com.github.rosklyar.client.transaction.encode.DefaultSigner)2 Signer (com.github.rosklyar.client.transaction.encode.Signer)2