public async Task <BigInteger> Post(AddAttributeFunction att)
        {
            var receipt = await Service.AddAttributeRequestAndWaitForReceiptAsync(att);

            var attEvent = receipt.DecodeAllEvents <AttAddedEventDTO>();

            return(attEvent.LastOrDefault().Event.AttId);
        }
Ejemplo n.º 2
0
        public Task AddAttributeRequestAndWaitForReceiptAsync(byte[] pAttrName, BigInteger pMaxLen, BigInteger pMaxNumVal, byte[] pDefVal, bool pIsStr, bool pIsNum, CancellationTokenSource cancellationToken = null)
        {
            var addAttributeFunction = new AddAttributeFunction();

            addAttributeFunction.PAttrName  = pAttrName;
            addAttributeFunction.PMaxLen    = pMaxLen;
            addAttributeFunction.PMaxNumVal = pMaxNumVal;
            addAttributeFunction.PDefVal    = pDefVal;
            addAttributeFunction.PIsStr     = pIsStr;
            addAttributeFunction.PIsNum     = pIsNum;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(addAttributeFunction, cancellationToken));
        }
Ejemplo n.º 3
0
        public Task AddAttributeRequestAsync(byte[] pAttrName, BigInteger pMaxLen, BigInteger pMaxNumVal, byte[] pDefVal, bool pIsStr, bool pIsNum)
        {
            var addAttributeFunction = new AddAttributeFunction();

            addAttributeFunction.PAttrName  = pAttrName;
            addAttributeFunction.PMaxLen    = pMaxLen;
            addAttributeFunction.PMaxNumVal = pMaxNumVal;
            addAttributeFunction.PDefVal    = pDefVal;
            addAttributeFunction.PIsStr     = pIsStr;
            addAttributeFunction.PIsNum     = pIsNum;

            return(ContractHandler.SendRequestAsync(addAttributeFunction));
        }
        public async Task <BigInteger> Post(AddAttributeFunction att)
        {
            using (HttpClient client = new HttpClient())
            {
                BigInteger    ret      = 0;
                StringContent cont     = new StringContent(JsonConvert.SerializeObject(att));
                var           response = await client.PostAsync(uri + "/", cont);

                if (response.IsSuccessStatusCode)
                {
                    var t = await response.Content.ReadAsStringAsync();

                    ret = JsonConvert.DeserializeObject <BigInteger>(t);
                }
                return(ret);
            }
        }
Ejemplo n.º 5
0
 public Task <TransactionReceipt> AddAttributeRequestAndWaitForReceiptAsync(AddAttributeFunction addAttributeFunction, CancellationTokenSource cancellationToken = null)
 {
     return(ContractHandler.SendRequestAndWaitForReceiptAsync(addAttributeFunction, cancellationToken));
 }
Ejemplo n.º 6
0
 public Task <string> AddAttributeRequestAsync(AddAttributeFunction addAttributeFunction)
 {
     return(ContractHandler.SendRequestAsync(addAttributeFunction));
 }