Class BlockRPCClient

java.lang.Object
org.starcoin.api.BlockRPCClient

public class BlockRPCClient
extends Object
Starcoin Block相关json-rpc接口的封装。
Since:
1.1.6
Author:
fanngyuan
  • Constructor Details

    • BlockRPCClient

      public BlockRPCClient​(URL baseUrl)
  • Method Details

    • getChainHeader

      public BlockHeader getChainHeader() throws com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
      获取当前主链的block header
      Throws:
      com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
    • getBlockByHash

      public Block getBlockByHash​(String hash) throws com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
      通过block_hash 获取block详细数据
      Throws:
      com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
    • getBlockByHeight

      public Block getBlockByHeight​(long height) throws com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
      通过block 高度 获取block详细数据
      Throws:
      com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
    • getBlockListFromHeight

      public List<Block> getBlockListFromHeight​(long height, int count) throws com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException
      从某个高度开始获取之后的block,可以通过参数count指定获取多少个
      Throws:
      com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException