예제 #1
0
        public async Task <TxResponse> QueryTx(string chaincode, string func, string[] args)
        {
            var tx = new QMBlockSDK.TX.TxHeader();

            tx.ChannelId     = _channelId;
            tx.Args          = args;
            tx.FuncName      = func;
            tx.ChaincodeName = chaincode;
            return(await _tx.QueryTx(tx));
        }
예제 #2
0
        //查询配置
        public async Task <ChannelConfig> QueryChannelConfigAsync(string channelId)
        {
            var txHeader = new QMBlockSDK.TX.TxHeader();

            txHeader.ChannelId     = channelId;
            txHeader.ChaincodeName = ConfigKey.SysNetConfigChaincode;
            txHeader.FuncName      = ConfigKey.QueryChannelConfig;
            txHeader.Args          = new string[0];
            txHeader.Type          = TxType.Query;
            var rs = await _txService.QueryTx(txHeader);

            if (rs.Status)
            {
                return(rs.Data as ChannelConfig);
            }
            else
            {
                throw new Exception(rs.Msg);
            }
        }
예제 #3
0
        //member.query
        //[Authorize(Roles = "Admin,User,Reader")]
        public override async Task <TxResponse> QueryTx(TxHeader request, ServerCallContext context)
        {
            try
            {
                var model = Newtonsoft.Json.JsonConvert.DeserializeObject <QMBlockSDK.TX.TxHeader>(request.Data);
                var rs    = await _txService.QueryTx(model);

                return(new TxResponse()
                {
                    Data = Newtonsoft.Json.JsonConvert.SerializeObject(rs)
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                var rs = new QMBlockSDK.TX.TxResponse();
                rs.Msg    = ex.Message;
                rs.Status = false;
                return(new TxResponse()
                {
                    Data = Newtonsoft.Json.JsonConvert.SerializeObject(rs)
                });
            }
        }
예제 #4
0
        public async Task <JsonResult> QueryTx(TxHeader request)
        {
            var rs = await _txService.QueryTx(request);

            return(new JsonResult(rs));
        }