public override async Task <GetOperationResponse> GetOperationsForBlockchain(GetOperationsForBlockchainRequest request, ServerCallContext context)
        {
            var operations = await _operationRepository.GetAllForBlockchainAsync(
                request.BlockchainId,
                request.Skip,
                request.Take);

            var response = new GetOperationResponse();

            if (operations != null && operations.Any())
            {
                response.Operations.AddRange(operations.Select(x =>
                                                               new OperationResponse()
                {
                    WalletKey = new WalletKey()
                    {
                        BlockchainAssetId = x.Key.BlockchainAssetId,
                        BlockchainId      = x.Key.BlockchainId,
                        WalletAddress     = x.Key.WalletAddress
                    },
                    BalanceChange = x.BalanceChange.ToString(),
                    OperationId   = x.OperationId,
                    Block         = x.Block
                }));
            }

            return(response);
        }
示例#2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetOperationResponse response = new GetOperationResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("operation", targetDepth))
                {
                    var unmarshaller = OperationUnmarshaller.Instance;
                    response.Operation = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
 private static void DisplayOperation(GetOperationResponse response)
 => Console.WriteLine(JsonConvert.SerializeObject(response, JsonSerializerSettings));