Example #1
0
        protected virtual async Task <ExcutedResult <string> > PushAction(Action action)
        {
            var trans = new Transaction
            {
                actions = new List <Action>
                {
                    action
                }
            };

            try
            {
                var result = await Client.CreateTransaction(trans);

                if (string.IsNullOrEmpty(result))
                {
                    return(ExcutedResult <string> .FailedResult(BusinessResultCode.DataNotExist, "数据不存在,请刷新!."));
                }

                return(ExcutedResult <string> .SuccessResult("", result));
            }
            catch (ApiErrorException e)
            {
                Log4NetHelper.WriteError(GetType(), e, $"Point:{Point.HttpAddress} Code:{e.code} ErrorName:{e.error.name} Error:{e.error.what} \nAction:{JsonConvert.SerializeObject(action)}");
                return(ExcutedResult <string> .FailedResult(BusinessResultCode.ChainRequestApiError, "EOS request api error."));
            }
            catch (ApiException ex)
            {
                NodeRepository.ApiException();
                Log4NetHelper.WriteError(GetType(), ex, $"Point:{Point.HttpAddress} StatusCode:{ex.StatusCode} Content:{ex.Content}");
                return(ExcutedResult <string> .FailedResult(BusinessResultCode.ChainRequestError, "EOS request error."));
            }
        }