Class Klay
- java.lang.Object
-
- com.klaytn.caver.rpc.Klay
-
public class Klay extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.web3j.protocol.Web3jService
web3jService
JSON-RPC service instance.
-
Constructor Summary
Constructors Constructor Description Klay(org.web3j.protocol.Web3jService web3jService)
Creates a Klay instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.web3j.protocol.core.Request<?,Boolean>
accountCreated(java.lang.String address)
Returns true if the account associated with the address is created.org.web3j.protocol.core.Request<?,Boolean>
accountCreated(java.lang.String address, long blockNumber)
Returns true if the account associated with the address is created.org.web3j.protocol.core.Request<?,Boolean>
accountCreated(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns true if the account associated with the address is created.org.web3j.protocol.core.Request<?,Bytes>
call(CallObject callObject)
Executes a new message call immediately without creating a transaction on the block chain.org.web3j.protocol.core.Request<?,Bytes>
call(CallObject callObject, Quantity blockNumber)
Executes a new message call immediately without creating a transaction on the block chain.org.web3j.protocol.core.Request<?,Bytes>
call(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Executes a new message call immediately without creating a transaction on the block chain.org.web3j.protocol.core.Request<?,AccessListResult>
createAccessList(CallObject callObject, java.lang.String blockHash)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.org.web3j.protocol.core.Request<?,AccessListResult>
createAccessList(CallObject callObject, java.math.BigInteger blockNumber)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.org.web3j.protocol.core.Request<?,AccessListResult>
createAccessList(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.org.web3j.protocol.core.Request<?,AccessListResult>
createAccessList(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.org.web3j.protocol.core.Request<?,AccountKey>
decodeAccountKey(java.lang.String encodedAccountKey)
Decodes an RLP encoded account key.org.web3j.protocol.core.Request<?,Bytes>
encodeAccountKey(IAccountKey accountKey)
Encodes an account key using the RLP encoding scheme.org.web3j.protocol.core.Request<?,Quantity>
estimateComputationCost(CallObject callObject)
Generates and returns an estimate of how much computation cost spent to execute the transaction.org.web3j.protocol.core.Request<?,Quantity>
estimateComputationCost(CallObject callObject, long blockNumber)
Generates and returns an estimate of how much computation cost spent to execute the transaction.org.web3j.protocol.core.Request<?,Quantity>
estimateComputationCost(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Generates and returns an estimate of how much computation cost spent to execute the transaction.org.web3j.protocol.core.Request<?,Quantity>
estimateGas(CallObject callObject)
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.org.web3j.protocol.core.Request<?,Account>
getAccount(java.lang.String address)
Returns the account information of a given address.org.web3j.protocol.core.Request<?,Account>
getAccount(java.lang.String address, long blockNumber)
Returns the account information of a given address.org.web3j.protocol.core.Request<?,Account>
getAccount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the account information of a given address.org.web3j.protocol.core.Request<?,AccountKey>
getAccountKey(java.lang.String address)
Returns AccountKey of a given address.org.web3j.protocol.core.Request<?,AccountKey>
getAccountKey(java.lang.String address, long blockNumber)
Returns AccountKey of a given address.org.web3j.protocol.core.Request<?,AccountKey>
getAccountKey(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns AccountKey of a given address.org.web3j.protocol.core.Request<?,Addresses>
getAccounts()
Returns a list of addresses owned by client.org.web3j.protocol.core.Request<?,Quantity>
getBalance(java.lang.String address)
Returns the balance of the account of given address.org.web3j.protocol.core.Request<?,Quantity>
getBalance(java.lang.String address, long blockNumber)
Returns the balance of the account of given address.org.web3j.protocol.core.Request<?,Quantity>
getBalance(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the balance of the account of given address.org.web3j.protocol.core.Request<?,Block>
getBlockByHash(java.lang.String blockHash)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Block>
getBlockByHash(java.lang.String blockHash, boolean isFullTransaction)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Block>
getBlockByNumber(long blockNumber)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Block>
getBlockByNumber(long blockNumber, boolean isFullTransaction)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Block>
getBlockByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Block>
getBlockByNumber(org.web3j.protocol.core.DefaultBlockParameter defaultBlockParameter, boolean isFullTransaction)
Returns information about a block by block number.org.web3j.protocol.core.Request<?,Quantity>
getBlockNumber()
Returns the number of most recent block.org.web3j.protocol.core.Request<?,BlockTransactionReceipts>
getBlockReceipts(java.lang.String blockHash)
Returns receipts included in a block identified by block hash.org.web3j.protocol.core.Request<?,Quantity>
getBlockTransactionCountByHash(java.lang.String blockHash)
Returns the number of transactions in a block from a block matching the given block hash.org.web3j.protocol.core.Request<?,Quantity>
getBlockTransactionCountByNumber(long blockNumber)
Returns the number of transactions in a block matching the given block number.org.web3j.protocol.core.Request<?,Quantity>
getBlockTransactionCountByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transactions in a block matching the given block number.org.web3j.protocol.core.Request<?,BlockWithConsensusInfo>
getBlockWithConsensusInfoByHash(java.lang.String blockHash)
Returns a block with consensus information matched by the given hash.org.web3j.protocol.core.Request<?,BlockWithConsensusInfo>
getBlockWithConsensusInfoByNumber(long blockNumber)
Returns a block with consensus information matched by the given block number.org.web3j.protocol.core.Request<?,BlockWithConsensusInfo>
getBlockWithConsensusInfoByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a block with consensus information matched by the given block number.org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfig()
Provides the latest chain configurationorg.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfig(java.lang.String blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfig(java.math.BigInteger blockNumber)
Provides the chain configuration at the specified block numberorg.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfig(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfig(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfigAt(java.lang.String blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfigAt(java.math.BigInteger blockNumber)
Provides the chain configuration at the specified block numberorg.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfigAt(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
org.web3j.protocol.core.Request<?,GovernanceChainConfig>
getChainConfigAt(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)org.web3j.protocol.core.Request<?,Quantity>
getChainID()
Returns the chain ID of the chain.org.web3j.protocol.core.Request<?,Bytes>
getClientVersion()
Returns the current client version of a Klaytn node.org.web3j.protocol.core.Request<?,Bytes>
getCode(java.lang.String address)
Returns code at a given address.org.web3j.protocol.core.Request<?,Bytes>
getCode(java.lang.String address, long blockNumber)
Returns code at a given address.org.web3j.protocol.core.Request<?,Bytes>
getCode(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns code at a given address.org.web3j.protocol.core.Request<?,Addresses>
getCommittee()
Returns a list of all validators in the committee at the specified block.org.web3j.protocol.core.Request<?,Addresses>
getCommittee(long blockNumber)
Returns a list of all validators in the committee at the specified block.org.web3j.protocol.core.Request<?,Addresses>
getCommittee(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a list of all validators in the committee at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCommitteeSize()
Returns the size of the committee at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCommitteeSize(long blockNumber)
Returns the size of the committee at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCommitteeSize(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the size of the committee at the specified block.org.web3j.protocol.core.Request<?,Addresses>
getCouncil()
Returns a list of all validators of the council at the specified block.org.web3j.protocol.core.Request<?,Addresses>
getCouncil(long blockNumber)
Returns a list of all validators of the council at the specified block.org.web3j.protocol.core.Request<?,Addresses>
getCouncil(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a list of all validators of the council at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCouncilSize()
Returns the size of the council at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCouncilSize(long blockNumber)
Returns the size of the council at the specified block.org.web3j.protocol.core.Request<?,Quantity>
getCouncilSize(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the size of the council at the specified block.org.web3j.protocol.core.Request<?,DecodeAnchoringTransaction>
getDecodedAnchoringTransaction(java.lang.String hash)
Returns the decoded anchored data in the transaction for the given transaction hash.org.web3j.protocol.core.Request<?,FeeHistoryResult>
getFeeHistory(long blockCount, long lastBlock, java.util.List<java.lang.Float> rewardPercentiles)
Returns fee history for the returned block range.org.web3j.protocol.core.Request<?,FeeHistoryResult>
getFeeHistory(long blockCount, org.web3j.protocol.core.DefaultBlockParameter lastBlock, java.util.List<java.lang.Float> rewardPercentiles)
Returns fee history for the returned block range.org.web3j.protocol.core.Request<?,KlayLogs>
getFilterChanges(java.lang.String filterId)
Polling method for a filter, which returns an array of logs which occurred since last poll.org.web3j.protocol.core.Request<?,KlayLogs>
getFilterLogs(java.lang.String filterId)
Returns an array of all logs matching filter with given id, which has been obtained using klay_newFilter.org.web3j.protocol.core.Request<?,Quantity>
getGasPrice()
Returns the current price per gas in peb.org.web3j.protocol.core.Request<?,Quantity>
getGasPriceAt()
Returns the unit price of the given block in peb.org.web3j.protocol.core.Request<?,Quantity>
getGasPriceAt(long blockNumber)
Returns the unit price of the given block in peb.org.web3j.protocol.core.Request<?,Quantity>
getGasPriceAt(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the unit price of the given block in peb.org.web3j.protocol.core.Request<?,GovernanceItems>
getGovParams()
It pass the latest block tag as a parameter.org.web3j.protocol.core.Request<?,GovernanceItems>
getGovParamsAt(java.lang.String blockTag)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,GovernanceItems>
getGovParamsAt(java.math.BigInteger blockNumber)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,GovernanceItems>
getGovParamsAt(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,BlockHeader>
getHeader(java.lang.String blockHash)
Returns a block header by block hash.org.web3j.protocol.core.Request<?,BlockHeader>
getHeader(java.math.BigInteger blockNumber)
Returns a block header by block number.org.web3j.protocol.core.Request<?,BlockHeader>
getHeader(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a block header by block number or block tag.org.web3j.protocol.core.Request<?,BlockHeader>
getHeader(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a block header by block tag.org.web3j.protocol.core.Request<?,BlockHeader>
getHeaderByHash(java.lang.String blockHash)
Returns a block header by block hash.org.web3j.protocol.core.Request<?,BlockHeader>
getHeaderByNumber(java.math.BigInteger blockNumber)
Returns a block header by block number.org.web3j.protocol.core.Request<?,BlockHeader>
getHeaderByNumber(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a block header by block number or block tag.org.web3j.protocol.core.Request<?,BlockHeader>
getHeaderByNumber(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a block header by block tag.org.web3j.protocol.core.Request<?,KlayLogs>
getLogs(KlayLogFilter filterOption)
Returns an array of all logs matching a given filter object.org.web3j.protocol.core.Request<?,Quantity>
getLowerBoundGasPrice()
Returns the lower bound gas price in peb.org.web3j.protocol.core.Request<?,Quantity>
getMaxPriorityFeePerGas()
Returns a suggestion for a gas tip cap for dynamic fee transactions in peb.org.web3j.protocol.core.Request<?,Bytes20>
getNodeAddress()
Provides the address of the node that a user is using.org.web3j.protocol.core.Request<?,GovernanceItems>
getParams()
Returns governance items at specific block.org.web3j.protocol.core.Request<?,GovernanceItems>
getParams(java.lang.String blockTag)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,GovernanceItems>
getParams(java.math.BigInteger blockNumber)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,GovernanceItems>
getParams(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns governance items at specific block.org.web3j.protocol.core.Request<?,Bytes>
getProtocolVersion()
Returns the Klaytn protocol version of the node.org.web3j.protocol.core.Request<?,Bytes20>
getRewardbase()
Returns the reward base of the current node.org.web3j.protocol.core.Request<?,KlayRewards>
getRewards()
Returns distributed block rewards information at the latest block numberorg.web3j.protocol.core.Request<?,KlayRewards>
getRewards(java.math.BigInteger blockNumber)
Returns distributed block rewards infomation by block number.org.web3j.protocol.core.Request<?,KlayRewards>
getRewards(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns the current block rewardsorg.web3j.protocol.core.Request<?,KlayRewards>
getRewards(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns distributed block rewards infomation by block tag.org.web3j.protocol.core.Request<?,GovernanceStakingInfo>
getStakingInfo()
The getStakingInfo returns staking information at a specific block.org.web3j.protocol.core.Request<?,GovernanceStakingInfo>
getStakingInfo(java.lang.String blockTag)
Returns staking information at a specific block.org.web3j.protocol.core.Request<?,GovernanceStakingInfo>
getStakingInfo(java.math.BigInteger blockNumber)
Returns staking information at a specific block.org.web3j.protocol.core.Request<?,GovernanceStakingInfo>
getStakingInfo(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns staking information at a specific block.org.web3j.protocol.core.Request<?,Bytes>
getStorageAt(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameterNumber position, long blockNumber)
Returns the value from a storage position at a given address.org.web3j.protocol.core.Request<?,Bytes>
getStorageAt(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameterNumber position, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the value from a storage position at a given address.org.web3j.protocol.core.Request<?,Transaction>
getTransactionByBlockHashAndIndex(java.lang.String blockHash, long index)
Returns information about a transaction by block hash and transaction index position.org.web3j.protocol.core.Request<?,Transaction>
getTransactionByBlockNumberAndIndex(long blockNumber, long index)
Returns information about a transaction by block number and transaction index position.org.web3j.protocol.core.Request<?,Transaction>
getTransactionByBlockNumberAndIndex(org.web3j.protocol.core.DefaultBlockParameter blockTag, org.web3j.protocol.core.DefaultBlockParameterNumber index)
Returns information about a transaction by block number and transaction index position.org.web3j.protocol.core.Request<?,Transaction>
getTransactionByHash(java.lang.String txHash)
Returns the information about a transaction requested by transaction hash.org.web3j.protocol.core.Request<?,Transaction>
getTransactionBySenderTxHash(java.lang.String senderTxHash)
Returns the information about a transaction requested by sender transaction hash.org.web3j.protocol.core.Request<?,Quantity>
getTransactionCount(java.lang.String address)
Returns the number of transactions sent from an address.org.web3j.protocol.core.Request<?,Quantity>
getTransactionCount(java.lang.String address, long blockNumber)
Returns the number of transactions sent from an address.org.web3j.protocol.core.Request<?,Quantity>
getTransactionCount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transaction sent from an addressorg.web3j.protocol.core.Request<?,Quantity>
getTransactionCountByHash(java.lang.String blockHash)
Returns the number of transactions in a block from a block matching the given block hash.org.web3j.protocol.core.Request<?,Quantity>
getTransactionCountByNumber(long blockNumber)
Returns the number of transactions in a block matching the given block number.org.web3j.protocol.core.Request<?,Quantity>
getTransactionCountByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transactions in a block matching the given block number.org.web3j.protocol.core.Request<?,TransactionReceipt>
getTransactionReceipt(java.lang.String transactionHash)
Returns the receipt of a transaction by transaction hash.org.web3j.protocol.core.Request<?,TransactionReceipt>
getTransactionReceiptBySenderTxHash(java.lang.String transactionHash)
Returns the receipt of a transaction by sender transaction hash.org.web3j.protocol.core.Request<?,Quantity>
getUpperBoundGasPrice()
Returns the upper bound gas price in peb.org.web3j.protocol.core.Request<?,Boolean>
isContractAccount(java.lang.String address)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.org.web3j.protocol.core.Request<?,Boolean>
isContractAccount(java.lang.String address, long blockNumber)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.org.web3j.protocol.core.Request<?,Boolean>
isContractAccount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.org.web3j.protocol.core.Request<?,Boolean>
isParallelDBWrite()
Returns true if the node is writing blockchain data in parallel manner.org.web3j.protocol.core.Request<?,Boolean>
isSenderTxHashIndexingEnabled()
Returns true if the node is indexing sender transaction hash to transaction hash mapping information.org.web3j.protocol.core.Request<?,KlaySyncing>
isSyncing()
Returns an object with data about the sync status or false.org.web3j.protocol.core.Request<?,Quantity>
newBlockFilter()
Creates a filter in the node, to notify when a new block arrives.org.web3j.protocol.core.Request<?,Quantity>
newFilter(KlayFilter filterOption)
Creates a filter object, based on filter options, to notify when the state changes (logs).org.web3j.protocol.core.Request<?,Quantity>
newPendingTransactionFilter()
Creates a filter in the node, to notify when new pending transactions arrive.org.web3j.protocol.core.Request<?,Bytes32>
sendRawTransaction(AbstractTransaction transaction)
Creates a new message call transaction or a contract creation for signed transactions.org.web3j.protocol.core.Request<?,Bytes32>
sendRawTransaction(java.lang.String signedTransactionData)
Creates a new message call transaction or a contract creation for signed transactions.org.web3j.protocol.core.Request<?,Bytes32>
sendTransaction(AbstractTransaction transaction)
Constructs a transaction with given parameters, signs the transaction with a sender's private key and propagates the transaction to Klaytn network.org.web3j.protocol.core.Request<?,Bytes32>
sendTransactionAsFeePayer(AbstractFeeDelegatedTransaction transaction)
Constructs a transaction with given parameters, signs the transaction with a fee payer's private key and propagates the transaction to Klaytn network.org.web3j.protocol.core.Request<?,Bytes>
sha3(java.lang.String data)
Returns Keccak-256 (not the standardized SHA3-256) of the given data.org.web3j.protocol.core.Request<?,Bytes>
sign(java.lang.String address, java.lang.String message)
The sign method calculates a Klaytn-specific signature.org.web3j.protocol.core.Request<?,SignTransaction>
signTransaction(AbstractTransaction transaction)
Constructs a transaction with given parameters and signs the transaction with a sender's private key.org.web3j.protocol.core.Request<?,SignTransaction>
signTransactionAsFeePayer(AbstractFeeDelegatedTransaction transaction)
Constructs a transaction with given parameters and signs the transaction with a fee payer's private key.io.reactivex.disposables.Disposable
subscribe(java.lang.String type, KlayFilter options, io.reactivex.functions.Consumer<LogsNotification> callback)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.io.reactivex.disposables.Disposable
subscribe(java.lang.String type, io.reactivex.functions.Consumer<NewHeadsNotification> callback)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.io.reactivex.Flowable<NewHeadsNotification>
subscribeFlowable(java.lang.String type)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.io.reactivex.Flowable<LogsNotification>
subscribeFlowable(java.lang.String type, KlayFilter options)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.org.web3j.protocol.core.Request<?,Boolean>
uninstallFilter(java.lang.String filterId)
Uninstalls a filter with given id.org.web3j.protocol.core.Request<?,Boolean>
unsubscribe(java.lang.String subscriptionId)
Cancels the subscription with a specific subscription id.
-
-
-
Method Detail
-
accountCreated
public org.web3j.protocol.core.Request<?,Boolean> accountCreated(java.lang.String address)
Returns true if the account associated with the address is created. It returns false otherwise.It sets block tag to "LATEST"
- Parameters:
address
- The account address- Returns:
- Boolean - The existence of an input address
-
accountCreated
public org.web3j.protocol.core.Request<?,Boolean> accountCreated(java.lang.String address, long blockNumber)
Returns true if the account associated with the address is created. It returns false otherwise.- Parameters:
address
- The account addressblockNumber
- The block number.- Returns:
- Boolean - The existence of an input address
-
accountCreated
public org.web3j.protocol.core.Request<?,Boolean> accountCreated(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns true if the account associated with the address is created. It returns false otherwise.- Parameters:
address
- The account address.blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Boolean - The existence of an input address
-
getAccounts
public org.web3j.protocol.core.Request<?,Addresses> getAccounts()
Returns a list of addresses owned by client.- Returns:
- Addresses - Addresses owned by the client.
-
encodeAccountKey
public org.web3j.protocol.core.Request<?,Bytes> encodeAccountKey(IAccountKey accountKey)
Encodes an account key using the RLP encoding scheme.- Parameters:
accountKey
- Account Key Object- Returns:
- Bytes
-
decodeAccountKey
public org.web3j.protocol.core.Request<?,AccountKey> decodeAccountKey(java.lang.String encodedAccountKey)
Decodes an RLP encoded account key.- Parameters:
encodedAccountKey
- RLP encoded account key- Returns:
- AccountKeyResponse
-
getAccount
public org.web3j.protocol.core.Request<?,Account> getAccount(java.lang.String address)
Returns the account information of a given address.There are two different account types in Klaytn: Externally Owned Account (EOA) and Smart Contract Account.
It sets block tag to "LATEST"
- Parameters:
address
- The account address.- Returns:
- AccountResponse
-
getAccount
public org.web3j.protocol.core.Request<?,Account> getAccount(java.lang.String address, long blockNumber)
Returns the account information of a given address. There are two different account types in Klaytn: Externally Owned Account (EOA) and Smart Contract Account.- Parameters:
address
- The account address.blockNumber
- The block number..- Returns:
- AccountResponse
-
getAccount
public org.web3j.protocol.core.Request<?,Account> getAccount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the account information of a given address.There are two different account types in Klaytn: Externally Owned Account (EOA) and Smart Contract Account.
- Parameters:
address
- The account addressblockTag
- The string "latest", "earliest" or "pending"- Returns:
- AccountResponse
-
getAccountKey
public org.web3j.protocol.core.Request<?,AccountKey> getAccountKey(java.lang.String address)
Returns AccountKey of a given address.If the account has AccountKeyLegacy or the account of the given address is a Smart Contract Account, it will return an empty key value. It sets block tag to "LATEST".
- Parameters:
address
- The account address- Returns:
- AccountKeyResponse
-
getAccountKey
public org.web3j.protocol.core.Request<?,AccountKey> getAccountKey(java.lang.String address, long blockNumber)
Returns AccountKey of a given address.If the account has AccountKeyLegacy or the account of the given address is a Smart Contract Account, it will return an empty key value.
- Parameters:
address
- The account addressblockNumber
- The block number..- Returns:
- AccountKeyResponse
-
getAccountKey
public org.web3j.protocol.core.Request<?,AccountKey> getAccountKey(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns AccountKey of a given address.If the account has AccountKeyLegacy or the account of the given address is a Smart Contract Account, it will return an empty key value.
- Parameters:
address
- The account addressblockTag
- The string "latest", "earliest" or "pending"- Returns:
- AccountKeyResponse
-
getBalance
public org.web3j.protocol.core.Request<?,Quantity> getBalance(java.lang.String address)
Returns the balance of the account of given address.It sets block tag to "LATEST".
- Parameters:
address
- The account address to check for balance.- Returns:
- Quantity
-
getBalance
public org.web3j.protocol.core.Request<?,Quantity> getBalance(java.lang.String address, long blockNumber)
Returns the balance of the account of given address.- Parameters:
address
- The account address to check for balance.blockNumber
- The block number.- Returns:
- Quantity
-
getBalance
public org.web3j.protocol.core.Request<?,Quantity> getBalance(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the balance of the account of given address.- Parameters:
address
- The account address to check for balance.blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Quantity
-
getCode
public org.web3j.protocol.core.Request<?,Bytes> getCode(java.lang.String address)
Returns code at a given address.It sets block tag to "LATEST"
- Parameters:
address
- The account address- Returns:
- Bytes
-
getCode
public org.web3j.protocol.core.Request<?,Bytes> getCode(java.lang.String address, long blockNumber)
Returns code at a given address.- Parameters:
address
- The account addressblockNumber
- The block number.- Returns:
- Bytes
-
getCode
public org.web3j.protocol.core.Request<?,Bytes> getCode(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns code at a given address.- Parameters:
address
- The account addressblockTag
- The string "latest", "earliest" or "pending"- Returns:
- Bytes
-
getTransactionCount
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCount(java.lang.String address)
Returns the number of transactions sent from an address.It sets block tag to "LATEST".
- Parameters:
address
- The account address- Returns:
- Quantity
-
getTransactionCount
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCount(java.lang.String address, long blockNumber)
Returns the number of transactions sent from an address.- Parameters:
address
- The account addressblockNumber
- The block number.- Returns:
- Quantity
-
getTransactionCount
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transaction sent from an address- Parameters:
address
- The account addressblockTag
- The string "latest", "earliest" or "pending"- Returns:
- Quantity
-
isContractAccount
public org.web3j.protocol.core.Request<?,Boolean> isContractAccount(java.lang.String address)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.It returns false if the account is an EOA or a smart contract account which doesn't have codeHash.
It sets block tag to "LATEST".
- Parameters:
address
- The account address- Returns:
- Boolean
-
isContractAccount
public org.web3j.protocol.core.Request<?,Boolean> isContractAccount(java.lang.String address, long blockNumber)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.It returns false if the account is an EOA or a smart contract account which doesn't have codeHash.
- Parameters:
address
- The account addressblockNumber
- The block number..- Returns:
- Boolean
-
isContractAccount
public org.web3j.protocol.core.Request<?,Boolean> isContractAccount(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns true if an input account has a non-empty codeHash at the time of a specific block number.It returns false if the account is an EOA or a smart contract account which doesn't have codeHash.
- Parameters:
address
- The account addressblockTag
- The string "latest", "earliest" or "pending"- Returns:
- Boolean
-
sign
public org.web3j.protocol.core.Request<?,Bytes> sign(java.lang.String address, java.lang.String message)
The sign method calculates a Klaytn-specific signature.NOTE : The address to sign with must be unlocked.
- Parameters:
address
- The account addressmessage
- The message to sign.- Returns:
- Bytes
-
getBlockNumber
public org.web3j.protocol.core.Request<?,Quantity> getBlockNumber()
Returns the number of most recent block.- Returns:
- Quantity
-
getHeaderByHash
public org.web3j.protocol.core.Request<?,BlockHeader> getHeaderByHash(java.lang.String blockHash)
Returns a block header by block hash.Example:
String blockHash = "0x5f06bed1f3f11d4f2b0760cfdf95ce6b2e6431ca46e2b778f2b958d4e5b9aa43"; BlockHeader response = caver.rpc.klay.getHeaderByHash(blockHash); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockHash
- The hash of block.- Returns:
- BlockHeader
-
getHeaderByNumber
public org.web3j.protocol.core.Request<?,BlockHeader> getHeaderByNumber(java.math.BigInteger blockNumber)
Returns a block header by block number.Example:
BlockHeader response = caver.rpc.klay.getHeaderByNumber(BigInteger.valueOf(5)); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockNumber
- The block number.- Returns:
- BlockHeader
-
getHeaderByNumber
public org.web3j.protocol.core.Request<?,BlockHeader> getHeaderByNumber(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a block header by block tag.Example:
BlockHeader response = caver.rpc.klay.getHeaderByNumber(DefaultBlockParameterName.LATEST); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- BlockHeader
-
getHeaderByNumber
public org.web3j.protocol.core.Request<?,BlockHeader> getHeaderByNumber(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a block header by block number or block tag.Example:
BlockHeader response = caver.rpc.klay.getHeaderByNumber(DefaultBlockParameterName.LATEST); BlockHeader.BlockHeaderData blockHeaderData = response.getResult(); response = caver.rpc.klay.getHeaderByNumber(new DefaultBlockParameterNumber(0)); blockHeaderData = response.getResult();
- Parameters:
blockNumberOrTag
- The block number or block tag which is one of "latest", "earliest", or "pending".- Returns:
- BlockHeader
-
getHeader
public org.web3j.protocol.core.Request<?,BlockHeader> getHeader(java.lang.String blockHash)
Returns a block header by block hash.Example:
String blockHash = "0x5f06bed1f3f11d4f2b0760cfdf95ce6b2e6431ca46e2b778f2b958d4e5b9aa43"; BlockHeader response = caver.rpc.klay.getHeader(blockHash); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockHash
- The hash of block.- Returns:
- BlockHeader
-
getHeader
public org.web3j.protocol.core.Request<?,BlockHeader> getHeader(java.math.BigInteger blockNumber)
Returns a block header by block number.Example:
BlockHeader response = caver.rpc.klay.getHeaderByNumber(BigInteger.valueOf(5)); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockNumber
- The block number.- Returns:
- BlockHeader
-
getHeader
public org.web3j.protocol.core.Request<?,BlockHeader> getHeader(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a block header by block tag.Example:
BlockHeader response = caver.rpc.klay.getHeader(DefaultBlockParameterName.LATEST); BlockHeader.BlockHeaderData blockHeaderData = response.getResult();
- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- BlockHeader
-
getHeader
public org.web3j.protocol.core.Request<?,BlockHeader> getHeader(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a block header by block number or block tag.Example:
BlockHeader response = caver.rpc.klay.getHeaderByNumber(DefaultBlockParameterName.LATEST); BlockHeader.BlockHeaderData blockHeaderData = response.getResult(); response = caver.rpc.klay.getHeaderByNumber(new DefaultBlockParameterNumber(0)); blockHeaderData = response.getResult();
- Parameters:
blockNumberOrTag
- The block number or block tag which is one of "latest", "earliest", or "pending".- Returns:
- BlockHeader
-
getBlockByNumber
public org.web3j.protocol.core.Request<?,Block> getBlockByNumber(long blockNumber)
Returns information about a block by block number.It set "isFullTransaction" param to false.
- Parameters:
blockNumber
- The block number.- Returns:
- Block
-
getBlockByNumber
public org.web3j.protocol.core.Request<?,Block> getBlockByNumber(long blockNumber, boolean isFullTransaction)
Returns information about a block by block number.- Parameters:
blockNumber
- The block number.isFullTransaction
- If true it returns the full transaction objects, if false only the hashes of the transactions.- Returns:
- Block
-
getBlockByNumber
public org.web3j.protocol.core.Request<?,Block> getBlockByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns information about a block by block number.It set "isFullTransaction" param to false.
- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- KlayBlock
-
getBlockByNumber
public org.web3j.protocol.core.Request<?,Block> getBlockByNumber(org.web3j.protocol.core.DefaultBlockParameter defaultBlockParameter, boolean isFullTransaction)
Returns information about a block by block number.- Parameters:
defaultBlockParameter
- The string "latest", "earliest" or "pending"isFullTransaction
- If true it returns the full transaction objects, if false only the hashes of the transactions.- Returns:
- Block
-
getBlockByHash
public org.web3j.protocol.core.Request<?,Block> getBlockByHash(java.lang.String blockHash)
Returns information about a block by block number.It set "isFullTransaction" param to false.
- Parameters:
blockHash
- The hash of block.- Returns:
- Block
-
getBlockByHash
public org.web3j.protocol.core.Request<?,Block> getBlockByHash(java.lang.String blockHash, boolean isFullTransaction)
Returns information about a block by block number.- Parameters:
blockHash
- The hash of block.isFullTransaction
- If true it returns the full transaction objects, if false only the hashes of the transactions.- Returns:
- Block
-
getBlockReceipts
public org.web3j.protocol.core.Request<?,BlockTransactionReceipts> getBlockReceipts(java.lang.String blockHash)
Returns receipts included in a block identified by block hash.- Parameters:
blockHash
- The hash of block.- Returns:
- BlockReceipt
-
getBlockTransactionCountByNumber
public org.web3j.protocol.core.Request<?,Quantity> getBlockTransactionCountByNumber(long blockNumber)
Returns the number of transactions in a block matching the given block number.- Parameters:
blockNumber
- The block number.- Returns:
- Quantity
-
getBlockTransactionCountByNumber
public org.web3j.protocol.core.Request<?,Quantity> getBlockTransactionCountByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transactions in a block matching the given block number.- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Quantity
-
getTransactionCountByNumber
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCountByNumber(long blockNumber)
Returns the number of transactions in a block matching the given block number.- Parameters:
blockNumber
- The block number.- Returns:
- Quantity
-
getTransactionCountByNumber
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCountByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the number of transactions in a block matching the given block number.- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Quantity
-
getBlockTransactionCountByHash
public org.web3j.protocol.core.Request<?,Quantity> getBlockTransactionCountByHash(java.lang.String blockHash)
Returns the number of transactions in a block from a block matching the given block hash.- Parameters:
blockHash
- The hash of a block- Returns:
- Quantity
-
getTransactionCountByHash
public org.web3j.protocol.core.Request<?,Quantity> getTransactionCountByHash(java.lang.String blockHash)
Returns the number of transactions in a block from a block matching the given block hash.- Parameters:
blockHash
- The hash of a block- Returns:
- Quantity
-
getBlockWithConsensusInfoByHash
public org.web3j.protocol.core.Request<?,BlockWithConsensusInfo> getBlockWithConsensusInfoByHash(java.lang.String blockHash)
Returns a block with consensus information matched by the given hash.- Parameters:
blockHash
- The hash of a block.- Returns:
- BlockWithConsensusInfo
-
getBlockWithConsensusInfoByNumber
public org.web3j.protocol.core.Request<?,BlockWithConsensusInfo> getBlockWithConsensusInfoByNumber(long blockNumber)
Returns a block with consensus information matched by the given block number.- Parameters:
blockNumber
- The block number.- Returns:
- BlockWithConsensusInfo
-
getBlockWithConsensusInfoByNumber
public org.web3j.protocol.core.Request<?,BlockWithConsensusInfo> getBlockWithConsensusInfoByNumber(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a block with consensus information matched by the given block number.- Parameters:
blockTag
- The string "latest", "earliest"- Returns:
- BlockWithConsensusInfo
-
getCommittee
public org.web3j.protocol.core.Request<?,Addresses> getCommittee()
Returns a list of all validators in the committee at the specified block.If the parameter is not set, returns a list of all validators in the committee at the latest block. It sets block tag to "LATEST".
- Returns:
- Addresses
-
getCommittee
public org.web3j.protocol.core.Request<?,Addresses> getCommittee(long blockNumber)
Returns a list of all validators in the committee at the specified block.If the parameter is not set, returns a list of all validators in the committee at the latest block.
- Parameters:
blockNumber
- The block number.- Returns:
- Addresses
-
getCommittee
public org.web3j.protocol.core.Request<?,Addresses> getCommittee(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a list of all validators in the committee at the specified block.If the parameter is not set, returns a list of all validators in the committee at the latest block.
- Parameters:
blockTag
- The string "latest", "earliest"- Returns:
- Addresses
-
getCommitteeSize
public org.web3j.protocol.core.Request<?,Quantity> getCommitteeSize()
Returns the size of the committee at the specified block.If the parameter is not set, returns the size of the committee at the latest block.
It sets block tag to "LATEST".
- Returns:
- Quantity
-
getCommitteeSize
public org.web3j.protocol.core.Request<?,Quantity> getCommitteeSize(long blockNumber)
Returns the size of the committee at the specified block.If the parameter is not set, returns the size of the committee at the latest block.
- Parameters:
blockNumber
- The block number.- Returns:
- Quantity
-
getCommitteeSize
public org.web3j.protocol.core.Request<?,Quantity> getCommitteeSize(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the size of the committee at the specified block.If the parameter is not set, returns the size of the committee at the latest block.
- Parameters:
blockTag
- The string "earliest" or "latest".- Returns:
-
getCouncil
public org.web3j.protocol.core.Request<?,Addresses> getCouncil()
Returns a list of all validators of the council at the specified block.If the parameter is not set, returns a list of all validators of the council at the latest block.
It set to block tag to "LATEST".
- Returns:
- Addresses
-
getCouncil
public org.web3j.protocol.core.Request<?,Addresses> getCouncil(long blockNumber)
Returns a list of all validators of the council at the specified block.If the parameter is not set, returns a list of all validators of the council at the latest block.
- Parameters:
blockNumber
- The block number.- Returns:
- Addresses
-
getCouncil
public org.web3j.protocol.core.Request<?,Addresses> getCouncil(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns a list of all validators of the council at the specified block.If the parameter is not set, returns a list of all validators of the council at the latest block.
- Parameters:
blockTag
- The string "earliest" or "latest".- Returns:
- Addresses
-
getCouncilSize
public org.web3j.protocol.core.Request<?,Quantity> getCouncilSize()
Returns the size of the council at the specified block.If the parameter is not set, returns the size of the council at the latest block.
It sets block tag to "LATEST".
- Returns:
- Quantity
-
getCouncilSize
public org.web3j.protocol.core.Request<?,Quantity> getCouncilSize(long blockNumber)
Returns the size of the council at the specified block.If the parameter is not set, returns the size of the council at the latest block.
- Parameters:
blockNumber
- The block number- Returns:
- Quantity
-
getCouncilSize
public org.web3j.protocol.core.Request<?,Quantity> getCouncilSize(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the size of the council at the specified block.If the parameter is not set, returns the size of the council at the latest block.
- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Quantity
-
getStorageAt
public org.web3j.protocol.core.Request<?,Bytes> getStorageAt(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameterNumber position, long blockNumber)
Returns the value from a storage position at a given address.- Parameters:
address
- The account address.position
- Integer of the position in the storage.blockNumber
- The block number.- Returns:
- Bytes
-
getStorageAt
public org.web3j.protocol.core.Request<?,Bytes> getStorageAt(java.lang.String address, org.web3j.protocol.core.DefaultBlockParameterNumber position, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the value from a storage position at a given address.- Parameters:
address
- The account address.position
- Integer of the position in the storage.blockTag
- The string "latest", "earliest" or "pending"- Returns:
- Bytes
-
isSyncing
public org.web3j.protocol.core.Request<?,KlaySyncing> isSyncing()
Returns an object with data about the sync status or false.- Returns:
- KlaySyncing
-
getChainID
public org.web3j.protocol.core.Request<?,Quantity> getChainID()
Returns the chain ID of the chain.- Returns:
- Quantity
-
call
public org.web3j.protocol.core.Request<?,Bytes> call(CallObject callObject)
Executes a new message call immediately without creating a transaction on the block chain.It returns data or an error object of JSON RPC if error occurs.
It sets block tag to "LATEST".
- Parameters:
callObject
- The transaction call object.- Returns:
- Bytes
-
call
public org.web3j.protocol.core.Request<?,Bytes> call(CallObject callObject, Quantity blockNumber)
Executes a new message call immediately without creating a transaction on the block chain.It returns data or an error object of JSON RPC if error occurs.
- Parameters:
callObject
- The transaction call object.blockNumber
- The block number.- Returns:
- Bytes
-
call
public org.web3j.protocol.core.Request<?,Bytes> call(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Executes a new message call immediately without creating a transaction on the block chain.It returns data or an error object of JSON RPC if error occurs.
- Parameters:
callObject
- The transaction call object.blockTag
- the string "latest", "earliest" or "pending"- Returns:
- Bytes
-
estimateGas
public org.web3j.protocol.core.Request<?,Quantity> estimateGas(CallObject callObject)
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.The transaction will not be added to the blockchain.
Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including Klaytn Virtual Machine mechanics and node performance.
- Parameters:
callObject
- The transaction call object.- Returns:
- Quantity
-
estimateComputationCost
public org.web3j.protocol.core.Request<?,Quantity> estimateComputationCost(CallObject callObject)
Generates and returns an estimate of how much computation cost spent to execute the transaction.Klaytn limits the computation cost of a transaction to 100000000 currently not to take too much time by a single transaction.
The transaction will not be added to the blockchain like klay_estimateGas.
- Parameters:
callObject
- The transaction call object.- Returns:
- Quantity
-
estimateComputationCost
public org.web3j.protocol.core.Request<?,Quantity> estimateComputationCost(CallObject callObject, long blockNumber)
Generates and returns an estimate of how much computation cost spent to execute the transaction.Klaytn limits the computation cost of a transaction to 100000000 currently not to take too much time by a single transaction.
The transaction will not be added to the blockchain like klay_estimateGas.
- Parameters:
callObject
- The transaction call object.- Returns:
- Quantity
-
estimateComputationCost
public org.web3j.protocol.core.Request<?,Quantity> estimateComputationCost(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockTag)
Generates and returns an estimate of how much computation cost spent to execute the transaction.Klaytn limits the computation cost of a transaction to 100000000 currently not to take too much time by a single transaction.
The transaction will not be added to the blockchain like klay_estimateGas.
- Parameters:
callObject
- The transaction call object.- Returns:
- Quantity
-
getTransactionByBlockHashAndIndex
public org.web3j.protocol.core.Request<?,Transaction> getTransactionByBlockHashAndIndex(java.lang.String blockHash, long index)
Returns information about a transaction by block hash and transaction index position.- Parameters:
blockHash
- The hash of a block.index
- Integer of the transaction index position.- Returns:
- Transaction
-
getTransactionByBlockNumberAndIndex
public org.web3j.protocol.core.Request<?,Transaction> getTransactionByBlockNumberAndIndex(long blockNumber, long index)
Returns information about a transaction by block number and transaction index position.- Parameters:
blockNumber
- The block numberindex
- The transaction index position.- Returns:
- Transaction
-
getTransactionByBlockNumberAndIndex
public org.web3j.protocol.core.Request<?,Transaction> getTransactionByBlockNumberAndIndex(org.web3j.protocol.core.DefaultBlockParameter blockTag, org.web3j.protocol.core.DefaultBlockParameterNumber index)
Returns information about a transaction by block number and transaction index position.- Parameters:
blockTag
- The string "latest", "earliest" or "pending"index
- The transaction index position.- Returns:
- Transaction
-
getTransactionByHash
public org.web3j.protocol.core.Request<?,Transaction> getTransactionByHash(java.lang.String txHash)
Returns the information about a transaction requested by transaction hash.- Parameters:
txHash
- The hash of a transaction- Returns:
- Transaction
-
getTransactionBySenderTxHash
public org.web3j.protocol.core.Request<?,Transaction> getTransactionBySenderTxHash(java.lang.String senderTxHash)
Returns the information about a transaction requested by sender transaction hash.Please note that this API returns correct result only if indexing feature is enabled by --sendertxhashindexing.
This can be checked by call klay_isSenderTxHashIndexingEnabled.
- Parameters:
senderTxHash
- The hash of a transaction before signing of feePayer(senderTransactionHash)- Returns:
- Transaction
-
getTransactionReceipt
public org.web3j.protocol.core.Request<?,TransactionReceipt> getTransactionReceipt(java.lang.String transactionHash)
Returns the receipt of a transaction by transaction hash.NOTE: The receipt is not available for pending transactions.
- Parameters:
transactionHash
- The hash of a transaction.- Returns:
- TransactionReceipt
-
getTransactionReceiptBySenderTxHash
public org.web3j.protocol.core.Request<?,TransactionReceipt> getTransactionReceiptBySenderTxHash(java.lang.String transactionHash)
Returns the receipt of a transaction by sender transaction hash.- Parameters:
transactionHash
- The hash of a transaction before signing of feePayer(senderTransactionHash).- Returns:
- TransactionReceipt
-
sendRawTransaction
public org.web3j.protocol.core.Request<?,Bytes32> sendRawTransaction(java.lang.String signedTransactionData)
Creates a new message call transaction or a contract creation for signed transactions.- Parameters:
signedTransactionData
- The signed transaction data.- Returns:
- Bytes32
-
sendRawTransaction
public org.web3j.protocol.core.Request<?,Bytes32> sendRawTransaction(AbstractTransaction transaction)
Creates a new message call transaction or a contract creation for signed transactions.- Parameters:
transaction
- A transaction instance.- Returns:
- Bytes32
-
sendTransaction
public org.web3j.protocol.core.Request<?,Bytes32> sendTransaction(AbstractTransaction transaction)
Constructs a transaction with given parameters, signs the transaction with a sender's private key and propagates the transaction to Klaytn network.NOTE: The address to sign with must be unlocked.
- Parameters:
transaction
- The object inherits AbstractTransaction.- Returns:
- Bytes32
-
sendTransactionAsFeePayer
public org.web3j.protocol.core.Request<?,Bytes32> sendTransactionAsFeePayer(AbstractFeeDelegatedTransaction transaction)
Constructs a transaction with given parameters, signs the transaction with a fee payer's private key and propagates the transaction to Klaytn network.This API supports only fee delegated type (including partial fee delegated type) transactions.
NOTE: The fee payer address to sign with must be unlocked.
- Parameters:
transaction
- The object inherits AbstractFeeDelegatedTransaction.- Returns:
- Bytes32
-
signTransaction
public org.web3j.protocol.core.Request<?,SignTransaction> signTransaction(AbstractTransaction transaction)
Constructs a transaction with given parameters and signs the transaction with a sender's private key.This method can be used either to generate a sender signature or to make a final raw transaction that is ready to submit to Klaytn network.
NOTE: The address to sign with must be unlocked.
- Parameters:
transaction
- The object inherits AbstractTransaction.- Returns:
- KlaySignTransaction
-
signTransactionAsFeePayer
public org.web3j.protocol.core.Request<?,SignTransaction> signTransactionAsFeePayer(AbstractFeeDelegatedTransaction transaction)
Constructs a transaction with given parameters and signs the transaction with a fee payer's private key.This method can be used either to generate a fee payer signature or to make a final raw transaction that is ready to submit to Klaytn network.
In case you just want to extract the fee-payer signature, simply take the feePayerSignatures from the result.
Note that the raw transaction is not final if the sender's signature is not attached (that is, signatures in tx is empty).
NOTE: The fee payer address to sign with must be unlocked.
- Parameters:
transaction
- The object inherits AbstractFeeDelegatedTransaction.- Returns:
- KlaySignTransaction
-
getDecodedAnchoringTransaction
public org.web3j.protocol.core.Request<?,DecodeAnchoringTransaction> getDecodedAnchoringTransaction(java.lang.String hash)
Returns the decoded anchored data in the transaction for the given transaction hash.- Parameters:
hash
- The hash of transaction- Returns:
- DecodeAnchoringTransaction
-
getClientVersion
public org.web3j.protocol.core.Request<?,Bytes> getClientVersion()
Returns the current client version of a Klaytn node.- Returns:
- Bytes
-
getChainConfig
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfig()
Provides the latest chain configurationExample :
GovernanceChainConfig response = caver.rpc.klay.getChainConfig().send();
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfig
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfig(java.math.BigInteger blockNumber)
Provides the chain configuration at the specified block numberExample :
GovernanceChainConfig response = caver.rpc.klay.getChainConfig(BigInteger.ZERO).send();
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfig
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfig(java.lang.String blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)Example :
GovernanceChainConfig response = caver.rpc.klay.getChainConfig("latest").send();
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfig
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfig(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)Example :
GovernanceChainConfig response = caver.rpc.klay.getChainConfig(DefaultBlockParameterName.LATEST).send(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfig
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfig(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
-
getChainConfigAt
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfigAt(java.math.BigInteger blockNumber)
Provides the chain configuration at the specified block numberExample :
GovernanceChainConfig response = caver.rpc.klay.getChainConfigAt(BigInteger.ZERO).send();
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfigAt
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfigAt(java.lang.String blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)Example :
GovernanceChainConfig response = caver.rpc.klay.getChainConfigAt("latest").send();
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfigAt
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfigAt(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Provides the chain configuration by block tag (latest, earliest, pending)Example :
GovernanceChainConfig response = caver.rpc.klay.getChainConfigAt(DefaultBlockParameterName.LATEST).send(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Returns:
- Request<?, GovernanceChainConfig>
-
getChainConfigAt
public org.web3j.protocol.core.Request<?,GovernanceChainConfig> getChainConfigAt(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
-
getParams
public org.web3j.protocol.core.Request<?,GovernanceItems> getParams()
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
It pass the latest block tag as a parameter.
Example :
GovernanceItems response = caver.rpc.klay.getParams().send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Returns:
- Request<?, Bytes20>
-
getParams
public org.web3j.protocol.core.Request<?,GovernanceItems> getParams(java.math.BigInteger blockNumber)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getParams(BigInteger.ZERO).send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockNumber
- The block number to query.- Returns:
- Request<?, GovernanceItems>
-
getParams
public org.web3j.protocol.core.Request<?,GovernanceItems> getParams(java.lang.String blockTag)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getParams("latest").send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockTag
- The block tag to query- Returns:
- Request<?, GovernanceItems>
-
getParams
public org.web3j.protocol.core.Request<?,GovernanceItems> getParams(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getParams(DefaultBlockParameterName.LATEST).send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockTag
- The block tag to query- Returns:
- Request<?, GovernanceItems>
-
getGovParams
public org.web3j.protocol.core.Request<?,GovernanceItems> getGovParams()
It pass the latest block tag as a parameter.Example :
GovernanceItems response = caver.rpc.klay.getGovParams().send(); GovernanceItems response = caver.rpc.klay.getParams().send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Returns:
- Request<?, Bytes20>
-
getGovParamsAt
public org.web3j.protocol.core.Request<?,GovernanceItems> getGovParamsAt(java.math.BigInteger blockNumber)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getGovParamsAt(BigInteger.ZERO).send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockNumber
- The block number to query.- Returns:
- Request<?, GovernanceItems>
-
getGovParamsAt
public org.web3j.protocol.core.Request<?,GovernanceItems> getGovParamsAt(java.lang.String blockTag)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getGovParamsAt("latest").send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockTag
- The block tag to query- Returns:
- Request<?, GovernanceItems>
-
getGovParamsAt
public org.web3j.protocol.core.Request<?,GovernanceItems> getGovParamsAt(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns governance items at specific block.It is the result of previous voting of the block and used as configuration for chain at the given block number.
Example :
GovernanceItems response = caver.rpc.klay.getGovParamsAt(DefaultBlockParameterName.LATEST).send(); Map<String, Object> governanceItem = response.getResult(); String mode = IVote.VoteItem.getGovernanceMode(governanceItem);
- Parameters:
blockTag
- The block tag to query- Returns:
- Request<?, GovernanceItems>
-
getStakingInfo
public org.web3j.protocol.core.Request<?,GovernanceStakingInfo> getStakingInfo()
The getStakingInfo returns staking information at a specific block.It passes the latest block tag as a parameter.
Example :
GovernanceStackingInfo response = caver.rpc.klay.getStakingInfo().send();
- Returns:
- Request<?, GovernanceStackingInfo>
-
getStakingInfo
public org.web3j.protocol.core.Request<?,GovernanceStakingInfo> getStakingInfo(java.math.BigInteger blockNumber)
Returns staking information at a specific block.Example :
GovernanceStackingInfo response = caver.rpc.klay.getStakingInfo(BigInteger.ZERO).send();
- Parameters:
blockNumber
- The block number.- Returns:
- Request<?, GovernanceStackingInfo>
-
getStakingInfo
public org.web3j.protocol.core.Request<?,GovernanceStakingInfo> getStakingInfo(java.lang.String blockTag)
Returns staking information at a specific block.Example :
GovernanceStackingInfo response = caver.rpc.klay.getStakingInfo("latest").send();
- Parameters:
blockTag
- The block tag.- Returns:
- Request<?, GovernanceStackingInfo>
-
getStakingInfo
public org.web3j.protocol.core.Request<?,GovernanceStakingInfo> getStakingInfo(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns staking information at a specific block.Example :
GovernanceStackingInfo response = caver.rpc.klay.getStakingInfo(DefaultBlockParameterName.LATEST).send();
- Parameters:
blockTag
- The block tag.- Returns:
- Request<?, GovernanceStackingInfo>
-
getNodeAddress
public org.web3j.protocol.core.Request<?,Bytes20> getNodeAddress()
Provides the address of the node that a user is using.It is derived from the nodekey and used to sign consensus messages. And the value of "governingnode" has to be one of validator's node address.
Example :
Bytes20 response = caver.rpc.klay.getNodeAddress().send();
- Returns:
- Request<?, Bytes20>
-
getRewards
public org.web3j.protocol.core.Request<?,KlayRewards> getRewards()
Returns distributed block rewards information at the latest block numberExample:
KlayRewards response = caver.rpc.klay.getRewards(); KlayRewards.BlockRewards blockRewards = response.getResult();
- Returns:
- KlayRewards
-
getRewards
public org.web3j.protocol.core.Request<?,KlayRewards> getRewards(java.math.BigInteger blockNumber)
Returns distributed block rewards infomation by block number.Example:
KlayRewards response = caver.rpc.klay.getRewards(BigInteger.valueOf(5)); KlayRewards.BlockRewards blockRewards = response.getResult();
- Parameters:
blockNumber
- The block number.- Returns:
- KlayRewards
-
getRewards
public org.web3j.protocol.core.Request<?,KlayRewards> getRewards(org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns distributed block rewards infomation by block tag.Example:
KlayRewards response = caver.rpc.klay.getRewards(DefaultBlockParameterName.LATEST); KlayRewards.BlockRewards blockRewards = response.getResult();
- Parameters:
blockTag
- The string "latest", "earliest" or "pending"- Returns:
- KlayRewards
-
getRewards
public org.web3j.protocol.core.Request<?,KlayRewards> getRewards(org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns the current block rewards- Returns:
- KlayRewards
-
getGasPrice
public org.web3j.protocol.core.Request<?,Quantity> getGasPrice()
Returns the current price per gas in peb.NOTE: This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.
- Returns:
- Quantity
-
getGasPriceAt
public org.web3j.protocol.core.Request<?,Quantity> getGasPriceAt()
Returns the unit price of the given block in peb.It returns latest unit price.
NOTE: This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.
- Returns:
- Quantity
-
getMaxPriorityFeePerGas
public org.web3j.protocol.core.Request<?,Quantity> getMaxPriorityFeePerGas()
Returns a suggestion for a gas tip cap for dynamic fee transactions in peb.Note: Since Klaytn has a fixed gas price, this `caver.rpc.klay.getMaxPriorityFeePerGas` returns the gas price set by Klaytn.
Example :
Quantity response = caver.rpc.klay.getMaxPriorityFeePerGas().send(); BigInteger result = response.getValue();
- Returns:
- Quantity
-
getGasPriceAt
public org.web3j.protocol.core.Request<?,Quantity> getGasPriceAt(long blockNumber)
Returns the unit price of the given block in peb.NOTE: This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.
- Parameters:
blockNumber
- The block number.- Returns:
- Quantity
-
getGasPriceAt
public org.web3j.protocol.core.Request<?,Quantity> getGasPriceAt(org.web3j.protocol.core.DefaultBlockParameter blockTag)
Returns the unit price of the given block in peb.NOTE: This API has different behavior from Ethereum's and returns a gas price of Klaytn instead of suggesting a gas price as in Ethereum.
- Parameters:
blockTag
- The block tag.- Returns:
- Quantity
-
getUpperBoundGasPrice
public org.web3j.protocol.core.Request<?,Quantity> getUpperBoundGasPrice()
Returns the upper bound gas price in peb.- Returns:
- Quantity
-
getLowerBoundGasPrice
public org.web3j.protocol.core.Request<?,Quantity> getLowerBoundGasPrice()
Returns the lower bound gas price in peb.- Returns:
- Quantity
-
isParallelDBWrite
public org.web3j.protocol.core.Request<?,Boolean> isParallelDBWrite()
Returns true if the node is writing blockchain data in parallel manner. It is enabled by default.- Returns:
- Boolean
-
isSenderTxHashIndexingEnabled
public org.web3j.protocol.core.Request<?,Boolean> isSenderTxHashIndexingEnabled()
Returns true if the node is indexing sender transaction hash to transaction hash mapping information.It is disabled by default and can be enabled by --sendertxhashindexing.
- Returns:
- Boolean
-
getProtocolVersion
public org.web3j.protocol.core.Request<?,Bytes> getProtocolVersion()
Returns the Klaytn protocol version of the node.- Returns:
- Bytes
-
getRewardbase
public org.web3j.protocol.core.Request<?,Bytes20> getRewardbase()
Returns the reward base of the current node.Reward base is the address of the account where the block rewards goes to. It is only required for CNs.
- Returns:
- Bytes20
-
getFilterChanges
public org.web3j.protocol.core.Request<?,KlayLogs> getFilterChanges(java.lang.String filterId)
Polling method for a filter, which returns an array of logs which occurred since last poll.- Parameters:
filterId
- The filter id.- Returns:
- KlayLogs
-
getFilterLogs
public org.web3j.protocol.core.Request<?,KlayLogs> getFilterLogs(java.lang.String filterId)
Returns an array of all logs matching filter with given id, which has been obtained using klay_newFilter.Note that filter ids returned by other filter creation functions, such as klay_newBlockFilter or klay_newPendingTransactionFilter, cannot be used with this function.
- Parameters:
filterId
- The filter id.- Returns:
- KlayLogs
-
getLogs
public org.web3j.protocol.core.Request<?,KlayLogs> getLogs(KlayLogFilter filterOption)
Returns an array of all logs matching a given filter object.- Parameters:
filterOption
- The filter options- Returns:
- KlayLogs
-
newBlockFilter
public org.web3j.protocol.core.Request<?,Quantity> newBlockFilter()
Creates a filter in the node, to notify when a new block arrives.To check if the state has changed, call klay_getFilterChanges.
- Returns:
- Quantity
-
newFilter
public org.web3j.protocol.core.Request<?,Quantity> newFilter(KlayFilter filterOption)
Creates a filter object, based on filter options, to notify when the state changes (logs).To check if the state has changed, call getFilterChanges.
To obtain all logs matching the filter created by klay_newFilter, call getFilterLogs(String).
- Parameters:
filterOption
- The filter option.- Returns:
- Quantity
-
newPendingTransactionFilter
public org.web3j.protocol.core.Request<?,Quantity> newPendingTransactionFilter()
Creates a filter in the node, to notify when new pending transactions arrive.To check if the state has changed, call klay_getFilterChanges.
- Returns:
- Quantity
-
uninstallFilter
public org.web3j.protocol.core.Request<?,Boolean> uninstallFilter(java.lang.String filterId)
Uninstalls a filter with given id. Should always be called when watch is no longer needed.Additionally, filters timeout when they are not requested with klay_getFilterChanges for a period of time.
- Parameters:
filterId
- A filter id.- Returns:
- Boolean
-
sha3
public org.web3j.protocol.core.Request<?,Bytes> sha3(java.lang.String data)
Returns Keccak-256 (not the standardized SHA3-256) of the given data.- Parameters:
data
- The data to convert into a SHA3 hash.- Returns:
- Bytes
-
createAccessList
public org.web3j.protocol.core.Request<?,AccessListResult> createAccessList(CallObject callObject, java.math.BigInteger blockNumber)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.Example :
BigInteger blockNumber = BigInteger.valueOf(5); AccessListResult accessListResult = caver.rpc.klay.createAccessList(callObject, blockNumber).send();
- Parameters:
callObject
- The transaction call object.blockNumber
- The block number.- Returns:
- AccessListResult
-
createAccessList
public org.web3j.protocol.core.Request<?,AccessListResult> createAccessList(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameterName blockTag)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.Example:
AccessListResult accessListResult = caver.rpc.klay.createAccessList(callObject, DefaultBlockParameterName.LATEST).send();
- Parameters:
callObject
- The transaction call object.blockTag
- The string "latest", "earliest" or "pending"- Returns:
- AccessListResult
-
createAccessList
public org.web3j.protocol.core.Request<?,AccessListResult> createAccessList(CallObject callObject, org.web3j.protocol.core.DefaultBlockParameter blockNumberOrTag)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.Example:
AccessListResult accessListResult = caver.rpc.klay.createAccessList(callObject, DefaultBlockParameterName.LATEST).send(); accessListResult = caver.rpc.klay.createAccessList(callObject, new DefaultBlockParameterNumber(1)).send();
- Parameters:
callObject
- The transaction call object.blockNumberOrTag
- The block number or block tag which is one of "latest", "earliest", or "pending".- Returns:
- AccessListResult
-
createAccessList
public org.web3j.protocol.core.Request<?,AccessListResult> createAccessList(CallObject callObject, java.lang.String blockHash)
Returns a list of addresses and storage keys used by the transaction, plus the gas consumed when the access list is added.Example:
String blockHash = "0x421440aef6024e2da883eadf663b9b485fe1c14f02883541fa4e6c16f7be8c74"; AccessListResult accessListResult = caver.rpc.klay.createAccessList(callObject, blockHash).send();
- Parameters:
callObject
- The transaction call object.blockHash
- The block hash.- Returns:
- AccessListResult
-
getFeeHistory
public org.web3j.protocol.core.Request<?,FeeHistoryResult> getFeeHistory(long blockCount, long lastBlock, java.util.List<java.lang.Float> rewardPercentiles)
Returns fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.Example:
long blockCount = 5; // Use block number from Transaction Receipt data. long lastBlock = new BigInteger(caver.utils.stripHexPrefix(receiptData.getBlockNumber()), 16).longValue(); List<Float> rewardPercentiles = new ArrayList<Float>(Arrays.asList(0.3f, 0.5f, 0.8f)); FeeHistory feeHistory = caver.rpc.klay.getFeeHistory(blockCount, lastBlock, rewardPercentiles).send();
- Parameters:
blockCount
- Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.lastBlock
- Highest number block (or block tag string) of the requested range.rewardPercentiles
- A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. (Example: `['0', '25', '50', '75', '100']` or `['0', '0.5', '1', '1.5', '3', '80']`)- Returns:
-
getFeeHistory
public org.web3j.protocol.core.Request<?,FeeHistoryResult> getFeeHistory(long blockCount, org.web3j.protocol.core.DefaultBlockParameter lastBlock, java.util.List<java.lang.Float> rewardPercentiles)
Returns fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.Example:
long blockCount = 5; List<Float> rewardPercentiles = new ArrayList<Float>(Arrays.asList(0.3f, 0.5f, 0.8f)); FeeHistory feeHistory = caver.rpc.klay.getFeeHistory(blockCount, DefaultBlockParameterName.LATEST, rewardPercentiles).send();
- Parameters:
blockCount
- Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.lastBlock
- Highest number block (or block tag string) of the requested range.rewardPercentiles
- A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. (Example: `['0', '25', '50', '75', '100']` or `['0', '0.5', '1', '1.5', '3', '80']`)- Returns:
-
subscribe
public io.reactivex.disposables.Disposable subscribe(java.lang.String type, io.reactivex.functions.Consumer<NewHeadsNotification> callback)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.The node will return a subscription id for each subscription created. For each event that matches the subscription, a notification with relevant data is sent together with the subscription id. If a connection is closed, all subscriptions created over the connection are removed.
It only allowed a 'newHeads' as a notificationType.
Also, It automatically calls a "klay_unsubscribe" API when stopping subscription.
Example
Disposable disposable = caver.rpc.klay.subscribe("newHeads", (blockData) -> { }); //Cancel subscribe notification disposable.dispose();
- Parameters:
type
- The notification type to subscribe.callback
- The callback method to handle notification.- Returns:
- Disposable
-
subscribe
public io.reactivex.disposables.Disposable subscribe(java.lang.String type, KlayFilter options, io.reactivex.functions.Consumer<LogsNotification> callback)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.The node will return a subscription id for each subscription created. For each event that matches the subscription, a notification with relevant data is sent together with the subscription id. If a connection is closed, all subscriptions created over the connection are removed.
It only allowed a 'logs' as a notification type.
Also, It automatically calls a "klay_unsubscribe" API when stopping subscription.
Example
KlayFilter options = new KlayFilter(); options.setAddress(kip7contract.getContractAddress()); options.setFromBlock(DefaultBlockParameterName.LATEST); options.setToBlock(DefaultBlockParameterName.LATEST); options.addSingleTopic("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"); options.addSingleTopic("0x0000000000000000000000002c8ad0ea2e0781db8b8c9242e07de3a5beabb71a"); //Cancel subscribe notification Disposable disposable = caver.rpc.klay.subscribe("logs", options, (logData) -> { }); //Stop to subscribe notification disposable.dispose();
- Parameters:
type
- The notification type to subscribe.options
- The filter options to filter notification.callback
- The callback method to handle notification.- Returns:
- Disposable
-
unsubscribe
public org.web3j.protocol.core.Request<?,Boolean> unsubscribe(java.lang.String subscriptionId)
Cancels the subscription with a specific subscription id.Example :
caver.rpc.klay.unsubscribe("{subscription id}").send();
- Parameters:
subscriptionId
- The subscription id.- Returns:
- Boolean
-
subscribeFlowable
public io.reactivex.Flowable<NewHeadsNotification> subscribeFlowable(java.lang.String type)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.The node will return a subscription id for each subscription created. For each event that matches the subscription, a notification with relevant data is sent together with the subscription id. If a connection is closed, all subscriptions created over the connection are removed.
It only allowed a 'newHeads' as a notificationType.
Also, It automatically calls a "klay_unsubscribe" API when stopping subscription.
You can configure the stream directly with the returned Flowable instance, i.e. register callback methods for various cases.
Example :
Flowable<NewHeadsNotification> events = caver.rpc.klay.subscribeFlowable("heads"); Disposable disposable = events.take(1).subscribe((data) -> {});
- Parameters:
type
- The notification type to subscribe.- Returns:
- Flowable
-
subscribeFlowable
public io.reactivex.Flowable<LogsNotification> subscribeFlowable(java.lang.String type, KlayFilter options)
Creates a new subscription to specific events by using RPC Pub/Sub over Websockets.The node will return a subscription id for each subscription created. For each event that matches the subscription, a notification with relevant data is sent together with the subscription id. If a connection is closed, all subscriptions created over the connection are removed.
It only allowed a 'logs' as a notification type.
Also, It automatically calls a "klay_unsubscribe" API when stopping subscription. You can configure the stream directly with the returned Flowable instance, i.e. register callback methods for various cases.
Example
KlayFilter options = new KlayFilter(); options.setAddress(kip7contract.getContractAddress()); options.setFromBlock(DefaultBlockParameterName.LATEST); options.setToBlock(DefaultBlockParameterName.LATEST); options.addSingleTopic("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"); options.addSingleTopic("0x0000000000000000000000002c8ad0ea2e0781db8b8c9242e07de3a5beabb71a"); Flowable<LogsNotification> events = caver.rpc.klay.subscribeFlowable("logs", options); Disposable disposable = events.take(1).subscribe((logData) -> {});
- Parameters:
type
- The notification type to subscribe.options
- The filter options to filter notification.- Returns:
- Flowable
-
-