Updated on 2026-08-14
This commit is contained in:
commit
cc3401a412
943 changed files with 15667 additions and 6451 deletions
|
|
@ -28,7 +28,7 @@ class AccountNodeRecognizer(private val blockchain: Blockchain) {
|
|||
// region Ethereum-like blockchains
|
||||
blockchain == Blockchain.Tezos -> ACCOUNT_NODE_INDEX
|
||||
blockchain == Blockchain.Quai -> ACCOUNT_NODE_INDEX
|
||||
blockchain.isEvm() -> ADDRESS_INDEX_NODE_INDEX
|
||||
blockchain.isEvm() && derivationPath.isEthDerivation() -> ADDRESS_INDEX_NODE_INDEX
|
||||
// endregion
|
||||
blockchain.isUTXO -> ACCOUNT_NODE_INDEX
|
||||
else -> ACCOUNT_NODE_INDEX
|
||||
|
|
@ -75,6 +75,13 @@ class AccountNodeRecognizer(private val blockchain: Blockchain) {
|
|||
.getOrNull()
|
||||
}
|
||||
|
||||
private fun DerivationPath.isEthDerivation(): Boolean {
|
||||
fun getIndex(nodeIndex: Int) = nodes.getOrNull(nodeIndex)?.getIndex(false)
|
||||
|
||||
return getIndex(FIRST_NODE_INDEX) == ETH_FIRST_NODE_VALUE &&
|
||||
getIndex(SECOND_NODE_INDEX) == ETH_SECOND_NODE_VALUE
|
||||
}
|
||||
|
||||
@Suppress("LongMethod")
|
||||
private fun Blockchain.isAccountsSupported(): Boolean {
|
||||
return when (this) {
|
||||
|
|
@ -253,5 +260,9 @@ class AccountNodeRecognizer(private val blockchain: Blockchain) {
|
|||
private companion object {
|
||||
const val ACCOUNT_NODE_INDEX = 2
|
||||
const val ADDRESS_INDEX_NODE_INDEX = 4
|
||||
const val FIRST_NODE_INDEX = 0
|
||||
const val ETH_FIRST_NODE_VALUE = 44L
|
||||
const val SECOND_NODE_INDEX = 1
|
||||
const val ETH_SECOND_NODE_VALUE = 60L
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.tangem.sdk.api
|
|||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import arrow.core.Either
|
||||
import com.tangem.Message
|
||||
import com.tangem.common.CompletionResult
|
||||
import com.tangem.common.KeyPair
|
||||
|
|
@ -16,6 +17,7 @@ import com.tangem.crypto.hdWallet.bip32.ExtendedPublicKey
|
|||
import com.tangem.domain.models.scan.CardDTO
|
||||
import com.tangem.domain.models.scan.ScanResponse
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
import com.tangem.domain.pay.WithdrawalSignatureResult
|
||||
import com.tangem.domain.visa.model.TangemPayInitialCredentials
|
||||
import com.tangem.domain.visa.model.VisaActivationInput
|
||||
import com.tangem.domain.visa.model.VisaDataForApprove
|
||||
|
|
@ -159,8 +161,13 @@ interface TangemSdkManager {
|
|||
visaDataForApprove: VisaDataForApprove,
|
||||
): CompletionResult<VisaSignedDataByCustomerWallet>
|
||||
|
||||
suspend fun tangemPayProduceInitialCredentials(cardId: String): CompletionResult<TangemPayInitialCredentials>
|
||||
suspend fun tangemPayProduceInitialCredentials(
|
||||
preflightReadFilter: PreflightReadFilter,
|
||||
): Either<Throwable, TangemPayInitialCredentials>
|
||||
|
||||
suspend fun getWithdrawalSignature(cardId: String, hash: String): CompletionResult<String>
|
||||
suspend fun getWithdrawalSignature(
|
||||
hash: String,
|
||||
preflightReadFilter: PreflightReadFilter,
|
||||
): Either<Throwable, WithdrawalSignatureResult>
|
||||
// endregion
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue