diff --git a/android/build.gradle b/android/build.gradle index 210118134..5e8648866 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -57,7 +57,8 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - implementation 'org.bouncycastle:bcprov-jdk18on:1.76' - implementation("com.squareup.okhttp3:okhttp:4.11.0") - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") + implementation 'org.bouncycastle:bcprov-jdk18on:1.77' + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1' + implementation 'org.jetbrains.kotlin:kotlin-reflect:1.9.23' } diff --git a/lib/src/main/kotlin/com/swmansion/starknet/crypto/NativeLoader.kt b/lib/src/main/kotlin/com/swmansion/starknet/crypto/NativeLoader.kt index 520c35b04..a7893e7be 100644 --- a/lib/src/main/kotlin/com/swmansion/starknet/crypto/NativeLoader.kt +++ b/lib/src/main/kotlin/com/swmansion/starknet/crypto/NativeLoader.kt @@ -7,7 +7,7 @@ import java.util.* internal object NativeLoader { private val operatingSystem: SystemType by lazy { - val system = System.getProperty("os.name", "generic").lowercase(Locale.ENGLISH) + val system = System.getProperty("os.name", "generic")?.lowercase(Locale.ENGLISH) ?: throw UnknownOS() when { system.contains("mac") || system.contains("darwin") -> SystemType.MacOS system.contains("win") -> SystemType.Windows @@ -57,6 +57,8 @@ internal object NativeLoader { class UnsupportedPlatform(system: String, architecture: String) : RuntimeException("Unsupported platfrom $system:$architecture") + class UnknownOS : RuntimeException("Failed to fetch OS name") + private fun getLibPath(system: SystemType, architecture: String, name: String): String { return when (system) { SystemType.MacOS -> "/darwin/$name.dylib" 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 242364073..2b69772a9 100644 --- a/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt +++ b/lib/src/main/kotlin/com/swmansion/starknet/data/TypedData.kt @@ -331,7 +331,7 @@ data class TypedData private constructor( private fun boolFromPrimitive(primitive: JsonPrimitive): Felt { val felt = feltFromPrimitive(primitive, allowBoolean = true, allowShortString = false) - require(felt.value < BigInteger.TWO) { "Expected boolean value, got [$primitive]." } + require(felt.value < BigInteger.valueOf(2)) { "Expected boolean value, got [$primitive]." } return felt } @@ -339,7 +339,7 @@ data class TypedData private constructor( private fun u128fromPrimitive(primitive: JsonPrimitive): Felt { val felt = feltFromPrimitive(primitive, allowShortString = false) - require(felt.value < BigInteger.TWO.pow(128)) { "Value [$primitive] is out of range for '${BasicType.U128.name}'." } + require(felt.value < BigInteger.valueOf(2).pow(128)) { "Value [$primitive] is out of range for '${BasicType.U128.name}'." } return felt } @@ -347,7 +347,7 @@ data class TypedData private constructor( private fun i128fromPrimitive(primitive: JsonPrimitive): Felt { val felt = feltFromPrimitive(primitive, allowSigned = true, allowShortString = false) - require(felt.value < BigInteger.TWO.pow(127) || felt.value >= Felt.PRIME - BigInteger.TWO.pow(127)) { "Value [$primitive] is out of range for '${BasicType.I128.name}'." } + require(felt.value < BigInteger.valueOf(2).pow(127) || felt.value >= Felt.PRIME - BigInteger.valueOf(2).pow(127)) { "Value [$primitive] is out of range for '${BasicType.I128.name}'." } return felt }