Interface CasperService


  • public interface CasperService
    Interface to be used as Dynamic Proxy for RPC method operation
    Since:
    0.0.1
    • 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 to
        additionalHeaders - 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 to
        port - 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 its BlockIdentifier
        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 its BlockIdentifier
        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 a BlockIdentifier
        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 a GlobalStateIdentifier, key and paths
        Parameters:
        stateIdentifier - GlobalStateIndentifier: block hash or state root hash
        key - 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 key
        blockIdentifier - 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 root
        purseUref - 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 root
        dictionaryIdentifier - 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 data
        deploy - 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 hash
        purseIdentifier - 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 root
        key - `casper_types::Key` as formatted string
        path - The path components starting from the key as base
        Returns:
        Object holding the api version, the merkle proof and the stored value data