Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

Expand Down
2 changes: 1 addition & 1 deletion stellarkit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies {
implementation "androidx.room:room-ktx:$room_version"
ksp "androidx.room:room-compiler:$room_version"

api 'org.stellar:wallet-sdk:2.0.0'
api 'com.github.piratecash:kotlin-wallet-sdk:169a2d4'

implementation 'androidx.core:core-ktx:1.16.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.horizontalsystems.stellarkit

import org.stellar.sdk.Transaction
import org.stellar.sdk.xdr.DecoratedSignature

interface Signer {
val publicKey: ByteArray
fun canSign(): Boolean
suspend fun sign(hash: ByteArray): DecoratedSignature
suspend fun signTransaction(transaction: Transaction): DecoratedSignature? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ class StellarKit(
private suspend fun sendTransaction(transaction: Transaction): TransactionResponse {
if (!signer.canSign()) throw WalletError.WatchOnly

val txHash = transaction.hash()
val signature = signer.sign(txHash)
val signature = signer.signTransaction(transaction)
?: signer.sign(transaction.hash())
transaction.addSignature(signature)

return try {
Expand All @@ -256,8 +256,8 @@ class StellarKit(
val transaction = Transaction.fromEnvelopeXdr(transactionEnvelope, stellarNetwork)
if (!signer.canSign()) throw WalletError.WatchOnly

val txHash = transaction.hash()
val signature = signer.sign(txHash)
val signature = (transaction as? Transaction)?.let { signer.signTransaction(it) }
?: signer.sign(transaction.hash())
transaction.addSignature(signature)

return transaction.toEnvelopeXdrBase64()
Expand Down