Skip to content

Commit 2994033

Browse files
authored
Include and validate the fees with the amount (#4154)
* - Add alert as an info for the user - Validate the amount input with fees included - Send the fees with the amount when submit * Decrease space between the alert and the form
1 parent 70b7f24 commit 2994033

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/playground/src/components/withdraw_dialog.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
<v-card>
1010
<v-card-title class="bg-primary"> Withdraw TFT </v-card-title>
1111
<v-card-text>
12-
Interact with the bridge in order to withdraw your TFT to
13-
{{ selectedName?.charAt(0).toUpperCase() + selectedName!.slice(1) }} (withdraw fee is: {{ withdrawFee }} TFT)
12+
<VAlert type="info">
13+
Interact with the bridge in order to withdraw your TFT to
14+
{{ selectedName?.charAt(0).toUpperCase() + selectedName!.slice(1) }} (withdraw fee is:
15+
{{ withdrawFee }} TFT)
16+
</VAlert>
1417
</v-card-text>
1518
<v-card-text>
1619
<FormValidator v-model="valid">
@@ -35,7 +38,7 @@
3538
:rules="[
3639
validators.required('This field is required'),
3740
validators.min('Amount should be at least 2 TFT', 2),
38-
validators.max( 'Amount cannot exceed balance',freeBalance!),
41+
validators.max('Amount cannot exceed balance with fees',freeBalance! - withdrawFee!),
3942
validators.isValidDecimalNumber(3,'Amount must have 3 decimals only')
4043
]"
4144
>
@@ -124,10 +127,11 @@ async function validateAddress() {
124127
}
125128
126129
async function withdrawTFT(targetAddress: string, withdrawAmount: number) {
130+
if (!props.withdrawFee) return;
127131
loadingWithdraw.value = true;
128132
try {
129133
updateGrid(grid, { projectName: "" });
130-
await grid?.bridge.swapToStellar({ amount: +withdrawAmount, target: targetAddress });
134+
await grid?.bridge.swapToStellar({ amount: +withdrawAmount + props.withdrawFee, target: targetAddress });
131135
132136
await ProfileManagerController.reloadBalance();
133137
createCustomToast("Transaction Succeeded", ToastType.success);

0 commit comments

Comments
 (0)