Skip to content

feat: support field information in tuple field. #297

@al8n

Description

@al8n

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions