API not respect from_block number parameter

Let say I input from_block=10697423&to_block=10697423 as parameters

Reproduce

curl -X 'POST' \
  'https://deep-index.moralis.io/api/v2/0x158da805682bdc8ee32d52833ad41e74bb951e59/events?chain=bsc&from_block=10697423&to_block=10697423&topic=Work%28uint256%2Cuint256%29' \
  -H 'accept: application/json' \
  -H 'X-API-Key: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
  "anonymous": false,
  "inputs": [
    {
      "indexed": true,
      "internalType": "uint256",
      "name": "id",
      "type": "uint256"
    },
    {
      "indexed": false,
      "internalType": "uint256",
      "name": "loan",
      "type": "uint256"
    }
  ],
  "name": "Work",
  "type": "event"
}'

Actual

{
  "total": 4,
  "page": 0,
  "page_size": 500,
  "result": [
    {
      "transaction_hash": "0xbe08812cba139795c1cd03898d821d7985c2c4412ddd61334fd91c463832bf03",
      "address": "0x158da805682bdc8ee32d52833ad41e74bb951e59",
      "block_timestamp": "2021-09-07T04:53:59.000Z",
      "block_number": "10698062",
      "block_hash": "0x5675f42d3545e265528a0837548d746c9abee368dffc251d25df48290a4e6fb5",
      "data": {
        "uid": "20910",
        "loan": "5024583876338014920825"
      }
    },
    {
      "transaction_hash": "0xe36f0ad5a85e3d3eff510369edeab8fbe6cd7b7b2b333c4f21cc9e051003dbe6",
      "address": "0x158da805682bdc8ee32d52833ad41e74bb951e59",
      "block_timestamp": "2021-09-07T04:23:55.000Z",
      "block_number": "10697466",
      "block_hash": "0x84369e87eb232cff2acbd64d72600bf1b23bf68d7112752403e2a6bb7bbdb2dd",
      "data": {
        "uid": "21159",
        "loan": "118431898608776861616"
      }
    },
    {
      "transaction_hash": "0x042d7c2492e352e25888d694274473e9d9cd2c548176c23555b54a3b44a76477",
      "address": "0x158da805682bdc8ee32d52833ad41e74bb951e59",
      "block_timestamp": "2021-09-07T04:23:55.000Z",
      "block_number": "10697466",
      "block_hash": "0x84369e87eb232cff2acbd64d72600bf1b23bf68d7112752403e2a6bb7bbdb2dd",
      "data": {
        "uid": "21237",
        "loan": "0"
      }
    },
    {
      "transaction_hash": "0x68e0585c772783667fe363b397380f6b2c2117bd1dd3e255f67a7d3c7b2cff7c",
      "address": "0x158da805682bdc8ee32d52833ad41e74bb951e59",
      "block_timestamp": "2021-09-07T04:21:43.000Z",
      "block_number": "10697423",
      "block_hash": "0x121332a590ab901e5b543c5fcf6640830e27bd3f247bcdedc29bd09b087c4697",
      "data": {
        "uid": "18815",
        "loan": "0"
      }
    }
  ]
}

Expected

{
  "total": 1,
  "page": 0,
  "page_size": 500,
  "result": [
    {
      "transaction_hash": "0x68e0585c772783667fe363b397380f6b2c2117bd1dd3e255f67a7d3c7b2cff7c",
      "address": "0x158da805682bdc8ee32d52833ad41e74bb951e59",
      "block_timestamp": "2021-09-07T04:21:43.000Z",
      "block_number": "10697423",
      "block_hash": "0x121332a590ab901e5b543c5fcf6640830e27bd3f247bcdedc29bd09b087c4697",
      "data": {
        "uid": "18815",
        "loan": "0"
      }
    }
  ]
}

Assume root cause

It seem like api not respect from_block number parameter and use latest instead.

FYI: I did issue this to github here https://github.com/MoralisWeb3/issue-tracker/issues/94

BTW, not just ​/{address}​/events but also /erc20/transfers get this problem too, which mean anything API that has from_block appear to have same issue.

Thanks

Hi,
I checked that and it looks like it is how you say it is, as in it doesn’t filter by from_block or to_block.
We’ll get back when we have a fix.
Thanks for reporting.

1 Like