private IObservable <string> CreateAndAnnounceTransaction(UploadParameter uploadParam,
                                                           ProximaxMessagePayloadModel messagePayload)
 {
     return(BlockchainTransactionService.CreateAndAnnounceTransaction(
                messagePayload, uploadParam.SignerPrivateKey, uploadParam.RecipientPublicKey,
                uploadParam.RecipientAddress,
                uploadParam.TransactionDeadline, uploadParam.TransactionMosaics,
                uploadParam.UseBlockchainSecureMessage));
 }
        public AsyncTask UploadAsync(UploadParameter uploadParam, AsyncCallbacks <UploadResult> asyncCallbacks)
        {
            CheckParameter(uploadParam != null, "uploadParam is required");

            var asyncTask = new AsyncTask();

            AsyncUtils.ProcessFirstItem(DoUpload(uploadParam), asyncCallbacks, asyncTask);

            return(asyncTask);
        }
 private IObservable <UploadResult> DoUpload(UploadParameter uploadParam)
 {
     try
     {
         var uploadResult = CreateProximaxDataService.CreateData(uploadParam).SelectMany(uploadedData =>
                                                                                         CreateProximaxMessagePayloadService.CreateMessagePayload(uploadParam, uploadedData)
                                                                                         .SelectMany(messagePayload =>
                                                                                                     CreateAndAnnounceTransaction(uploadParam, messagePayload)
                                                                                                     .Select(transactionHash =>
                                                                                                             CreateUploadResult(messagePayload, transactionHash)))).Wait();
         return(Observable.Return(uploadResult));
     }
     catch (Exception ex)
     {
         return(Observable.Throw <UploadResult>(new UploadFailureException("Upload failed.", ex)));
     }
 }
        public UploadResult Upload(UploadParameter uploadParam)
        {
            CheckParameter(uploadParam != null, "uploadParam is required");

            return(DoUpload(uploadParam).Wait());
        }