Updated on 2026-08-14
This commit is contained in:
parent
1d8522dca6
commit
0039672af9
19 changed files with 146 additions and 90 deletions
|
|
@ -3,8 +3,8 @@ package com.tangem.domain.demo
|
|||
import com.tangem.blockchain.common.*
|
||||
import com.tangem.blockchain.common.transaction.Fee
|
||||
import com.tangem.blockchain.common.transaction.TransactionFee
|
||||
import com.tangem.blockchain.common.transaction.TransactionSendResult
|
||||
import com.tangem.blockchain.extensions.Result
|
||||
import com.tangem.blockchain.extensions.SimpleResult
|
||||
import com.tangem.common.CompletionResult
|
||||
import kotlin.random.Random
|
||||
|
||||
|
|
@ -25,14 +25,17 @@ class DemoTransactionSender(private val walletManager: WalletManager) : Transact
|
|||
return getFee(amount, walletManager.wallet.address)
|
||||
}
|
||||
|
||||
override suspend fun send(transactionData: TransactionData, signer: TransactionSigner): SimpleResult {
|
||||
override suspend fun send(
|
||||
transactionData: TransactionData,
|
||||
signer: TransactionSigner,
|
||||
): Result<TransactionSendResult> {
|
||||
val signerResponse = signer.sign(
|
||||
hash = getDataToSign(),
|
||||
publicKey = walletManager.wallet.publicKey,
|
||||
)
|
||||
return when (signerResponse) {
|
||||
is CompletionResult.Success -> SimpleResult.Failure(Exception(ID).toBlockchainSdkError())
|
||||
is CompletionResult.Failure -> SimpleResult.fromTangemSdkError(signerResponse.error)
|
||||
is CompletionResult.Success -> Result.Failure(Exception(ID).toBlockchainSdkError())
|
||||
is CompletionResult.Failure -> Result.fromTangemSdkError(signerResponse.error)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue