MetaplexAuctioneerProgram.buy constructor

MetaplexAuctioneerProgram.buy({
  1. required SolAddress auctionHouseProgram,
  2. required SolAddress listingConfig,
  3. required SolAddress seller,
  4. required SolAddress wallet,
  5. required SolAddress paymentAccount,
  6. required SolAddress transferAuthority,
  7. required SolAddress treasuryMint,
  8. required SolAddress tokenAccount,
  9. required SolAddress metadata,
  10. required SolAddress escrowPaymentAccount,
  11. required SolAddress authority,
  12. required SolAddress auctionHouse,
  13. required SolAddress auctionHouseFeeAccount,
  14. required SolAddress buyerTradeState,
  15. required SolAddress auctioneerAuthority,
  16. required SolAddress ahAuctioneerPda,
  17. required MetaplexAuctioneerBuyLayout layout,
  18. SolAddress tokenProgramId = SPLTokenProgramConst.tokenProgramId,
  19. SolAddress systemProgram = SystemProgramConst.programId,
  20. SolAddress rent = SystemProgramConst.sysvarRentPubkey,
})

Create a private buy bid by creating a buyer_trade_state account and an escrow_payment account and funding the escrow with the necessary SOL or SPL token amount.

Implementation

factory MetaplexAuctioneerProgram.buy(
    {
    /// Auction House Program
    required SolAddress auctionHouseProgram,
    // Accounts used for Auctioneer
    /// The Listing Config used for listing settings
    required SolAddress listingConfig,

    /// The seller of the NFT
    required SolAddress seller,

    /// User wallet account.
    required SolAddress wallet,

    /// User SOL or SPL account to transfer funds from.
    required SolAddress paymentAccount,

    /// SPL token account transfer authority.
    required SolAddress transferAuthority,

    /// Auction House instance treasury mint account.
    required SolAddress treasuryMint,

    /// SPL token account.
    required SolAddress tokenAccount,

    /// SPL token account metadata.
    required SolAddress metadata,

    /// Buyer escrow payment account PDA.
    required SolAddress escrowPaymentAccount,

    /// Auction House instance authority account.
    required SolAddress authority,

    /// Auction House instance PDA account.
    required SolAddress auctionHouse,

    /// Auction House instance fee account.
    required SolAddress auctionHouseFeeAccount,

    /// Buyer trade state PDA.
    required SolAddress buyerTradeState,

    /// The auctioneer program PDA running this auction.
    required SolAddress auctioneerAuthority,

    /// The auctioneer PDA owned by Auction House storing scopes.
    required SolAddress ahAuctioneerPda,
    required MetaplexAuctioneerBuyLayout layout,
    SolAddress tokenProgramId = SPLTokenProgramConst.tokenProgramId,
    SolAddress systemProgram = SystemProgramConst.programId,
    SolAddress rent = SystemProgramConst.sysvarRentPubkey}) {
  return MetaplexAuctioneerProgram(keys: [
    auctionHouseProgram.toReadOnly(),
    listingConfig.toWritable(),
    seller.toReadOnly(),
    wallet.toSigner(),
    paymentAccount.toWritable(),
    transferAuthority.toReadOnly(),
    treasuryMint.toReadOnly(),
    tokenAccount.toReadOnly(),
    metadata.toReadOnly(),
    escrowPaymentAccount.toWritable(),
    authority.toReadOnly(),
    auctionHouse.toReadOnly(),
    auctionHouseFeeAccount.toWritable(),
    buyerTradeState.toWritable(),
    auctioneerAuthority.toReadOnly(),
    ahAuctioneerPda.toReadOnly(),
    tokenProgramId.toReadOnly(),
    systemProgram.toReadOnly(),
    rent.toReadOnly(),
  ], programId: MetaplexAuctioneerProgramConst.programId, layout: layout);
}