Skip to content

Commit

Permalink
Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
10gic committed Sep 24, 2024
1 parent fa21f62 commit b94a2e0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b94a2e0

Please sign in to comment.