Exemplo n.º 1
0
        public IObservable <string> CreateAndAnnounceTransaction(ProximaxMessagePayloadModel messagePayload,
                                                                 string signerPrivateKey,
                                                                 string recipientPublicKey, string recipientAddress, int transactionDeadline,
                                                                 List <Mosaic> transactionMosaics, bool useBlockchainSecureMessage)
        {
            CheckParameter(signerPrivateKey != null, "signerPrivateKey is required");
            CheckParameter(messagePayload != null, "messagePayload is required");

            var message = BlockchainMessageService.CreateMessage(messagePayload, signerPrivateKey,
                                                                 recipientPublicKey, recipientAddress, useBlockchainSecureMessage);
            var recipient         = GetRecipient(signerPrivateKey, recipientPublicKey, recipientAddress);
            var transaction       = CreateTransaction(recipient, transactionDeadline, transactionMosaics, message);
            var signedTransaction = NemUtils.SignTransaction(signerPrivateKey, transaction);

            TransactionClient.Announce(signedTransaction, NemUtils.GetAddressFromPrivateKey(signerPrivateKey));

            return(Observable.Return(signedTransaction.Hash));
        }