Updated on 2026-08-14
This commit is contained in:
commit
8eb1a28f29
236 changed files with 3852 additions and 2068 deletions
|
|
@ -169,6 +169,8 @@ fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? {
|
|||
"hyperevm/test" -> Blockchain.HyperliquidTestnet
|
||||
"quai-network" -> Blockchain.Quai
|
||||
"quai-network/test" -> Blockchain.QuaiTestnet
|
||||
"linea" -> Blockchain.Linea
|
||||
"linea/test" -> Blockchain.LineaTestnet
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
@ -335,6 +337,8 @@ fun Blockchain.toNetworkId(): String {
|
|||
Blockchain.HyperliquidTestnet -> "hyperevm/test"
|
||||
Blockchain.Quai -> "quai-network"
|
||||
Blockchain.QuaiTestnet -> "quai-network/test"
|
||||
Blockchain.Linea -> "linea"
|
||||
Blockchain.LineaTestnet -> "linea/test"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -440,6 +444,7 @@ fun Blockchain.toCoinId(): String {
|
|||
Blockchain.Pepecoin, Blockchain.PepecoinTestnet -> "pepecoin-network"
|
||||
Blockchain.Hyperliquid, Blockchain.HyperliquidTestnet -> "hyperliquid"
|
||||
Blockchain.Quai, Blockchain.QuaiTestnet -> "quai-network"
|
||||
Blockchain.Linea, Blockchain.LineaTestnet -> "linea"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.lib.crypto.derivation
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.isUTXO
|
||||
import com.tangem.crypto.hdWallet.DerivationPath
|
||||
import com.tangem.domain.models.network.Network
|
||||
|
||||
/**
|
||||
* Utility class to recognize the account node in a derivation path based on the blockchain type.
|
||||
|
|
@ -21,12 +22,21 @@ class AccountNodeRecognizer(blockchain: Blockchain) {
|
|||
NON_UTXO_BLOCKCHAIN_NODE_INDEX
|
||||
}
|
||||
|
||||
/** Recognizes the account node value from the given [derivationPath] */
|
||||
fun recognize(derivationPath: Network.DerivationPath): Long? {
|
||||
val derivationPathValue = derivationPath.value ?: return null
|
||||
|
||||
return recognize(derivationPathValue = derivationPathValue)
|
||||
}
|
||||
|
||||
/** Recognizes the account node value from the given derivation path string [derivationPathValue] */
|
||||
fun recognize(derivationPathValue: String): Long? {
|
||||
if (derivationPathValue.isBlank()) return null
|
||||
|
||||
return runCatching {
|
||||
recognize(derivationPath = DerivationPath(rawPath = derivationPathValue))
|
||||
}
|
||||
.getOrNull()
|
||||
val cardSdkDerivationPath = DerivationPath(rawPath = derivationPathValue)
|
||||
recognize(derivationPath = cardSdkDerivationPath)
|
||||
}.getOrNull()
|
||||
}
|
||||
|
||||
/** Recognizes the account node value from the given [derivationPath] */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue