Filter
getFilterChanges
필터에 대한 폴링 방법으로, 마지막 폴링 이후 발생한 로그를 배열의 형태로 반환합니다.
Parameters
Name | Type | Description |
---|---|---|
filterId | String | 필터 ID입니다. |
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
프로미스
는 배열
을 반환합니다 - 로그 객체의 배열을 반환하거나 또는 최근 폴링 이후 변화가 없는 경우 빈 배열을 반환합니다.
Array
에 담겨 반환된 로그 Object
의 구조는 다음과 같습니다:
Name | Type | Description |
---|---|---|
address | 20-byte DATA | Address from which this log originated. |
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., |
data | DATA | Contains the non-indexed arguments of the log. |
blockNumber | QUANTITY | The block number where this log was in. |
transactionHash | 32-byte DATA | 이 로그를 생성한 트랜잭션의 해시입니다. 트랜잭션이 보류 상태이면 |
transactionIndex | QUANTITY | 정수. 이 로그를 생성한 트랜잭션의 인덱스입니다. |
blockHash | 32-byte DATA | Hash of the block where this log was in. |
logIndex | QUANTITY | Integer of the log index position in the block. |
id | String | A log identifier. It is made by concatenating "log_" string with |
Example
getFilterLogs
입력으로 받은 필터 ID값을 가진 필터 객체를 찾고, 이 필터 객체에 해당하는 모든 로그를 배열 형태로 반환합니다. The filter object should be obtained using newFilter. Note that filter ids returned by other filter creation functions, such as newBlockFilter or newPendingTransactionFilter, cannot be used with this function.
Parameters
Name | Type | Description |
---|---|---|
filterId | String | The filter id. |
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
See getFilterChanges
Example
getPastLogs
주어진 옵션에 맞는 과거 로그를 얻습니다.
Parameters
Name | Type | Description |
---|---|---|
options | Object | The filter options. |
options.fromBlock | Number | String | (optional) The number of the earliest block to get the logs. ( |
options.toBlock | Number | String | (optional) The number of the last block to get the logs. ( |
options.address | String | Array | (선택 사항) 주소 또는 주소 목록입니다. Only the logs related to the particular account(s) will be returned. |
options.topics | Array | (optional) An array of values that must appear in the log entries. The order is important. 특정 토픽을 쓰지 않으려면 |
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
프로미스
는 Array
를 반환: 로그 객체들이 있는 배열입니다.
Array
에 담겨 반환된 이벤트 Object
의 구조는 다음과 같습니다:
Name | Type | Description |
---|---|---|
address | String | 이벤트가 발생한 곳입니다. |
data | String | The data containing non-indexed log parameter. |
topics | Array | 최대 4개의 32바이트 주제를 가진 배열, 주제 1-3은 로그의 색인화된 매개변수가 포함됩니다. |
logIndex | Number | Integer of the event index position in the block. |
transactionIndex | Number | 이벤트가 생성된 트랜잭션의 인덱스 위치의 정수값. |
transactionHash | 32-byte String | 이 이벤트가 생성된 트랜잭션의 해시. |
blockHash | 32-byte String | 이 이벤트가 생성된 블록의 해시. 아직 보류 중인 경우 |
blockNumber | Number | 이 로그가 생성된 블록 번호. |
id | String | A log identifier. |
Example
newBlockFilter
새로운 블록이 도착했다는 정보를 받기 위해 노드에 필터를 만듭니다. To check if the state has changed, call getFilterChanges.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback. 콜백(callback)은 오류 객체를 첫 번째 매개 변수로, 결과를 두 번째 매개 변수로 하여 실행됩니다. |
Return Value
프로미스
는 String
을 반환 - 필터 ID입니다.
Example
newFilter
주어진 필터 옵션을 사용해 특정 상태 변화(로그)를 받을 필터 객체를 만듭니다.
To check if the state has changed, call getFilterChanges.
To obtain all logs matching the filter created by
newFilter
, call getFilterLogs.
For detailed information about topic filters, please see Klaytn Platform API - klay_newFilter.
Parameters
Name | Type | Description |
---|---|---|
options | Object | The filter options. |
options.fromBlock | Number | String | (optional) The number of the earliest block height to query the events. (There are special tags, |
options.toBlock | Number | String | (optional) The number of the last block height to query the events (There are special tags, |
options.address | String | Array | (optional) An address or a list of addresses to get logs generated inside the given contract(s). |
options.topics | Array | (optional) An array of values to search for in the log entries. The order is important. If you want to match everything in the given position, use |
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns String
- A filter id.
Example
newPendingTransactionFilter
보류 상태의 트랜잭션이 새롭게 도착했다는 정보를 받기 위해 노드에 필터를 만듭니다. To check if the state has changed, call getFilterChanges.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
Promise
returns String
- A filter id.
Example
uninstallFilter
주어진 ID를 가진 필터를 제거합니다. 모니터링이 불필요하다면 즉시 필터를 제거하는 것을 강력하게 권장합니다. A filter will be removed if the filter has not been invoked through getFilterChanges for more than the timeout value set in the node. 기본 설정은 5분 입니다.
Parameters
Name | Type | Description |
---|---|---|
filterId | String | The filter id. |
callback | Function | (optional) Optional callback, returns an error object as the first parameter and the result as the second. |
Return Value
프로미스
는 Boolean
을 반환합니다 - 필터가 잘 제거 되었으면 true
, 그렇지 않으면 false
입니다.
Example
Last updated