Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix: fix incorrect bidder name for settle auction
Browse files Browse the repository at this point in the history
  • Loading branch information
sincerely91 authored and stiartsly committed May 21, 2022
1 parent 4d5d760 commit 5a372e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
8 changes: 6 additions & 2 deletions src/pages/MyNFT/Auction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { blankNFTItem } from 'src/constants/init-constants';
// import CancelSaleDlgContainer from 'src/components/TransactionDialogs/CancelSale';
// import AcceptBidDlgContainer from 'src/components/TransactionDialogs/AcceptBid';
// import ReceivedBidsDlgContainer from 'src/components/TransactionDialogs/ReceivedBids';
import { reduceUserName } from 'src/services/common';
import { reduceHexAddress, reduceUserName } from 'src/services/common';

const MyNFTAuction: React.FC = (): JSX.Element => {
const params = useParams();
Expand Down Expand Up @@ -281,7 +281,11 @@ const MyNFTAuction: React.FC = (): JSX.Element => {
const topBid = bidsList.length ? bidsList[0].price : 0;
const bidPrice = topBid > 0 ? topBid : 0;
const biderName =
topBid > 0 ? bidsList[0].user : productDetail.holderName;
topBid > 0
? bidsList[0].user
: productDetail.holderName
? productDetail.holderName
: reduceHexAddress(productDetail.holder, 4);
const bidOrderId =
topBid > 0 ? bidsList[0].orderId : productDetail.orderId || '';
setDialogState({
Expand Down
6 changes: 4 additions & 2 deletions src/pages/SingleNFTAuction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { blankNFTItem } from 'src/constants/init-constants';
import ProjectDescription from 'src/components/SingleNFTMoreInfo/ProjectDescription';
import AboutAuthor from 'src/components/SingleNFTMoreInfo/AboutAuthor';
import ChainDetails from 'src/components/SingleNFTMoreInfo/ChainDetails';
import { getMintCategory } from 'src/services/common';
import { getMintCategory, reduceHexAddress } from 'src/services/common';
// import PlaceBidDlgContainer from 'src/components/TransactionDialogs/PlaceBid';
// import ChangePriceDlgContainer from 'src/components/TransactionDialogs/ChangePrice';
// import CancelSaleDlgContainer from 'src/components/TransactionDialogs/CancelSale';
Expand All @@ -45,7 +45,9 @@ const SingleNFTAuction: React.FC = (): JSX.Element => {
const [myBidsList, setMyBidsList] = useState<Array<TypeSingleNFTBid>>([]);
let lastBidder = 0;
let lastBidPrice = 0;
let lastBidderName = productDetail.holderName;
let lastBidderName = productDetail.holderName
? productDetail.holderName
: reduceHexAddress(productDetail.holder, 4);
let lastBidderAddress = '';
let lastBidOrderId = productDetail.orderId || '';
// check for latest bidder and bid price
Expand Down
13 changes: 5 additions & 8 deletions src/services/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export const getNFTItem = async (
_NFTItem.authorImg = itemObject.authorAvatar ? getImageFromAsset(itemObject.authorAvatar) : 'default';
_NFTItem.authorAddress = itemObject.royaltyOwner;
_NFTItem.holder = itemObject.holder;
_NFTItem.holderName = itemObject.holderName ? itemObject.holderName : _NFTItem.author;
_NFTItem.holderName = itemObject.holder === itemObject.royaltyOwner ? _NFTItem.author : itemObject.holderName;
_NFTItem.orderId = itemObject.orderId;
_NFTItem.tokenIdHex = itemObject.tokenIdHex;
_NFTItem.royalties = parseInt(itemObject.royalties) / 1e4;
Expand Down Expand Up @@ -904,9 +904,7 @@ export const getMyNFTItem = async (
_MyNFTItem.authorImg = itemObject.authorAvatar ? getImageFromAsset(itemObject.authorAvatar) : 'default';
_MyNFTItem.authorAddress = itemObject.royaltyOwner;
_MyNFTItem.holderName =
!itemObject.holderName || itemObject.holder === itemObject.royaltyOwner
? _MyNFTItem.author
: itemObject.holderName;
itemObject.holder === itemObject.royaltyOwner ? _MyNFTItem.author : itemObject.holderName;
_MyNFTItem.holder = itemObject.holder;
_MyNFTItem.royaltyOwner = itemObject.royaltyOwner;
_MyNFTItem.tokenIdHex = itemObject.tokenIdHex;
Expand All @@ -915,12 +913,11 @@ export const getMyNFTItem = async (
_MyNFTItem.timestamp = parseInt(itemObject.createTime) * 1000;
const createTime = getTime(itemObject.createTime);
_MyNFTItem.createTime = createTime.date + ' ' + createTime.time;
if (itemObject.endTime && itemObject.endTime !== "0") {
if (itemObject.endTime && itemObject.endTime !== '0') {
const endTime = getTime(itemObject.endTime);
_MyNFTItem.endTime = endTime.date + ' ' + endTime.time;
}
else {
_MyNFTItem.endTime = "0";
} else {
_MyNFTItem.endTime = '0';
}
_MyNFTItem.holder = itemObject.holder;
_MyNFTItem.orderId = itemObject.orderId;
Expand Down

1 comment on commit 5a372e5

@vercel
Copy link

@vercel vercel bot commented on 5a372e5 May 21, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

met-east – ./

met-east-lifayi2008.vercel.app
met-east-git-main-lifayi2008.vercel.app
testnet.meteast.io

Please sign in to comment.