Merge pull request #3459 from ethcore/ng-abi-fallback

Add fallback check in ABI validation
This commit is contained in:
Gav Wood 2016-11-16 11:19:50 +08:00 committed by GitHub
commit 4d5ce8fde4

View File

@ -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) {
@ -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;