ObsidianLabs/XuperIDE

Error: 2 UNKNOWN: arg name not found

Opened this issue · 0 comments

Error: 2 UNKNOWN: arg name not found 该错误为链返回的错误,具体原因是因为代码中使用了 public 的 state variable,编译出来的 ABI 对应的 view 的 input 的 name 为空字符串,如:

  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "name": "Id",
    "outputs": [
      {
        "internalType": "string",
        "name": "name",
        "type": "string"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },

目前建议使用 private/internal state 配合 view 函数使用