Updated on 2026-08-14
This commit is contained in:
parent
c68cf7165b
commit
39a190f056
22 changed files with 378 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ 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.blockchain.common.ReverseResolveAddressResult
|
||||
import com.tangem.blockchainsdk.utils.toBlockchain
|
||||
import com.tangem.domain.models.network.Network
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
|
@ -22,6 +23,40 @@ class DefaultWalletAddressServiceRepository(
|
|||
private val dispatchers: CoroutineDispatcherProvider,
|
||||
) : WalletAddressServiceRepository {
|
||||
|
||||
override suspend fun getEns(userWalletId: UserWalletId, network: Network, address: String): String? {
|
||||
return withContext(dispatchers.io) {
|
||||
val blockchain = network.toBlockchain()
|
||||
val walletManager = walletManagersFacade.getOrCreateWalletManager(
|
||||
userWalletId = userWalletId,
|
||||
blockchain = blockchain,
|
||||
derivationPath = network.derivationPath.value,
|
||||
)
|
||||
walletManager?.wallet?.ens
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun reverseResolveAddress(
|
||||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
address: String,
|
||||
): ReverseResolveAddressResult {
|
||||
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.reverseResolve(address.toByteArray())
|
||||
} else {
|
||||
ReverseResolveAddressResult.NotSupported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun resolveAddress(
|
||||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue