Updated on 2026-08-14

This commit is contained in:
Tangem 2022-07-11 18:52:03 +04:00
parent 39ee5c12e1
commit 5dff0e709c
2 changed files with 13 additions and 2 deletions

View file

@ -1,5 +1,6 @@
package com.tangem.domain.common.extensions
import com.tangem.blockchain.blockchains.bitcoincash.cashaddr.CashAddr
import com.tangem.blockchain.common.Blockchain
fun Blockchain.Companion.fromNetworkId(networkId: String): Blockchain? {
@ -104,4 +105,12 @@ fun Blockchain.toCoinId(): String {
Blockchain.Tron, Blockchain.TronTestnet -> "tron"
else -> "unknown"
}
}
fun Blockchain.removePrefixFromAddress(address: String): String {
return when (this) {
Blockchain.BitcoinCash -> address
.removePrefix(CashAddr.MAIN_NET_PREFIX).removePrefix(":")
else -> address
}
}