public Task <ResponseCheckTx> RouteCheckTx(RequestCheckTx request, ServerCallContext context) { var data = ResolveRequestTx(request.Tx); var handler = _transactionHandlerFactory.CreateHandlerFor(data.Payload); _logger.LogInformation($"Handling CheckTx {data.Payload.GetType()} with handler {handler.GetType()}"); return(handler.CheckTx(data.TransactionToken, data.Payload, request, context)); }
private (ITransactionHandler Handler, TransactionToken TransactionToken, BaseTransaction Payload) ResolveTransactionHandler(Func <ByteString> byteStringAccessor) { var byteString = byteStringAccessor(); var transactionToken = TransactionToken.FromByteString(byteString); var payload = JsonConvert.DeserializeObject <BaseTransaction>(Encoding.UTF8.GetString(transactionToken.Data), _transactionSerializerSettings); return(_transactionHandlerFactory.CreateHandlerFor(payload), transactionToken, payload); }