diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json
index 0d03819e612c..85332c1395e8 100644
--- a/packages/mask/shared-ui/locales/en-US.json
+++ b/packages/mask/shared-ui/locales/en-US.json
@@ -633,6 +633,7 @@
"plugin_collectible_no_history": "No History",
"plugin_collectible_ensure_unreviewed_item": "Please ensure unreviewed item",
"plugin_collectible_check_tos_document": "Please check ToS document",
+ "plugin_collectible_insufficient_offer": "Insufficient Offer",
"plugin_collectible_not_been_reviewed_by_opensea": "This item has not been reviewed by OpenSea.",
"plugin_collectible_reviewed_tips": "You should proceed with extra caution. Anyone can create a digital item on a blockchain with any\n name, including fake versions of existing items. Please take extra caution and do your research\n when interacting with this item to ensure it's what it chains to be.",
"plugin_collectible_total": "Total",
diff --git a/packages/mask/shared-ui/locales/zh-CN.json b/packages/mask/shared-ui/locales/zh-CN.json
index c607ffe93c87..34f887f0ca75 100644
--- a/packages/mask/shared-ui/locales/zh-CN.json
+++ b/packages/mask/shared-ui/locales/zh-CN.json
@@ -620,6 +620,7 @@
"plugin_collectible_no_history": "无历史记录",
"plugin_collectible_ensure_unreviewed_item": "请确保未经审核的收藏品",
"plugin_collectible_check_tos_document": "请查阅 ToS 文档",
+ "plugin_collectible_insufficient_offer": "报价不足",
"plugin_collectible_not_been_reviewed_by_opensea": "此收藏品尚未经 OpenSea 审查。",
"plugin_collectible_reviewed_tips": "你需要格外谨慎。 任何人都可以在区块链上创建一个带有任何名称的收藏品。 包括现有收藏品的假版本。 请在与这个收藏品交互时格外小心并进行研究,以确保它是您想要的收藏品。",
"plugin_collectible_total": "总共",
diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/MakeOfferDialog.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/MakeOfferDialog.tsx
index 6151bb1fde52..18ea02667f03 100644
--- a/packages/mask/src/plugins/Collectible/SNSAdaptor/MakeOfferDialog.tsx
+++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/MakeOfferDialog.tsx
@@ -35,6 +35,7 @@ import { toAsset } from '../helpers'
import { PluginTraderMessages } from '../../Trader/messages'
import { Trans } from 'react-i18next'
import getUnixTime from 'date-fns/getUnixTime'
+import { rightShift, ZERO } from '@masknet/web3-shared-base/utils/number'
const useStyles = makeStyles()((theme) => {
return {
@@ -74,6 +75,9 @@ export function MakeOfferDialog(props: MakeOfferDialogProps) {
const { asset, open, onClose } = props
const isAuction = asset?.value?.is_auction ?? false
const isVerified = asset?.value?.is_verified ?? false
+ const leastPrice =
+ asset?.value && asset.value.orders?.length ? new BigNumber(asset.value.orders[0].base_price ?? '0') : ZERO
+
const paymentTokens = (isAuction ? asset?.value?.offer_payment_tokens : asset?.value?.order_payment_tokens) ?? []
const selectedPaymentToken = first(paymentTokens)
@@ -114,14 +118,17 @@ export function MakeOfferDialog(props: MakeOfferDialogProps) {
}, [open])
const validationMessage = useMemo(() => {
- const amount_ = new BigNumber(amount || '0')
+ const amount_ = rightShift(amount, token.value?.decimals)
const balance_ = new BigNumber(balance.value ?? '0')
- if (amount_.isZero()) return t('plugin_collectible_enter_a_price')
+ if (amount_.isNaN() || amount_.isZero()) return t('plugin_collectible_enter_a_price')
if (balance_.isZero() || amount_.isGreaterThan(balance_)) return t('plugin_collectible_insufficient_balance')
if (!isAuction && expirationDateTime.getTime() - Date.now() <= 0)
return t('plugin_collectible_invalid_expiration_date')
if (!isVerified && !unreviewedChecked) return t('plugin_collectible_ensure_unreviewed_item')
- if (!isVerified && !ToS_Checked) return t('plugin_collectible_check_tos_document')
+ if (!ToS_Checked) return t('plugin_collectible_check_tos_document')
+ if (leastPrice.isGreaterThan(amount_)) {
+ return t('plugin_collectible_insufficient_offer')
+ }
return ''
}, [amount, balance.value, expirationDateTime, isVerified, isAuction, unreviewedChecked, ToS_Checked])
@@ -155,6 +162,7 @@ export function MakeOfferDialog(props: MakeOfferDialogProps) {
whitelist: paymentTokens.map((x) => x.address),
}}
/>
+
{!isAuction ? (
) : null}
-
- {isVerified ? null : (
- <>
- ) =>
- setUnreviewedChecked(ev.target.checked)
- }
- />
- }
- label={
-
- {t('plugin_collectible_approved_by_open_sea')}
-
- }
- />
- ) =>
- setToS_Checked(ev.target.checked)
- }
- />
- }
- label={
-
-
- ),
- }}
+ ) => setToS_Checked(ev.target.checked)}
+ />
+ }
+ label={
+
+
-
+ ),
+ }}
+ />
+
+ }
+ />
+ {isVerified ? null : (
+ ) =>
+ setUnreviewedChecked(ev.target.checked)
}
/>
- >
- )}
-
+ }
+ label={
+
+ {t('plugin_collectible_approved_by_open_sea')}
+
+ }
+ />
+ )}
diff --git a/packages/mask/src/plugins/Collectible/types/opensea.ts b/packages/mask/src/plugins/Collectible/types/opensea.ts
index c9036f6984bf..a0af4e48e4de 100644
--- a/packages/mask/src/plugins/Collectible/types/opensea.ts
+++ b/packages/mask/src/plugins/Collectible/types/opensea.ts
@@ -188,6 +188,7 @@ export interface AssetOrder {
quantity: string
expiration_time: number
order_hash: string
+ base_price?: string
}
export interface OpenSeaResponse extends Asset {