diff --git a/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt b/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt index ebf49ddf6..cf5d4838b 100644 --- a/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt +++ b/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt @@ -150,7 +150,7 @@ data class TypedData private constructor( customTypes.keys.forEach { require(it.isNotEmpty()) { "Type names cannot be empty." } require(!it.isArray()) { "Type names cannot end in *. [$it] was found." } - require(!it.startsWith("(") && !it.endsWith(")")) { "Type names cannot be enclosed in parentheses. [$it] was found." } + require(!it.isEnum()) { "Type names cannot be enclosed in parentheses. [$it] was found." } require(!it.contains(",")) { "Type names cannot contain commas. [$it] was found." } require(it in referencedTypes) { "Dangling types are not allowed. Unreferenced type [$it] was found." } } diff --git a/lib/src/test/kotlin/starknet/data/TypedDataTest.kt b/lib/src/test/kotlin/starknet/data/TypedDataTest.kt index 7cc8cff13..7389b6969 100644 --- a/lib/src/test/kotlin/starknet/data/TypedDataTest.kt +++ b/lib/src/test/kotlin/starknet/data/TypedDataTest.kt @@ -469,13 +469,11 @@ internal class TypedDataTest { @Test fun `type with parentheses`() { - val types = listOf("(left", "right)", "(both)") - types.forEach { type -> - val exception = assertThrows { - makeTypedData(Revision.V1, type) - } - assertEquals("Type names cannot be enclosed in parentheses. [$type] was found.", exception.message) + val type = "(mytype)" + val exception = assertThrows { + makeTypedData(Revision.V1, type) } + assertEquals("Type names cannot be enclosed in parentheses. [$type] was found.", exception.message) } @Test