Example #1
0
        /// <summary>
        /// Creates the instanse of TezosRpc
        /// </summary>
        /// <param name="uri">Base URI of the node</param>
        /// <param name="timeout">Timeout in seconds for the requests</param>
        /// <param name="chain">Chain to work with</param>
        public TezosRpc(string uri, int timeout, Chain chain = Rpc.Chain.Main)
        {
            Client = new RpcClient(uri, timeout);
            Chain  = chain.ToString().ToLower();

            Blocks = new BlocksQuery(Client, $"chains/{Chain}/blocks/");
            Inject = new InjectionQuery(Client, $"injection/");
        }
Example #2
0
        /// <summary>
        /// Creates the instanse of TezosRpc
        /// </summary>
        /// <param name="client">HttpClient instanse that will be used for sending RPC requests.</param>
        /// <param name="chain">Chain to work with.
        /// Note: this is not a network (mainnet or testnet), but a chain of the network.
        /// In 99.99% cases you likely want to use Chain.Main, because Chain.Test is only relevant during the testing phase of the Tezos voting process.</param>
        public TezosRpc(HttpClient client, Chain chain = Rpc.Chain.Main)
        {
            Client = new RpcClient(client);
            Chain  = chain.ToString().ToLower();

            Blocks = new BlocksQuery(Client, $"chains/{Chain}/blocks/");
            Inject = new InjectionQuery(Client, $"injection/");
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="depth"></param>
        /// <returns></returns>
        public List <BlockInfoResponse> ShowBlocks(int depth)
        {
            var blocksQuery = new BlocksQuery
            {
                Depth = depth
            };
            var response = client.getBlocks(blocksQuery);
            var result   = HandleStream(response);

            return(result.ConvertAll(item => item as BlockInfoResponse));
        }