Skip to content

Include and validate the fees with the amount #4154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions packages/playground/src/components/withdraw_dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
<v-card>
<v-card-title class="bg-primary"> Withdraw TFT </v-card-title>
<v-card-text>
Interact with the bridge in order to withdraw your TFT to
{{ selectedName?.charAt(0).toUpperCase() + selectedName!.slice(1) }} (withdraw fee is: {{ withdrawFee }} TFT)
<VAlert type="info" class="mb-5">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we decrease the margin here please?
image

Interact with the bridge in order to withdraw your TFT to
{{ selectedName?.charAt(0).toUpperCase() + selectedName!.slice(1) }} (withdraw fee is:
{{ withdrawFee }} TFT)
</VAlert>
</v-card-text>
<v-card-text>
<FormValidator v-model="valid">
Expand All @@ -35,7 +38,7 @@
:rules="[
validators.required('This field is required'),
validators.min('Amount should be at least 2 TFT', 2),
validators.max( 'Amount cannot exceed balance',freeBalance!),
validators.max('Amount cannot exceed balance with fees',freeBalance! - withdrawFee!),
validators.isValidDecimalNumber(3,'Amount must have 3 decimals only')
]"
>
Expand Down Expand Up @@ -124,10 +127,11 @@ async function validateAddress() {
}

async function withdrawTFT(targetAddress: string, withdrawAmount: number) {
if (!props.withdrawFee) return;
loadingWithdraw.value = true;
try {
updateGrid(grid, { projectName: "" });
await grid?.bridge.swapToStellar({ amount: +withdrawAmount, target: targetAddress });
await grid?.bridge.swapToStellar({ amount: +withdrawAmount + props.withdrawFee, target: targetAddress });

await ProfileManagerController.reloadBalance();
createCustomToast("Transaction Succeeded", ToastType.success);
Expand Down
Loading