Class ProxyApiProvider

java.lang.Object
io.api.etherscan.core.impl.ProxyApiProvider
All Implemented Interfaces:
IProxyApi

public class ProxyApiProvider extends Object implements IProxyApi
Proxy API Implementation
Since:
28.10.2018
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    block(long blockNo)
    Returns information about a block by block number eth_getBlockByNumber
    long
    Returns the number of most recent block eth_blockNumber
    blockUncle(long blockNo, long index)
    Returns information about a uncle by block number eth_getUncleByBlockNumberAndIndex
    @NotNull Optional<String>
    call(String address, String data)
    Executes a new message call immediately without creating a transaction on the block chain eth_call
    @NotNull Optional<String>
    code(String address)
    Returns code at a given address eth_getCode
    @NotNull BigInteger
     
    @NotNull BigInteger
    Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas eth_estimateGas
    @NotNull BigInteger
    Returns the current price per gas in wei eth_gasPrice
    @NotNull Optional<String>
    storageAt(String address, long position)
    (**experimental) Returns the value from a storage position at a given address eth_getStorageAt
    @NotNull Optional<TxProxy>
    tx(long blockNo, long index)
    Returns information about a transaction by block number and transaction index position eth_getTransactionByBlockNumberAndIndex
    @NotNull Optional<TxProxy>
    tx(String txhash)
    Returns the information about a transaction requested by transaction hash eth_getTransactionByHash
    int
    txCount(long blockNo)
    Returns the number of transactions in a block from a block matching the given block number eth_getBlockTransactionCountByNumber
    txReceipt(String txhash)
    Returns the receipt of a transaction by transaction hash eth_getTransactionReceipt
    int
    Returns the number of transactions sent from an address eth_getTransactionCount
    @NotNull Optional<String>
    txSendRaw(String hexEncodedTx)
    Creates new message call transaction or a contract creation for signed transactions eth_sendRawTransaction

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • blockNoLast

      public long blockNoLast() throws ApiException
      Description copied from interface: IProxyApi
      Returns the number of most recent block eth_blockNumber
      Specified by:
      blockNoLast in interface IProxyApi
      Returns:
      last block number
      Throws:
      ApiException - parent exception class
    • block

      @NotNull public @NotNull Optional<BlockProxy> block(long blockNo) throws ApiException
      Description copied from interface: IProxyApi
      Returns information about a block by block number eth_getBlockByNumber
      Specified by:
      block in interface IProxyApi
      Parameters:
      blockNo - block number from 0 to last
      Returns:
      optional block result
      Throws:
      ApiException - parent exception class
    • blockUncle

      @NotNull public @NotNull Optional<BlockProxy> blockUncle(long blockNo, long index) throws ApiException
      Description copied from interface: IProxyApi
      Returns information about a uncle by block number eth_getUncleByBlockNumberAndIndex
      Specified by:
      blockUncle in interface IProxyApi
      Parameters:
      blockNo - block number from 0 to last
      index - uncle block index
      Returns:
      optional block result
      Throws:
      ApiException - parent exception class
    • tx

      @NotNull public @NotNull Optional<TxProxy> tx(String txhash) throws ApiException
      Description copied from interface: IProxyApi
      Returns the information about a transaction requested by transaction hash eth_getTransactionByHash
      Specified by:
      tx in interface IProxyApi
      Parameters:
      txhash - transaction hash
      Returns:
      optional tx result
      Throws:
      ApiException - parent exception class
    • tx

      @NotNull public @NotNull Optional<TxProxy> tx(long blockNo, long index) throws ApiException
      Description copied from interface: IProxyApi
      Returns information about a transaction by block number and transaction index position eth_getTransactionByBlockNumberAndIndex
      Specified by:
      tx in interface IProxyApi
      Parameters:
      blockNo - block number from 0 to last
      index - tx index in block
      Returns:
      optional tx result
      Throws:
      ApiException - parent exception class
    • txCount

      public int txCount(long blockNo) throws ApiException
      Description copied from interface: IProxyApi
      Returns the number of transactions in a block from a block matching the given block number eth_getBlockTransactionCountByNumber
      Specified by:
      txCount in interface IProxyApi
      Parameters:
      blockNo - block number from 0 to last
      Returns:
      transaction amount in block
      Throws:
      ApiException - parent exception class
    • txSendCount

      public int txSendCount(String address) throws ApiException
      Description copied from interface: IProxyApi
      Returns the number of transactions sent from an address eth_getTransactionCount
      Specified by:
      txSendCount in interface IProxyApi
      Parameters:
      address - eth address
      Returns:
      transactions send amount from address
      Throws:
      ApiException - parent exception class
    • txSendRaw

      @NotNull public @NotNull Optional<String> txSendRaw(String hexEncodedTx) throws ApiException
      Description copied from interface: IProxyApi
      Creates new message call transaction or a contract creation for signed transactions eth_sendRawTransaction
      Specified by:
      txSendRaw in interface IProxyApi
      Parameters:
      hexEncodedTx - encoded hex data to send
      Returns:
      optional string response
      Throws:
      ApiException - parent exception class
    • txReceipt

      @NotNull public @NotNull Optional<ReceiptProxy> txReceipt(String txhash) throws ApiException
      Description copied from interface: IProxyApi
      Returns the receipt of a transaction by transaction hash eth_getTransactionReceipt
      Specified by:
      txReceipt in interface IProxyApi
      Parameters:
      txhash - transaction hash
      Returns:
      optional tx receipt
      Throws:
      ApiException - parent exception class
    • call

      @NotNull public @NotNull Optional<String> call(String address, String data) throws ApiException
      Description copied from interface: IProxyApi
      Executes a new message call immediately without creating a transaction on the block chain eth_call
      Specified by:
      call in interface IProxyApi
      Parameters:
      address - to call
      data - data to call address
      Returns:
      optional the return value of executed contract.
      Throws:
      ApiException - parent exception class
    • code

      @NotNull public @NotNull Optional<String> code(String address) throws ApiException
      Description copied from interface: IProxyApi
      Returns code at a given address eth_getCode
      Specified by:
      code in interface IProxyApi
      Parameters:
      address - get code from
      Returns:
      optional the code from the given address
      Throws:
      ApiException - parent exception class
    • storageAt

      @NotNull public @NotNull Optional<String> storageAt(String address, long position) throws ApiException
      Description copied from interface: IProxyApi
      (**experimental) Returns the value from a storage position at a given address eth_getStorageAt
      Specified by:
      storageAt in interface IProxyApi
      Parameters:
      address - to get storage
      position - storage position
      Returns:
      optional the value at this storage position
      Throws:
      ApiException - parent exception class
    • gasPrice

      @NotNull public @NotNull BigInteger gasPrice() throws ApiException
      Description copied from interface: IProxyApi
      Returns the current price per gas in wei eth_gasPrice
      Specified by:
      gasPrice in interface IProxyApi
      Returns:
      estimated gas price
      Throws:
      ApiException - parent exception class
    • gasEstimated

      @NotNull public @NotNull BigInteger gasEstimated() throws ApiException
      Specified by:
      gasEstimated in interface IProxyApi
      Throws:
      ApiException
    • gasEstimated

      @NotNull public @NotNull BigInteger gasEstimated(String hexData) throws ApiException
      Description copied from interface: IProxyApi
      Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas eth_estimateGas
      Specified by:
      gasEstimated in interface IProxyApi
      Parameters:
      hexData - data to calc gas usage for
      Returns:
      estimated gas usage
      Throws:
      ApiException - parent exception class