Package io.goodforgod.api.etherscan
Class ProxyAPIProvider
java.lang.Object
io.goodforgod.api.etherscan.BasicProvider
io.goodforgod.api.etherscan.ProxyAPIProvider
- All Implemented Interfaces:
ProxyAPI
Proxy API Implementation
- Since:
- 28.10.2018
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProxyAPIProvider(RequestQueueManager queue, String baseUrl, EthHttpClient executor, Converter converter, int retryCount) -
Method Summary
Modifier and TypeMethodDescription@NotNull Optional<BlockProxy>block(long blockNo) Returns information about a block by block number eth_getBlockByNumberlongReturns the number of most recent block eth_blockNumber@NotNull Optional<BlockProxy>blockUncle(long blockNo, long index) Returns information about a uncle by block number eth_getUncleByBlockNumberAndIndexExecutes a new message call immediately without creating a transaction on the block chain eth_callReturns code at a given address eth_getCode@NotNull Wei@NotNull WeigasEstimated(@NotNull String hexData) 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 WeigasPrice()Returns the current price per gas in wei eth_gasPrice(**experimental) Returns the value from a storage position at a given address eth_getStorageAttx(long blockNo, long index) Returns information about a transaction by block number and transaction index position eth_getTransactionByBlockNumberAndIndexReturns the information about a transaction requested by transaction hash eth_getTransactionByHashinttxCount(long blockNo) Returns the number of transactions in a block from a block matching the given block number eth_getBlockTransactionCountByNumber@NotNull Optional<ReceiptProxy>Returns the receipt of a transaction by transaction hash eth_getTransactionReceiptinttxSendCount(@NotNull String address) Returns the number of transactions sent from an address eth_getTransactionCountCreates new message call transaction or a contract creation for signed transactions eth_sendRawTransactionMethods inherited from class io.goodforgod.api.etherscan.BasicProvider
convert, getMaximumOffset, getRequestUsingOffset, getResponse, getResponse, getResponse, postRequest, postRequest, postRequest
-
Constructor Details
-
ProxyAPIProvider
public ProxyAPIProvider(RequestQueueManager queue, String baseUrl, EthHttpClient executor, Converter converter, int retryCount)
-
-
Method Details
-
blockNoLast
Description copied from interface:ProxyAPIReturns the number of most recent block eth_blockNumber- Specified by:
blockNoLastin interfaceProxyAPI- Returns:
- last block number
- Throws:
EtherScanException- parent exception class
-
block
Description copied from interface:ProxyAPIReturns information about a block by block number eth_getBlockByNumber- Specified by:
blockin interfaceProxyAPI- 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:ProxyAPIReturns information about a uncle by block number eth_getUncleByBlockNumberAndIndex- Specified by:
blockUnclein interfaceProxyAPI- Parameters:
blockNo- block number from 0 to lastindex- 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:ProxyAPIReturns the information about a transaction requested by transaction hash eth_getTransactionByHash- Specified by:
txin interfaceProxyAPI- Parameters:
txhash- transaction hash- Returns:
- optional tx result
- Throws:
EtherScanException- parent exception class
-
tx
Description copied from interface:ProxyAPIReturns information about a transaction by block number and transaction index position eth_getTransactionByBlockNumberAndIndex- Specified by:
txin interfaceProxyAPI- Parameters:
blockNo- block number from 0 to lastindex- tx index in block- Returns:
- optional tx result
- Throws:
EtherScanException- parent exception class
-
txCount
Description copied from interface:ProxyAPIReturns the number of transactions in a block from a block matching the given block number eth_getBlockTransactionCountByNumber- Specified by:
txCountin interfaceProxyAPI- Parameters:
blockNo- block number from 0 to last- Returns:
- transaction amount in block
- Throws:
EtherScanException- parent exception class
-
txSendCount
Description copied from interface:ProxyAPIReturns the number of transactions sent from an address eth_getTransactionCount- Specified by:
txSendCountin interfaceProxyAPI- 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:ProxyAPICreates new message call transaction or a contract creation for signed transactions eth_sendRawTransaction- Specified by:
txSendRawin interfaceProxyAPI- 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:ProxyAPIReturns the receipt of a transaction by transaction hash eth_getTransactionReceipt- Specified by:
txReceiptin interfaceProxyAPI- 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:ProxyAPIExecutes a new message call immediately without creating a transaction on the block chain eth_call- Specified by:
callin interfaceProxyAPI- Parameters:
address- to calldata- 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:ProxyAPIReturns code at a given address eth_getCode- Specified by:
codein interfaceProxyAPI- 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:
storageAtin interfaceProxyAPI- Parameters:
address- to get storageposition- storage position- Returns:
- optional the value at this storage position
- Throws:
EtherScanException- parent exception class
-
gasPrice
Description copied from interface:ProxyAPIReturns the current price per gas in wei eth_gasPrice- Specified by:
gasPricein interfaceProxyAPI- Returns:
- estimated gas price
- Throws:
EtherScanException- parent exception class
-
gasEstimated
- Specified by:
gasEstimatedin interfaceProxyAPI- Throws:
EtherScanException
-
gasEstimated
@NotNull public @NotNull Wei gasEstimated(@NotNull @NotNull String hexData) throws EtherScanException Description copied from interface:ProxyAPIMakes 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:
gasEstimatedin interfaceProxyAPI- Parameters:
hexData- data to calc gas usage for- Returns:
- estimated gas usage
- Throws:
EtherScanException- parent exception class
-