Package com.casper.sdk.service
Interface CasperService
-
public interface CasperServiceInterface to be used as Dynamic Proxy for RPC method operation- Since:
- 0.0.1
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description GetBalanceDatagetBalance(java.lang.String stateRootHash, URef purseUref)Fetches balance valueJsonBlockDatagetBlock()Get the latest block infoJsonBlockDatagetBlock(BlockIdentifier blockIdentifier)Retrieve block info by itsBlockIdentifierTransferDatagetBlockTransfers()Retrieve last block's transfersTransferDatagetBlockTransfers(BlockIdentifier blockIdentifier)Retrieve block transfers by itsBlockIdentifierChainspecDatagetChainspec()Fetches chainspec file as bytesDeployDatagetDeploy(java.lang.String deployHash)Returns a Deploy from the networkEraInfoDatagetEraInfoBySwitchBlock(BlockIdentifier blockIdentifier)Returns an EraInfo from the networkEraInfoDatagetEraSummary(BlockIdentifier blockIdentifier)Returns an EraInfo for a given blockPeerDatagetPeerData()Get network peers dataAccountDatagetStateAccountInfo(java.lang.String publicKey, BlockIdentifier blockIdentifier)Returns an Account from the networkAuctionDatagetStateAuctionInfo(BlockIdentifier blockIdentifier)Returns the Auction info for a given blockDictionaryDatagetStateDictionaryItem(java.lang.String stateRootHash, DictionaryIdentifier dictionaryIdentifier)Lookup a dictionary item via a Contract's named keys.StoredValueDatagetStateItem(java.lang.String stateRootHash, java.lang.String key, java.util.List<java.lang.String> path)Deprecated.StateRootHashDatagetStateRootHash()Returns a state root hash at the last BlockStateRootHashDatagetStateRootHash(BlockIdentifier blockIdentifier)Returns a state root hash at a given aBlockIdentifierStatusDatagetStatus()Returns the current status of the nodeValidatorChangeDatagetValidatorsChanges()Returns the Validator Changes in between two erasDeployResultputDeploy(Deploy deploy)Sends a deploy to be received by the networkQueryBalanceDataqueryBalance(GlobalStateIdentifier stateIdentifier, PurseIdentifier purseIdentifier)Fetches balance valueGlobalStateDataqueryGlobalState(GlobalStateIdentifier stateIdentifier, java.lang.String key, java.lang.String[] path)Returns the global state data given aGlobalStateIdentifier, key and pathsSpeculativeDeployDataspeculativeExec(BlockIdentifier blockIdentifier, Deploy deploy)The speculative_exec endpoint provides a method to execute a Deploy without committing it to global stateSpeculativeDeployDataspeculativeExec(Deploy deploy)The speculative_exec endpoint provides a method to execute a Deploy without committing it to global statestatic CasperServiceusingPeer(java.lang.String ip, int port)Builds a CasperService for the node ip/port pair
-
-
-
Method Detail
-
usingPeer
static CasperService usingPeer(java.lang.String ip, int port) throws java.net.MalformedURLException
Builds a CasperService for the node ip/port pair- Parameters:
ip- the peer ip to connect toport- the service port of the peer- Returns:
- A Dynamic Proxy to CasperService
- Throws:
java.net.MalformedURLException- is thrown if ip/port are not compliant
-
getBlock
JsonBlockData getBlock()
Get the latest block info- Returns:
- Object holding the api version and block
-
getBlock
JsonBlockData getBlock(BlockIdentifier blockIdentifier)
Retrieve block info by itsBlockIdentifier- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version and block
-
getBlockTransfers
TransferData getBlockTransfers()
Retrieve last block's transfers- Returns:
- Object holding the api version and transfer data
-
getBlockTransfers
TransferData getBlockTransfers(BlockIdentifier blockIdentifier)
Retrieve block transfers by itsBlockIdentifier- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version and transfer data
-
getStateRootHash
StateRootHashData getStateRootHash()
Returns a state root hash at the last Block- Returns:
- Object holding the api version and state root hash data
-
getStateRootHash
StateRootHashData getStateRootHash(BlockIdentifier blockIdentifier)
Returns a state root hash at a given aBlockIdentifier- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version and state root hash data
-
getDeploy
DeployData getDeploy(java.lang.String deployHash)
Returns a Deploy from the network- Parameters:
deployHash- The deploy hash- Returns:
- Object holding the api version, the deploy and the map of block hash to execution result
-
queryGlobalState
GlobalStateData queryGlobalState(GlobalStateIdentifier stateIdentifier, java.lang.String key, java.lang.String[] path)
Returns the global state data given aGlobalStateIdentifier, key and paths- Parameters:
stateIdentifier- GlobalStateIndentifier: block hash or state root hashkey- casper_types::Key as a formatted string.path- The path components starting from the key as base.- Returns:
- Object holding the api version, block header, merkle proof and stored values
-
getStateAccountInfo
AccountData getStateAccountInfo(java.lang.String publicKey, BlockIdentifier blockIdentifier)
Returns an Account from the network- Parameters:
publicKey- the account's public keyblockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version, the account data and the merkle proof
-
getBalance
GetBalanceData getBalance(java.lang.String stateRootHash, URef purseUref)
Fetches balance value- Parameters:
stateRootHash- the hash of state rootpurseUref- formatted URef- Returns:
- Result for "state_get_balance" RPC response
-
getStateDictionaryItem
DictionaryData getStateDictionaryItem(java.lang.String stateRootHash, DictionaryIdentifier dictionaryIdentifier)
Lookup a dictionary item via a Contract's named keys. Returns an item from a Dictionary given the AccountNamedKey/ContractNamedKey/Dictionary/Uref- Parameters:
stateRootHash- the hash of state rootdictionaryIdentifier- any concrete DictionaryIdentifier- Returns:
- Object holding the api version, the dictionary key, the merkle proof and the stored value
-
getPeerData
PeerData getPeerData()
Get network peers data- Returns:
- Object holding the api version and peer list
-
getStatus
StatusData getStatus()
Returns the current status of the node- Returns:
- Object holding the apiversion, minimal block information, build version and other properties
-
putDeploy
DeployResult putDeploy(Deploy deploy)
Sends a deploy to be received by the network- Parameters:
deploy- the deploy object to send to the network- Returns:
- Object holding the api version and the deploy hash
-
speculativeExec
SpeculativeDeployData speculativeExec(BlockIdentifier blockIdentifier, Deploy deploy)
The speculative_exec endpoint provides a method to execute a Deploy without committing it to global state- Parameters:
blockIdentifier- BlockIdentifier datadeploy- the deploy object to send to the network- Returns:
- Object holding the api version and the deploy hash
-
speculativeExec
SpeculativeDeployData speculativeExec(Deploy deploy)
The speculative_exec endpoint provides a method to execute a Deploy without committing it to global state- Parameters:
deploy- the deploy object to send to the network- Returns:
- Object holding the api version and the deploy hash
-
getStateAuctionInfo
AuctionData getStateAuctionInfo(BlockIdentifier blockIdentifier)
Returns the Auction info for a given block- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version and auction state data
-
getValidatorsChanges
ValidatorChangeData getValidatorsChanges()
Returns the Validator Changes in between two eras- Returns:
- Object holding the api version and the validator change data
-
getEraInfoBySwitchBlock
EraInfoData getEraInfoBySwitchBlock(BlockIdentifier blockIdentifier)
Returns an EraInfo from the network- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding api version and EraInfo
-
getEraSummary
EraInfoData getEraSummary(BlockIdentifier blockIdentifier)
Returns an EraInfo for a given block- Parameters:
blockIdentifier- BlockIdentifier data- Returns:
- Object holding api version and EraInfo
-
queryBalance
QueryBalanceData queryBalance(GlobalStateIdentifier stateIdentifier, PurseIdentifier purseIdentifier)
Fetches balance value- Parameters:
stateIdentifier- GlobalStateIndentifier: block hash or state root hashpurseIdentifier- The identifier to obtain the purse corresponding to balance query.- Returns:
- Result for "query_balance" RPC response
-
getChainspec
ChainspecData getChainspec()
Fetches chainspec file as bytes- Returns:
- the ChainspecData holder object
-
getStateItem
@Deprecated StoredValueData getStateItem(java.lang.String stateRootHash, java.lang.String key, java.util.List<java.lang.String> path)
Deprecated.Returns a stored value from the network. This RPC is deprecated, use `query_global_state` instead"- Parameters:
stateRootHash- Hash of the state rootkey- `casper_types::Key` as formatted stringpath- The path components starting from the key as base- Returns:
- Object holding the api version, the merkle proof and the stored value data
-
-