Ejemplo n.º 1
0
        public async Task <TxResponse> InitChannel(string channelId)
        {
            var tx = new QMBlockSDK.TX.TxHeader
            {
                ChannelId     = channelId,
                Type          = TxType.Invoke,
                FuncName      = QMBlockSDK.CC.ConfigKey.InitChannelFunc,
                ChaincodeName = QMBlockSDK.CC.ConfigKey.SysNetConfigChaincode
            };

            return(await _service.InvokeTx(tx));

            //return await _client.TxInvoke(tx);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 向节点注册成员
        /// </summary>
        /// <param name="channelId"></param>
        /// <param name="ca"></param>
        /// <returns></returns>
        public async Task <TxResponse> RegistMember(string channelId, OrgMemberConfig ca)
        {
            var txHeader = new QMBlockSDK.TX.TxHeader();

            txHeader.ChannelId = channelId;
            //txHeader.ChaincodeName = ConfigKey.SysIdentityChaincode;
            txHeader.ChaincodeName = ConfigKey.SysNetConfigChaincode;
            txHeader.FuncName      = ConfigKey.AddOrgMemberFunc;
            txHeader.Args          = new string[] { Newtonsoft.Json.JsonConvert.SerializeObject(ca) };
            txHeader.Type          = TxType.Invoke;
            var rs = await _txService.InvokeTx(txHeader);

            return(rs);
        }
Ejemplo n.º 3
0
        //member.admin

        //[Authorize(Roles = "Admin,User")]
        public override async Task <TxResponse> InvokeTx(TxHeader request, ServerCallContext context)
        {
            try
            {
                var model = Newtonsoft.Json.JsonConvert.DeserializeObject <QMBlockSDK.TX.TxHeader>(request.Data);
                var rs    = await _txService.InvokeTx(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)
                });
            }
        }
Ejemplo n.º 4
0
        public async Task <JsonResult> InvokeTx(TxHeader request)
        {
            var rs = await _txService.InvokeTx(request);

            return(new JsonResult(rs));
        }