예제 #1
0
        /// <inheritdoc />
        public async Task <TransactionBuildingResult> BuildSingleReceiveTransactionAsync(Guid operationId, string sendTransactionHash)
        {
            ValidateOperationIdIsNotEmpty(operationId);
            ValidateSendTransactionHashIsNotEmpty(sendTransactionHash);

            try
            {
                var apiResponse = await _runner.RunWithRetriesAsync(() => _api.BuildSingleReceiveTransactionAsync(
                                                                        new BuildSingleReceiveTransactionRequest
                {
                    OperationId         = operationId,
                    SendTransactionHash = sendTransactionHash
                }));

                return(new TransactionBuildingResult(apiResponse));
            }
            catch (ErrorResponseException ex) when(ex.StatusCode == HttpStatusCode.NotImplemented)
            {
                throw new NotSupportedException("Operation is not supported by the blockchain. See GetCapabilitiesAsync", ex);
            }
            catch (ErrorResponseException ex) when(ex.StatusCode == HttpStatusCode.Conflict)
            {
                throw new TransactionAlreadyBroadcastedException(ex);
            }
        }
        /// <inheritdoc />
        public async Task <TransactionBuildingResult> BuildSingleReceiveTransactionAsync(Guid operationId, string sendTransactionHash)
        {
            ValidateOperationIdIsNotEmpty(operationId);
            ValidateSendTransactionHashIsNotEmpty(sendTransactionHash);

            var apiResponse = await _runner.RunWithRetriesAsync(() => _api.BuildSingleReceiveTransactionAsync(
                                                                    new BuildSingleReceiveTransactionRequest
            {
                OperationId         = operationId,
                SendTransactionHash = sendTransactionHash
            }));

            return(new TransactionBuildingResult(apiResponse));
        }