diff --git a/app/build.gradle b/app/build.gradle index 433a84d15c..cb0e83d439 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -71,7 +71,7 @@ dependencies { implementation 'com.google.android.material:material:1.2.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' - implementation 'com.tangem:blockchain:1.128.0' + implementation 'com.tangem:blockchain:1.130.0' implementation 'com.tangem:core:1.92.0' implementation 'com.tangem:sdk:1.92.0' diff --git a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt index 988613d3f1..ded3984926 100644 --- a/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt +++ b/app/src/main/java/com/tangem/tap/features/send/redux/middlewares/AddressPayIdMiddleware.kt @@ -110,7 +110,24 @@ internal class AddressPayIdMiddleware { } private fun verifyAddress(address: String, wallet: Wallet, isUserInput: Boolean, dispatch: (Action) -> Unit) { - val supposedAddress = extractAddressFromShareUri(address).removeNonAddressData() + val addressSchemeSplit = address.split(":") + val noSchemeAddress = when (addressSchemeSplit.size) { + 1 -> address // no scheme + 2 -> { // scheme + if (wallet.blockchain.validateShareScheme(addressSchemeSplit[0])) { + addressSchemeSplit[1] + } else { + dispatch(SetAddressError(Error.ADDRESS_INVALID_OR_UNSUPPORTED_BY_BLOCKCHAIN)) + return + } + } + else -> { // invalid URI + dispatch(SetAddressError(Error.ADDRESS_INVALID_OR_UNSUPPORTED_BY_BLOCKCHAIN)) + return + } + } + + val supposedAddress = noSchemeAddress.removeShareUriQuery() //TODO: parse query? val failReason = isValidBlockchainAddressAndNotTheSameAsWallet(wallet, supposedAddress) if (failReason == null) { @@ -141,7 +158,7 @@ internal class AddressPayIdMiddleware { return if (prefixes.isEmpty()) shareUri else shareUri.replace(prefixes[0], "") } - private fun String.removeNonAddressData(): String = this.substringBefore("?") + private fun String.removeShareUriQuery(): String = this.substringBefore("?") private fun verifyClipboard(input: String?, appState: AppState?, dispatch: DispatchFunction) { val addressPayId = input ?: return