Class AlgodClient


  • public class AlgodClient
    extends Client
    • Constructor Detail

      • AlgodClient

        public AlgodClient​(String host,
                           int port,
                           String token)
        Construct an AlgodClient for communicating with the REST API.
        Parameters:
        host - using a URI format. If the scheme is not supplied the client will use HTTP.
        port - REST server port.
        token - authentication token.
      • AlgodClient

        public AlgodClient​(String host,
                           int port,
                           String token,
                           String tokenKey)
        Construct an AlgodClient with custom token key for communicating with the REST API.
        Parameters:
        host - using a URI format. If the scheme is not supplied the client will use HTTP.
        port - REST server port.
        token - authentication token.
        tokenKey - authentication token key.
    • Method Detail

      • HealthCheck

        public HealthCheck HealthCheck()
        Returns OK if healthy. /health
      • GetReady

        public GetReady GetReady()
        Returns OK if healthy and fully caught up. /ready
      • Metrics

        public Metrics Metrics()
        Return metrics about algod functioning. /metrics
      • GetGenesis

        public GetGenesis GetGenesis()
        Returns the entire genesis file in json. /genesis
      • SwaggerJSON

        public SwaggerJSON SwaggerJSON()
        Returns the entire swagger spec in json. /swagger.json
      • GetVersion

        public GetVersion GetVersion()
        Retrieves the supported API versions, binary build versions, and genesis information. /versions
      • AccountInformation

        public AccountInformation AccountInformation​(Address address)
        Given a specific account public key, this call returns the accounts status, balance and spendable amounts /v2/accounts/{address}
      • AccountAssetInformation

        public AccountAssetInformation AccountAssetInformation​(Address address,
                                                               Long assetId)
        Given a specific account public key and asset ID, this call returns the account's asset holding and asset parameters (if either exist). Asset parameters will only be returned if the provided address is the asset's creator. /v2/accounts/{address}/assets/{asset-id}
      • AccountApplicationInformation

        public AccountApplicationInformation AccountApplicationInformation​(Address address,
                                                                           Long applicationId)
        Given a specific account public key and application ID, this call returns the account's application local state and global state (AppLocalState and AppParams, if either exists). Global state will only be returned if the provided address is the application's creator. /v2/accounts/{address}/applications/{application-id}
      • GetPendingTransactionsByAddress

        public GetPendingTransactionsByAddress GetPendingTransactionsByAddress​(Address address)
        Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. /v2/accounts/{address}/transactions/pending
      • GetBlock

        public GetBlock GetBlock​(Long round)
        Get the block for the given round. /v2/blocks/{round}
      • GetBlockTxids

        public GetBlockTxids GetBlockTxids​(Long round)
        Get the top level transaction IDs for the block on the given round. /v2/blocks/{round}/txids
      • GetBlockHash

        public GetBlockHash GetBlockHash​(Long round)
        Get the block hash for the block on the given round. /v2/blocks/{round}/hash
      • GetTransactionProof

        public GetTransactionProof GetTransactionProof​(Long round,
                                                       String txid)
        Get a proof for a transaction in a block. /v2/blocks/{round}/transactions/{txid}/proof
      • GetSupply

        public GetSupply GetSupply()
        Get the current supply reported by the ledger. /v2/ledger/supply
      • GetStatus

        public GetStatus GetStatus()
        Gets the current node status. /v2/status
      • WaitForBlock

        public WaitForBlock WaitForBlock​(Long round)
        Waits for a block to appear after round {round} and returns the node's status at the time. There is a 1 minute timeout, when reached the current status is returned regardless of whether or not it is the round after the given round. /v2/status/wait-for-block-after/{round}
      • RawTransaction

        public RawTransaction RawTransaction()
        Broadcasts a raw transaction or transaction group to the network. /v2/transactions
      • SimulateTransaction

        public SimulateTransaction SimulateTransaction()
        Simulates a raw transaction or transaction group as it would be evaluated on the network. The simulation will use blockchain state from the latest committed round. /v2/transactions/simulate
      • TransactionParams

        public TransactionParams TransactionParams()
        Get parameters for constructing a new transaction /v2/transactions/params
      • GetPendingTransactions

        public GetPendingTransactions GetPendingTransactions()
        Get the list of pending transactions, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions. /v2/transactions/pending
      • PendingTransactionInformation

        public PendingTransactionInformation PendingTransactionInformation​(String txid)
        Given a transaction ID of a recently submitted transaction, it returns information about it. There are several cases when this might succeed: - transaction committed (committed round > 0) - transaction still in the pool (committed round = 0, pool error = "") - transaction removed from pool due to error (committed round = 0, pool error != "") Or the transaction may have happened sufficiently long ago that the node no longer remembers it, and this will return an error. /v2/transactions/pending/{txid}
      • GetLedgerStateDelta

        public GetLedgerStateDelta GetLedgerStateDelta​(Long round)
        Get ledger deltas for a round. /v2/deltas/{round}
      • GetTransactionGroupLedgerStateDeltasForRound

        public GetTransactionGroupLedgerStateDeltasForRound GetTransactionGroupLedgerStateDeltasForRound​(Long round)
        Get ledger deltas for transaction groups in a given round. /v2/deltas/{round}/txn/group
      • GetStateProof

        public GetStateProof GetStateProof​(Long round)
        Get a state proof that covers a given round /v2/stateproofs/{round}
      • GetLightBlockHeaderProof

        public GetLightBlockHeaderProof GetLightBlockHeaderProof​(Long round)
        Gets a proof for a given light block header inside a state proof commitment /v2/blocks/{round}/lightheader/proof
      • GetApplicationByID

        public GetApplicationByID GetApplicationByID​(Long applicationId)
        Given a application ID, it returns application information including creator, approval and clear programs, global and local schemas, and global state. /v2/applications/{application-id}
      • GetApplicationBoxes

        public GetApplicationBoxes GetApplicationBoxes​(Long applicationId)
        Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names. /v2/applications/{application-id}/boxes
      • GetApplicationBoxByName

        public GetApplicationBoxByName GetApplicationBoxByName​(Long applicationId)
        Given an application ID and box name, it returns the round, box name, and value (each base64 encoded). Box names must be in the goal app call arg encoding form 'encoding:value'. For ints, use the form 'int:1234'. For raw bytes, use the form 'b64:A=='. For printable strings, use the form 'str:hello'. For addresses, use the form 'addr:XYZ...'. /v2/applications/{application-id}/box
      • GetAssetByID

        public GetAssetByID GetAssetByID​(Long assetId)
        Given a asset ID, it returns asset information including creator, name, total supply and special addresses. /v2/assets/{asset-id}
      • UnsetSyncRound

        public UnsetSyncRound UnsetSyncRound()
        Unset the ledger sync round. /v2/ledger/sync
      • GetSyncRound

        public GetSyncRound GetSyncRound()
        Gets the minimum sync round for the ledger. /v2/ledger/sync
      • SetSyncRound

        public SetSyncRound SetSyncRound​(Long round)
        Sets the minimum sync round on the ledger. /v2/ledger/sync/{round}
      • TealCompile

        public TealCompile TealCompile()
        Given TEAL source code in plain text, return base64 encoded program bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. /v2/teal/compile
      • TealDisassemble

        public TealDisassemble TealDisassemble()
        Given the program bytes, return the TEAL source code in plain text. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. /v2/teal/disassemble
      • TealDryrun

        public TealDryrun TealDryrun()
        Executes TEAL program(s) in context and returns debugging information about the execution. This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true. /v2/teal/dryrun
      • GetBlockTimeStampOffset

        public GetBlockTimeStampOffset GetBlockTimeStampOffset()
        Gets the current timestamp offset. /v2/devmode/blocks/offset
      • SetBlockTimeStampOffset

        public SetBlockTimeStampOffset SetBlockTimeStampOffset​(Long offset)
        Sets the timestamp offset (seconds) for blocks in dev mode. Providing an offset of 0 will unset this value and try to use the real clock for the timestamp. /v2/devmode/blocks/offset/{offset}