Exemplo n.º 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));
        }
Exemplo 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);
        }
Exemplo n.º 3
0
        public static QMBlockSDK.TX.TxResponse InvokeTx()
        {
            _ = new QMBlockSDK.TX.TxHeader
            {
                ChannelId     = "mychannel",
                Type          = TxType.Invoke,
                Args          = new string[] { "b", "a", "1" },
                FuncName      = "Transfer",
                ChaincodeName = "TestChainCode"
            };
            var client = GetChannel();

            return(client.InvokeTx("TestChainCode", "Transfer", new string[] { "b", "a", "1" }).Result);
        }
Exemplo n.º 4
0
        public async Task <TxResponse> JoinChannel(string channelId)
        {
            var tx = new QMBlockSDK.TX.TxHeader
            {
                ChannelId     = channelId,
                Type          = TxType.Invoke,
                FuncName      = QMBlockSDK.CC.ConfigKey.JoinChannelFunc,
                ChaincodeName = QMBlockSDK.CC.ConfigKey.SysNetConfigChaincode
            };

            return(await _service.InvokeTx(tx));

            //return await _client.TxInvoke(tx);
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
 public TxRequest()
 {
     Data   = new TxData();
     Header = new TxHeader();
     Signer = new Signer();
 }