Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support field information in tuple field. #297

Open
al8n opened this issue Jun 28, 2023 · 0 comments
Open

feat: support field information in tuple field. #297

al8n opened this issue Jun 28, 2023 · 0 comments

Comments

@al8n
Copy link

al8n commented Jun 28, 2023

The current inputs and outputs params for Function and Event are Vec<Param>, but the problem is that, if the Param is a tuple, then will lose name and internal_type information about the elements in this tuple.

For example, if I have an abi like.

   "inputs": [
      {
        "components": [
          {
            "internalType": "uint8",
            "name": "blockType",
            "type": "uint8"
          },
          {
            "components": [
              {
                "internalType": "uint256",
                "name": "txIndex",
                "type": "uint256"
              },
              {
                "internalType": "bytes",
                "name": "data",
                "type": "bytes"
              }
            ],
            "internalType": "struct ExchangeData.AuxiliaryData[]",
            "name": "auxiliaryData",
            "type": "tuple[]"
          },
          {
            "internalType": "bytes",
            "name": "offchainData",
            "type": "bytes"
          }
        ],
        "internalType": "struct ExchangeData.Block[]",
        "name": "blocks",
        "type": "tuple[]"
      }
    ],

This abi can be parsed fine, but the problem is that the current ParamType for tuple is Tuple(Vec<ParamType>). So this means I cannot get the elements' names blockType and blocks.

Those information is important in my use case, I would like to suggest to change the ParamType::Tuple(Vec<ParamType>) to ParamType::Tuple(Vec<TupleParam>), in this way, users can get the name and internal type information.

@al8n al8n changed the title Support field information in nested tuple field. feat: support field information in nested tuple field. Jun 28, 2023
@al8n al8n changed the title feat: support field information in nested tuple field. feat: support field information in tuple field. Jun 28, 2023
al8n added a commit to al8n/ethabi that referenced this issue Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant