@@ -25,6 +25,7 @@ import (
25
25
"math/big"
26
26
"reflect"
27
27
"regexp"
28
+ "slices"
28
29
"sort"
29
30
"strconv"
30
31
"strings"
@@ -386,16 +387,8 @@ func (typedData *TypedData) HashStruct(primaryType string, data TypedDataMessage
386
387
// Dependencies returns an array of custom types ordered by their hierarchical reference tree
387
388
func (typedData * TypedData ) Dependencies (primaryType string , found []string ) []string {
388
389
primaryType = strings .TrimSuffix (primaryType , "[]" )
389
- includes := func (arr []string , str string ) bool {
390
- for _ , obj := range arr {
391
- if obj == str {
392
- return true
393
- }
394
- }
395
- return false
396
- }
397
390
398
- if includes (found , primaryType ) {
391
+ if slices . Contains (found , primaryType ) {
399
392
return found
400
393
}
401
394
if typedData .Types [primaryType ] == nil {
@@ -404,7 +397,7 @@ func (typedData *TypedData) Dependencies(primaryType string, found []string) []s
404
397
found = append (found , primaryType )
405
398
for _ , field := range typedData .Types [primaryType ] {
406
399
for _ , dep := range typedData .Dependencies (field .Type , found ) {
407
- if ! includes (found , dep ) {
400
+ if ! slices . Contains (found , dep ) {
408
401
found = append (found , dep )
409
402
}
410
403
}
0 commit comments