Skip to content

Commit 264c012

Browse files
authored
Merge pull request #181 from NanYeZhuYu/develop_local
fix EIP712 encodeType with Array
2 parents 2db8d9d + 673fe99 commit 264c012

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

coinlib/src/main/java/com/keystone/coinlib/coins/ETH/StructuredDataEncoder.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,19 @@ public Set<String> getDependencies(String primaryType) {
9797
deps.add(structName);
9898

9999
for (StructuredData.Entry entry : types.get(primaryType)) {
100-
if (!types.containsKey(entry.getType())) {
100+
String declarationFieldTypeName = entry.getType();
101+
String baseDeclarationTypeName =
102+
arrayTypePattern.matcher(declarationFieldTypeName).find()
103+
? declarationFieldTypeName.substring(
104+
0, declarationFieldTypeName.indexOf('['))
105+
: declarationFieldTypeName;
106+
if (!types.containsKey(baseDeclarationTypeName)) {
101107
// Don't expand on non-user defined types
102-
} else if (deps.contains(entry.getType())) {
108+
} else if (deps.contains(baseDeclarationTypeName)) {
103109
// Skip types which are already expanded
104110
} else {
105111
// Encountered a user defined type
106-
remainingTypes.add(entry.getType());
112+
remainingTypes.add(baseDeclarationTypeName);
107113
}
108114
}
109115
}

0 commit comments

Comments
 (0)