Exemplo n.º 1
0
        public void LatestIrreversibleBlock()
        {
            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            var         result = neb.API.LatestIrreversibleBlockAsync().Result;

            Assert.IsNotNull(result.Result.ChainId);
        }
Exemplo n.º 2
0
        public void NewAccountTest()
        {
            var    account = Account.NewAccount();
            string _host   = "https://testnet.nebulas.io";
            string from    = account.GetAddressString();


            ////string from, string to, string value, string nonce, int gasPrice, int gasLimit, string function,string args
            string to       = "n22TK8fuUGbMGFKZTWus7a2R3a24uhr1NaQ";
            string value    = "0";
            string nonce    = "0";
            int    gasPrice = 1000000;
            int    gasLimit = 2000000;
            string function = "getIntegralByPage";
            string args     = "[]";

            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            dynamic     result = neb.API.CallAsync(from, to, value, nonce, gasPrice, gasLimit, function, args).Result;

            Assert.IsNotNull(result.result.result.Value);

            Assert.IsNotNull(account.GetAddressString());
            Assert.IsNotNull(account.GetPrivateKey());
            Assert.IsNotNull(account.GetPrivateKeyString());
            Assert.IsNotNull(account.GetPublicKeyString());
        }
Exemplo n.º 3
0
        public void GetAccountState()
        {
            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            var         result = neb.API.GetAccountStateAsync(from).Result;

            Assert.IsNotNull(result.Result.Balance);
        }
Exemplo n.º 4
0
        public void GetNebState()
        {
            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            var         result = neb.API.GetNebStateAsync().Result;

            Assert.IsNotNull(result.Result.ChainId);
        }
Exemplo n.º 5
0
        public void GetTransactionReceiptAsync()
        {
            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            var         result = neb.API.GetTransactionReceiptAsync("ef2308cb962188481f879c159117fbd08bb7e3e1cf56f0163ab21c7ec31930cc").Result;

            Assert.IsNotNull(result.Result);
        }
Exemplo n.º 6
0
        public void TestGetEventsByHash()
        {
            Neb neb = new Neb();

            var result = neb.GetEventsByHash(TEST_TXHASH);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 7
0
        public void TestGetTransactionReceipt()
        {
            Neb neb = new Neb();

            var result = neb.GetTransactionReceipt(TEST_TXHASH);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 8
0
        public void TestGetBlockByHeight()
        {
            Neb neb = new Neb();

            var result = neb.GetBlockByHeight(415520, true);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 9
0
        public void TestGetBlockByHash()
        {
            Neb neb = new Neb();

            var result = neb.GetBlockByHash(TEST_HASH, true);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 10
0
        public void TestGetLatestIrreversibleBlock()
        {
            Neb neb = new Neb();

            var result = neb.LatestIrreversibleBlock();

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 11
0
        public void TestGetNebState()
        {
            Neb neb = new Neb();

            var result = neb.GetNebState();

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 12
0
        public void TestGetTransactionByContract()
        {
            Neb neb = new Neb();

            var result = neb.GetTransactionByContract(TEST_CONTRACT_ADDRESS);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 13
0
        public void TestEstimateGas()
        {
            Neb neb = new Neb(true);

            var result = neb.EstimateGas(TESTNET_ACCOUNT, TESTNET_ACCOUNT1, "10000000000000", 1000, "1000000", "2000000");

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 14
0
        public void TestGetAccountState()
        {
            Neb neb = new Neb();

            string strAddress = "n1Z6SbjLuAEXfhX1UJvXT6BB5osWYxVg3F3";
            var    result     = neb.GetAccountState(strAddress);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 15
0
        public void TestSimulateCall()
        {
            //http://inty.co#u2355c
            Neb neb = new Neb();

            ContractInfo contractInfo = new ContractInfo();

            contractInfo.function = "get";
            contractInfo.args     = "[\"u2355c\"]";
            var result = neb.SimulateCall(TEST_CONTRACT_ADDRESS, contractInfo);

            Assert.IsTrue(result.message == string.Empty);
        }
Exemplo n.º 16
0
        public void Subscribe()
        {
            Nebulas.Neb neb  = new Neb(new HttpRequest(_host));
            string      temp = "";

            neb.API.Subscribe(new string[] { "chain.linkBlock", "chain.pendingTransaction", "chain.transactionResult" }, (s) =>
            {
                temp = s;
            });
            while (string.IsNullOrEmpty(temp))
            {
                Thread.Sleep(100);
            }
        }
Exemplo n.º 17
0
        public void Call()
        {
            //string from, string to, string value, string nonce, int gasPrice, int gasLimit, string function,string args
            string to       = "n22TK8fuUGbMGFKZTWus7a2R3a24uhr1NaQ";
            string value    = "0";
            string nonce    = "0";
            int    gasPrice = 1000000;
            int    gasLimit = 2000000;
            string function = "getIntegralByPage";
            string args     = "[]";

            Nebulas.Neb neb    = new Neb(new HttpRequest(_host));
            dynamic     result = neb.API.CallAsync(from, to, value, nonce, gasPrice, gasLimit, function, args).Result;
        }
Exemplo n.º 18
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);
        }