diff --git a/wallet/build.gradle b/wallet/build.gradle index 1bc559f71f..65822d57e2 100644 --- a/wallet/build.gradle +++ b/wallet/build.gradle @@ -25,6 +25,9 @@ dependencies { implementation "androidx.room:room-runtime:2.2.5" annotationProcessor "androidx.room:room-compiler:2.2.5" api 'com.dogecoin:libdohj-core:0.15-SNAPSHOT' + implementation('com.unstoppabledomains:resolution:1.13.3') { + exclude group: 'org.bouncycastle' + } implementation 'com.lambdaworks:scrypt:1.4.0' implementation 'com.google.protobuf:protobuf-java:3.7.1' implementation 'com.google.guava:guava:29.0-android' diff --git a/wallet/src/de/schildbach/wallet/ui/send/SendCoinsFragment.java b/wallet/src/de/schildbach/wallet/ui/send/SendCoinsFragment.java index 254ed1b77b..09b59fae1d 100644 --- a/wallet/src/de/schildbach/wallet/ui/send/SendCoinsFragment.java +++ b/wallet/src/de/schildbach/wallet/ui/send/SendCoinsFragment.java @@ -56,6 +56,10 @@ import androidx.lifecycle.ViewModelProvider; import com.google.common.base.Joiner; import com.google.common.util.concurrent.ListenableFuture; +import com.unstoppabledomains.exceptions.ns.NamingServiceException; +import com.unstoppabledomains.resolution.DomainResolution; +import com.unstoppabledomains.resolution.Resolution; + import de.schildbach.wallet.Configuration; import de.schildbach.wallet.Constants; import de.schildbach.wallet.R; @@ -587,12 +591,17 @@ public boolean onOptionsItemSelected(final MenuItem item) { private void validateReceivingAddress() { try { - final String addressStr = receivingAddressView.getText().toString().trim(); + String addressStr = receivingAddressView.getText().toString().trim(); if (!addressStr.isEmpty()) { + String domain = ""; + if (addressStr.endsWith(".crypto")) { + DomainResolution resolution = new Resolution(); + domain = addressStr; + addressStr = resolution.getAddress(addressStr, "DOGE"); + } final Address address = Address.fromString(Constants.NETWORK_PARAMETERS, addressStr); final String label = addressBookDao.resolveLabel(address.toString()); - viewModel.validatedAddress = new AddressAndLabel(Constants.NETWORK_PARAMETERS, address.toString(), - label); + viewModel.validatedAddress = new AddressAndLabel(Constants.NETWORK_PARAMETERS, address.toString(), domain != "" ? domain : label); receivingAddressView.setText(null); log.info("Locked to valid address: {}", viewModel.validatedAddress); }