Example #1
0
        public void FromJson(string jsonValue)
        {
            var jsonObj     = new { from = string.Empty, to = string.Empty, gas = string.Empty, gasPrice = string.Empty, value = string.Empty, data = string.Empty, nonce = string.Empty };
            var transaction = _jsonSerializer.DeserializeAnonymousType(jsonValue, jsonObj);

            From     = !string.IsNullOrEmpty(transaction.from) ? new Data(transaction.from) : null;
            To       = !string.IsNullOrEmpty(transaction.to) ? new Data(transaction.to) : null;
            Gas      = !string.IsNullOrEmpty(transaction.gas) ? new Quantity(transaction.gas) : null;
            GasPrice = !string.IsNullOrEmpty(transaction.gasPrice) ? new Quantity(transaction.gasPrice) : null;
            Value    = !string.IsNullOrEmpty(transaction.value) ? new Quantity(transaction.value) : null;
            Data     = !string.IsNullOrEmpty(transaction.data) ? new Data(transaction.data) : null;
            Nonce    = !string.IsNullOrEmpty(transaction.nonce) ? new Quantity(transaction.nonce) : null;
        }
Example #2
0
        public void FromJson(string jsonValue)
        {
            var jsonObj = new
            {
                contract   = string.Empty,
                evmversion = string.Empty,
                optimize   = new bool(),
                runs       = new uint()
            };

            var compileParameters = _jsonSerializer.DeserializeAnonymousType(jsonValue, jsonObj);

            Contract   = compileParameters.contract;
            EvmVersion = compileParameters.evmversion ?? "byzantium";
            Optimize   = compileParameters.optimize;
            Runs       = compileParameters.runs;
        }