Skip to content

Commit

Permalink
enhancement: displaying error when funds are insufficient to cover th…
Browse files Browse the repository at this point in the history
…e transfer fee
  • Loading branch information
dafuga committed Sep 2, 2023
1 parent d027cd9 commit 987c4d5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/pages/transfer/form.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import type {Asset as CoreAsset} from '@greymass/eosio'
import {Asset as CoreAsset} from '@greymass/eosio'
import {currentAccountBalance, evmAccount, activeSession} from '~/store'
import {Token, systemToken} from '~/stores/tokens'
Expand Down Expand Up @@ -73,6 +73,9 @@
}
}
}
$: balance = from?.name === 'EOS' ? $currentAccountBalance : evmBalance
$: availableToReceive = CoreAsset.from((balance?.value || 0) - (feeAmount?.value || 0), '4,EOS')
</script>

<style type="scss">
Expand Down Expand Up @@ -100,6 +103,7 @@
width: 44%; /* or set a flex-basis instead */
margin: 3%;
padding: 20px;
min-height: 220px;
button {
cursor: pointer;
Expand Down Expand Up @@ -168,11 +172,13 @@
<Asset
fluid
placeholder="0.0000"
balance={from?.name === 'EOS' ? $currentAccountBalance : evmBalance}
balance={availableToReceive}
bind:valid={validAmount}
bind:value={amount}
/>
<button on:click={useEntireBalance}>Entire Balance</button>
{#if from && to}
<button on:click={useEntireBalance}>Entire Balance</button>
{/if}
</div>
<div class="right-section">
<Label align="left">To</Label>
Expand Down

0 comments on commit 987c4d5

Please sign in to comment.