Is there an existing issue for this?
Current Behavior
Currently the tuple value validation always return false if we pass a JSON object instead of array format.
Expected Behavior
If the JSON object is valid as per schema it should pass the validation.
Steps to Reproduce
const schema = [
  {
    components: [
      { internalType: 'string', name: 'name', type: 'string' },
      { internalType: 'address', name: 'addr', type: 'address' },
      {
        components: [
          { internalType: 'string', name: 'email', type: 'string' },
          { internalType: 'string', name: 'phone', type: 'string' },
        ],
        internalType: 'struct ABIV2UserDirectory.Contact',
        name: 'contact',
        type: 'tuple',
      },
    ],
    internalType: 'struct ABIV2UserDirectory.User',
    name: 'user',
    type: 'tuple',
  },
];
const data = [
  {
    name: 'Rick Sanchez',
    addr: '0xCB00CDE33a7a0Fba30C63745534F1f7Ae607076b',
    contact: {
      email: '[email protected]',
      phone: '+1 (555) 314-1593',
    },
  },
];
validator.validate(schema, data)Web3.js Version
4.x
Environment
N/A
Anything Else?
The tuple data format been specified by provider ABI specifications are the nested arrays. e.g. Above schema object can in ABI format should be. Our validator was written fully compliance to it. But in some cases the user can pass on the JSON object notation for the same data.
[['Rick Sanchez', '0xCB00CDE33a7a0Fba30C63745534F1f7Ae607076b', ['[email protected]', '+1 (555) 314-1593']]]