From 6226ade91d898ab5678f588c0d706cc867d7eb6e Mon Sep 17 00:00:00 2001 From: shotgunofdeath <42133844+shotgunofdeath@users.noreply.github.com> Date: Mon, 13 Sep 2021 14:19:33 +0300 Subject: [PATCH] feat(instant sale): allow auction owner place bid on mater nft with no copies --- js/packages/common/src/utils/ids.ts | 10 +++++--- .../web/src/components/AuctionCard/index.tsx | 25 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/js/packages/common/src/utils/ids.ts b/js/packages/common/src/utils/ids.ts index 6816fff..926712d 100644 --- a/js/packages/common/src/utils/ids.ts +++ b/js/packages/common/src/utils/ids.ts @@ -67,10 +67,14 @@ export const METADATA_PROGRAM_ID = export const VAULT_ID = 'vau1zxA2LbssAUEF7Gpw91zMM1LvXrvpzJtmZ58rPsn' as StringPublicKey; +// export const AUCTION_ID = +// 'auctxRXPeJoc4817jDhf4HbjnhEcr1cCXenosMhK5R8' as StringPublicKey; +// +// export const METAPLEX_ID = +// 'p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98' as StringPublicKey; export const AUCTION_ID = - 'auctxRXPeJoc4817jDhf4HbjnhEcr1cCXenosMhK5R8' as StringPublicKey; - + 'D97wCr2KeRKCbyDmCCWe8dyDmNRDVCpBqnyv8HRfMVLQ' as StringPublicKey; export const METAPLEX_ID = - 'p1exdMJcjVao65QdewkaZRUnU6VPSXhus9n2GzWfh98' as StringPublicKey; + '8sSkg1dMoB6dBPeyHbLcunH2B6Dt6n1MGsUa6nbCms75' as StringPublicKey; export const SYSTEM = new PublicKey('11111111111111111111111111111111'); diff --git a/js/packages/web/src/components/AuctionCard/index.tsx b/js/packages/web/src/components/AuctionCard/index.tsx index b8193e1..df66e99 100644 --- a/js/packages/web/src/components/AuctionCard/index.tsx +++ b/js/packages/web/src/components/AuctionCard/index.tsx @@ -44,6 +44,7 @@ import { findEligibleParticipationBidsForRedemption } from '../../actions/claimU import { BidRedemptionTicket, MAX_PRIZE_TRACKING_TICKET_SIZE, + WinningConfigType, } from '../../models/metaplex'; async function calculateTotalCostOfRedeemingOtherPeoplesBids( @@ -395,7 +396,7 @@ export const AuctionCard = ({ ) : auctionView.isInstantSale ? ( !isAuctionManagerAuthorityNotWalletOwner ? ( - 'Claim master' + 'Claim item' ) : auctionView.myBidderPot ? ( 'Claim Purchase' ) : ( @@ -514,14 +515,26 @@ export const AuctionCard = ({ const instantSale = async () => { setLoading(true); - - // Placing a "bid" of the full amount results in a purchase to redeem. - if ( + const instantSalePrice = + auctionView.auctionDataExtended?.info.instantSalePrice; + const winningConfigType = + auctionView.items[0][0].winningConfigType; + const isAuctionItemMaster = + winningConfigType === WinningConfigType.FullRightsTransfer || + winningConfigType === WinningConfigType.TokenOnlyTransfer; + const allowBidToPublic = myPayingAccount && !auctionView.myBidderPot && isAuctionManagerAuthorityNotWalletOwner && - auctionView.auctionDataExtended?.info.instantSalePrice - ) { + instantSalePrice; + const allowBidToAuctionOwner = + myPayingAccount && + !isAuctionManagerAuthorityNotWalletOwner && + isAuctionItemMaster && + instantSalePrice; + + // Placing a "bid" of the full amount results in a purchase to redeem. + if (allowBidToPublic || allowBidToAuctionOwner) { try { const bid = await sendPlaceBid( connection,