Package org.starcoin.api
Class StateRPCClient
- java.lang.Object
-
- org.starcoin.api.StateRPCClient
-
public class StateRPCClient extends Object
Starcoin State 相关json-rpc接口的封装。- Since:
- 1.1.6
- Author:
- fanngyuan
-
-
Constructor Summary
Constructors Constructor Description StateRPCClient(URL baseUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description longgetAddressAmount(String address, String token)Deprecated.BigIntegergetAddressAmountValue(String address, String token)用于获取某个地址下的token 数量ListResourcegetAllResourcesByAddress(String address)通过 address 查询当前账户下的所有资源集合ListResourcegetAllResourcesByResourceTypes(String address, List<String> resourceTypes)通过 address 和 resourceTypes 查询当前账户下的所有资源集合ListResourcegetAllResourcesByTypeTags(String address, List<String> typeTags)通过 address 和 TypeTags 查询当前账户下的所有资源集合ListResourcegetResourceListByPage(String address, int startIndex, int maxSize)通过 address 分页查询当前账户下的所有资源集合ListResourcegetState(String address)用于某个地址的状态ListResourcegetState(String address, boolean isDecode, String state_root)用于某个地址的状态TokenInfogetTokenInfo(String address, String tokenCode)
-
-
-
Constructor Detail
-
StateRPCClient
public StateRPCClient(URL baseUrl)
-
-
Method Detail
-
getState
public ListResource getState(String address) throws JSONRPC2SessionException
用于某个地址的状态- Throws:
JSONRPC2SessionException
-
getState
public ListResource getState(String address, boolean isDecode, String state_root) throws JSONRPC2SessionException
用于某个地址的状态- Throws:
JSONRPC2SessionException
-
getTokenInfo
public TokenInfo getTokenInfo(String address, String tokenCode) throws JSONRPC2SessionException, com.fasterxml.jackson.core.JsonProcessingException
- Throws:
JSONRPC2SessionExceptioncom.fasterxml.jackson.core.JsonProcessingException
-
getAddressAmount
@Deprecated public long getAddressAmount(String address, String token)
Deprecated.用于获取某个地址下的token 数量 由于amount的数量可能超过long的最大值,所以这个方法已经在某些token下会溢出,建议使用getAddressAmountValue方法
-
getAddressAmountValue
public BigInteger getAddressAmountValue(String address, String token)
用于获取某个地址下的token 数量
-
getAllResourcesByAddress
public ListResource getAllResourcesByAddress(String address) throws JSONRPC2SessionException
通过 address 查询当前账户下的所有资源集合- Parameters:
address- 地址- Returns:
- Throws:
JSONRPC2SessionException
-
getAllResourcesByResourceTypes
public ListResource getAllResourcesByResourceTypes(String address, List<String> resourceTypes) throws JSONRPC2SessionException
通过 address 和 resourceTypes 查询当前账户下的所有资源集合- Parameters:
address- 地址resourceTypes- 资源类型集合- Returns:
- Throws:
JSONRPC2SessionException
-
getAllResourcesByTypeTags
public ListResource getAllResourcesByTypeTags(String address, List<String> typeTags) throws JSONRPC2SessionException
通过 address 和 TypeTags 查询当前账户下的所有资源集合- Parameters:
address-typeTags-- Returns:
- Throws:
JSONRPC2SessionException
-
getResourceListByPage
public ListResource getResourceListByPage(String address, int startIndex, int maxSize) throws JSONRPC2SessionException
通过 address 分页查询当前账户下的所有资源集合- Parameters:
address-startIndex-maxSize-- Returns:
- Throws:
JSONRPC2SessionException
-
-