import { useWallet } from '@solana/wallet-adapter-react' import { ModalProps } from '../../types/modal' import Modal from '../shared/Modal' import { useAuctionHouse, useBids, useLoadBids, } from 'hooks/market/useAuctionHouse' import { toUiDecimals } from '@blockworks-foundation/mango-v4' import { MANGO_MINT_DECIMALS } from 'utils/governance/constants' import { ImgWithLoader } from '@components/ImgWithLoader' import metaplexStore from '@store/metaplexStore' import { Bid } from '@metaplex-foundation/js' import { useTranslation } from 'next-i18next' import dayjs from 'dayjs' import NftMarketButton from './NftMarketButton' const MyBidsModal = ({ isOpen, onClose }: ModalProps) => { const { publicKey } = useWallet() const metaplex = metaplexStore((s) => s.metaplex) const { t } = useTranslation(['nft-market']) const { data: auctionHouse } = useAuctionHouse() const { data: lazyBids, refetch } = useBids() const myBids = lazyBids && publicKey ? lazyBids.filter((x) => x.buyerAddress.equals(publicKey)) : [] const { data: bids } = useLoadBids(myBids) const cancelBid = async (bid: Bid) => { await metaplex!.auctionHouse().cancelBid({ auctionHouse: auctionHouse!, bid, }) refetch() } return (

Your Offers

{bids?.map((x) => (

{dayjs(x.createdAt.toNumber()).format('DD MMM YY h:mma')}

{toUiDecimals(x.price.basisPoints, MANGO_MINT_DECIMALS)} MNGO
cancelBid(x)} />
))}
) } export default MyBidsModal