Package org.starcoin.api
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 Summary
Constructors Constructor Description BlockRPCClient(URL baseUrl) -
Method Summary
Modifier and Type Method Description BlockgetBlockByHash(String hash)通过block_hash 获取block详细数据BlockgetBlockByHeight(long height)通过block 高度 获取block详细数据List<Block>getBlockListFromHeight(long height, int count)从某个高度开始获取之后的block,可以通过参数count指定获取多少个BlockHeadergetChainHeader()获取当前主链的block header
-
Constructor Details
-
BlockRPCClient
-
-
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
-