예제 #1
0
        public PeerResult GetPeers(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_peers";

            var peers = HttpRequestHelper.Request <JsonRpcResult <PeerResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/net", jsonRpcArg);

            return(peers.Result);
        }
예제 #2
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        public async Task <bool> IsForked(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "node_isforked";

            var state = await HttpRequestHelper.Request <JsonRpcResult <NodeStateResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(state.Result.IsForked);
        }
예제 #3
0
        public PoolStateResult GetPoolState(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_pool_state";

            var state = HttpRequestHelper.Request <JsonRpcResult <PoolStateResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/net", jsonRpcArg);

            return(state.Result);
        }
예제 #4
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        public async Task <bool> IsAlive(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "dpos_isalive";

            var state = await HttpRequestHelper.Request <JsonRpcResult <DposStateResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(state.Result.IsAlive);
        }
예제 #5
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        private async Task <ulong> GetCurrentChainHeight(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_block_height";

            var height = await HttpRequestHelper.Request <JsonRpcResult <ChainHeightResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(Convert.ToUInt64(height.Result.Result.ChainHeight));
        }
예제 #6
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        private async Task <int> GetRollBackTimes(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_rollback_times";

            var state = await HttpRequestHelper.Request <JsonRpcResult <RollBackResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(state.Result.RollBackTimes);
        }
예제 #7
0
        public ulong GetPoolSize(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_txpool_size";

            var state = HttpRequestHelper.Request <JsonRpcResult <TxPoolSizeResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(state.Result.CurrentTransactionPoolSize);
        }
예제 #8
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        private async Task <int> GetInvalidBlockCount(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "get_invalid_block";

            var state = await HttpRequestHelper.Request <JsonRpcResult <InvalidBlockResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(state.Result.InvalidBlockCount);
        }
예제 #9
0
        public async Task <List <ActorStateResult> > GetState(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "akkastate";

            var state = await HttpRequestHelper.Request <JsonRpcResult <List <ActorStateResult> > >(ServiceUrlHelper.GetMonitorRpcAddress(chainId), jsonRpcArg);

            return(state.Result);
        }
예제 #10
0
//        public async Task<PoolStateResult> GetPoolState(string chainId)
//        {
//            var jsonRpcArg = new JsonRpcArg();
//            jsonRpcArg.Method = "get_pool_state";
//
//            var state = await HttpRequestHelper.Request<JsonRpcResult<PoolStateResult>>(
//                _managementOptions.ServiceUrls[chainId].RpcAddress + "/net", jsonRpcArg);
//
//            return state.Result;
//        }

        public async Task <PeerResult> GetPeers(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "GetPeers";

            var peers = await HttpRequestHelper.Request <JsonRpcResult <PeerResult> >(
                _managementOptions.ServiceUrls[chainId].RpcAddress + "/net", jsonRpcArg);

            return(peers.Result);
        }
예제 #11
0
        public async Task <List <ActorStateResult> > GetState(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "AkkaState";

            var state = await HttpRequestHelper.Request <JsonRpcResult <List <ActorStateResult> > >(_managementOptions
                                                                                                    .ServiceUrls[chainId].MonitorRpcAddress, jsonRpcArg);

            return(state.Result);
        }
예제 #12
0
        public async Task <bool> IsForked(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "GetNodeStatus";

            var state = await HttpRequestHelper.Request <JsonRpcResult <NodeStateResult> >(
                _managementOptions.ServiceUrls[chainId].RpcAddress + "/chain", jsonRpcArg);

            return(state.Result.IsForked);
        }
예제 #13
0
        public async Task <int> GetPoolSize(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg {
                Method = "GetTransactionPoolStatus"
            };

            var state = await HttpRequestHelper.Request <JsonRpcResult <TxPoolSizeResult> >(
                _managementOptions.ServiceUrls[chainId].RpcAddress + "/chain", jsonRpcArg);

            return(state.Result.Queued);
        }
예제 #14
0
        private async Task <ChainStatusResult> GetCurrentChainStatus(string chainId)
        {
            var jsonRpcArg = new JsonRpcArg();

            jsonRpcArg.Method = "GetChainStatus";

            var height =
                await HttpRequestHelper.Request <JsonRpcResult <ChainStatusResult> >(
                    _managementOptions.ServiceUrls[chainId].RpcAddress + "/chain", jsonRpcArg);

            return(height.Result);
        }
예제 #15
0
파일: NodeService.cs 프로젝트: wyk125/AElf
        private async Task <BlockInfoResult> GetBlockInfo(string chainId, ulong height)
        {
            var jsonRpcArg = new JsonRpcArg <BlockInfoArg>();

            jsonRpcArg.Method = "get_block_info";
            jsonRpcArg.Params = new BlockInfoArg
            {
                BlockHeight = height,
                IncludeTxs  = false
            };

            var blockInfo = await HttpRequestHelper.Request <JsonRpcResult <BlockInfoResult> >(ServiceUrlHelper.GetRpcAddress(chainId) + "/chain", jsonRpcArg);

            return(blockInfo.Result);
        }
예제 #16
0
        private async Task <BlockInfoResult> GetBlockInfo(string chainId, long height)
        {
            var jsonRpcArg = new JsonRpcArg <BlockInfoArg>();

            jsonRpcArg.Method = "GetBlockInfo";
            jsonRpcArg.Params = new BlockInfoArg
            {
                BlockHeight = height,
                IncludeTxs  = false
            };

            var blockInfo =
                await HttpRequestHelper.Request <JsonRpcResult <BlockInfoResult> >(
                    _managementOptions.ServiceUrls[chainId].RpcAddress + "/chain", jsonRpcArg);

            return(blockInfo.Result);
        }