Class ProxyAPIProvider

java.lang.Object
io.goodforgod.api.etherscan.BasicProvider
io.goodforgod.api.etherscan.ProxyAPIProvider
All Implemented Interfaces:
ProxyAPI

public class ProxyAPIProvider extends BasicProvider implements ProxyAPI
Proxy API Implementation
Since:
28.10.2018
See Also:
  • Constructor Details

  • Method Details

    • blockNoLast

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

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

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

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

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

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

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

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

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

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

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

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

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

      @NotNull public @NotNull Wei gasEstimated() throws EtherScanException
      Specified by:
      gasEstimated in interface ProxyAPI
      Throws:
      EtherScanException
    • gasEstimated

      @NotNull public @NotNull Wei gasEstimated(@NotNull @NotNull String hexData) throws EtherScanException
      Description copied from interface: ProxyAPI
      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 ProxyAPI
      Parameters:
      hexData - data to calc gas usage for
      Returns:
      estimated gas usage
      Throws:
      EtherScanException - parent exception class