MetaplexAuctionHouseProgram.buy constructor

MetaplexAuctionHouseProgram.buy({
  1. required SolAddress wallet,
  2. required SolAddress paymentAccount,
  3. required SolAddress transferAuthority,
  4. required SolAddress treasuryMint,
  5. required SolAddress tokenAccount,
  6. required SolAddress metadata,
  7. required SolAddress escrowPaymentAccount,
  8. required SolAddress authority,
  9. required SolAddress auctionHouse,
  10. required SolAddress auctionHouseFeeAccount,
  11. required SolAddress buyerTradeState,
  12. required MetaplexAuctionHouseBuyLayout layout,
  13. SolAddress tokenProgram = SPLTokenProgramConst.tokenProgramId,
  14. SolAddress systemProgram = SystemProgramConst.programId,
  15. 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 MetaplexAuctionHouseProgram.buy({
  required SolAddress wallet,
  required SolAddress paymentAccount,
  required SolAddress transferAuthority,
  required SolAddress treasuryMint,
  required SolAddress tokenAccount,
  required SolAddress metadata,
  required SolAddress escrowPaymentAccount,
  required SolAddress authority,
  required SolAddress auctionHouse,
  required SolAddress auctionHouseFeeAccount,
  required SolAddress buyerTradeState,
  required MetaplexAuctionHouseBuyLayout layout,
  SolAddress tokenProgram = SPLTokenProgramConst.tokenProgramId,
  SolAddress systemProgram = SystemProgramConst.programId,
  SolAddress rent = SystemProgramConst.sysvarRentPubkey,
}) {
  return MetaplexAuctionHouseProgram(keys: [
    wallet.toSigner(),
    paymentAccount.toWritable(),
    transferAuthority.toReadOnly(),
    treasuryMint.toReadOnly(),
    tokenAccount.toReadOnly(),
    metadata.toReadOnly(),
    escrowPaymentAccount.toWritable(),
    authority.toReadOnly(),
    auctionHouse.toReadOnly(),
    auctionHouseFeeAccount.toWritable(),
    buyerTradeState.toWritable(),
    tokenProgram.toReadOnly(),
    systemProgram.toReadOnly(),
    rent.toReadOnly()
  ], programId: MetaplexAuctionHouseProgramConst.programId, layout: layout);
}