Exemplo n.º 1
0
 public async Task CreateChannelAsync(CreateChannelDto input)
 {
     ////验证
     ////Assert.IsFalse(this.channelRepository.ExistsName(input.Name), "栏目名称已存在!");
     //Channel parentChannel = input.ParentId == 0 ? null : this.unitOfWork.Resolve<Channel>(input.ParentId);
     //this.unitOfWork.RegisterAdd(Mapper.Map<Channel>(input));
     //await this.unitOfWork.UnitedCommitAsync();
 }
        public async Task <ChannelCreateResult> CreateChannelReply([FromBody] CreateChannelDto channel)
        {
            var addressSender = EthereumUtils.GetAddressFromPrivateKey(_config.PrivateKey);
            var transcationId = await _contract.CreateChannelReply(channel);

            return(new ChannelCreateResult
            {
                TransactionId = transcationId,
                ChannelId = EthereumUtils.GetChannelAddress(channel.ReceiverAddress, addressSender)
            });
        }
Exemplo n.º 3
0
        public async Task <string> CreateChannelReply(CreateChannelDto channel)
        {
            var contract            = _web3.Eth.GetContract(_config.ContractABI, _config.ContractAddress);
            var openChannelFunction = contract.GetFunction("respondChannel");

            var transactionInput = GetTransactionInput(channel.AmountWei);

            var res = await openChannelFunction
                      .SendTransactionAsync(transactionInput,
                                            channel.ReceiverAddress);

            return(res);
        }