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 valueChainGetBlockResultgetBlock()Get the latest block infoChainGetBlockResultgetBlock(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 dataGetRewardResultgetReward(EraIdentifier eraIdentifier, PublicKey validator, PublicKey delegator)Obtains validator or delegator rewards.AccountDatagetStateAccountInfo(java.lang.String accountIdentifier, BlockIdentifier blockIdentifier)Deprecated.AuctionDatagetStateAuctionInfo(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.StateEntityResultgetStateEntity(EntityIdentifier entityIdentifier, BlockIdentifier blockIdentifier)Returns an AddressableEntity from the networkStoredValueDatagetStateItem(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 nodeGetTransactionResultgetTransaction(TransactionHash transactionHash)Returns a Transaction from the networkValidatorChangeDatagetValidatorsChanges()Returns the Validator Changes in between two erasDeployResultputDeploy(Deploy deploy)Deprecated.useputTransaction(Transaction)insteadPutTransactionResultputTransaction(Transaction transaction)Sends a transaction to be received by the networkQueryBalanceDataqueryBalance(GlobalStateIdentifier stateIdentifier, PurseIdentifier purseIdentifier)Fetches balance valueQueryBalanceDetailsResultqueryBalanceDetails(PurseIdentifier purseIdentifier, GlobalStateIdentifier stateIdentifier)Query for full balance information using a purse identifier and a state identifier.GlobalStateDataqueryGlobalState(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 pairstatic CasperServiceusingPeer(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)Builds a CasperService for the node url.
-
-
-
Method Detail
-
usingPeer
static CasperService usingPeer(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> additionalHeaders) throws java.net.MalformedURLException
Builds a CasperService for the node url.- Parameters:
url- the peer url to connect toadditionalHeaders- additional headers to be added to the request- Returns:
- A Dynamic Proxy to CasperService
- Throws:
java.net.MalformedURLException- is thrown if ip/port are not compliant
-
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
ChainGetBlockResult getBlock()
Get the latest block info- Returns:
- Object holding the api version and block
-
getBlock
ChainGetBlockResult 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
-
getTransaction
GetTransactionResult getTransaction(TransactionHash transactionHash)
Returns a Transaction from the network- Parameters:
transactionHash- the hash of the transaction to obtain- Returns:
- Object holding the api version, the transaction and execution info
-
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- GlobalStateIdentifier: 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
-
queryBalanceDetails
QueryBalanceDetailsResult queryBalanceDetails(PurseIdentifier purseIdentifier, GlobalStateIdentifier stateIdentifier)
Query for full balance information using a purse identifier and a state identifier.- Parameters:
purseIdentifier- The identifier to obtain the purse corresponding to balance querystateIdentifier- The identifier for the state used for the query, if none is passed, the latest block will be used.- Returns:
- the result for "query_balance_details" RPC response.
-
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 api version, minimal block information, build version and other properties
-
getStateEntity
StateEntityResult getStateEntity(EntityIdentifier entityIdentifier, BlockIdentifier blockIdentifier)
Returns an AddressableEntity from the network- Parameters:
entityIdentifier- the entity identifierblockIdentifier- the optional block identifier, if provided will obtain the entity from a specific block if omitted will provide the entity from the latest block.- Returns:
- object holding the AddressableEntity or LegacyAccount
-
getReward
GetRewardResult getReward(EraIdentifier eraIdentifier, PublicKey validator, PublicKey delegator)
Obtains validator or delegator rewards.- Parameters:
eraIdentifier- the optional era identifier. If omitted, the last finalized era is used.validator- the required public keydelegator- the optional delegator public key. If provided, the rewards for the delegator are returned. If omitted, the rewards for the validator are returned.- Returns:
- the result for "info_get_reward" RPC request
-
putTransaction
PutTransactionResult putTransaction(Transaction transaction)
Sends a transaction to be received by the network- Parameters:
transaction- 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- GlobalStateIdentifier: 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
-
putDeploy
@Deprecated DeployResult putDeploy(Deploy deploy)
Deprecated.useputTransaction(Transaction)insteadSends 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
-
getStateAccountInfo
@Deprecated AccountData getStateAccountInfo(java.lang.String accountIdentifier, BlockIdentifier blockIdentifier)
Deprecated.Returns an Account from the network- Parameters:
accountIdentifier- the account's public key or account hashblockIdentifier- BlockIdentifier data- Returns:
- Object holding the api version, the account data and the merkle proof
-
-