Fixed JSON ABI parsing (#3674).
This commit is contained in:
parent
5b1020f72c
commit
1b13716986
@ -853,25 +853,25 @@ export class ParamType {
|
|||||||
|
|
||||||
let arrayMatch = type.match(regexArrayType);
|
let arrayMatch = type.match(regexArrayType);
|
||||||
if (arrayMatch) {
|
if (arrayMatch) {
|
||||||
const arrayLength = arrayMatch[2];
|
const arrayLength = parseInt(arrayMatch[2]);
|
||||||
const arrayChildren = ParamType.from({
|
const arrayChildren = ParamType.from({
|
||||||
type: arrayMatch[1],
|
type: arrayMatch[1],
|
||||||
components: obj.components
|
components: obj.components
|
||||||
});
|
});
|
||||||
|
|
||||||
return new ParamType(_guard, name, type, "array", indexed, null, arrayLength, arrayChildren);
|
return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "tuple" || type.substring(0, 5) === "tuple(" || type[0] === "(") {
|
if (type === "tuple" || type.substring(0, 5) === "tuple(" || type[0] === "(") {
|
||||||
const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null;
|
const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null;
|
||||||
const tuple = new ParamType(_guard, name, type, "tuple", indexed, comps, null, null);
|
const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null);
|
||||||
// @TODO: use lexer to validate and normalize type
|
// @TODO: use lexer to validate and normalize type
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
type = verifyBasicType(obj.type);
|
type = verifyBasicType(obj.type);
|
||||||
|
|
||||||
return new ParamType(_guard, name, type, type, indexed, null, null, null);
|
return new ParamType(_guard, name || "", type, type, indexed, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user