vechain / vechain-sdk-js

The official JavaScript SDK for VeChain.
19 stars 6 forks source link

πŸ› [BUG] - RPC `eth_getLogs` does not support multiple topics filters #1015

Open ifavo opened 6 days ago

ifavo commented 6 days ago

Description

eth_getLogs does accept either a single topic hash or a list of topic hashes according to https://ethereum.github.io/execution-apis/api-documentation/

The SDK does not support the list of hashes.

Reproduction URL

https://www.val.town/v/ifavo/coffeeHookworm

Reproduction steps

import { ThorClient, VeChainProvider } from "@vechain/sdk-network";

const thorClient = ThorClient.fromUrl("https://mainnet.vechain.org");
const provider = new VeChainProvider(thorClient);

// this works
const singleTopic = await provider.request({
  method: "eth_getLogs",
  params: [
    {
      "address": "0x6e04f400810be5c570c08ea2def43c4d44481063",
      "fromBlock": "0x10c8e00",
      "toBlock": "0x10c8e00",
      "topics": [
        "0xb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d9",
      ],
    },
  ],
});
console.log("Single Matches", singleTopic);

// this fails, because the HTTP Post to the node is being incorrectly formatted
const multiTopics = await provider.request({
  method: "eth_getLogs",
  params: [
    {
      "address": "0x6e04f400810be5c570c08ea2def43c4d44481063",
      "fromBlock": "0x10c8e00",
      "toBlock": "0x10c8e00",
      "topics": [
        [
          "0xb3d987963d01b2f68493b4bdb130988f157ea43070d4ad840fee0466ed9370d9",
          "0x9b87a00e30f1ac65d898f070f8a3488fe60517182d0a2098e1b4b93a54aa9bd6",
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        ],
      ],
    },
  ],
});

console.log("Multi Matches", multiTopics);

Screenshots

![DESCRIPTION](LINK.png)

Logs

No response

OS

No response