调整NFT市场
This commit is contained in:
parent
f565316323
commit
eb41990fef
|
|
@ -1298,7 +1298,12 @@
|
||||||
"1.NFT may not be traded or transferred at the time of sale": "1.NFT在出售挂单时不可进行交易或转让",
|
"1.NFT may not be traded or transferred at the time of sale": "1.NFT在出售挂单时不可进行交易或转让",
|
||||||
"2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee": "2.NFT出售成功后,平台将收取发布人收益的6%作为手续费",
|
"2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee": "2.NFT出售成功后,平台将收取发布人收益的6%作为手续费",
|
||||||
"order status": "订单状态",
|
"order status": "订单状态",
|
||||||
"Asking price": "起拍价格",
|
"Asking price%price%": "起拍价格%price%",
|
||||||
"Can't be less than %num%": "不能小于%num%",
|
"Can't be less than %num%": "不能小于%num%",
|
||||||
"They are in": "挂单中"
|
"The price is greater than %num%": "价格要大于%num%",
|
||||||
|
"They are in": "挂单中",
|
||||||
|
"In the sale": "售卖中",
|
||||||
|
"The purchase": "竞拍成功",
|
||||||
|
"The selling time cannot be less than %hour% hour": "出售时间不能小于%hour%小时",
|
||||||
|
"Did not take": "未拍中"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export default {
|
||||||
hccMarketplace: {
|
hccMarketplace: {
|
||||||
97: '0x91b9a998eedbb513f86b7d2a8efc01624a6d9636',
|
97: '0x91b9a998eedbb513f86b7d2a8efc01624a6d9636',
|
||||||
56: '0x75c6c866f9f4ba6d0cad39d29f8e54a7ec64afb8', // NEED CHANGE NFT市场
|
56: '0x75c6c866f9f4ba6d0cad39d29f8e54a7ec64afb8', // NEED CHANGE NFT市场
|
||||||
5: '0x8678a822dfa815da423517b315641ef7f20020d7',
|
5: '0x0e88b33ff165679c841c55f5d39239d0f3e7df4f',
|
||||||
},
|
},
|
||||||
blindBox: {
|
blindBox: {
|
||||||
97: '0x0e226d7b83b511ce224803b1330beb4a59bfa5d6',
|
97: '0x0e226d7b83b511ce224803b1330beb4a59bfa5d6',
|
||||||
|
|
|
||||||
|
|
@ -1425,7 +1425,12 @@
|
||||||
"1.NFT may not be traded or transferred at the time of sale": "1.NFT may not be traded or transferred at the time of sale",
|
"1.NFT may not be traded or transferred at the time of sale": "1.NFT may not be traded or transferred at the time of sale",
|
||||||
"2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee": "2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee",
|
"2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee": "2. After the successful sale of NFT, the platform will charge the publisher 6% of the profits as a commission fee",
|
||||||
"order status": "order status",
|
"order status": "order status",
|
||||||
"Asking price": "Asking price",
|
"Asking price%price%": "Asking price%price%",
|
||||||
"Can't be less than %num%": "Can't be less than %num%",
|
"Can't be less than %num%": "Can't be less than %num%",
|
||||||
"They are in": "They are in"
|
"The price is greater than %num%": "The price is greater than %num%",
|
||||||
|
"They are in": "They are in",
|
||||||
|
"In the sale": "In the sale",
|
||||||
|
"The purchase": "The purchase",
|
||||||
|
"The selling time cannot be less than %hour% hour": "The selling time cannot be less than %hour% hour",
|
||||||
|
"Did not take": "Did not take"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,5 +92,18 @@ export const tradeRecordPage = (params) => {
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const marketStatistics = () => {
|
||||||
|
return request.request({
|
||||||
|
url: `/high_city/app/api/market/statistics`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPublishTime = () => {
|
||||||
|
return request.request({
|
||||||
|
url: `/high_city/app/api/base/config/market/auction/publish/time/limit`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default getOfficialPage
|
export default getOfficialPage
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import Pagination from '@mui/material/Pagination'
|
import Pagination from '@mui/material/Pagination'
|
||||||
import { Text, Button, Image, Flex } from '@pancakeswap/uikit'
|
import { Text, Button, Image, Flex, Dropdown } from '@pancakeswap/uikit'
|
||||||
|
import useRefresh from 'hooks/useRefresh'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { tradeRecordPage } from 'services/bazaar'
|
|
||||||
import Empty from 'components/Empty'
|
import Empty from 'components/Empty'
|
||||||
|
import { executeOrderTx, tradeRecordPage } from 'services/bazaar'
|
||||||
|
import { useExecuteOrder } from '../hooks'
|
||||||
|
|
||||||
interface AuctionRecordProps {
|
interface AuctionRecordProps {
|
||||||
onDismiss?: () => void
|
onDismiss?: () => void
|
||||||
|
|
@ -46,9 +48,12 @@ const HeaderText = styled(Text)`
|
||||||
|
|
||||||
const TypeFlex = styled(Flex)`
|
const TypeFlex = styled(Flex)`
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 35px;
|
margin-top: 35px;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
|
`
|
||||||
|
const TypeLeftFlex = styled(Flex)`
|
||||||
& > .active {
|
& > .active {
|
||||||
background: linear-gradient(90deg, #1fd4b0 0%, #1fc9d3 100%);
|
background: linear-gradient(90deg, #1fd4b0 0%, #1fc9d3 100%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
@ -130,9 +135,51 @@ const HashText = styled(Text)`
|
||||||
border-bottom: 1px solid #1fc7d4;
|
border-bottom: 1px solid #1fc7d4;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const SelectFlex = styled(Flex)`
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
`
|
||||||
|
const SelectMain = styled(Flex)`
|
||||||
|
z-index: 999;
|
||||||
|
width: 120px;
|
||||||
|
`
|
||||||
|
const SelectText = styled(Text)`
|
||||||
|
font-size: 16px;
|
||||||
|
width: 120px;
|
||||||
|
color: #666666;
|
||||||
|
margin-left: 4px;
|
||||||
|
`
|
||||||
|
const FlexOption = styled(Flex)`
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 120px;
|
||||||
|
height: 40px;
|
||||||
|
cursor: pointer;
|
||||||
|
z-index: 999;
|
||||||
|
`
|
||||||
|
const DidText = styled(Text)`
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: 5px;
|
||||||
|
color: rgba(102, 102, 102, 1);
|
||||||
|
margin-right: 5px;
|
||||||
|
`
|
||||||
|
|
||||||
const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }) => {
|
const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [count, setCount] = useState(undefined)
|
const [count, setCount] = useState(undefined)
|
||||||
|
const executeOrder = useExecuteOrder()
|
||||||
|
const [loading, setLoading] = useState(false)
|
||||||
|
const [txExecuteId, setTxExecuteId] = useState('')
|
||||||
|
const { fastRefresh } = useRefresh()
|
||||||
|
const [auctionSelect, setAuctionSelect] = useState({ label: t('All'), value: '' })
|
||||||
|
const auctionList = [
|
||||||
|
{ label: t('All'), value: '' },
|
||||||
|
{ label: t('In the auction'), value: 'PENDING' },
|
||||||
|
{ label: t('traded'), value: 'SUCCESS' },
|
||||||
|
{ label: t('Cancel'), value: 'CANCEL' },
|
||||||
|
{ label: t('abortive auction'), value: 'STREAMING' },
|
||||||
|
{ label: t('The purchase'), value: 'BID_SUCCESS' },
|
||||||
|
]
|
||||||
|
|
||||||
const typeList = [
|
const typeList = [
|
||||||
{ label: t('All transactions'), value: '' },
|
{ label: t('All transactions'), value: '' },
|
||||||
|
|
@ -152,11 +199,11 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
t('operation'),
|
t('operation'),
|
||||||
]
|
]
|
||||||
const statusTxt = {
|
const statusTxt = {
|
||||||
PENDING: t('They are in'),
|
|
||||||
CANCEL: t('Canceled'),
|
CANCEL: t('Canceled'),
|
||||||
|
PENDING: t('In the auction'),
|
||||||
STREAMING: t('abortive auction'),
|
STREAMING: t('abortive auction'),
|
||||||
SUCCESS: t('success'),
|
SUCCESS: t('traded'),
|
||||||
end: t('finished'),
|
BID_SUCCESS: t('The purchase'),
|
||||||
}
|
}
|
||||||
|
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
|
|
@ -165,6 +212,7 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
page: pageNum,
|
page: pageNum,
|
||||||
size: 4,
|
size: 4,
|
||||||
type: 'AUCTION',
|
type: 'AUCTION',
|
||||||
|
status: auctionSelect.value,
|
||||||
relationType: typeList[typeIndex].value,
|
relationType: typeList[typeIndex].value,
|
||||||
})
|
})
|
||||||
setCount(getTotalPageNum(res.total, 4))
|
setCount(getTotalPageNum(res.total, 4))
|
||||||
|
|
@ -180,11 +228,26 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getList()
|
getList()
|
||||||
}, [pageNum, typeIndex])
|
}, [pageNum, typeIndex, auctionSelect])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// 购买
|
||||||
|
if (txExecuteId && loading) {
|
||||||
|
executeOrderFn()
|
||||||
|
}
|
||||||
|
}, [fastRefresh])
|
||||||
const goHash = (val) => {
|
const goHash = (val) => {
|
||||||
window.open(`https://goerli.etherscan.io/tx/${val.tx}`)
|
window.open(`https://goerli.etherscan.io/tx/${val.tx}`)
|
||||||
}
|
}
|
||||||
|
const executeOrderFn = async () => {
|
||||||
|
setLoading(true)
|
||||||
|
const res = await executeOrderTx(txExecuteId)
|
||||||
|
if (res) {
|
||||||
|
setTxExecuteId(undefined)
|
||||||
|
setLoading(false)
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
const changeType = async (index) => {
|
const changeType = async (index) => {
|
||||||
setTypeIndex(index)
|
setTypeIndex(index)
|
||||||
setPage(1)
|
setPage(1)
|
||||||
|
|
@ -193,12 +256,23 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
recordDetail(item)
|
recordDetail(item)
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}
|
}
|
||||||
|
// 领取
|
||||||
|
const onSell = async (item) => {
|
||||||
|
setLoading(true)
|
||||||
|
const res = await executeOrder(item.token, item.lastPrice)
|
||||||
|
setTxExecuteId(res.hash)
|
||||||
|
}
|
||||||
|
const changeAcution = (item) => {
|
||||||
|
setAuctionSelect(item)
|
||||||
|
setPage(1)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FlexMain>
|
<FlexMain>
|
||||||
<CloseImage src="/images/nft/close.svg" width={15} height={15} onClick={onDismiss} />
|
<CloseImage src="/images/nft/close.svg" width={15} height={15} onClick={onDismiss} />
|
||||||
<HeaderText>{t('Auctions a record')}</HeaderText>
|
<HeaderText>{t('Auctions a record')}</HeaderText>
|
||||||
<TypeFlex>
|
<TypeFlex>
|
||||||
|
<TypeLeftFlex>
|
||||||
{typeList.map((item, index) => {
|
{typeList.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<TypeItem
|
<TypeItem
|
||||||
|
|
@ -210,6 +284,26 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
</TypeItem>
|
</TypeItem>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
|
</TypeLeftFlex>
|
||||||
|
<SelectMain>
|
||||||
|
<Dropdown
|
||||||
|
position="bottom"
|
||||||
|
target={
|
||||||
|
<SelectFlex>
|
||||||
|
<Image src="/images/nft/bottom-arrows.svg" width={12} height={7} />
|
||||||
|
<SelectText>{auctionSelect.label}</SelectText>
|
||||||
|
</SelectFlex>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{auctionList.map((item) => {
|
||||||
|
return (
|
||||||
|
<FlexOption key={item.value} onClick={() => changeAcution(item)}>
|
||||||
|
{item.label}
|
||||||
|
</FlexOption>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Dropdown>
|
||||||
|
</SelectMain>
|
||||||
</TypeFlex>
|
</TypeFlex>
|
||||||
<>
|
<>
|
||||||
<TableThemed>
|
<TableThemed>
|
||||||
|
|
@ -217,6 +311,7 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
return <ThemedItem key={item}>{item}</ThemedItem>
|
return <ThemedItem key={item}>{item}</ThemedItem>
|
||||||
})}
|
})}
|
||||||
</TableThemed>
|
</TableThemed>
|
||||||
|
{list?.length === 0 && <Empty />}
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{list?.length > 0 &&
|
{list?.length > 0 &&
|
||||||
list.map((item) => {
|
list.map((item) => {
|
||||||
|
|
@ -227,24 +322,38 @@ const AuctionRecord: React.FC<AuctionRecordProps> = ({ onDismiss, recordDetail }
|
||||||
{item.goodsName}
|
{item.goodsName}
|
||||||
</TdFlex>
|
</TdFlex>
|
||||||
<TdFlex>{item.price}</TdFlex>
|
<TdFlex>{item.price}</TdFlex>
|
||||||
<TdFlex>{item.lastPrice}</TdFlex>
|
<TdFlex>{item.lastPrice}HCC</TdFlex>
|
||||||
<TdFlex>{item.updatedAt}</TdFlex>
|
<TdFlex>{item.updatedAt}</TdFlex>
|
||||||
<TdFlex>{statusTxt[item.status]}</TdFlex>
|
<TdFlex>{statusTxt[item.status]}</TdFlex>
|
||||||
<TdBtnFlex>
|
<TdBtnFlex>
|
||||||
|
<Flex>
|
||||||
|
{typeList[typeIndex].value === 'PARTICIPATE' && item.status === 'BID_SUCCESS' && (
|
||||||
|
<DetailButton disabled={loading} onClick={() => onSell(item)}>
|
||||||
|
{t('Get')}
|
||||||
|
</DetailButton>
|
||||||
|
)}
|
||||||
<DetailButton onClick={() => lookDetail(item)}>{t('Detail')}</DetailButton>
|
<DetailButton onClick={() => lookDetail(item)}>{t('Detail')}</DetailButton>
|
||||||
<HashText onClick={() => goHash(item)}>{t('deal Hash')}</HashText>
|
</Flex>
|
||||||
|
<Flex alignItems="center">
|
||||||
|
{typeList[typeIndex].value === 'PARTICIPATE' && item.status === 'SUCCESS' && (
|
||||||
|
<DidText>{t('Did not take')}</DidText>
|
||||||
|
)}
|
||||||
|
<HashText onClick={() => goHash(item)}>{t('Trade')}Hash</HashText>
|
||||||
|
{/* <HashText onClick={() => goHash(item)}>
|
||||||
|
{item.tx && item.tx.substring(0, 6)}....
|
||||||
|
{item.tx && item.tx.substring(item.tx.length - 6, item.tx.length)}
|
||||||
|
</HashText> */}
|
||||||
|
</Flex>
|
||||||
</TdBtnFlex>
|
</TdBtnFlex>
|
||||||
</TrFlex>
|
</TrFlex>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
{list?.length === 0 ? (
|
</TableBody>
|
||||||
<Empty />
|
{list?.length > 0 && (
|
||||||
) : (
|
|
||||||
<Flex justifyContent="center" padding={10}>
|
<Flex justifyContent="center" padding={10}>
|
||||||
<Pagination count={count} onChange={pageChange} page={pageNum} />
|
<Pagination count={count} onChange={pageChange} page={pageNum} />
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
</TableBody>
|
|
||||||
</>
|
</>
|
||||||
</FlexMain>
|
</FlexMain>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ const Content: React.FC = () => {
|
||||||
const [detail, setDetail] = useState<ListProps>({})
|
const [detail, setDetail] = useState<ListProps>({})
|
||||||
const [detailVisible, setDetailVisible] = useState(false)
|
const [detailVisible, setDetailVisible] = useState(false)
|
||||||
const [ids, setId] = useState('')
|
const [ids, setId] = useState('')
|
||||||
|
const account = useAccount()
|
||||||
const typeList = [
|
const typeList = [
|
||||||
{ label: t('official market'), type: 1 },
|
{ label: t('official market'), type: 1 },
|
||||||
{ label: t('bazaar'), type: 2 },
|
{ label: t('bazaar'), type: 2 },
|
||||||
|
|
@ -191,8 +192,8 @@ const Content: React.FC = () => {
|
||||||
const params = {
|
const params = {
|
||||||
page: pageNum,
|
page: pageNum,
|
||||||
size: 8,
|
size: 8,
|
||||||
name: searchTitle,
|
goodsName: searchTitle,
|
||||||
grade: searchGrade,
|
goodsGrade: searchGrade,
|
||||||
status: auctionSelect.value,
|
status: auctionSelect.value,
|
||||||
type,
|
type,
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +245,7 @@ const Content: React.FC = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
useEffect(() => {
|
const getList = async () => {
|
||||||
switch (typeIndex) {
|
switch (typeIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
getData()
|
getData()
|
||||||
|
|
@ -258,18 +259,26 @@ const Content: React.FC = () => {
|
||||||
default:
|
default:
|
||||||
getData()
|
getData()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getList()
|
||||||
}, [pageNum, searchGrade, typeIndex, detailVisible, auctionSelect])
|
}, [pageNum, searchGrade, typeIndex, detailVisible, auctionSelect])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setPriceSelect({ label: t('Prices go from low to high'), value: '3' })
|
setPriceSelect({ label: t('Prices go from low to high'), value: '3' })
|
||||||
}, [t])
|
setAuctionSelect({ label: t('In the auction'), value: 'PENDING' })
|
||||||
|
}, [t, account])
|
||||||
|
|
||||||
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const { value } = evt.target
|
const { value } = evt.target
|
||||||
setSearchTitle(value)
|
setSearchTitle(value)
|
||||||
}
|
}
|
||||||
const searchList = () => {
|
const searchList = () => {
|
||||||
|
if (pageNum !== 1) {
|
||||||
setPage(1)
|
setPage(1)
|
||||||
|
} else {
|
||||||
|
getList()
|
||||||
|
}
|
||||||
// getData()
|
// getData()
|
||||||
}
|
}
|
||||||
const showDetail = (val) => {
|
const showDetail = (val) => {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ const ContentShop: React.FC<ContentShop> = ({ list, getDetail, typeIndex }) => {
|
||||||
width={278}
|
width={278}
|
||||||
height={302}
|
height={302}
|
||||||
img={item.coverResource.url}
|
img={item.coverResource.url}
|
||||||
grade={item.grade}
|
grade={item.goodsGrade}
|
||||||
borderRadius="20px 20px 0 0"
|
borderRadius="20px 20px 0 0"
|
||||||
/>
|
/>
|
||||||
<ShopName>{item?.goodsName}</ShopName>
|
<ShopName>{item?.goodsName}</ShopName>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { Flex, Text, Link } from '@pancakeswap/uikit'
|
||||||
|
|
||||||
interface FlexProps {
|
interface FlexProps {
|
||||||
name: string
|
name: string
|
||||||
value: string
|
value: string | number
|
||||||
paddings?: string
|
paddings?: string
|
||||||
leftColor?: string
|
leftColor?: string
|
||||||
rightColor?: string
|
rightColor?: string
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import { useLocation, useHistory, useParams } from 'react-router-dom'
|
import { useLocation, useHistory, useParams } from 'react-router-dom'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { Text, Button, Image, Input, Flex, Dropdown } from '@pancakeswap/uikit'
|
import { Text, Button, Image, Input, Flex, Dropdown } from '@pancakeswap/uikit'
|
||||||
|
|
@ -6,7 +7,7 @@ import { useTranslation } from 'contexts/Localization'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { getHccMarketplaceAddress } from 'utils/addressHelpers'
|
import { getHccMarketplaceAddress } from 'utils/addressHelpers'
|
||||||
import useRefresh from 'hooks/useRefresh'
|
import useRefresh from 'hooks/useRefresh'
|
||||||
import { marketTradeCreateOrderTx } from 'services/bazaar'
|
import { marketTradeCreateOrderTx, getPublishTime } from 'services/bazaar'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { useCreateNormalOrder, useCreateAuctionOrder, useIsApproved, useApproved } from '../hooks'
|
import { useCreateNormalOrder, useCreateAuctionOrder, useIsApproved, useApproved } from '../hooks'
|
||||||
import ShopList from './ShopList'
|
import ShopList from './ShopList'
|
||||||
|
|
@ -212,12 +213,16 @@ const SellModal: React.FC<sellModalProps> = ({ onDismiss, detailData }) => {
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [createOrderId, setCreateOrderId] = useState('')
|
const [createOrderId, setCreateOrderId] = useState('')
|
||||||
const [agreementLoading, setAgreementLoading] = useState(false)
|
const [agreementLoading, setAgreementLoading] = useState(false)
|
||||||
|
const [minTime, setMinTime] = useState(0)
|
||||||
|
|
||||||
const SellingWayList = [
|
const SellingWayList = [
|
||||||
{ label: t('fixed price'), value: '1' },
|
{ label: t('fixed price'), value: '1' },
|
||||||
{ label: t('Auction'), value: '2' },
|
{ label: t('Auction'), value: '2' },
|
||||||
]
|
]
|
||||||
|
const getTime = async () => {
|
||||||
|
const res = await getPublishTime()
|
||||||
|
setMinTime(new BigNumber(res).toNumber())
|
||||||
|
}
|
||||||
const onSelectNft = () => {
|
const onSelectNft = () => {
|
||||||
setShowModal(!showModal)
|
setShowModal(!showModal)
|
||||||
}
|
}
|
||||||
|
|
@ -259,20 +264,32 @@ const SellModal: React.FC<sellModalProps> = ({ onDismiss, detailData }) => {
|
||||||
toastError(t('Please enter price'))
|
toastError(t('Please enter price'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (Number(price) < 0) {
|
if (Number(price) <= 0) {
|
||||||
toastError(t("Can't be less than %num%", { num: 0 }))
|
toastError(t('The price is greater than %num%', { num: 0 }))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (sellingWay?.value === '2' && Number(time) < 0) {
|
if (sellingWay?.value === '2' && Number(time) < 0) {
|
||||||
toastError(t("Can't be less than %num%", { num: 0 }))
|
toastError(t('The price is greater than %num%', { num: 0 }))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
let res = { hash: undefined }
|
let res = { hash: undefined }
|
||||||
if (sellingWay?.value === '2') {
|
if (sellingWay?.value === '2') {
|
||||||
const auctionTime = new BigNumber(time).multipliedBy(3600000).plus(new Date().getTime()).toNumber()
|
if (minTime > new BigNumber(time).multipliedBy(3600).toNumber()) {
|
||||||
|
setLoading(false)
|
||||||
|
toastError(
|
||||||
|
t('The selling time cannot be less than %hour% hour', {
|
||||||
|
hour: new BigNumber(minTime).dividedBy(3600).toNumber(),
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const auctionTime = new BigNumber(time)
|
||||||
|
.multipliedBy(3600)
|
||||||
|
.plus(new BigNumber(new Date().getTime()).dividedBy(1000).toNumber())
|
||||||
|
.toNumber()
|
||||||
// const auctionTime = Number(time) * 3600000 + new Date().getTime()
|
// const auctionTime = Number(time) * 3600000 + new Date().getTime()
|
||||||
res = await createAuctionOrder(shopData.token, price, auctionTime)
|
res = await createAuctionOrder(shopData.token, price, Math.round(auctionTime))
|
||||||
} else {
|
} else {
|
||||||
res = await createNormalOrder(shopData.token, price)
|
res = await createNormalOrder(shopData.token, price)
|
||||||
}
|
}
|
||||||
|
|
@ -292,6 +309,7 @@ const SellModal: React.FC<sellModalProps> = ({ onDismiss, detailData }) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
getTime()
|
||||||
detailData && setShopData(detailData)
|
detailData && setShopData(detailData)
|
||||||
}, [])
|
}, [])
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -351,6 +369,7 @@ const SellModal: React.FC<sellModalProps> = ({ onDismiss, detailData }) => {
|
||||||
<ShopList
|
<ShopList
|
||||||
item={shopData}
|
item={shopData}
|
||||||
img={shopData?.info?.coverResource?.url}
|
img={shopData?.info?.coverResource?.url}
|
||||||
|
grade={shopData?.info?.grade}
|
||||||
width={278}
|
width={278}
|
||||||
height={280}
|
height={280}
|
||||||
borderRadius="20px 20px 0 0"
|
borderRadius="20px 20px 0 0"
|
||||||
|
|
|
||||||
|
|
@ -295,6 +295,11 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
updatedAt: res?.updatedAt,
|
updatedAt: res?.updatedAt,
|
||||||
token: res?.token,
|
token: res?.token,
|
||||||
})
|
})
|
||||||
|
if (res.status === 'PENDING') {
|
||||||
|
setSellVerify(false)
|
||||||
|
} else {
|
||||||
|
setSellVerify(true)
|
||||||
|
}
|
||||||
setStatusBtnTxt(res.status)
|
setStatusBtnTxt(res.status)
|
||||||
setDetail(res)
|
setDetail(res)
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +326,7 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
|
|
||||||
const getLink = () => {
|
const getLink = () => {
|
||||||
const createInput = document.createElement('input')
|
const createInput = document.createElement('input')
|
||||||
createInput.value = `${window.location.href}?id=${detail.id}`
|
createInput.value = `${window.location.href}?id=${detail.id}&type=${typeIndex}`
|
||||||
document.body.appendChild(createInput)
|
document.body.appendChild(createInput)
|
||||||
createInput.select()
|
createInput.select()
|
||||||
document.execCommand('Copy')
|
document.execCommand('Copy')
|
||||||
|
|
@ -371,13 +376,14 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
}
|
}
|
||||||
const getNft = async () => {
|
const getNft = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
const res = await executeOrder(detail.token, 0)
|
// const res = await executeOrder(detail.token, orderMapData?.bid)
|
||||||
|
const res = await executeOrder(orderMapData?.bidder, orderMapData?.bid)
|
||||||
setTxExecuteId(res.hash)
|
setTxExecuteId(res.hash)
|
||||||
}
|
}
|
||||||
const getOrderMap = async (token) => {
|
const getOrderMap = async (token) => {
|
||||||
const res = await orderMap(token)
|
const res = await orderMap(token)
|
||||||
// 竞价按钮
|
// 竞价按钮
|
||||||
if (allowance && !ownOrder && typeIndex === 2 && res?.expiresAt > new Date().getTime()) {
|
if (account && allowance && !ownOrder && typeIndex === 2 && res?.expiresAt > new Date().getTime()) {
|
||||||
setBidAuctionStatus(true)
|
setBidAuctionStatus(true)
|
||||||
} else {
|
} else {
|
||||||
setBidAuctionStatus(false)
|
setBidAuctionStatus(false)
|
||||||
|
|
@ -414,7 +420,7 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
setCountDown(`${hour}:${minute}:${second}`)
|
setCountDown(`${hour}:${minute}:${second}`)
|
||||||
} else {
|
} else {
|
||||||
setCountDown(t('finished'))
|
setCountDown(t('finished'))
|
||||||
setStatusBtnTxt('end')
|
// setStatusBtnTxt('end')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -467,24 +473,33 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
)}
|
)}
|
||||||
{typeIndex !== 2 && (
|
{typeIndex !== 2 && (
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('present price%price%', { price: '' })}
|
name={t('present price%price%', { price: '(HCC)' })}
|
||||||
value={detail?.price}
|
// value={detail?.price}
|
||||||
|
value={orderMapData?.bidder === '0' ? orderMapData?.price : orderMapData?.bid}
|
||||||
size="18px"
|
size="18px"
|
||||||
rightSize="30px"
|
rightSize="30px"
|
||||||
textColor="#1FC7D4"
|
textColor="#1FC7D4"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{typeIndex === 2 && (
|
{typeIndex === 2 && (
|
||||||
|
//
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={orderMapData?.bidder === '0' ? t('Asking price') : t('present price%price%', { price: '' })}
|
name={
|
||||||
value={detail?.price}
|
orderMapData?.bidder === '0'
|
||||||
|
? t('Asking price%price%', { price: '(HCC)' })
|
||||||
|
: orderMapData?.expiresAt > new Date().getTime()
|
||||||
|
? `${t('The latest offer')}(HCC)`
|
||||||
|
: t('present price%price%', { price: '(HCC)' })
|
||||||
|
}
|
||||||
|
// value={detail?.price}
|
||||||
|
value={orderMapData?.bidder === '0' ? orderMapData?.price : orderMapData?.bid}
|
||||||
size="18px"
|
size="18px"
|
||||||
rightSize="30px"
|
rightSize="30px"
|
||||||
textColor="#1FC7D4"
|
textColor="#1FC7D4"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!account && <UnlockButtonDiv />}
|
{!account && <UnlockButtonDiv />}
|
||||||
{approveStatus && (
|
{approveStatus && account && (
|
||||||
<AuthorizationBtn
|
<AuthorizationBtn
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|
@ -508,7 +523,7 @@ const ShopDetail: React.FC<DetailProps> = ({ close, id, typeIndex }) => {
|
||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
)}
|
)}
|
||||||
{allowance && !ownOrder && !sellVerify && typeIndex === 1 ? (
|
{account && allowance && !ownOrder && !sellVerify && typeIndex === 1 ? (
|
||||||
<AuthorizationBtn disabled={loading} onClick={onSell}>
|
<AuthorizationBtn disabled={loading} onClick={onSell}>
|
||||||
{t('Buy It Now')}
|
{t('Buy It Now')}
|
||||||
</AuthorizationBtn>
|
</AuthorizationBtn>
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ const ShopModal: React.FC<ShopProp> = ({ name, value, onDismiss, close, add }) =
|
||||||
img={item?.info?.coverResource?.url}
|
img={item?.info?.coverResource?.url}
|
||||||
width={278}
|
width={278}
|
||||||
height={280}
|
height={280}
|
||||||
|
grade={item?.info?.grade}
|
||||||
borderRadius="20px 20px 0 0"
|
borderRadius="20px 20px 0 0"
|
||||||
/>
|
/>
|
||||||
<ShopName>{item?.info?.name}</ShopName>
|
<ShopName>{item?.info?.name}</ShopName>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,13 @@ import { useTranslation } from 'contexts/Localization'
|
||||||
import { Flex, Text } from '@pancakeswap/uikit'
|
import { Flex, Text } from '@pancakeswap/uikit'
|
||||||
import { useAccount } from 'state/userInfo/hooks'
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import useRefresh from 'hooks/useRefresh'
|
import useRefresh from 'hooks/useRefresh'
|
||||||
|
import { useMarketStatistics } from '../hooks'
|
||||||
|
|
||||||
|
interface MarketStatisticsProps {
|
||||||
|
auctionTimes?: string
|
||||||
|
tradeAmount?: string
|
||||||
|
tradeTimes?: string
|
||||||
|
}
|
||||||
|
|
||||||
const TransactionFlex = styled(Flex)`
|
const TransactionFlex = styled(Flex)`
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
|
|
@ -46,28 +53,39 @@ const Separate = styled.div`
|
||||||
|
|
||||||
const Transaction: React.FC = () => {
|
const Transaction: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const account = useAccount()
|
||||||
|
const [detail, setDetail] = useState<MarketStatisticsProps>()
|
||||||
|
const marketStatistics = useMarketStatistics()
|
||||||
|
|
||||||
|
const getData = async () => {
|
||||||
|
const { auctionTimes, tradeAmount, tradeTimes } = await marketStatistics()
|
||||||
|
setDetail({ auctionTimes, tradeAmount, tradeTimes })
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getData()
|
||||||
|
}, [account])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TransactionFlex>
|
<TransactionFlex>
|
||||||
<TransactionItem>
|
<TransactionItem>
|
||||||
<TransactionItemNum>0</TransactionItemNum>
|
<TransactionItemNum>{Number(detail?.tradeAmount).toFixed(3)}</TransactionItemNum>
|
||||||
<TransactionItemLabel>{t('The total volume')}</TransactionItemLabel>
|
<TransactionItemLabel>{t('The total volume')}</TransactionItemLabel>
|
||||||
</TransactionItem>
|
</TransactionItem>
|
||||||
<Separate />
|
<Separate />
|
||||||
<TransactionItem>
|
<TransactionItem>
|
||||||
<TransactionItemNum>0</TransactionItemNum>
|
<TransactionItemNum>{detail?.tradeTimes}</TransactionItemNum>
|
||||||
<TransactionItemLabel>{t('The total number of transactions')}</TransactionItemLabel>
|
<TransactionItemLabel>{t('The total number of transactions')}</TransactionItemLabel>
|
||||||
</TransactionItem>
|
</TransactionItem>
|
||||||
<Separate />
|
<Separate />
|
||||||
<TransactionItem>
|
<TransactionItem>
|
||||||
<TransactionItemNum>0</TransactionItemNum>
|
<TransactionItemNum>{detail?.auctionTimes}</TransactionItemNum>
|
||||||
<TransactionItemLabel>{t('Total number of auctions')}</TransactionItemLabel>
|
<TransactionItemLabel>{t('Total number of auctions')}</TransactionItemLabel>
|
||||||
</TransactionItem>
|
</TransactionItem>
|
||||||
<Separate />
|
{/* <Separate />
|
||||||
<TransactionItem>
|
<TransactionItem>
|
||||||
<TransactionItemNum>0</TransactionItemNum>
|
<TransactionItemNum>0</TransactionItemNum>
|
||||||
<TransactionItemLabel>{t('Total transaction rebate')}</TransactionItemLabel>
|
<TransactionItemLabel>{t('Total transaction rebate')}</TransactionItemLabel>
|
||||||
</TransactionItem>
|
</TransactionItem> */}
|
||||||
</TransactionFlex>
|
</TransactionFlex>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ const ThemedItem = styled.div`
|
||||||
border-top: 1px solid #e3e3e3;
|
border-top: 1px solid #e3e3e3;
|
||||||
`
|
`
|
||||||
const TableBody = styled.div`
|
const TableBody = styled.div`
|
||||||
height: 420px;
|
height: 350px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
`
|
`
|
||||||
const TrFlex = styled(Flex)`
|
const TrFlex = styled(Flex)`
|
||||||
|
|
@ -123,13 +123,21 @@ const TransactionRecord: React.FC<TransactionRecordProps> = ({ onDismiss, active
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const typeList = [
|
const typeList = [
|
||||||
{ label: t('All transactions'), value: '1' },
|
// { label: t('All transactions'), value: '1' },
|
||||||
{ label: t('on offer'), value: '2' },
|
// { label: t('on offer'), value: '2' },
|
||||||
{ label: t('be sold'), value: '3' },
|
// { label: t('be sold'), value: '3' },
|
||||||
{ label: t('have bought'), value: '4' },
|
// { label: t('have bought'), value: '4' },
|
||||||
|
{ label: t('All transactions'), value: '' },
|
||||||
|
{ label: t('I participate in'), value: 'PARTICIPATE' },
|
||||||
|
{ label: t('I released'), value: 'PUBLISH' },
|
||||||
]
|
]
|
||||||
const [typeIndex, setTypeIndex] = useState(0)
|
const [typeIndex, setTypeIndex] = useState(0)
|
||||||
|
const statusTxt = {
|
||||||
|
CANCEL: t('Canceled'),
|
||||||
|
PENDING: t('In the sale'),
|
||||||
|
STREAMING: t('abortive auction'),
|
||||||
|
SUCCESS: t('traded'),
|
||||||
|
}
|
||||||
const ThemedList = [t('NFT name'), t('price'), t('Time'), t('state'), t('operation')]
|
const ThemedList = [t('NFT name'), t('price'), t('Time'), t('state'), t('operation')]
|
||||||
|
|
||||||
const [list, setList] = useState([])
|
const [list, setList] = useState([])
|
||||||
|
|
@ -163,7 +171,9 @@ const TransactionRecord: React.FC<TransactionRecordProps> = ({ onDismiss, active
|
||||||
relationType = ''
|
relationType = ''
|
||||||
status = ''
|
status = ''
|
||||||
}
|
}
|
||||||
const obj = { page: pageNum, size: 10, type: 'NORMAL', relationType, status }
|
|
||||||
|
const obj = { page: pageNum, size: 4, type: 'NORMAL', relationType: typeList[typeIndex].value }
|
||||||
|
// const obj = { page: pageNum, size: 4, type: 'NORMAL', relationType, status }
|
||||||
const res = await tradeRecordPage(obj)
|
const res = await tradeRecordPage(obj)
|
||||||
setCount(getTotalPageNum(res.total, 4))
|
setCount(getTotalPageNum(res.total, 4))
|
||||||
setList(res.content)
|
setList(res.content)
|
||||||
|
|
@ -268,18 +278,23 @@ const TransactionRecord: React.FC<TransactionRecordProps> = ({ onDismiss, active
|
||||||
{activeIndex !== 0 && <TdFlex>{item.lastPrice}</TdFlex>}
|
{activeIndex !== 0 && <TdFlex>{item.lastPrice}</TdFlex>}
|
||||||
{activeIndex === 0 && <TdFlex>{dayjs(Number(item.tradeTime)).format('YYYY-MM-DD HH:mm:ss')}</TdFlex>}
|
{activeIndex === 0 && <TdFlex>{dayjs(Number(item.tradeTime)).format('YYYY-MM-DD HH:mm:ss')}</TdFlex>}
|
||||||
{activeIndex !== 0 && <TdFlex>{item.updatedAt}</TdFlex>}
|
{activeIndex !== 0 && <TdFlex>{item.updatedAt}</TdFlex>}
|
||||||
<TdFlex>{item.status ? item.status : t('success')}</TdFlex>
|
<TdFlex>{item.status ? statusTxt[item.status] : t('success')}</TdFlex>
|
||||||
<TdBtnFlex>
|
<TdBtnFlex>
|
||||||
<DetailButton onClick={() => lookDetail(item)}>{t('Detail')}</DetailButton>
|
<DetailButton onClick={() => lookDetail(item)}>{t('Detail')}</DetailButton>
|
||||||
<HashText onClick={() => goHash(item)}>{t('deal Hash')}</HashText>
|
<HashText onClick={() => goHash(item)}>
|
||||||
|
{item.tx && item.tx.substring(0, 6)}....
|
||||||
|
{item.tx && item.tx.substring(item.tx.length - 6, item.tx.length)}
|
||||||
|
</HashText>
|
||||||
</TdBtnFlex>
|
</TdBtnFlex>
|
||||||
</TrFlex>
|
</TrFlex>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</TableBody>
|
</TableBody>
|
||||||
|
{list.length > 0 && (
|
||||||
<Flex justifyContent="center" padding={10}>
|
<Flex justifyContent="center" padding={10}>
|
||||||
<Pagination count={count} onChange={pageChange} page={pageNum} />
|
<Pagination count={count} onChange={pageChange} page={pageNum} />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
</FlexMain>
|
</FlexMain>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,14 @@ import blindBoxABI from 'config/abi/blindBox.json'
|
||||||
import { useBlindBox, useHccMarketplace } from 'hooks/useContract'
|
import { useBlindBox, useHccMarketplace } from 'hooks/useContract'
|
||||||
import { getAddress, getBlindBoxAddress, getHccMarketplaceAddress } from 'utils/addressHelpers'
|
import { getAddress, getBlindBoxAddress, getHccMarketplaceAddress } from 'utils/addressHelpers'
|
||||||
import { useAccount } from 'state/userInfo/hooks'
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import { getOfficialPage, getOfficialPurchase, getPurchaseRecord, getNftDetail, getTradePage } from 'services/bazaar'
|
import {
|
||||||
|
getOfficialPage,
|
||||||
|
getOfficialPurchase,
|
||||||
|
getPurchaseRecord,
|
||||||
|
getNftDetail,
|
||||||
|
getTradePage,
|
||||||
|
marketStatistics,
|
||||||
|
} from 'services/bazaar'
|
||||||
import { ethers, Contract } from 'ethers'
|
import { ethers, Contract } from 'ethers'
|
||||||
import multicall from 'utils/multicall'
|
import multicall from 'utils/multicall'
|
||||||
import {
|
import {
|
||||||
|
|
@ -69,7 +76,6 @@ export const useMarketplaceApproveHcc = (tokenContract: Contract) => {
|
||||||
export const useGetPurchaseRecord = () => {
|
export const useGetPurchaseRecord = () => {
|
||||||
const data = async (page, size) => {
|
const data = async (page, size) => {
|
||||||
const result = await getPurchaseRecord({ page, size })
|
const result = await getPurchaseRecord({ page, size })
|
||||||
console.log(result)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
@ -93,7 +99,6 @@ export const useBuyTransaction = () => {
|
||||||
export const useGetNftDetail = () => {
|
export const useGetNftDetail = () => {
|
||||||
const data = async (token, params) => {
|
const data = async (token, params) => {
|
||||||
const result = await getNftDetail(token, params)
|
const result = await getNftDetail(token, params)
|
||||||
console.log(result)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
@ -103,7 +108,6 @@ export const useGetNftDetail = () => {
|
||||||
export const useGetTradePage = () => {
|
export const useGetTradePage = () => {
|
||||||
const data = async (params) => {
|
const data = async (params) => {
|
||||||
const result = await getTradePage(params)
|
const result = await getTradePage(params)
|
||||||
console.log(result)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
@ -127,9 +131,6 @@ export const useIsApproved = () => {
|
||||||
]
|
]
|
||||||
|
|
||||||
const res = await multicall(blindBoxABI, calls)
|
const res = await multicall(blindBoxABI, calls)
|
||||||
// const res = await blindBox.getApproved(...mintParams)
|
|
||||||
console.log(res[0][0].toLowerCase())
|
|
||||||
console.log(hccMarketplaceAddress)
|
|
||||||
let status = false
|
let status = false
|
||||||
if (res[0][0].toLowerCase() === hccMarketplaceAddress.toLowerCase()) {
|
if (res[0][0].toLowerCase() === hccMarketplaceAddress.toLowerCase()) {
|
||||||
status = true
|
status = true
|
||||||
|
|
@ -146,18 +147,7 @@ export const useApproved = () => {
|
||||||
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
||||||
const transaction = async (tokenId) => {
|
const transaction = async (tokenId) => {
|
||||||
const mintParams = [hccMarketplaceAddress, tokenId]
|
const mintParams = [hccMarketplaceAddress, tokenId]
|
||||||
console.log(mintParams)
|
|
||||||
// const calls = [
|
|
||||||
// {
|
|
||||||
// address,
|
|
||||||
// name: 'getApproved',
|
|
||||||
// params: [tokenId],
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
// const res = await multicall(blindBoxABI, calls)
|
|
||||||
const res = await blindBox.approve(...mintParams)
|
const res = await blindBox.approve(...mintParams)
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -176,11 +166,7 @@ export const useCreateNormalOrder = () => {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
||||||
console.log(mintParams)
|
|
||||||
const res = await hccMarketplace.createNormalOrder(...mintParams)
|
const res = await hccMarketplace.createNormalOrder(...mintParams)
|
||||||
|
|
||||||
// const res = await multicall(hccMarketplaceABI, calls)
|
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -191,19 +177,8 @@ export const useCreateAuctionOrder = () => {
|
||||||
const hccMarketplace = useHccMarketplace()
|
const hccMarketplace = useHccMarketplace()
|
||||||
const transaction = async (tokenId, price, time) => {
|
const transaction = async (tokenId, price, time) => {
|
||||||
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
||||||
// const calls = [
|
|
||||||
// {
|
|
||||||
// address: hccMarketplaceAddress,
|
|
||||||
// name: 'createAuctionOrder',
|
|
||||||
// params: [account],
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
console.log(hccMarketplace)
|
|
||||||
const mintParams = [tokenId, getDecimalAmount(price).toString(), time]
|
const mintParams = [tokenId, getDecimalAmount(price).toString(), time]
|
||||||
console.log(mintParams)
|
|
||||||
const res = await hccMarketplace.createAuctionOrder(...mintParams)
|
const res = await hccMarketplace.createAuctionOrder(...mintParams)
|
||||||
// const res = await multicall(hccMarketplaceABI, calls)
|
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -214,19 +189,8 @@ export const useCancelOrder = () => {
|
||||||
const hccMarketplace = useHccMarketplace()
|
const hccMarketplace = useHccMarketplace()
|
||||||
const transaction = async (id) => {
|
const transaction = async (id) => {
|
||||||
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
||||||
// const calls = [
|
|
||||||
// {
|
|
||||||
// address: hccMarketplaceAddress,
|
|
||||||
// name: 'createAuctionOrder',
|
|
||||||
// params: [account],
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
const mintParams = [id]
|
const mintParams = [id]
|
||||||
console.log(...mintParams)
|
|
||||||
const res = await hccMarketplace.cancelOrder(...mintParams)
|
const res = await hccMarketplace.cancelOrder(...mintParams)
|
||||||
// const res = await multicall(hccMarketplaceABI, calls)
|
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -237,19 +201,8 @@ export const useExecuteOrder = () => {
|
||||||
const hccMarketplace = useHccMarketplace()
|
const hccMarketplace = useHccMarketplace()
|
||||||
const transaction = async (tokenId, price) => {
|
const transaction = async (tokenId, price) => {
|
||||||
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
||||||
// const calls = [
|
|
||||||
// {
|
|
||||||
// address: hccMarketplaceAddress,
|
|
||||||
// name: 'createAuctionOrder',
|
|
||||||
// params: [account],
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
||||||
console.log(...mintParams)
|
|
||||||
const res = await hccMarketplace.executeOrder(...mintParams)
|
const res = await hccMarketplace.executeOrder(...mintParams)
|
||||||
// const res = await multicall(hccMarketplaceABI, calls)
|
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -259,19 +212,8 @@ export const useBidAuctionOrder = () => {
|
||||||
const hccMarketplace = useHccMarketplace()
|
const hccMarketplace = useHccMarketplace()
|
||||||
const transaction = async (tokenId, price) => {
|
const transaction = async (tokenId, price) => {
|
||||||
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
const hccMarketplaceAddress = getHccMarketplaceAddress()
|
||||||
// const calls = [
|
|
||||||
// {
|
|
||||||
// address: hccMarketplaceAddress,
|
|
||||||
// name: 'createAuctionOrder',
|
|
||||||
// params: [account],
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
const mintParams = [tokenId, getDecimalAmount(price).toString()]
|
||||||
console.log(...mintParams)
|
|
||||||
const res = await hccMarketplace.bidAuctionOrder(...mintParams)
|
const res = await hccMarketplace.bidAuctionOrder(...mintParams)
|
||||||
// const res = await multicall(hccMarketplaceABI, calls)
|
|
||||||
console.log(res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
return transaction
|
return transaction
|
||||||
|
|
@ -290,11 +232,10 @@ export const useOrderMap = () => {
|
||||||
]
|
]
|
||||||
const res = await multicall(hccMarketplaceABI, calls)
|
const res = await multicall(hccMarketplaceABI, calls)
|
||||||
const arr = res.map((item) => {
|
const arr = res.map((item) => {
|
||||||
console.log(item)
|
|
||||||
console.log(new BigNumber(item.expiresAt._hex).toNumber())
|
|
||||||
return {
|
return {
|
||||||
price: getBalanceNumber(item.price._hex),
|
price: getBalanceNumber(item.price._hex),
|
||||||
expiresAt: new BigNumber(item.expiresAt._hex).toNumber(),
|
// expiresAt: new BigNumber(item.expiresAt._hex).toNumber(),
|
||||||
|
expiresAt: new BigNumber(item.expiresAt._hex).multipliedBy(1000).toNumber(),
|
||||||
bidder:
|
bidder:
|
||||||
new BigNumber(item.bidder).toString().toLowerCase() === 'nan'
|
new BigNumber(item.bidder).toString().toLowerCase() === 'nan'
|
||||||
? item.bidder
|
? item.bidder
|
||||||
|
|
@ -307,4 +248,13 @@ export const useOrderMap = () => {
|
||||||
return transaction
|
return transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取统计
|
||||||
|
export const useMarketStatistics = () => {
|
||||||
|
const data = async () => {
|
||||||
|
const result = await marketStatistics()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
export default useGetOfficialPage
|
export default useGetOfficialPage
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue