From 5523f93bdd81ddb4c81b6ae251dd14fdba5cd16f Mon Sep 17 00:00:00 2001 From: 10gic <2391796+10gic@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:05:35 +0800 Subject: [PATCH] Remove unused functions --- .../src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt | 4 ++-- .../src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt | 4 ---- .../src/iosMain/kotlin/com/trustwallet/core/StringExt.kt | 4 ---- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt index d764e183856..480d260002f 100644 --- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt +++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/AnySigner.kt @@ -10,7 +10,7 @@ actual object AnySigner { actual fun sign(input: ByteArray, coin: CoinType): ByteArray { val inputData = TWDataCreateWithBytes(input.toUByteArray().toCValues(), input.size.toULong()) - val result = TWAnySignerSign(input.toTwData(), coin.value)!!.readTwBytes()!! + val result = TWAnySignerSign(inputData, coin.value)!!.readTwBytes()!! TWDataDelete(inputData) return result } @@ -29,7 +29,7 @@ actual object AnySigner { actual fun plan(input: ByteArray, coin: CoinType): ByteArray { val inputData = TWDataCreateWithBytes(input.toUByteArray().toCValues(), input.size.toULong()) - val result = TWAnySignerPlan(input.toTwData(), coin.value)?.readTwBytes()!! + val result = TWAnySignerPlan(inputData, coin.value)?.readTwBytes()!! TWDataDelete(inputData) return result } diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt index 67a7326c857..bc537de453d 100644 --- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt +++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/ByteArrayExt.kt @@ -15,7 +15,3 @@ internal fun COpaquePointer?.readTwBytes(): ByteArray? = TWDataDelete(it) result } - -@OptIn(ExperimentalUnsignedTypes::class) -internal fun ByteArray?.toTwData(): COpaquePointer? = - TWDataCreateWithBytes(this?.toUByteArray()?.toCValues(), this?.size?.toULong() ?: 0u) diff --git a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt index 101ebbfc7f5..79cd8125d84 100644 --- a/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt +++ b/kotlin/wallet-core-kotlin/src/iosMain/kotlin/com/trustwallet/core/StringExt.kt @@ -4,13 +4,9 @@ package com.trustwallet.core -import kotlinx.cinterop.COpaquePointer import kotlinx.cinterop.CValuesRef import kotlinx.cinterop.toKString -internal fun String?.toTwString(): COpaquePointer? = - this?.let { TWStringCreateWithUTF8Bytes(it) } - // Build String from TWString, and then delete TWString internal fun CValuesRef<*>?.fromTwString(): String? = this?.let {