Moralis 在尝试同步和观看合约事件时出现“无效的 ABI,请验证”

时间:2021-07-24 06:42:11

标签: ethereum web3 web3js

我在尝试安装 Sync and watch Contract Events 插件时不断收到错误“无效的 ABI,请验证”。我不确定还能做什么,我已经尝试进入并复制我认为正确的 ABI,但我不知道。

与此相关的截图—— enter image description here

1 个答案:

答案 0 :(得分:2)

您错误地复制了 ABI。所有打开的 { } 和 [ ] 都应该关闭。

试试这个:

{
  "anonymous": false,
  "inputs": [
    {
      "indexed": true,
      "internalType": "address",
      "name": "from",
      "type": "address"
    },
    {
      "indexed": true,
      "internalType": "address",
      "name": "to",
      "type": "address"
    },
    {
      "indexed": false,
      "internalType": "uint256",
      "name": "value",
      "type": "uint256"
    }
  ],
  "name": "Transfer",
  "type": "event"
}

我们还需要将密钥括在 “” 中。

小心,因为 VS Code 的自动格式化会删除键中的 “”

我建议您自定义格式化程序设置以避免以后出现问题。