Last updated
Last updated
Polling method for a filter, which returns an array of logs which occurred since last poll.
Parameters
Return Value
Array
- Array of log objects, or an empty array if nothing has changed since last poll.
For filters created with , the return are block hashes (32-byte DATA), e.g., ["0x3454645634534..."]
.
For filters created with , the return are transaction hashes (32-byte DATA), e.g., ["0x6345343454645..."]
.
For filters created with , logs are objects with following parameters:
Example
The execution of this API can be limited by two node configurations to manage resources of Klaytn node safely.
The number of maximum returned results in a single query (Default: 10,000).
The execution duration limit of a single query (Default: 10 seconds).
Parameters
Return Value
Example
Returns an array of all logs matching a given filter object.
The execution of this API can be limited by two node configurations to manage resources of Klaytn node safely.
The number of maximum returned results in a single query (Default: 10,000).
The execution duration limit of a single query (Default: 10 seconds).
Parameters
Object
- The filter options:
Return Value
Examples
Parameters
None
Return Value
Example
Creates a filter object, based on filter options, to notify when the state changes (logs).
A note on specifying topic filters: Topics are order-dependent. A transaction with a log with topics [A, B]
will be matched by the following topic filters:
[]
"anything"
[A]
"A in first position (and anything after)"
[null, B]
"anything in first position AND B in second position (and anything after)"
[A, B]
"A in first position AND B in second position (and anything after)"
[[A, B], [A, B]]
"(A OR B) in first position AND (A OR B) in second position (and anything after)"
Parameters
Object
- The filter options:
NOTE: In versions earlier than Klaytn v1.7.0, only integer block number, the string "earliest"
and "latest"
are available.
Return Value
Example
Parameters
None
Return Value
Example
Creates a new subscription to specific events by using either RPC Pub/Sub over WebSockets or filters over HTTP. It allows clients to wait for events instead of polling for them.
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.
Parameters
Object
- A notification type: "newHeads"
or "logs"
.
Return Value
Example
Parameters
Return Value
Example
Cancels the subscription with a specific subscription id by using either RPC Pub/Sub over WebSockets or filters over HTTP. Only the connection that created a subscription can unsubscribe from it.
Parameters
Return Value
Example
Returns an array of all logs matching filter with given id, which has been obtained using . Note that filter ids returned by other filter creation functions, such as or , cannot be used with this function.
See
See
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call .
To check if the state has changed, call .
To obtain all logs matching the filter created by eth_newFilter
, call .
Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call .
"newHeads"
notifies you of each block added to the blockchain. "logs"
notifies you of logs included in new blocks. This type requires a second parameter that specifies filter options. For more details, go to .
This API is appropriate for use with a WebSocket tool, .
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 for a period of time.
This API is appropriate for use with a WebSocket tool, .
id
QUANTITY
The filter id
QUANTITY
A filter id.
QUANTITY
A filter id
QUANTITY
A filter id.
QUANTITY
A subscription id when a subscription is created. For each event that matches the subscription, a notification with relevant data will be delivered as well.
filter
QUANTITY
A filter id.
Boolean
true
if the filter was successfully uninstalled, otherwise false
.
QUANTITY
A subscription id.
Boolean
true
if the subscription was successfully canceled, otherwise false
.
id
QUANTITY
The filter id (e.g., "0x16" // 22).
removed
TAG
true
when the log was removed, due to a chain reorganization. false
if it is a valid log.
logIndex
QUANTITY
Integer of the log index position in the block. null
when it is a pending log.
transactionIndex
QUANTITY
Integer of the transactions index position log was created from. null
when pending.
transactionHash
32-byte DATA
Hash of the transactions this log was created from. null
when pending.
blockHash
32-byte DATA
Hash of the block where this log was in. null
when pending.
blockNumber
QUANTITY
The block number where this log was in. null
when pending.
address
20-byte DATA
Address from which this log originated.
data
DATA
Contains the non-indexed arguments of the log.
topics
Array of DATA
Array of 0 to 4 32-byte DATA of indexed log arguments. (In Solidity: The first topic is the hash of the signature of the event (e.g., Deposit(address,bytes32,uint256)
), except you declared the event with the anonymous
specifier.).
fromBlock
QUANTITY | TAG
toBlock
QUANTITY | TAG
address
20-byte DATA | Array
(optional) Contract address or a list of addresses from which logs should originate.
topics
Array of DATA
(optional) Array of 32-byte DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with “or” options.
blockHash
32-byte DATA
(optional) A filter option that restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in in the filter criteria, then neither fromBlock nor toBlock are allowed.
fromBlock
QUANTITY | TAG
toBlock
QUANTITY | TAG
address
20-byte DATA | Array
(optional) Contract address or a list of addresses from which logs should originate.
topics
Array of DATA
(optional) Array of 32-byte DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
(optional, default: "latest"
) Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in the .
(optional, default: "latest"
) Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in the .
(optional, default: "latest"
) Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in the .
(optional, default: "latest"
) Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in the .