L0vdL0vd

erigon_getLatestLogs

Returns the most recent logs matching a filter, newest first, without choosing a block range.

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"erigon_getLatestLogs","params":[{"address":"0xdAC17F958D2ee523a2206206994597C13D831ec7"},{"logCount":2}]}'

响应示例

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000d38b3894f0f5cac606d466d1dd0b75948a5766d0"
      ],
      "data": "0x0000000000000000000000000000000000000000000000000000000000ac0dbf",
      "blockNumber": "0x1936554",
      "transactionHash": "0x4863064f42de4487811920e2de1c6e079b727324e3fab2a5147248d82f434945",
      "transactionIndex": "0x1b2",
      "blockHash": "0x844e902781170398d4ee20e5ba3ccaf98b1542af15284ef5ab665f9e97eaae81",
      "logIndex": "0x0",
      "removed": false,
      "timestamp": "0x6afcaf1b"
    },
    {
      "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x00000000000000000000000035ece63b5591c3b94153f21ca357c9b4b2da8124"
      ],
      "data": "0x000000000000000000000000000000000000000000000000000000000a9d6031",
      "blockNumber": "0x1936554",
      "transactionHash": "0xbf35f45affe4226b8c37d2920ab42f6de65082ff4b48db734cc3b3d0b989969c",
      "transactionIndex": "0x1b1",
      "blockHash": "0x844e902781170398d4ee20e5ba3ccaf98b1542af15284ef5ab665f9e97eaae81",
      "logIndex": "0x0",
      "removed": false,
      "timestamp": "0x6afcaf1b"
    }
  ]
}

示例中较长的数组和十六进制字符串已截断。

参数与您的端点

参数

filterobject必填
address and topics, as in eth_getLogs.
optionsobject必填
logCount (how many logs) or blockCount (how many blocks back), plus optional ignoreTopicsOrder.

返回值

array Matching log objects.

addressstring
Contract that emitted the log.
topicsarray
Up to four indexed topics; topic 0 is the event signature hash.
datastring
Non-indexed event arguments, ABI-encoded.
blockNumberstring
Block number, hex.
transactionHashstring
Hash of the transaction that emitted the log.
logIndexstring
Position of the log in the block, hex.
removedboolean
true if the log was removed by a reorg.

适用场景

Show the latest N events of a contract (recent transfers, latest swaps) without guessing a block range.

如何解读结果

Log objects, newest first.

提示

  • Use logCount for a fixed number of events or blockCount to look back a fixed number of blocks.

相关方法