diff --git a/src/api/pmset.ts b/src/api/pmset.ts index ce2460f..3d6b83d 100644 --- a/src/api/pmset.ts +++ b/src/api/pmset.ts @@ -199,3 +199,24 @@ export async function getWithdrawConfig( return get('/pmset/getWithdrawConfig', undefined, config) } +/** 充值配置(GET /pmset/getDepositConfig) */ +export interface DepositConfig { + /** 最小到账金额,最小精度整数(1U=1e6;系统参数配置口径 1=1U,默认 10) */ + minDepositAmount: number +} + +export interface DepositConfigResponse extends ApiResponse { + code: number + data?: DepositConfig + msg: string +} + +/** + * GET /pmset/getDepositConfig + * 获取最小到账金额(系统参数 minDepositAmount,配置 1=1U,默认 10;缺失自动插入) + */ +export async function getDepositConfig( + config?: { headers?: Record }, +): Promise { + return get('/pmset/getDepositConfig', undefined, config) +} diff --git a/src/components/DepositDialog.vue b/src/components/DepositDialog.vue index 59472fb..db44f31 100644 --- a/src/components/DepositDialog.vue +++ b/src/components/DepositDialog.vue @@ -126,6 +126,7 @@ @update:model-value="onDepositNetworkChange" />

{{ t('deposit.supportedTip') }}

+

{{ t('deposit.minArrivalAmount', { amount: minDepositDisplay }) }}

{{ t('deposit.depositAddress') }} @@ -214,6 +215,7 @@ @update:model-value="onDepositNetworkChange" />

{{ t('deposit.metamaskSendHint') }}

+

{{ t('deposit.minArrivalAmount', { amount: minDepositDisplay }) }}

amountToUsdcDisplay(minDepositRaw.value)) + +async function loadDepositConfig() { + try { + const res = await getDepositConfig() + if (res.code === 0 || res.code === 200) { + const raw = Number(res.data?.minDepositAmount ?? 0) + minDepositRaw.value = Number.isFinite(raw) && raw > 0 ? raw : 10_000_000 + return + } + } catch (e) { + console.error('[loadDepositConfig]', e) + } + minDepositRaw.value = 10_000_000 +} const depositFooterWalletBtnRef = ref(null) const depositFooterCollectBtnRef = ref(null) @@ -926,6 +945,10 @@ async function sendUsdcViaMetaMask() { metamaskSendError.value = t('deposit.invalidAmount') return } + if (amountWei < BigInt(minDepositRaw.value)) { + metamaskSendError.value = t('deposit.belowMinArrivalAmount', { amount: minDepositDisplay.value }) + return + } if (!USDC_ADDRESS_BY_CHAIN[selectedNetwork.value]) { metamaskSendError.value = t('deposit.networkConfigError') return @@ -1005,6 +1028,7 @@ watch( metamaskSendError.value = '' stopDepositCheck() } else { + void loadDepositConfig() if (step.value === 'crypto') fetchAddress() } }, @@ -1127,6 +1151,13 @@ onUnmounted(() => { padding-bottom: 0; align-items: center; } +.crypto-min-amount-tip { + margin: 0 0 12px; + font-size: 0.8125rem; + font-weight: 500; + color: #374151; + line-height: 1.4; +} .crypto-support-tip { font-size: 0.75rem; font-weight: 500; diff --git a/src/locales/en.json b/src/locales/en.json index 9e654d6..480efa3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -494,7 +494,9 @@ "txConfirmTimeout": "Transaction was submitted but not confirmed in time. Check it in your wallet or a block explorer.", "walletRpcIncomplete": "Your wallet returned incomplete transaction data. If issues persist, update MetaMask or change the RPC.", "depositHistory": "Deposit History", - "depositStatusAll": "All" + "depositStatusAll": "All", + "minArrivalAmount": "Minimum credit amount: {amount} USDC", + "belowMinArrivalAmount": "Deposit amount must be at least {amount} USDC" }, "withdraw": { "title": "Withdraw", @@ -548,4 +550,4 @@ "ja": "日本語", "ko": "한국어" } -} +} \ No newline at end of file diff --git a/src/locales/ja.json b/src/locales/ja.json index 39facc2..b109c7d 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -494,7 +494,9 @@ "txConfirmTimeout": "トランザクションは送信されましたが、一定時間内に確認されませんでした。ウォレットまたはブロックエクスプローラーでご確認ください。", "walletRpcIncomplete": "ウォレットから返ったトランザクション情報が不完全です。MetaMask の更新や RPC の変更をお試しください。", "depositHistory": "入金履歴", - "depositStatusAll": "すべて" + "depositStatusAll": "すべて", + "minArrivalAmount": "最小着金金額:{amount} USDC", + "belowMinArrivalAmount": "入金額は {amount} USDC 以上である必要があります" }, "withdraw": { "title": "出金", @@ -548,4 +550,4 @@ "ja": "日本語", "ko": "한국어" } -} +} \ No newline at end of file diff --git a/src/locales/ko.json b/src/locales/ko.json index 75dd607..8c118b5 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -494,7 +494,9 @@ "txConfirmTimeout": "거래는 제출되었지만 제한 시간 안에 확인되지 않았습니다. 지갑이나 블록 탐색기에서 확인해 주세요.", "walletRpcIncomplete": "지갑에서 반환된 거래 데이터가 불완전합니다. MetaMask를 업데이트하거나 RPC를 변경해 보세요.", "depositHistory": "입금 내역", - "depositStatusAll": "전체" + "depositStatusAll": "전체", + "minArrivalAmount": "최소 입금 금액: {amount} USDC", + "belowMinArrivalAmount": "입금 금액은 최소 {amount} USDC 이상이어야 합니다" }, "withdraw": { "title": "출금", @@ -548,4 +550,4 @@ "ja": "日本語", "ko": "한국어" } -} +} \ No newline at end of file diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index f871dee..29b6201 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -494,7 +494,9 @@ "txConfirmTimeout": "交易已提交,但长时间未在链上确认,请在浏览器钱包或区块浏览器中查看该笔交易。", "walletRpcIncomplete": "钱包返回的交易数据不完整。已改为直连接口发交易;若仍失败请更新 MetaMask 或更换 RPC。", "depositHistory": "充值历史", - "depositStatusAll": "全部" + "depositStatusAll": "全部", + "minArrivalAmount": "最小到账金额:{amount} USDC", + "belowMinArrivalAmount": "充值金额不能低于 {amount} USDC" }, "withdraw": { "title": "提现", @@ -561,4 +563,4 @@ "ja": "日本語", "ko": "한국어" } -} +} \ No newline at end of file diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index 8a76d5e..fed6d3a 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -494,7 +494,9 @@ "txConfirmTimeout": "交易已提交,但長時間未在鏈上確認,請在瀏覽器錢包或區塊瀏覽器中查看該筆交易。", "walletRpcIncomplete": "錢包回傳的交易資料不完整。已改為直接介面發送;若仍失敗請更新 MetaMask 或更換 RPC。", "depositHistory": "充值歷史", - "depositStatusAll": "全部" + "depositStatusAll": "全部", + "minArrivalAmount": "最小到帳金額:{amount} USDC", + "belowMinArrivalAmount": "充值金額不能低於 {amount} USDC" }, "withdraw": { "title": "提現",