diff --git a/src/components/gateway/WithdrawForm.vue b/src/components/gateway/WithdrawForm.vue index 54fedbb8..941acd2f 100644 --- a/src/components/gateway/WithdrawForm.vue +++ b/src/components/gateway/WithdrawForm.vue @@ -33,9 +33,14 @@
{{ $t('components.gateway.withdraw_form_modal.balance') }} {{ balance | tokenAmount(tokenInfo.decimals)}} {{ token }}
-
+
+ {{ $t('components.gateway.withdraw_form_modal.daily_withdrawal_limit_reached') }} + {{ maxPerAccountDailyWithdrawalAmount | tokenAmount(tokenInfo.decimals) }} {{ token }} +
+
{{ $t('components.gateway.withdraw_form_modal.daily_remaining_withdraw_amount') }} - {{ dailyRemainingWithdrawAmount | tokenAmount(tokenInfo.decimals) }} {{ token }} + {{ dailyRemainingWithdrawAmount | tokenAmount(tokenInfo.decimals) }} / + {{ maxPerAccountDailyWithdrawalAmount | tokenAmount(tokenInfo.decimals) }} {{ token }}
{{ $t('components.gateway.withdraw_form_modal.withdraw') }} @@ -104,6 +109,7 @@ export default class WithdrawForm extends Vue { isValidAddress: boolean = false recepient = "" dailyRemainingWithdrawAmount: BN = ZERO + maxPerAccountDailyWithdrawalAmount: BN = ZERO tokenInfo: TokenData | null = null @@ -173,6 +179,10 @@ export default class WithdrawForm extends Vue { this.visible = false } + get reachedLimit() { + return this.isWithdrawalLimitEnabled && this.dailyRemainingWithdrawAmount.lte(new BN(0)) + } + setAmountIsError(isError: boolean) { this.amountIsValid = !isError } @@ -211,10 +221,9 @@ export default class WithdrawForm extends Vue { if (lastWithdrawalLimitResetDate.toDateString() !== todayDate.toDateString()) { totalWithdrawalAmount = new BN(0) } - const gatewayState = await gateway.getGatewayState() - const maxPerAccountDailyWithdrawalAmount: BN = gatewayState!.maxPerAccountDailyWithdrawalAmount - const remainingWithdrawAmount = maxPerAccountDailyWithdrawalAmount.sub(totalWithdrawalAmount) + this.maxPerAccountDailyWithdrawalAmount = gatewayState!.maxPerAccountDailyWithdrawalAmount + const remainingWithdrawAmount = this.maxPerAccountDailyWithdrawalAmount.sub(totalWithdrawalAmount) console.log("remainingWithdrawAmount: ", remainingWithdrawAmount.toString()) return remainingWithdrawAmount diff --git a/src/locales/en.json b/src/locales/en.json index 2c9c74c6..7a53467b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -578,6 +578,7 @@ "transfer_fee": "Transfer to {chain} requires a fee of ", "balance": "Your balance : ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "Recipient on {chain}", "withdraw": "Withdraw" } @@ -884,6 +885,8 @@ "could_not_deposit_eth": "Could not deposit ETH, please make sure you pay enough gas for the transaction.", "deposit_approval_failed": "Deposit approval failed.", "withdraw_failed": "Withdraw failed, please try again or contact support.", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "The supplied key is already mapped.", "unexpected_error_while_add_account": "Unexpected error while adding account mapping.", "balance_not_enough": "Your balance isn't enough. Please deposit first.", diff --git a/src/locales/es.json b/src/locales/es.json index 99a202a0..2920a57e 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -523,6 +523,7 @@ "transfer_fee": "Transfer to {chain} requires a fee of ", "balance": "Your balance : ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "Recipient on {chain}", "withdraw": "Withdraw" } @@ -829,6 +830,8 @@ "could_not_deposit_eth": "Could not deposit ETH, please make sure you pay enough gas for the transaction.", "deposit_approval_failed": "Deposit approval failed.", "withdraw_failed": "Withdraw failed, please try again or contact support.", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "The supplied key is already mapped.", "unexpected_error_while_add_account": "Unexpected error while adding account mapping.", "balance_not_enough": "Your balance isn't enough. Please deposit first.", diff --git a/src/locales/ja.json b/src/locales/ja.json index 4315ea12..6526f30c 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -523,6 +523,7 @@ "transfer_fee": "Transfer to {chain} requires a fee of ", "balance": "Your balance : ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "Recipient on {chain}", "withdraw": "Withdraw" } @@ -829,6 +830,8 @@ "could_not_deposit_eth": "Could not deposit ETH, please make sure you pay enough gas for the transaction.", "deposit_approval_failed": "Deposit approval failed.", "withdraw_failed": "Withdraw failed, please try again or contact support.", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "The supplied key is already mapped.", "unexpected_error_while_add_account": "Unexpected error while adding account mapping.", "balance_not_enough": "Your balance isn't enough. Please deposit first.", diff --git a/src/locales/ko.json b/src/locales/ko.json index 9d16e703..f605d40e 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -523,6 +523,7 @@ "transfer_fee": "{chain}으로 전송하려면 수수료가 필요합니다.", "balance": "당신의 잔액 : ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "{chain} 상의 수신자", "withdraw": "출금" } @@ -829,6 +830,8 @@ "could_not_deposit_eth": "ETH를 입금할 수 없습니다. 트랜잭션 처리에 충분한 가스 수수료를 지불했는지 확인하세요.", "deposit_approval_failed": "입금 승인 실패", "withdraw_failed": "출금에 실패하였습니다. 다시 시도하거나 고객센터에 문의하세요.", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "제공된 키가 이미 매핑되었습니다.", "unexpected_error_while_add_account": "계정 매핑을 추가하던 중 예상치 못한 오류가 발생했습니다.", "balance_not_enough": "잔액이 충분하지 않습니다. 먼저 자금을 입금하세요.", diff --git a/src/locales/th.json b/src/locales/th.json index dc626136..95e5da47 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -523,6 +523,7 @@ "transfer_fee": "Transfer to {chain} requires a fee of ", "balance": "Your balance : ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "Recipient on {chain}", "withdraw": "Withdraw" } @@ -829,6 +830,8 @@ "could_not_deposit_eth": "Could not deposit ETH, please make sure you pay enough gas for the transaction.", "deposit_approval_failed": "Deposit approval failed.", "withdraw_failed": "Withdraw failed, please try again or contact support.", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "The supplied key is already mapped.", "unexpected_error_while_add_account": "Unexpected error while adding account mapping.", "balance_not_enough": "Your balance isn't enough. Please deposit first.", diff --git a/src/locales/zh.json b/src/locales/zh.json index f2ba552c..29fe82ae 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -523,6 +523,7 @@ "transfer_fee": "转移到 {chain} 需要手续费 ", "balance": "你的余额: ", "daily_remaining_withdraw_amount": "Daily remaining withdraw amount: ", + "daily_withdrawal_limit_reached": "Daily withdrawal limit reached", "recipient": "{chain} 上的接受者", "withdraw": "提取" } @@ -829,6 +830,8 @@ "could_not_deposit_eth": "不能存入 ETH,请确认为此事务支付足够的 gas 费。", "deposit_approval_failed": "存入批准失败。", "withdraw_failed": "提取出错,请重试或联系客服。", + "withdraw_failed_total_limit_reached": "Total daily withdrawal limit has been reached, please try again tomorrow.", + "withdraw_failed_account_limit_reached": "Account daily withdrawal limit has been reached, please try again tomorrow.", "supplied_key_already_mapped": "提供的密钥已映射。", "unexpected_error_while_add_account": "添加账户映射时出现意外错误。", "balance_not_enough": "你的余额不足。请先存入一些。", diff --git a/src/store/gateway/plasma.ts b/src/store/gateway/plasma.ts index 2b23debc..257b46e4 100644 --- a/src/store/gateway/plasma.ts +++ b/src/store/gateway/plasma.ts @@ -334,7 +334,13 @@ export async function plasmaWithdraw(context: ActionContext, funds: Funds) { return } feedback.endTask() - feedback.showError(i18n.t("feedback_msg.error.withdraw_failed").toString()) + if (error.message.includes("TG024")) { + feedback.showError(i18n.t("feedback_msg.error.withdraw_failed_total_limit_reached").toString()) + } else if (error.message.includes("TG025")) { + feedback.showError(i18n.t("feedback_msg.error.withdraw_failed_account_limit_reached").toString()) + } else { + feedback.showError(i18n.t("feedback_msg.error.withdraw_failed").toString()) + } Sentry.withScope((scope) => { scope.setExtra("plasmaWithdraw", { withdraw: JSON.stringify({