Updated on 2026-08-14
This commit is contained in:
parent
8aa6ce0100
commit
eaf587e7b8
12 changed files with 85 additions and 32 deletions
|
|
@ -4,6 +4,8 @@ import android.net.Uri
|
|||
import androidx.core.text.isDigitsOnly
|
||||
import com.tangem.blockchain.blockchains.near.NearWalletManager
|
||||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.NameResolver
|
||||
import com.tangem.blockchain.common.ResolveAddressResult
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.transaction.WalletAddressServiceRepository
|
||||
|
|
@ -20,6 +22,28 @@ class DefaultWalletAddressServiceRepository(
|
|||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
) : WalletAddressServiceRepository {
|
||||
|
||||
override suspend fun resolveAddress(
|
||||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
address: String,
|
||||
): ResolveAddressResult {
|
||||
return withContext(dispatchers.io) {
|
||||
val blockchain = network.toBlockchain()
|
||||
|
||||
val walletManager = walletManagersFacade.getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
derivationPath = network.derivationPath.value,
|
||||
)
|
||||
|
||||
if (walletManager is NameResolver) {
|
||||
walletManager.resolve(address)
|
||||
} else {
|
||||
ResolveAddressResult.NotSupported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun validateAddress(userWalletId: UserWalletId, network: Network, address: String): Boolean =
|
||||
withContext(dispatchers.io) {
|
||||
val blockchain = network.toBlockchain()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue