diff --git a/src/locales/en/common.json b/src/locales/en/common.json index 100731d19..af157311e 100644 --- a/src/locales/en/common.json +++ b/src/locales/en/common.json @@ -95,5 +95,6 @@ "ph": "Tagalog", "cb": "Cebuano" }, - "noResults": "No results found" + "noResults": "No results found", + "minSendAmount": "Minimum amount that can be sent." } diff --git a/src/views/Send/Send.vue b/src/views/Send/Send.vue index 097cc7616..52983dced 100644 --- a/src/views/Send/Send.vue +++ b/src/views/Send/Send.vue @@ -18,9 +18,10 @@ :amount="amount" :account="account" :amount-fiat="amountFiat" + :minimum-send-amount="minimumAssetSendAmount" @update:amount="(newAmount) => (amount = newAmount)" @toggle-max="toggleMaxAmount" - @update:amountFiat="(amount) => (amountFiat = amount)" + @update:amountFiat="updateSendAmount" :max="available" :available="available" :max-fiat="prettyFiatBalance(available, fiatRates[asset])" @@ -128,7 +129,7 @@ class="btn btn-primary btn-lg" id="send_review_button" @click="review" - :disabled="!canSend" + :disabled="!canSend || !isValidSendAmount" > {{ $t('common.review') }} @@ -323,7 +324,10 @@ export default { memo: '', updatingFees: false, domainData: {}, - domainResolver: null + domainResolver: null, + minimumAssetsSendAmounts: { + SOL: 0.0015 + } } }, mounted() { @@ -343,17 +347,20 @@ export default { networkWalletBalances() { return this.account?.balances }, + minimumAssetSendAmount() { + return this.minimumAssetsSendAmounts[this.asset] || 0 + }, + isValidSendAmount() { + return this.stateAmount >= this.minimumAssetSendAmount + }, amount: { get() { return this.stateAmount }, set(newValue) { - if (newValue && !isNaN(newValue)) { - this.stateAmount = newValue - } else { - this.stateAmount = 0.0 - } - this.stateAmountFiat = prettyFiatBalance(this.stateAmount, this.fiatRates[this.asset]) + this.$nextTick(() => { + this.updateSendAmount(newValue) + }) } }, amountFiat: { @@ -524,6 +531,14 @@ export default { getAssetIcon, getAssetColorStyle, shortenAddress, + updateSendAmount(newValue) { + if (newValue && !isNaN(newValue)) { + this.stateAmount = newValue + } else { + this.stateAmount = this.minimumAssetSendAmount + } + this.stateAmountFiat = prettyFiatBalance(this.stateAmount, this.fiatRates[this.asset]) + }, async _updateSendFees(amount) { const sendFees = await getSendTxFees(this.account.id, this.asset, amount, this.customFee) if (amount === undefined) { @@ -725,6 +740,11 @@ export default { label: `${this.asset}` } }) + + // Set Asset minimum send Amount + this.$nextTick(() => { + this.stateAmount = this.minimumAssetSendAmount || 0.0 + }) }, watch: { selectedFee: { diff --git a/src/views/Send/SendInput.vue b/src/views/Send/SendInput.vue index dfc7b0fb3..09b4e6d39 100644 --- a/src/views/Send/SendInput.vue +++ b/src/views/Send/SendInput.vue @@ -66,8 +66,17 @@
{{ $t('common.available') }} - {{ isNaN(available) ? '0' : dpUI(available) || '0' }} {{ asset }} + {{ isNaN(available) ? '0' : dpUI(available) || '0' }}
{{ asset }}
+ +
+ {{ $t('common.minimum') }} + {{ minimumSendAmount }}
{{ asset }} +
+ +
@@ -117,7 +126,8 @@ export default { 'available', 'maxFiat', 'amountError', - 'maxActive' + 'maxActive', + 'minimumSendAmount' ], computed: { ...mapState(['fiatRates']) @@ -225,6 +235,10 @@ export default { text-transform: none; font-weight: $font-weight-light; font-size: $font-size-tiny; + + .capitalised { + text-transform: capitalize; + } } } }