Skip to content

Commit c56cc90

Browse files
authored
Merge pull request #1179 from soramitsu/flw-4636-bridges_2
added Liberland, Acala and Astar with Sora bridges
2 parents 094798d + 17f9868 commit c56cc90

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

common/src/main/res/values/strings.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
<string name="common_assets_filters_fiat">Fiat balance</string>
163163
<string name="common_assets_filters_name">Name</string>
164164
<string name="common_assets_filters_popularity">Popularity</string>
165+
<string name="common_attention">Attention</string>
165166
<string name="common_available_format">Available: %s</string>
166167
<string name="common_available_networks">Available networks</string>
167168
<string name="common_backup_your_wallet">Wallet backup</string>
@@ -759,6 +760,7 @@
759760
<string name="social_media">Social Media</string>
760761
<string name="sora_bridge_amount_less_fee">The amount you\'re trying to transfer is insufficient to cover the transaction fees on the %s network. Although the transaction won\'t process, you\'ll still be charged the fees on the Sora network.</string>
761762
<string name="sora_bridge_low_amount_format_alert">Currently, there\'s a min. amount %s for bridging to ensure the stability and security of the SORA Network. We appreciate your understanding.</string>
763+
<string name="sora_bridge_low_amount_format_alert_2">Currently, there\'s a min. amount %s for bridging to ensure the stability and security. We appreciate your understanding.</string>
762764
<string name="sora_card_annual_service_fee">€0 annual service fee</string>
763765
<string name="sora_card_blacklisted_countires_title">Excluded of application</string>
764766
<string name="sora_card_blacklisted_countires_warning"><![CDATA[Residents from <b>certain countries<br>can not apply</b> for SORA Card at this moment<br><a href=\"https://soracard.com/blacklist/\">See the list</a>]]></string>
@@ -1145,4 +1147,4 @@
11451147
<string name="what_accounts_for_export">What accounts in the wallet do you want to export?</string>
11461148
<string name="yesterday">Yesterday</string>
11471149
<string name="your_collator">Your collator</string>
1148-
</resources>
1150+
</resources>

feature-wallet-impl/src/main/java/jp/co/soramitsu/wallet/impl/domain/XcmInteractor.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ class XcmInteractor(
151151
}.getOrNull()
152152
}
153153

154+
suspend fun getAmountMinLimit(originChainId: ChainId, destinationChainId: ChainId, asset: Asset) =
155+
xcmService.getAmountMinLimit(originChainId, destinationChainId, asset)
156+
154157
private fun Asset.getPlanksFromAmountForOriginFee(amount: BigDecimal): BigInteger {
155158
val rawAmountInPlanks = planksFromAmount(amount)
156159
if (rawAmountInPlanks == BigInteger.ZERO) {

feature-wallet-impl/src/main/java/jp/co/soramitsu/wallet/impl/presentation/cross_chain/setup/CrossChainSetupViewModel.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,21 @@ class CrossChainSetupViewModel @Inject constructor(
514514
val fee = originFeeInPlanksFlow.value
515515
val destinationFeeAmount = destinationFeeAmountFlow.value ?: BigDecimal.ZERO
516516

517+
val minLimit = xcmInteractor.getAmountMinLimit(
518+
requireNotNull(originChainId),
519+
requireNotNull(destinationChainId),
520+
asset.token.configuration
521+
)
522+
523+
if(amount < minLimit && minLimit != BigDecimal.ZERO) {
524+
showError(
525+
title = resourceManager.getString(R.string.common_attention),
526+
message = resourceManager.getString(R.string.sora_bridge_low_amount_format_alert_2, minLimit.formatCrypto(asset.token.configuration.symbol) ),
527+
negativeButtonText = resourceManager.getString(R.string.common_cancel)
528+
)
529+
return@launch
530+
}
531+
517532
val destinationChainId = chainAssetsManager.destinationChainId ?: return@launch
518533
val validationProcessResult = validateTransferUseCase(
519534
amountInPlanks = inPlanks,

0 commit comments

Comments
 (0)