コード例 #1
0
        public void EstimateGasAsync()
        {
            RequestEstimateGas request = new RequestEstimateGas()
            {
                From     = from,
                To       = "n1o5DKJefXgFNLhUTXRiJFFrTp2npgSuhvW",
                Value    = "0",
                Nonce    = "0",
                GasPrice = "1000000",
                GasLimit = "2000000"
            };

            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            var         result = neb.API.EstimateGasAsync(request).Result;

            Assert.IsNotNull(result.Result);
        }
コード例 #2
0
ファイル: API.cs プロジェクト: twistys01/nebulas-.NET-sdk
        /**
         * Return the estimate gas of transaction.
         * @see {@link https://github.com/nebulasio/wiki/blob/master/rpc.md#estimategas}
         *
         * @param {TransactionOptions} options
         *
         * @return [Gas]{@link https://github.com/nebulasio/wiki/blob/master/rpc.md#estimategas}
         *
         * @example
         * var api = new Neb().api;
         * api.estimateGas({
         *    chainID: 1,
         *    from: "n1QZMXSZtW7BUerroSms4axNfyBGyFGkrh5",
         *    to: "n1SAeQRVn33bamxN4ehWUT7JGdxipwn8b17",
         *    value: 10,
         *    nonce: 12,
         *    gasPrice: 1000000,
         *    gasLimit: 2000000
         * }).then(function(gas) {
         * //code
         * });
         */
        public async Task <dynamic> EstimateGasAsync(RequestEstimateGas request)
        {
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(request, Formatting.Indented, CamelCaseSetting);

            return(await sendRequestAsync <dynamic>("post", "/estimateGas", jsonString));
        }