Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Add fallback check in ABI validation #3392
Browse files Browse the repository at this point in the history
  • Loading branch information
ngotchac committed Nov 15, 2016
1 parent 039bd3c commit 3b8286f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion js/src/util/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function validateAbi (abi, api) {

// Validate each elements of the Array
const invalidIndex = abiParsed
.map((o) => isValidAbiEvent(o, api) || isValidAbiFunction(o, api))
.map((o) => isValidAbiEvent(o, api) || isValidAbiFunction(o, api) || isAbiFallback(o))
.findIndex((valid) => !valid);

if (invalidIndex !== -1) {
Expand Down Expand Up @@ -74,6 +74,14 @@ function isValidAbiFunction (object, api) {
(object.inputs && api.util.isArray(object.inputs));
}

function isAbiFallback (object) {
if (!object) {
return false;
}

return object.type === 'fallback';
}

function isValidAbiEvent (object, api) {
if (!object) {
return false;
Expand Down

0 comments on commit 3b8286f

Please sign in to comment.