로그 조회
GetLogs(filter map[string]interface{}) ([]map[string]interface{}, error) 주어진 필터 객체와 일치하는 모든 로그 배열을 반환합니다. 과거 이벤트를 조회하는 데 사용됩니다.
파라미터
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
filter | map[string]interface{} | ✓ | 필터 기준 (시작 블록, 종료 블록, 주소, 토픽) |
반환값
타입:
[]map[string]interface{} 로그 객체 목록
예제
컨트랙트 이벤트 조회
filter := map[string]interface{}{
"fromBlock": "0x1",
"toBlock": "latest",
"address": "0xContract...",
}
logs, _ := rpc.GetLogs(filter)