Add fallback check in ABI validation #3392

This commit is contained in:
Nicolas Gotchac 2016-11-15 18:53:53 +01:00
parent 039bd3c9f9
commit 3b8286f474

View File

@ -44,7 +44,7 @@ export function validateAbi (abi, api) {
// Validate each elements of the Array // Validate each elements of the Array
const invalidIndex = abiParsed const invalidIndex = abiParsed
.map((o) => isValidAbiEvent(o, api) || isValidAbiFunction(o, api)) .map((o) => isValidAbiEvent(o, api) || isValidAbiFunction(o, api) || isAbiFallback(o))
.findIndex((valid) => !valid); .findIndex((valid) => !valid);
if (invalidIndex !== -1) { if (invalidIndex !== -1) {
@ -74,6 +74,14 @@ function isValidAbiFunction (object, api) {
(object.inputs && api.util.isArray(object.inputs)); (object.inputs && api.util.isArray(object.inputs));
} }
function isAbiFallback (object) {
if (!object) {
return false;
}
return object.type === 'fallback';
}
function isValidAbiEvent (object, api) { function isValidAbiEvent (object, api) {
if (!object) { if (!object) {
return false; return false;