Skip to content

Commit

Permalink
fix: fixed native asset required for send
Browse files Browse the repository at this point in the history
  • Loading branch information
bradleySuira committed Jan 13, 2023
1 parent 6b12671 commit 0b035fe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liquality-wallet",
"version": "0.83.0",
"version": "0.83.1",
"private": true,
"author": "Liquality <info@liquality.io>",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manifest_version": 2,
"version": "0.83.0",
"version": "0.83.1",
"name": "__MSG_appName__",
"description": "__MSG_appDesc__",
"default_locale": "en",
Expand Down
42 changes: 14 additions & 28 deletions src/views/Send/Send.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@
{{ $t('common.send') }}
</NavBar>
<InfoNotification v-if="nativeAssetRequired">
<EthRequiredMessage :account-id="account.id" :action="'send'" />
{{ $t('components.noFundsForNetworkFee.noEnoughAsset', { asset: assetChain }) }}
<router-link :to="accountUrl" class="btn btn-option get-bridgeAsset-btn">
{{ $t('common.get') }} {{ assetChain }}
</router-link>
</InfoNotification>
<InfoNotification v-else-if="!isValidSendAmount">
{{ `${$t('common.minSendAmount')} ${minimumAssetSendAmount} ${asset}` }}
</InfoNotification>
<InfoNotification v-else-if="!hasEnoughGasFee">
{{ $t('components.noFundsForNetworkFee.noEnoughAsset', { asset: nativeAsset }) }}
<router-link :to="accountUrl" class="btn btn-option get-bridgeAsset-btn">
{{ $t('common.get') }} {{ nativeAsset }}
</router-link>
</InfoNotification>
<div class="wrapper form">
<div class="wrapper_top">
<SendInput
Expand Down Expand Up @@ -296,7 +293,6 @@ import { UNSResolver } from '@liquality/wallet-core/dist/src/nameResolvers/uns'
import { errorToLiqualityErrorString } from '@liquality/error-parser/dist/src/utils'
import { reportLiqualityError } from '@liquality/error-parser/dist/src/reporters/index'
import InfoNotification from '@/components/InfoNotification'
import EthRequiredMessage from '@/components/EthRequiredMessage'
export default {
components: {
Expand All @@ -309,8 +305,7 @@ export default {
LedgerSignRequestModal,
CustomFees,
CustomFeesEIP1559,
InfoNotification,
EthRequiredMessage
InfoNotification
},
mixins: [ledgerConnectMixin],
data() {
Expand Down Expand Up @@ -357,22 +352,12 @@ export default {
...mapState(['activeNetwork', 'activeWalletId', 'fees', 'fiatRates']),
...mapGetters('app', ['ledgerBridgeReady']),
...mapGetters(['accountItem', 'client', 'suggestedFeePrices']),
nativeAsset() {
return this.getNativeAsset(this.asset)
},
accountUrl() {
return `/accounts/${this.accountId}/${this.nativeAsset}/receive`
},
account() {
return this.accountItem(this.accountId)
},
nativeAssetBalance() {
const balance = this.account.balances?.[this.nativeAsset] || 0
return new BN(balance)
},
hasEnoughGasFee() {
return this.nativeAssetBalance.gte(this.prettyFee)
},
networkWalletBalances() {
return this.account?.balances
},
Expand Down Expand Up @@ -489,12 +474,14 @@ export default {
return true
}
const nativeAssetBalance = this.networkWalletBalances[this.assetChain]
if (
!nativeAssetBalance ||
BN(nativeAssetBalance).lte(0) ||
BN(nativeAssetBalance).minus(BN(this.currentFee)).lte(0)
) {
const balance = this.networkWalletBalances[this.assetChain]
if (!balance) {
return true
}
const nativeAssetBalance = unitToCurrency(cryptoassets[this.assetChain], BN(balance))
if (nativeAssetBalance.lte(0) || nativeAssetBalance.minus(BN(this.currentFee)).lte(0)) {
return true
}
return false
Expand All @@ -506,8 +493,7 @@ export default {
!this.addressError &&
BN(this.amount).gte(BN(this.minimumAssetSendAmount)) &&
BN(this.amount).gt(0) &&
!this.amountError &&
this.hasEnoughGasFee
!this.amountError
) {
return true
}
Expand Down

0 comments on commit 0b035fe

Please sign in to comment.