Interface CasperService


  • public interface CasperService
    Interface to be used as Dynamic Proxy for RPC method operation
    Since:
    0.0.1
    • Method Detail

      • getPeerData

        PeerData getPeerData()
        Get network peers data
        Returns:
        Object holding the api version and peer list
      • getBlock

        JsonBlockData getBlock()
        Get 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
      • getStateItem

        StoredValueData getStateItem​(java.lang.String stateRootHash,
                                     java.lang.String key,
                                     java.util.List<java.lang.String> path)
        Returns a stored value from the network
        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
      • getEraInfoBySwitchBlock

        EraInfoData getEraInfoBySwitchBlock​(BlockIdentifier blockIdentifier)
        Returns an EraInfo from the network
        Parameters:
        blockIdentifier - BlockIdentifier data
        Returns:
        Object holding api version and EraInfo
      • 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
      • getStatus

        StatusData getStatus()
        Returns the current status of the node
        Returns:
        Object holding the apiversion, minimal block information, build version and other properties
      • 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:
        Oject holding the api version, the account data and the merkle proof
      • 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
      • getStateDictionaryItem

        DictionaryData getStateDictionaryItem​(java.lang.String stateRootHash,
                                              DictionaryIdentifier dictionaryIdentifier)
        Lookup a dictionary item via an 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
      • getBalance

        BalanceData getBalance​(java.lang.String stateRootHash,
                               java.lang.String purseUref)
        Fetches balance value
        Parameters:
        stateRootHash - the hash of state root
        purseUref - formatted URef
        Returns:
        Result for "state_get_balance" RPC response
      • 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
      • 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