ywpl_plex/
instruction.rs

1use crate::{
2    deprecated_state::AuctionManagerSettingsV1,
3    state::{SafetyDepositConfig, TupleNumericType, PREFIX},
4};
5use borsh::{BorshDeserialize, BorshSerialize};
6use mpl_token_metadata::state::EDITION_MARKER_BIT_SIZE;
7use solana_program::{
8    instruction::{AccountMeta, Instruction},
9    pubkey::Pubkey,
10    sysvar,
11};
12#[derive(BorshSerialize, BorshDeserialize, Clone)]
13pub struct SetStoreArgs {
14    pub public: bool,
15}
16
17#[derive(BorshSerialize, BorshDeserialize, Clone)]
18pub struct SetStoreV2Args {
19    pub public: bool,
20    pub settings_uri: Option<String>,
21}
22
23#[derive(BorshSerialize, BorshDeserialize, Clone)]
24pub struct SetWhitelistedCreatorArgs {
25    pub activated: bool,
26}
27
28#[derive(BorshSerialize, BorshDeserialize, Clone)]
29pub struct EmptyPaymentAccountArgs {
30    // If not redeeming a participation NFT's contributions, need to provide
31    // the winning config index your redeeming for. For participation, just pass None.
32    pub winning_config_index: Option<u8>,
33
34    /// If not redeeming a participation NFT, you also need to index into the winning config item's list.
35    pub winning_config_item_index: Option<u8>,
36
37    /// index in the metadata creator list, can be None if metadata has no creator list.
38    pub creator_index: Option<u8>,
39}
40#[derive(BorshSerialize, BorshDeserialize, Clone)]
41pub enum ProxyCallAddress {
42    RedeemBid,
43    RedeemFullRightsTransferBid,
44}
45#[derive(BorshSerialize, BorshDeserialize, Clone)]
46pub struct RedeemUnusedWinningConfigItemsAsAuctioneerArgs {
47    pub winning_config_item_index: u8,
48    pub proxy_call: ProxyCallAddress,
49}
50
51#[derive(BorshSerialize, BorshDeserialize, Clone)]
52pub struct RedeemPrintingV2BidArgs {
53    pub edition_offset: u64,
54    pub win_index: u64,
55}
56
57#[derive(BorshSerialize, BorshDeserialize, Clone)]
58pub struct RedeemParticipationBidV3Args {
59    pub win_index: Option<u64>,
60}
61
62#[derive(BorshSerialize, BorshDeserialize, Clone)]
63pub struct InitAuctionManagerV2Args {
64    pub amount_type: TupleNumericType,
65    pub length_type: TupleNumericType,
66    // how many ranges you can store in the AuctionWinnerTokenTypeTracker. For a limited edition single, you really
67    // only need 1, for more complex auctions you may need more. Feel free to scale this
68    // with the complexity of your auctions - this thing stores a range of how many unique token types
69    // each range of people gets in the most efficient compressed way possible, but if you don't
70    // give a high enough list length, while you may save space, you may also blow out your struct size while performing
71    // validation and have a failed auction.
72    pub max_ranges: u64,
73}
74#[derive(BorshSerialize, BorshDeserialize, Clone)]
75pub struct EndAuctionArgs {
76    /// If the auction was blinded, a revealing price must be specified to release the auction
77    /// winnings.
78    pub reveal: Option<(u64, u64)>,
79}
80
81#[derive(BorshSerialize, BorshDeserialize, Clone)]
82pub struct SetStoreIndexArgs {
83    pub page: u64,
84    pub offset: u64,
85}
86
87/// Instructions supported by the Fraction program.
88#[derive(BorshSerialize, BorshDeserialize, Clone)]
89pub enum MetaplexInstruction {
90    /// Initializes an Auction Manager V1
91    ///
92    ///   0. `[writable]` Uninitialized, unallocated auction manager account with pda of ['metaplex', auction_key from auction referenced below]
93    ///   1. `[]` Combined vault account with authority set to auction manager account (this will be checked)
94    ///           Note in addition that this vault account should have authority set to this program's pda of ['metaplex', auction_key]
95    ///   2. `[]` Auction with auctioned item being set to the vault given and authority set to this program's pda of ['metaplex', auction_key]
96    ///   3. `[]` Authority for the Auction Manager
97    ///   4. `[signer]` Payer
98    ///   5. `[]` Accept payment account of same token mint as the auction for taking payment for open editions, owner should be auction manager key
99    ///   6. `[]` Store that this auction manager will belong to
100    ///   7. `[]` System sysvar
101    ///   8. `[]` Rent sysvar
102    DeprecatedInitAuctionManagerV1(AuctionManagerSettingsV1),
103
104    /// Validates that a given safety deposit box has in it contents that match the expected WinningConfig in the auction manager.
105    /// A stateful call, this will error out if you call it a second time after validation has occurred.
106    ///   0. `[writable]` Uninitialized Safety deposit validation ticket, pda of seed ['metaplex', program id, auction manager key, safety deposit key]
107    ///   1. `[writable]` Auction manager
108    ///   2. `[writable]` Metadata account
109    ///   3. `[writable]` Original authority lookup - unallocated uninitialized pda account with seed ['metaplex', auction key, metadata key]
110    ///                   We will store original authority here to return it later.
111    ///   4. `[]` A whitelisted creator entry for the store of this auction manager pda of ['metaplex', store key, creator key]
112    ///   where creator key comes from creator list of metadata, any will do
113    ///   5. `[]` The auction manager's store key
114    ///   6. `[]` Safety deposit box account
115    ///   7. `[]` Safety deposit box storage account where the actual nft token is stored
116    ///   8. `[]` Mint account of the token in the safety deposit box
117    ///   9. `[]` Edition OR MasterEdition record key
118    ///           Remember this does not need to be an existing account (may not be depending on token), just is a pda with seed
119    ///            of ['metadata', program id, Printing mint id, 'edition']. - remember PDA is relative to token metadata program.
120    ///   10. `[]` Vault account
121    ///   11. `[signer]` Authority
122    ///   12. `[signer optional]` Metadata Authority - Signer only required if doing a full ownership txfer
123    ///   13. `[signer]` Payer
124    ///   14. `[]` Token metadata program
125    ///   15. `[]` System
126    ///   16. `[]` Rent sysvar
127    ///   17. `[writable]` Limited edition Printing mint account (optional - only if using sending Limited Edition)
128    ///   18. `[signer]` Limited edition Printing mint Authority account, this will TEMPORARILY TRANSFER MINTING AUTHORITY to the auction manager
129    ///         until all limited editions have been redeemed for authority tokens.
130    DeprecatedValidateSafetyDepositBoxV1,
131
132    /// NOTE: Requires an AuctionManagerV1.
133    /// Note: This requires that auction manager be in a Running state.
134    ///
135    /// If an auction is complete, you can redeem your bid for a specific item here. If you are the first to do this,
136    /// The auction manager will switch from Running state to Disbursing state. If you are the last, this may change
137    /// the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
138    ///
139    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at the RedeemParticipationBid point for an open edition
140    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
141    ///
142    ///   0. `[writable]` Auction manager
143    ///   1. `[writable]` Safety deposit token storage account
144    ///   2. `[writable]` Destination account.
145    ///   3. `[writable]` Bid redemption key -
146    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
147    ///   4. `[writable]` Safety deposit box account
148    ///   5. `[writable]` Vault account
149    ///   6. `[writable]` Fraction mint of the vault
150    ///   7. `[]` Auction
151    ///   8. `[]` Your BidderMetadata account
152    ///   9. `[signer optional]` Your Bidder account - Only needs to be signer if payer does not own
153    ///   10. `[signer]` Payer
154    ///   11. `[]` Token program
155    ///   12. `[]` Token Vault program
156    ///   13. `[]` Token metadata program
157    ///   14. `[]` Store
158    ///   15. `[]` System
159    ///   16. `[]` Rent sysvar
160    ///   17. `[]` PDA-based Transfer authority to move the tokens from the store to the destination seed ['vault', program_id, vault key]
161    ///        but please note that this is a PDA relative to the Token Vault program, with the 'vault' prefix
162    ///   18. `[optional/writable]` Master edition (if Printing type of WinningConfig)
163    ///   19. `[optional/writable]` Reservation list PDA ['metadata', program id, master edition key, 'reservation', auction manager key]
164    ///        relative to token metadata program (if Printing type of WinningConfig)
165    ///   20. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
166    ///      This account will only get used AND BE REQUIRED in the event this is an AuctionManagerV2
167    ///   21. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
168    RedeemBid,
169
170    /// Note: This requires that auction manager be in a Running state.
171    ///
172    /// If an auction is complete, you can redeem your bid for the actual Master Edition itself if it's for that prize here.
173    /// If you are the first to do this, the auction manager will switch from Running state to Disbursing state.
174    /// If you are the last, this may change the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
175    ///
176    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at the RedeemParticipationBid point for an open edition
177    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
178    ///
179    ///   0. `[writable]` Auction manager
180    ///   1. `[writable]` Safety deposit token storage account
181    ///   2. `[writable]` Destination account.
182    ///   3. `[writable]` Bid redemption key -
183    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
184    ///   4. `[writable]` Safety deposit box account
185    ///   5. `[writable]` Vault account
186    ///   6. `[writable]` Fraction mint of the vault
187    ///   7. `[]` Auction
188    ///   8. `[]` Your BidderMetadata account
189    ///   9. `[signer optional]` Your Bidder account - Only needs to be signer if payer does not own
190    ///   10. `[signer]` Payer
191    ///   11. `[]` Token program
192    ///   12. `[]` Token Vault program
193    ///   13. `[]` Token metadata program
194    ///   14. `[]` Store
195    ///   15. `[]` System
196    ///   16. `[]` Rent sysvar
197    ///   17. `[writable]` Master Metadata account (pda of ['metadata', program id, Printing mint id]) - remember PDA is relative to token metadata program
198    ///           (This account is optional, and will only be used if metadata is unique, otherwise this account key will be ignored no matter it's value)
199    ///   18. `[]` New authority for Master Metadata - If you are taking ownership of a Master Edition in and of itself, or a Limited Edition that isn't newly minted for you during this auction
200    ///             ie someone else had it minted for themselves in a prior auction or through some other means, this is the account the metadata for these tokens will be delegated to
201    ///             after this transaction. Otherwise this account will be ignored.
202    ///   19. `[]` PDA-based Transfer authority to move the tokens from the store to the destination seed ['vault', program_id, vault key]
203    ///        but please note that this is a PDA relative to the Token Vault program, with the 'vault' prefix
204    ///   20. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
205    ///      This account will only get used AND BE REQUIRED in the event this is an AuctionManagerV2
206    ///   21. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
207    RedeemFullRightsTransferBid,
208
209    /// Note: This requires that auction manager be in a Running state.
210    ///
211    /// If an auction is complete, you can redeem your bid for an Open Edition token if it is eligible. If you are the first to do this,
212    /// The auction manager will switch from Running state to Disbursing state. If you are the last, this may change
213    /// the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
214    ///
215    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at this end point for a open edition
216    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
217    ///
218    /// NOTE: If you are redeeming a newly minted Open Edition, you must actually supply a destination account containing a token from a brand new
219    /// mint. We do not provide the token to you. Our job with this action is to christen this mint + token combo as an official Open Edition.
220    ///
221    ///   0. `[writable]` Auction manager
222    ///   1. `[writable]` Safety deposit token storage account
223    ///   2. `[writable]` Destination account for limited edition authority token. Must be same mint as master edition Printing mint.
224    ///   3. `[writable]` Bid redemption key -
225    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
226    ///   4. `[]` Safety deposit box account
227    ///   5. `[]` Vault account
228    ///   6. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
229    ///      This account will only get used in the event this is an AuctionManagerV2    
230    ///   7. `[]` Auction
231    ///   8. `[]` Your BidderMetadata account
232    ///   9. `[signer optional/writable]` Your Bidder account - Only needs to be signer if payer does not own
233    ///   10. `[signer]` Payer
234    ///   11. `[]` Token program
235    ///   12. `[]` Token Vault program
236    ///   13. `[]` Token metadata program
237    ///   14. `[]` Store
238    ///   15. `[]` System
239    ///   16. `[]` Rent sysvar
240    ///   17. `[signer]` Transfer authority to move the payment in the auction's token_mint coin from the bidder account for the participation_fixed_price
241    ///             on the auction manager to the auction manager account itself.
242    ///   18.  `[writable]` The accept payment account for the auction manager
243    ///   19.  `[writable]` The token account you will potentially pay for the open edition bid with if necessary
244    ///   20. `[writable]` Participation NFT printing holding account (present on participation_state)
245    ///   21. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
246    DeprecatedRedeemParticipationBid,
247
248    /// If the auction manager is in Validated state, it can invoke the start command via calling this command here.
249    ///
250    ///   0. `[writable]` Auction manager
251    ///   1. `[writable]` Auction
252    ///   3. `[signer]` Auction manager authority
253    ///   4. `[]` Store key
254    ///   5. `[]` Auction program
255    ///   6. `[]` Clock sysvar
256    StartAuction,
257
258    /// If the auction manager is in a Disbursing or Finished state, then this means Auction must be in Ended state.
259    /// Then this end point can be used as a signed proxy to use auction manager's authority over the auction to claim bid funds
260    /// into the accept payment account on the auction manager for a given bid. Auction has no opinions on how bids are redeemed,
261    /// only that they exist, have been paid, and have a winning place. It is up to the implementer of the auction to determine redemption,
262    /// and auction manager does this via bid redemption tickets and the vault contract which ensure the user always
263    /// can get their NFT once they have paid. Therefore, once they have paid, and the auction is over, the artist can claim
264    /// funds at any time without any danger to the user of losing out on their NFT, because the AM will honor their bid with an NFT
265    /// at ANY time.
266    ///
267    ///   0. `[writable]` The accept payment account on the auction manager
268    ///   1. `[writable]` The bidder pot token account
269    ///   2. `[writable]` The bidder pot pda account [seed of ['auction', program_id, auction key, bidder key] -
270    ///           relative to the auction program, not auction manager
271    ///   3. `[writable]` Auction manager
272    ///   4. `[]` The auction
273    ///   5. `[]` The bidder wallet
274    ///   6. `[]` Token mint of the auction
275    ///   7. `[]` Vault
276    ///   8. `[]` Store
277    ///   9. `[]` Auction program
278    ///   10. `[]` Clock sysvar
279    ///   11. `[]` Token program
280    ///   12. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
281    ClaimBid,
282
283    /// At any time, the auction manager authority may empty whatever funds are in the accept payment account
284    /// on the auction manager. Funds come here from fixed price payments for partipation nfts, and from draining bid payments
285    /// from the auction.
286    ///
287    /// This action specifically takes a given safety deposit box, winning config, and creator on a metadata for the token inside that safety deposit box
288    /// and pumps the requisite monies out to that creator as required by the royalties formula.
289    ///
290    /// It's up to the UI to iterate through all winning configs, all safety deposit boxes in a given winning config tier, and all creators for
291    /// each metadata attached to each safety deposit box, to get all the money. Note that one safety deposit box can be used in multiple different winning configs,
292    /// but this shouldn't make any difference to this function.
293    ///
294    /// We designed this function to be called in this loop-like manner because there is a limit to the number of accounts that can
295    /// be passed up at once (32) and there may be many more than that easily in a given auction, so it's easier for the implementer to just
296    /// loop through and call it, and there is an incentive for them to do so (to get paid.) It's permissionless as well as it
297    /// will empty into any destination account owned by the creator that has the proper mint, so anybody can call it.
298    ///
299    /// For the participation NFT, there is no winning config, but the total is figured by summing the winning bids and subtracting
300    /// from the total escrow amount present.
301    ///
302    ///   0. `[writable]` The accept payment account on the auction manager
303    ///   1. `[writable]` The destination account of same mint type as the accept payment account. Must be an Associated Token Account.
304    ///   2. `[writable]` Auction manager
305    ///   3. `[writable]` Payout ticket info to keep track of this artist or auctioneer's payment, pda of [metaplex, auction manager, winning config index OR 'participation', safety deposit key]
306    ///   4. `[signer]` payer
307    ///   5. `[]` The metadata
308    ///   6. `[]` The master edition of the metadata (optional if exists)
309    ///           (pda of ['metadata', program id, metadata mint id, 'edition']) - remember PDA is relative to token metadata program
310    ///   7. `[]` Safety deposit box account
311    ///   8. `[]` The store of the auction manager
312    ///   9. `[]` The vault
313    ///   10. `[]` Auction
314    ///   11. `[]` Token program
315    ///   12. `[]` System program
316    ///   13. `[]` Rent sysvar
317    ///   14. `[]` AuctionWinnerTokenTypeTracker, pda of seed ['metaplex', program id, auction manager key, 'totals']
318    ///   15. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
319    EmptyPaymentAccount(EmptyPaymentAccountArgs),
320
321    /// Given a signer wallet, create a store with pda ['metaplex', wallet] (if it does not exist) and/or update it
322    /// (if it already exists). Stores can be set to open (anybody can publish) or closed (publish only via whitelist).
323    ///
324    ///   0. `[writable]` The store key, seed of ['metaplex', admin wallet]
325    ///   1. `[signer]`  The admin wallet
326    ///   2. `[signer]`  Payer
327    ///   3. `[]` Token program
328    ///   4. `[]` Token vault program
329    ///   5. `[]` Token metadata program
330    ///   6. `[]` Auction program
331    ///   7. `[]` System
332    ///   8. `[]` Rent sysvar
333    SetStore(SetStoreArgs),
334
335    /// Given an existing store, add or update an existing whitelisted creator for the store. This creates
336    /// a PDA with seed ['metaplex', store key, creator key] if it does not already exist to store attributes there.
337    ///
338    ///   0. `[writable]` The whitelisted creator pda key, seed of ['metaplex', store key, creator key]
339    ///   1. `[signer]`  The admin wallet
340    ///   2. `[signer]`  Payer
341    ///   3. `[]` The creator key
342    ///   4. `[]` The store key, seed of ['metaplex', admin wallet]
343    ///   5. `[]` System
344    ///   6. `[]` Rent sysvar
345    SetWhitelistedCreator(SetWhitelistedCreatorArgs),
346
347    /// NOTE: Requires an AuctionManagerV1.
348    ///   Validates an participation nft (if present) on the Auction Manager. Because of the differing mechanics of an open
349    ///   edition (required for participation nft), it needs to be validated at a different endpoint than a normal safety deposit box.
350    ///   0. `[writable]` Auction manager
351    ///   1. `[]` Open edition metadata
352    ///   2. `[]` Open edition MasterEdition account
353    ///   3. `[]` Printing authorization token holding account - must be of the printing_mint type on the master_edition, used by
354    ///        the auction manager to hold printing authorization tokens for all eligible winners of the participation nft when auction ends. Must
355    ///         be owned by auction manager account.
356    ///   4. `[signer]` Authority for the Auction Manager
357    ///   5. `[]` A whitelisted creator entry for this store for the open edition
358    ///       pda of ['metaplex', store key, creator key] where creator key comes from creator list of metadata
359    ///   6. `[]` The auction manager's store
360    ///   7. `[]` Safety deposit box
361    ///   8. `[]` Safety deposit token store
362    ///   9. `[]` Vault
363    ///   10. `[]` Rent sysvar
364    DeprecatedValidateParticipation,
365
366    /// NOTE: Requires an AuctionManagerV1.
367    /// Needs to be called by someone at the end of the auction - will use the one time authorization token
368    /// to fire up a bunch of printing tokens for use in participation redemptions.
369    ///
370    ///   0. `[writable]` Safety deposit token store
371    ///   1. `[writable]` Transient account with mint of one time authorization account on master edition - you can delete after this txn
372    ///   2. `[writable]` The printing token account on the participation state of the auction manager
373    ///   3. `[writable]` One time printing authorization mint
374    ///   4. `[writable]` Printing mint
375    ///   5. `[writable]` Safety deposit of the participation prize
376    ///   6. `[writable]` Vault info
377    ///   7. `[]` Fraction mint
378    ///   8. `[]` Auction info
379    ///   9. `[]` Auction manager info
380    ///   10. `[]` Token program
381    ///   11. `[]` Token vault program
382    ///   12. `[]` Token metadata program
383    ///   13. `[]` Auction manager store
384    ///   14. `[]` Master edition
385    ///   15. `[]` PDA-based Transfer authority to move the tokens from the store to the destination seed ['vault', program_id]
386    ///        but please note that this is a PDA relative to the Token Vault program, with the 'vault' prefix
387    ///   16. `[]` Payer who wishes to receive refund for closing of one time transient account once we're done here
388    ///   17. `[]` Rent
389    DeprecatedPopulateParticipationPrintingAccount,
390
391    /// If you are an auctioneer, redeem an unused winning config entry. You provide the winning index, and if the winning
392    /// index has no winner, then the correct redemption method is called with a special flag set to ignore bidder_metadata checks
393    /// and a hardcoded winner index to empty this win to you.
394    ///
395    /// All the keys, in exact sequence, should follow the expected call you wish to proxy to, because these will be passed
396    /// to the process_ method of the next call. This method exists primarily to pass in an additional
397    /// argument to the other redemption methods that subtly changes their behavior. We made this additional call so that if the auctioneer
398    /// calls those methods directly, they still act the same as if the auctioneer were a normal bidder, which is be desirable behavior.
399    ///
400    /// An auctioneer should never be in the position where the auction can never work the same for them simply because they are an auctioneer.
401    /// This special endpoint exists to give them the "out" to unload items via a proxy call once the auction is over.
402    RedeemUnusedWinningConfigItemsAsAuctioneer(RedeemUnusedWinningConfigItemsAsAuctioneerArgs),
403
404    /// If you have an auction manager in an Initialized state and for some reason you can't validate it, you want to retrieve
405    /// The items inside of it. This will allow you to move it straight to Disbursing, and then you can, as Auctioneer,
406    /// Redeem those items using the RedeemUnusedWinningConfigItemsAsAuctioneer endpoint.
407    ///
408    /// If you pass the vault program account, authority over the vault will be returned to you, so you can unwind the vault
409    /// to get your items back that way instead.
410    ///
411    /// Be WARNED: Because the boxes have not been validated, the logic for redemptions may not work quite right. For instance,
412    /// if your validation step failed because you provided an empty box but said there was a token in it, when you go
413    /// and try to redeem it, you yourself will experience quite the explosion. It will be up to you to tactfully
414    /// request the bids that can be properly redeemed from the ones that cannot.
415    ///
416    /// If you had a FullRightsTransfer token, and you never validated (and thus transferred) ownership, when the redemption happens
417    /// it will skip trying to transfer it to you, so that should work fine.
418    ///
419    /// 0. `[writable]` Auction Manager
420    /// 1. `[writable]` Auction
421    /// 2. `[signer]` Authority of the Auction Manager
422    /// 3. `[writable]` Vault
423    /// 4. `[]` Store
424    /// 5. `[]` Auction program
425    /// 6. `[]` Clock sysvar
426    /// 7. `[]` Vault program (Optional)
427    DecommissionAuctionManager,
428
429    /// Note: This requires that auction manager be in a Running state and that be of the V1 type.
430    ///
431    /// If an auction is complete, you can redeem your printing v2 bid for a specific item here. If you are the first to do this,
432    /// The auction manager will switch from Running state to Disbursing state. If you are the last, this may change
433    /// the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
434    ///
435    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at the RedeemParticipationBid point for an open edition
436    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
437    ///
438    ///   0. `[writable]` Auction manager
439    ///   1. `[writable]` Safety deposit token storage account
440    ///   2. `[writable]` Account containing 1 token of your new mint type.
441    ///   MUST be an associated token account of pda [wallet, token program, mint] relative to ata program.
442    ///   3. `[writable]` Bid redemption key -
443    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
444    ///   4. `[writable]` Safety deposit box account
445    ///   5. `[writable]` Vault account
446    ///   6. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
447    ///      This account will only get used in the event this is an AuctionManagerV2
448    ///   7. `[]` Auction
449    ///   8. `[]` Your BidderMetadata account
450    ///   9. `[]` Your Bidder account - Only needs to be signer if payer does not own
451    ///   10. `[signer]` Payer
452    ///   11. `[]` Token program
453    ///   12. `[]` Token Vault program
454    ///   13. `[]` Token metadata program
455    ///   14. `[]` Store
456    ///   15. `[]` System
457    ///   16. `[]` Rent sysvar
458    ///   17. `[writable]` Prize tracking ticket (pda of ['metaplex', program id, auction manager key, metadata mint id])
459    ///   18. `[writable]` New Metadata key (pda of ['metadata', program id, mint id])
460    ///   19. `[writable]` New Edition (pda of ['metadata', program id, mint id, 'edition'])
461    ///   20. `[writable]` Master Edition of token in vault V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) PDA is relative to token metadata.
462    ///   21. `[writable]` Mint of new token
463    ///   22. `[writable]` Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number])
464    ///        where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). PDA is relative to token metadata.
465    ///   23. `[signer]` Mint authority of new mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY
466    ///   24. `[]` Metadata account of token in vault
467    ///   25. `[]` Auction extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
468    RedeemPrintingV2Bid(RedeemPrintingV2BidArgs),
469
470    /// Permissionless call to redeem the master edition in a given safety deposit for a PrintingV2 winning config to the
471    /// ATA of the Auctioneer. Can only be called once all redemptions have been met.
472    ///
473    ///   0. `[writable]` Auction manager
474    ///   1. `[writable]` Safety deposit token storage account
475    ///   2. `[writable]` Associated token account owned by auction manager authority of same mint as token storage account
476    ///   3. `[writable]` Safety deposit box account
477    ///   4. `[writable]` Vault account
478    ///   5. `[writable]` Fraction mint of the vault
479    ///   6. `[]` Prize tracking ticket (pda of ['metaplex', program id, auction manager key, metadata mint id])
480    ///   7. `[]` PDA-based Vault transfer authority ['vault', program_id, vault key]
481    ///        but please note that this is a PDA relative to the Token Vault program, with the 'vault' prefix
482    ///   8. `[]` Auction
483    ///   9. `[]` Auction data extended (pda relative to auction of ['auction', program id, vault key, 'extended'])
484    ///   10. `[]` Token program
485    ///   11. `[]` Token Vault program
486    ///   12. `[]` Store
487    ///   13. `[]` Rent sysvar
488    ///   14. `[]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
489    ///      This account will only get used in the event this is an AuctionManagerV2
490    WithdrawMasterEdition,
491
492    /// Note: This requires that auction manager be in a Running state.
493    ///
494    /// Second note: Unlike it's predecessor, V2 is permissionless.
495    /// You can in theory pay for someone else's participation NFT and gift it to them.
496    ///
497    /// If an auction is complete, you can redeem your bid for an Open Edition token if it is eligible. If you are the first to do this,
498    /// The auction manager will switch from Running state to Disbursing state. If you are the last, this may change
499    /// the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
500    ///
501    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at this end point for a open edition
502    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
503    ///
504    /// NOTE: If you are redeeming a newly minted Open Edition, you must actually supply a destination account containing a token from a brand new
505    /// mint. We do not provide the token to you. Our job with this action is to christen this mint + token combo as an official Open Edition.
506    ///
507    ///   0. `[writable]` Auction manager
508    ///   1. `[writable]` Safety deposit token storage account
509    ///   2. `[writable]` Account containing 1 token of your new mint type.
510    ///   MUST be an associated token account of pda [wallet, token program, mint] relative to ata program.
511    ///   3. `[writable]` Bid redemption key -
512    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
513    ///   4. `[]` Safety deposit box account
514    ///   5. `[]` Vault account
515    ///   6. `[writable]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
516    ///      This account will only get used in the event this is an AuctionManagerV2
517    ///   7. `[]` Auction
518    ///   8. `[]` Your BidderMetadata account
519    ///   9. `[]` Your Bidder account
520    ///   10. `[signer]` Payer
521    ///   11. `[]` Token program
522    ///   12. `[]` Token Vault program
523    ///   13. `[]` Token metadata program
524    ///   14. `[]` Store
525    ///   15. `[]` System
526    ///   16. `[]` Rent sysvar
527    ///   17. `[signer]` Transfer authority to move the payment in the auction's token_mint coin from the bidder account for the participation_fixed_price
528    ///             on the auction manager to the auction manager account itself.
529    ///   18.  `[writable]` The accept payment account for the auction manager
530    ///   19.  `[writable]` The token account you will potentially pay for the open edition bid with if necessary.
531    ///   20. `[writable]` Prize tracking ticket (pda of ['metaplex', program id, auction manager key, metadata mint id])
532    ///   21. `[writable]` New Metadata key (pda of ['metadata', program id, mint id])
533    ///   22. `[writable]` New Edition (pda of ['metadata', program id, mint id, 'edition'])
534    ///   23. `[writable]` Master Edition of token in vault V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) PDA is relative to token metadata.
535    ///   24. `[writable]` Mint of new token
536    ///   25. `[writable]` Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number])
537    ///        where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). PDA is relative to token metadata.
538    ///   26. `[signer]` Mint authority of new mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY
539    ///   27. `[]` Metadata account of token in vault
540    //    28. `[]` Auction data extended - pda of ['auction', auction program id, vault key, 'extended'] relative to auction program
541    DeprecatedRedeemParticipationBidV2,
542
543    /// Initializes an Auction Manager V2
544    ///
545    /// NOTE: It is not possible to use MasterEditionV1s for participation nfts with these managers.
546    ///
547    ///   0. `[writable]` Uninitialized, unallocated auction manager account with pda of ['metaplex', auction_key from auction referenced below]
548    ///   1. `[writable]` AuctionWinnerTokenTypeTracker, pda of seed ['metaplex', program id, auction manager key, 'totals']
549    ///   2. `[]` Combined vault account with authority set to auction manager account (this will be checked)
550    ///           Note in addition that this vault account should have authority set to this program's pda of ['metaplex', auction_key]
551    ///   3. `[]` Auction with auctioned item being set to the vault given and authority set to this program's pda of ['metaplex', auction_key]
552    ///   4. `[]` Authority for the Auction Manager
553    ///   5. `[signer]` Payer
554    ///   6. `[]` Accept payment account of same token mint as the auction for taking payment for open editions, owner should be auction manager key
555    ///   7. `[]` Store that this auction manager will belong to
556    ///   8. `[]` System sysvar    
557    ///   9. `[]` Rent sysvar
558    InitAuctionManagerV2(InitAuctionManagerV2Args),
559
560    /// NOTE: Requires an AuctionManagerV2.
561    ///
562    /// Validates that a given safety deposit box has in it contents that match the given SafetyDepositConfig, and creates said config.
563    /// A stateful call, this will error out if you call it a second time after validation has occurred.
564    ///   0. `[writable]` Uninitialized Safety deposit config, pda of seed ['metaplex', program id, auction manager key, safety deposit key]
565    ///   1. `[writable]` AuctionWinnerTokenTypeTracker, pda of seed ['metaplex', program id, auction manager key, 'totals']
566    ///   2. `[writable]` Auction manager
567    ///   3. `[writable]` Metadata account
568    ///   4. `[writable]` Original authority lookup - unallocated uninitialized pda account with seed ['metaplex', auction key, metadata key]
569    ///                   We will store original authority here to return it later.
570    ///   5. `[]` A whitelisted creator entry for the store of this auction manager pda of ['metaplex', store key, creator key]
571    ///   where creator key comes from creator list of metadata, any will do
572    ///   6. `[]` The auction manager's store key
573    ///   7. `[]` Safety deposit box account
574    ///   8. `[]` Safety deposit box storage account where the actual nft token is stored
575    ///   9. `[]` Mint account of the token in the safety deposit box
576    ///   10. `[]` Edition OR MasterEdition record key
577    ///           Remember this does not need to be an existing account (may not be depending on token), just is a pda with seed
578    ///            of ['metadata', program id, Printing mint id, 'edition']. - remember PDA is relative to token metadata program.
579    ///   11. `[]` Vault account
580    ///   12. `[signer]` Authority
581    ///   13. `[signer optional]` Metadata Authority - Signer only required if doing a full ownership txfer
582    ///   14. `[signer]` Payer
583    ///   15. `[]` Token metadata program
584    ///   16. `[]` System
585    ///   17. `[]` Rent sysvar
586    ValidateSafetyDepositBoxV2(SafetyDepositConfig),
587
588    /// Note: This requires that auction manager be in a Running state.
589    ///
590    /// Second note: V3 is the same as V2, but it requires an additional argument because it is intended to be used with AuctionManagerV2s,
591    /// not V1s, which use BidRedemptionTicketV2s, which require this additional argument (the user_provided_win_index).
592    /// You can in theory pay for someone else's participation NFT and gift it to them.
593    ///
594    /// If an auction is complete, you can redeem your bid for an Open Edition token if it is eligible. If you are the first to do this,
595    /// The auction manager will switch from Running state to Disbursing state. If you are the last, this may change
596    /// the auction manager state to Finished provided that no authorities remain to be delegated for Master Edition tokens.
597    ///
598    /// NOTE: Please note that it is totally possible to redeem a bid 2x - once for a prize you won and once at this end point for a open edition
599    /// that comes as a 'token of appreciation' for bidding. They are not mutually exclusive unless explicitly set to be that way.
600    ///
601    /// NOTE: If you are redeeming a newly minted Open Edition, you must actually supply a destination account containing a token from a brand new
602    /// mint. We do not provide the token to you. Our job with this action is to christen this mint + token combo as an official Open Edition.
603    ///
604    ///   0. `[writable]` Auction manager
605    ///   1. `[writable]` Safety deposit token storage account
606    ///   2. `[writable]` Account containing 1 token of your new mint type.
607    ///   MUST be an associated token account of pda [wallet, token program, mint] relative to ata program.
608    ///   3. `[writable]` Bid redemption key -
609    ///        Just a PDA with seed ['metaplex', auction_key, bidder_metadata_key] that we will allocate to mark that you redeemed your bid
610    ///   4. `[]` Safety deposit box account
611    ///   5. `[]` Vault account
612    ///   6. `[writable]` Safety deposit config pda of ['metaplex', program id, auction manager, safety deposit]
613    ///      This account will only get used in the event this is an AuctionManagerV2
614    ///   7. `[]` Auction
615    ///   8. `[]` Your BidderMetadata account
616    ///   9. `[]` Your Bidder account
617    ///   10. `[signer]` Payer
618    ///   11. `[]` Token program
619    ///   12. `[]` Token Vault program
620    ///   13. `[]` Token metadata program
621    ///   14. `[]` Store
622    ///   15. `[]` System
623    ///   16. `[]` Rent sysvar
624    ///   17. `[signer]` Transfer authority to move the payment in the auction's token_mint coin from the bidder account for the participation_fixed_price
625    ///             on the auction manager to the auction manager account itself.
626    ///   18.  `[writable]` The accept payment account for the auction manager
627    ///   19.  `[writable]` The token account you will potentially pay for the open edition bid with if necessary.
628    ///   20. `[writable]` Prize tracking ticket (pda of ['metaplex', program id, auction manager key, metadata mint id])
629    ///   21. `[writable]` New Metadata key (pda of ['metadata', program id, mint id])
630    ///   22. `[writable]` New Edition (pda of ['metadata', program id, mint id, 'edition'])
631    ///   23. `[writable]` Master Edition of token in vault V2 (pda of ['metadata', program id, master metadata mint id, 'edition']) PDA is relative to token metadata.
632    ///   24. `[writable]` Mint of new token
633    ///   25. `[writable]` Edition pda to mark creation - will be checked for pre-existence. (pda of ['metadata', program id, master metadata mint id, 'edition', edition_number])
634    ///        where edition_number is NOT the edition number you pass in args but actually edition_number = floor(edition/EDITION_MARKER_BIT_SIZE). PDA is relative to token metadata.
635    ///   26. `[signer]` Mint authority of new mint - THIS WILL TRANSFER AUTHORITY AWAY FROM THIS KEY
636    ///   27. `[]` Metadata account of token in vault
637    //    28. `[]` Auction data extended - pda of ['auction', auction program id, vault key, 'extended'] relative to auction program
638    RedeemParticipationBidV3(RedeemParticipationBidV3Args),
639    /// Ends an auction, regardless of end timing conditions.
640    ///
641    ///   0. `[writable]` Auction manager
642    ///   1. `[writable]` Auction
643    ///   2. `[]` Auction extended data account (pda relative to auction of ['auction', program id, vault key, 'extended']).
644    ///   3. `[signer]` Auction manager authority
645    ///   4. `[]` Store key
646    ///   5. `[]` Auction program
647    ///   6. `[]` Clock sysvar
648    EndAuction(EndAuctionArgs),
649    /// Creates/Updates a store index page
650    ///
651    ///   0. `[writable]` Store index (pda of ['metaplex', program id, store key, 'index', page_number])
652    ///   1. `[signer]` Payer info
653    ///   2. `[]` Auction cache (pda of ['metaplex', program id, store key, auction key, 'cache'])
654    ///   3. `[]` Store key
655    ///   4. `[]` System
656    ///   5. `[]` Rent sysvar
657    ///   7. `[optional]` Auction cache above current (pda of ['metaplex', program id, store key, auction key, 'cache'])
658    ///                   Note: Can pass the below in this slot if there is no above
659    ///   8. `[optional]` Auction cache below current (pda of ['metaplex', program id, store key, auction key, 'cache'])
660    SetStoreIndex(SetStoreIndexArgs),
661    /// Creates/Updates a store index page
662    ///
663    ///   0. `[writable]` Auction cache (pda of ['metaplex', program id, store key, auction key, 'cache'])
664    ///   1. `[signer]` Payer info
665    ///   2. `[]` Auction
666    ///   3. `[]` Safety deposit box account
667    ///   4. `[]` Auction manager
668    ///   5. `[]` Store key
669    ///   6. `[]` System
670    ///   7. `[]` Rent sysvar
671    ///   8. `[]` Clock sysvar
672    SetAuctionCache,
673    /// Given a signer wallet, create a store with pda ['metaplex', wallet] (if it does not exist) and/or update it
674    /// (if it already exists). Stores can be set to open (anybody can publish) or closed (publish only via whitelist).
675    ///
676    ///   0. `[writable]` The store key, seed of ['metaplex', admin wallet]
677    ///   1. `[writable]` The store config key, seed of ['metaplex', store key]
678    ///   2. `[signer]`  The admin wallet
679    ///   3. `[signer]`  Payer
680    ///   4. `[]` Token program
681    ///   5. `[]` Token vault program
682    ///   6. `[]` Token metadata program
683    ///   7. `[]` Auction program
684    ///   8. `[]` System
685    ///   8. `[]` Rent sysvar
686    SetStoreV2(SetStoreV2Args),
687}
688
689/// Creates an DeprecatedInitAuctionManager instruction
690#[allow(clippy::too_many_arguments)]
691pub fn create_deprecated_init_auction_manager_v1_instruction(
692    program_id: Pubkey,
693    auction_manager: Pubkey,
694    vault: Pubkey,
695    auction: Pubkey,
696    auction_manager_authority: Pubkey,
697    payer: Pubkey,
698    accept_payment_account_key: Pubkey,
699    store: Pubkey,
700    settings: AuctionManagerSettingsV1,
701) -> Instruction {
702    Instruction {
703        program_id,
704        accounts: vec![
705            AccountMeta::new(auction_manager, false),
706            AccountMeta::new_readonly(vault, false),
707            AccountMeta::new_readonly(auction, false),
708            AccountMeta::new_readonly(auction_manager_authority, false),
709            AccountMeta::new_readonly(payer, true),
710            AccountMeta::new_readonly(accept_payment_account_key, false),
711            AccountMeta::new_readonly(store, false),
712            AccountMeta::new_readonly(solana_program::system_program::id(), false),
713            AccountMeta::new_readonly(sysvar::rent::id(), false),
714        ],
715        data: MetaplexInstruction::DeprecatedInitAuctionManagerV1(settings)
716            .try_to_vec()
717            .unwrap(),
718    }
719}
720
721/// Creates an InitAuctionManager instruction
722#[allow(clippy::too_many_arguments)]
723pub fn create_init_auction_manager_v2_instruction(
724    program_id: Pubkey,
725    auction_manager: Pubkey,
726    vault: Pubkey,
727    auction: Pubkey,
728    auction_manager_authority: Pubkey,
729    payer: Pubkey,
730    accept_payment_account_key: Pubkey,
731    store: Pubkey,
732    amount_type: TupleNumericType,
733    length_type: TupleNumericType,
734    max_ranges: u64,
735) -> Instruction {
736    Instruction {
737        program_id,
738        accounts: vec![
739            AccountMeta::new(auction_manager, false),
740            AccountMeta::new_readonly(vault, false),
741            AccountMeta::new_readonly(auction, false),
742            AccountMeta::new_readonly(auction_manager_authority, false),
743            AccountMeta::new_readonly(payer, true),
744            AccountMeta::new_readonly(accept_payment_account_key, false),
745            AccountMeta::new_readonly(store, false),
746            AccountMeta::new_readonly(solana_program::system_program::id(), false),
747            AccountMeta::new_readonly(sysvar::rent::id(), false),
748        ],
749        data: MetaplexInstruction::InitAuctionManagerV2(InitAuctionManagerV2Args {
750            amount_type,
751            length_type,
752            max_ranges,
753        })
754        .try_to_vec()
755        .unwrap(),
756    }
757}
758
759/// Creates an ValidateParticipation instruction
760#[allow(clippy::too_many_arguments)]
761pub fn deprecated_create_validate_participation_instruction(
762    program_id: Pubkey,
763    auction_manager: Pubkey,
764    open_edition_metadata: Pubkey,
765    open_edition_master_edition: Pubkey,
766    printing_authorization_token_account: Pubkey,
767    auction_manager_authority: Pubkey,
768    whitelisted_creator: Pubkey,
769    store: Pubkey,
770    safety_deposit_box: Pubkey,
771    safety_deposit_box_token_store: Pubkey,
772    vault: Pubkey,
773) -> Instruction {
774    Instruction {
775        program_id,
776        accounts: vec![
777            AccountMeta::new(auction_manager, false),
778            AccountMeta::new_readonly(open_edition_metadata, false),
779            AccountMeta::new_readonly(open_edition_master_edition, false),
780            AccountMeta::new_readonly(printing_authorization_token_account, false),
781            AccountMeta::new_readonly(auction_manager_authority, true),
782            AccountMeta::new_readonly(whitelisted_creator, false),
783            AccountMeta::new_readonly(store, false),
784            AccountMeta::new_readonly(safety_deposit_box, false),
785            AccountMeta::new_readonly(safety_deposit_box_token_store, false),
786            AccountMeta::new_readonly(vault, false),
787            AccountMeta::new_readonly(sysvar::rent::id(), false),
788        ],
789        data: MetaplexInstruction::DeprecatedValidateParticipation
790            .try_to_vec()
791            .unwrap(),
792    }
793}
794
795/// Creates an DeprecatedValidateSafetyDepositBoxV1 instruction
796#[allow(clippy::too_many_arguments)]
797pub fn create_deprecated_validate_safety_deposit_box_v1_instruction(
798    program_id: Pubkey,
799    auction_manager: Pubkey,
800    metadata: Pubkey,
801    original_authority_lookup: Pubkey,
802    whitelisted_creator: Pubkey,
803    store: Pubkey,
804    safety_deposit_box: Pubkey,
805    safety_deposit_token_store: Pubkey,
806    safety_deposit_mint: Pubkey,
807    edition: Pubkey,
808    vault: Pubkey,
809    auction_manager_authority: Pubkey,
810    metadata_authority: Pubkey,
811    payer: Pubkey,
812    printing_mint: Option<Pubkey>,
813    printing_mint_authority: Option<Pubkey>,
814) -> Instruction {
815    let (validation, _) = Pubkey::find_program_address(
816        &[
817            PREFIX.as_bytes(),
818            program_id.as_ref(),
819            auction_manager.as_ref(),
820            safety_deposit_box.as_ref(),
821        ],
822        &program_id,
823    );
824    let mut accounts = vec![
825        AccountMeta::new(validation, false),
826        AccountMeta::new(auction_manager, false),
827        AccountMeta::new(metadata, false),
828        AccountMeta::new(original_authority_lookup, false),
829        AccountMeta::new_readonly(whitelisted_creator, false),
830        AccountMeta::new_readonly(store, false),
831        AccountMeta::new_readonly(safety_deposit_box, false),
832        AccountMeta::new_readonly(safety_deposit_token_store, false),
833        AccountMeta::new_readonly(safety_deposit_mint, false),
834        AccountMeta::new_readonly(edition, false),
835        AccountMeta::new_readonly(vault, false),
836        AccountMeta::new_readonly(auction_manager_authority, true),
837        AccountMeta::new_readonly(metadata_authority, true),
838        AccountMeta::new_readonly(payer, true),
839        AccountMeta::new_readonly(mpl_token_metadata::id(), false),
840        AccountMeta::new_readonly(solana_program::system_program::id(), false),
841        AccountMeta::new_readonly(sysvar::rent::id(), false),
842    ];
843
844    if let Some(key) = printing_mint {
845        accounts.push(AccountMeta::new(key, false))
846    }
847
848    if let Some(key) = printing_mint_authority {
849        accounts.push(AccountMeta::new_readonly(key, true))
850    }
851
852    Instruction {
853        program_id,
854        accounts,
855        data: MetaplexInstruction::DeprecatedValidateSafetyDepositBoxV1
856            .try_to_vec()
857            .unwrap(),
858    }
859}
860
861/// Creates an ValidateSafetyDepositBoxV2 instruction
862#[allow(clippy::too_many_arguments)]
863pub fn create_validate_safety_deposit_box_v2_instruction(
864    program_id: Pubkey,
865    auction_manager: Pubkey,
866    metadata: Pubkey,
867    original_authority_lookup: Pubkey,
868    whitelisted_creator: Pubkey,
869    store: Pubkey,
870    safety_deposit_box: Pubkey,
871    safety_deposit_token_store: Pubkey,
872    safety_deposit_mint: Pubkey,
873    edition: Pubkey,
874    vault: Pubkey,
875    auction_manager_authority: Pubkey,
876    metadata_authority: Pubkey,
877    payer: Pubkey,
878    safety_deposit_config: SafetyDepositConfig,
879) -> Instruction {
880    let (validation, _) = Pubkey::find_program_address(
881        &[
882            PREFIX.as_bytes(),
883            program_id.as_ref(),
884            auction_manager.as_ref(),
885            safety_deposit_box.as_ref(),
886        ],
887        &program_id,
888    );
889    let accounts = vec![
890        AccountMeta::new(validation, false),
891        AccountMeta::new(auction_manager, false),
892        AccountMeta::new(metadata, false),
893        AccountMeta::new(original_authority_lookup, false),
894        AccountMeta::new_readonly(whitelisted_creator, false),
895        AccountMeta::new_readonly(store, false),
896        AccountMeta::new_readonly(safety_deposit_box, false),
897        AccountMeta::new_readonly(safety_deposit_token_store, false),
898        AccountMeta::new_readonly(safety_deposit_mint, false),
899        AccountMeta::new_readonly(edition, false),
900        AccountMeta::new_readonly(vault, false),
901        AccountMeta::new_readonly(auction_manager_authority, true),
902        AccountMeta::new_readonly(metadata_authority, true),
903        AccountMeta::new_readonly(payer, true),
904        AccountMeta::new_readonly(mpl_token_metadata::id(), false),
905        AccountMeta::new_readonly(solana_program::system_program::id(), false),
906        AccountMeta::new_readonly(sysvar::rent::id(), false),
907    ];
908
909    Instruction {
910        program_id,
911        accounts,
912        data: MetaplexInstruction::ValidateSafetyDepositBoxV2(safety_deposit_config)
913            .try_to_vec()
914            .unwrap(),
915    }
916}
917
918/// Creates an RedeemBid instruction
919#[allow(clippy::too_many_arguments)]
920pub fn create_redeem_bid_instruction(
921    program_id: Pubkey,
922    auction_manager: Pubkey,
923    safety_deposit_token_store: Pubkey,
924    destination: Pubkey,
925    bid_redemption: Pubkey,
926    safety_deposit_box: Pubkey,
927    vault: Pubkey,
928    fraction_mint: Pubkey,
929    auction: Pubkey,
930    auction_extended: Pubkey,
931    bidder_metadata: Pubkey,
932    bidder: Pubkey,
933    payer: Pubkey,
934    store: Pubkey,
935    transfer_authority: Pubkey,
936) -> Instruction {
937    Instruction {
938        program_id,
939        accounts: vec![
940            AccountMeta::new(auction_manager, false),
941            AccountMeta::new(safety_deposit_token_store, false),
942            AccountMeta::new(destination, false),
943            AccountMeta::new(bid_redemption, false),
944            AccountMeta::new(safety_deposit_box, false),
945            AccountMeta::new(vault, false),
946            AccountMeta::new(fraction_mint, false),
947            AccountMeta::new_readonly(auction, false),
948            AccountMeta::new_readonly(bidder_metadata, false),
949            AccountMeta::new_readonly(bidder, true),
950            AccountMeta::new_readonly(payer, true),
951            AccountMeta::new_readonly(spl_token::id(), false),
952            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
953            AccountMeta::new_readonly(mpl_token_metadata::id(), false),
954            AccountMeta::new_readonly(store, false),
955            AccountMeta::new_readonly(solana_program::system_program::id(), false),
956            AccountMeta::new_readonly(sysvar::rent::id(), false),
957            AccountMeta::new_readonly(transfer_authority, false),
958            AccountMeta::new_readonly(auction_extended, false),
959        ],
960        data: MetaplexInstruction::RedeemBid.try_to_vec().unwrap(),
961    }
962}
963
964/// Creates an RedeemFullRightsTransferBid instruction
965#[allow(clippy::too_many_arguments)]
966pub fn create_redeem_full_rights_transfer_bid_instruction(
967    program_id: Pubkey,
968    auction_manager: Pubkey,
969    safety_deposit_token_store: Pubkey,
970    destination: Pubkey,
971    bid_redemption: Pubkey,
972    safety_deposit_box: Pubkey,
973    vault: Pubkey,
974    fraction_mint: Pubkey,
975    auction: Pubkey,
976    auction_extended: Pubkey,
977    bidder_metadata: Pubkey,
978    bidder: Pubkey,
979    payer: Pubkey,
980    store: Pubkey,
981    master_metadata: Pubkey,
982    new_metadata_authority: Pubkey,
983    transfer_authority: Pubkey,
984) -> Instruction {
985    Instruction {
986        program_id,
987        accounts: vec![
988            AccountMeta::new(auction_manager, false),
989            AccountMeta::new(safety_deposit_token_store, false),
990            AccountMeta::new(destination, false),
991            AccountMeta::new(bid_redemption, false),
992            AccountMeta::new(safety_deposit_box, false),
993            AccountMeta::new(vault, false),
994            AccountMeta::new(fraction_mint, false),
995            AccountMeta::new_readonly(auction, false),
996            AccountMeta::new_readonly(bidder_metadata, false),
997            AccountMeta::new_readonly(bidder, true),
998            AccountMeta::new_readonly(payer, true),
999            AccountMeta::new_readonly(spl_token::id(), false),
1000            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1001            AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1002            AccountMeta::new_readonly(store, false),
1003            AccountMeta::new_readonly(solana_program::system_program::id(), false),
1004            AccountMeta::new_readonly(sysvar::rent::id(), false),
1005            AccountMeta::new(master_metadata, false),
1006            AccountMeta::new_readonly(new_metadata_authority, false),
1007            AccountMeta::new_readonly(transfer_authority, false),
1008            AccountMeta::new_readonly(auction_extended, false),
1009        ],
1010        data: MetaplexInstruction::RedeemFullRightsTransferBid
1011            .try_to_vec()
1012            .unwrap(),
1013    }
1014}
1015
1016/// Creates an RedeemOpenEditionBid instruction
1017#[allow(clippy::too_many_arguments)]
1018pub fn create_deprecated_redeem_participation_bid_instruction(
1019    program_id: Pubkey,
1020    auction_manager: Pubkey,
1021    safety_deposit_token_store: Pubkey,
1022    destination: Pubkey,
1023    bid_redemption: Pubkey,
1024    safety_deposit_box: Pubkey,
1025    vault: Pubkey,
1026    fraction_mint: Pubkey,
1027    auction: Pubkey,
1028    auction_extended: Pubkey,
1029    bidder_metadata: Pubkey,
1030    bidder: Pubkey,
1031    payer: Pubkey,
1032    store: Pubkey,
1033    transfer_authority: Pubkey,
1034    accept_payment: Pubkey,
1035    paying_token_account: Pubkey,
1036    printing_authorization_token_account: Pubkey,
1037) -> Instruction {
1038    Instruction {
1039        program_id,
1040        accounts: vec![
1041            AccountMeta::new(auction_manager, false),
1042            AccountMeta::new(safety_deposit_token_store, false),
1043            AccountMeta::new(destination, false),
1044            AccountMeta::new(bid_redemption, false),
1045            AccountMeta::new_readonly(safety_deposit_box, false),
1046            AccountMeta::new_readonly(vault, false),
1047            AccountMeta::new_readonly(fraction_mint, false),
1048            AccountMeta::new_readonly(auction, false),
1049            AccountMeta::new_readonly(bidder_metadata, false),
1050            AccountMeta::new_readonly(bidder, true),
1051            AccountMeta::new(payer, true),
1052            AccountMeta::new_readonly(spl_token::id(), false),
1053            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1054            AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1055            AccountMeta::new_readonly(store, false),
1056            AccountMeta::new_readonly(solana_program::system_program::id(), false),
1057            AccountMeta::new_readonly(sysvar::rent::id(), false),
1058            AccountMeta::new_readonly(transfer_authority, true),
1059            AccountMeta::new(accept_payment, false),
1060            AccountMeta::new(paying_token_account, false),
1061            AccountMeta::new(printing_authorization_token_account, false),
1062            AccountMeta::new_readonly(auction_extended, false),
1063        ],
1064        data: MetaplexInstruction::DeprecatedRedeemParticipationBid
1065            .try_to_vec()
1066            .unwrap(),
1067    }
1068}
1069
1070/// Creates an StartAuction instruction
1071#[allow(clippy::too_many_arguments)]
1072pub fn create_start_auction_instruction(
1073    program_id: Pubkey,
1074    auction_manager: Pubkey,
1075    auction: Pubkey,
1076    auction_manager_authority: Pubkey,
1077    store: Pubkey,
1078) -> Instruction {
1079    Instruction {
1080        program_id,
1081        accounts: vec![
1082            AccountMeta::new(auction_manager, false),
1083            AccountMeta::new(auction, false),
1084            AccountMeta::new_readonly(auction_manager_authority, true),
1085            AccountMeta::new_readonly(store, false),
1086            AccountMeta::new_readonly(ywpl_auction::id(), false),
1087            AccountMeta::new_readonly(sysvar::clock::id(), false),
1088        ],
1089        data: MetaplexInstruction::StartAuction.try_to_vec().unwrap(),
1090    }
1091}
1092
1093/// Creates an SetStore instruction
1094pub fn create_set_store_instruction(
1095    program_id: Pubkey,
1096    store: Pubkey,
1097    admin: Pubkey,
1098    payer: Pubkey,
1099    public: bool,
1100) -> Instruction {
1101    let accounts = vec![
1102        AccountMeta::new(store, false),
1103        AccountMeta::new_readonly(admin, true),
1104        AccountMeta::new_readonly(payer, true),
1105        AccountMeta::new_readonly(spl_token::id(), false),
1106        AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1107        AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1108        AccountMeta::new_readonly(ywpl_auction::id(), false),
1109        AccountMeta::new_readonly(solana_program::system_program::id(), false),
1110        AccountMeta::new_readonly(sysvar::rent::id(), false),
1111    ];
1112    Instruction {
1113        program_id,
1114        accounts,
1115        data: MetaplexInstruction::SetStore(SetStoreArgs { public })
1116            .try_to_vec()
1117            .unwrap(),
1118    }
1119}
1120
1121/// Creates an SetStore instruction
1122pub fn create_set_store_v2_instruction(
1123    program_id: Pubkey,
1124    store: Pubkey,
1125    config: Pubkey,
1126    admin: Pubkey,
1127    payer: Pubkey,
1128    public: bool,
1129    settings_uri: Option<String>,
1130) -> Instruction {
1131    let accounts = vec![
1132        AccountMeta::new(store, false),
1133        AccountMeta::new(config, false),
1134        AccountMeta::new_readonly(admin, true),
1135        AccountMeta::new_readonly(payer, true),
1136        AccountMeta::new_readonly(spl_token::id(), false),
1137        AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1138        AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1139        AccountMeta::new_readonly(ywpl_auction::id(), false),
1140        AccountMeta::new_readonly(solana_program::system_program::id(), false),
1141        AccountMeta::new_readonly(sysvar::rent::id(), false),
1142    ];
1143    Instruction {
1144        program_id,
1145        accounts,
1146        data: MetaplexInstruction::SetStoreV2(SetStoreV2Args {
1147            public,
1148            settings_uri,
1149        })
1150        .try_to_vec()
1151        .unwrap(),
1152    }
1153}
1154
1155#[allow(clippy::too_many_arguments)]
1156pub fn create_deprecated_populate_participation_printing_account_instruction(
1157    program_id: Pubkey,
1158    safety_deposit_token_store: Pubkey,
1159    transient_one_time_mint_account: Pubkey,
1160    participation_state_printing_account: Pubkey,
1161    one_time_printing_authorization_mint: Pubkey,
1162    printing_mint: Pubkey,
1163    participation_safety_deposit_box: Pubkey,
1164    vault: Pubkey,
1165    fraction_mint: Pubkey,
1166    auction: Pubkey,
1167    auction_manager: Pubkey,
1168    store: Pubkey,
1169    master_edition: Pubkey,
1170    transfer_authority: Pubkey,
1171    payer: Pubkey,
1172) -> Instruction {
1173    let accounts = vec![
1174        AccountMeta::new(safety_deposit_token_store, false),
1175        AccountMeta::new(transient_one_time_mint_account, false),
1176        AccountMeta::new(participation_state_printing_account, false),
1177        AccountMeta::new(one_time_printing_authorization_mint, false),
1178        AccountMeta::new(printing_mint, false),
1179        AccountMeta::new(participation_safety_deposit_box, false),
1180        AccountMeta::new(vault, false),
1181        AccountMeta::new_readonly(fraction_mint, false),
1182        AccountMeta::new_readonly(auction, false),
1183        AccountMeta::new_readonly(auction_manager, false),
1184        AccountMeta::new_readonly(spl_token::id(), false),
1185        AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1186        AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1187        AccountMeta::new_readonly(store, false),
1188        AccountMeta::new_readonly(master_edition, false),
1189        AccountMeta::new_readonly(transfer_authority, false),
1190        AccountMeta::new_readonly(payer, false),
1191        AccountMeta::new_readonly(sysvar::rent::id(), false),
1192    ];
1193    Instruction {
1194        program_id,
1195        accounts,
1196        data: MetaplexInstruction::DeprecatedPopulateParticipationPrintingAccount
1197            .try_to_vec()
1198            .unwrap(),
1199    }
1200}
1201
1202/// Creates an DecommissionAuctionManager instruction
1203pub fn create_decommission_auction_manager_instruction(
1204    program_id: Pubkey,
1205    auction_manager: Pubkey,
1206    auction: Pubkey,
1207    authority: Pubkey,
1208    vault: Pubkey,
1209    store: Pubkey,
1210) -> Instruction {
1211    let accounts = vec![
1212        AccountMeta::new(auction_manager, false),
1213        AccountMeta::new(auction, false),
1214        AccountMeta::new_readonly(authority, true),
1215        AccountMeta::new_readonly(vault, false),
1216        AccountMeta::new_readonly(store, false),
1217        AccountMeta::new_readonly(ywpl_auction::id(), false),
1218        AccountMeta::new_readonly(sysvar::clock::id(), false),
1219    ];
1220    Instruction {
1221        program_id,
1222        accounts,
1223        data: MetaplexInstruction::DecommissionAuctionManager
1224            .try_to_vec()
1225            .unwrap(),
1226    }
1227}
1228
1229/// Creates an RedeemPrintingV2Bid instruction
1230#[allow(clippy::too_many_arguments)]
1231pub fn create_redeem_printing_v2_bid_instruction(
1232    program_id: Pubkey,
1233    auction_manager: Pubkey,
1234    safety_deposit_token_store: Pubkey,
1235    destination: Pubkey,
1236    bid_redemption: Pubkey,
1237    safety_deposit_box: Pubkey,
1238    vault: Pubkey,
1239    auction: Pubkey,
1240    auction_extended: Pubkey,
1241    bidder_metadata: Pubkey,
1242    bidder: Pubkey,
1243    payer: Pubkey,
1244    store: Pubkey,
1245    new_metadata: Pubkey,
1246    original_mint: Pubkey,
1247    new_mint: Pubkey,
1248    new_mint_authority: Pubkey,
1249    edition: u64,
1250    win_index: u64,
1251) -> Instruction {
1252    let (config, _) = Pubkey::find_program_address(
1253        &[
1254            PREFIX.as_bytes(),
1255            program_id.as_ref(),
1256            auction_manager.as_ref(),
1257            safety_deposit_box.as_ref(),
1258        ],
1259        &program_id,
1260    );
1261
1262    let (prize_tracking_ticket, _) = Pubkey::find_program_address(
1263        &[
1264            PREFIX.as_bytes(),
1265            program_id.as_ref(),
1266            auction_manager.as_ref(),
1267            original_mint.as_ref(),
1268        ],
1269        &program_id,
1270    );
1271
1272    let edition_offset = edition.checked_rem(EDITION_MARKER_BIT_SIZE).unwrap();
1273    let edition_number = edition.checked_div(EDITION_MARKER_BIT_SIZE).unwrap();
1274
1275    let (edition_mark_pda, _) = Pubkey::find_program_address(
1276        &[
1277            mpl_token_metadata::state::PREFIX.as_bytes(),
1278            mpl_token_metadata::id().as_ref(),
1279            original_mint.as_ref(),
1280            mpl_token_metadata::state::EDITION.as_bytes(),
1281            edition_number.to_string().as_bytes(),
1282        ],
1283        &mpl_token_metadata::id(),
1284    );
1285
1286    let (metadata, _) = Pubkey::find_program_address(
1287        &[
1288            mpl_token_metadata::state::PREFIX.as_bytes(),
1289            mpl_token_metadata::id().as_ref(),
1290            original_mint.as_ref(),
1291        ],
1292        &mpl_token_metadata::id(),
1293    );
1294
1295    let (master_edition, _) = Pubkey::find_program_address(
1296        &[
1297            mpl_token_metadata::state::PREFIX.as_bytes(),
1298            mpl_token_metadata::id().as_ref(),
1299            original_mint.as_ref(),
1300            mpl_token_metadata::state::EDITION.as_bytes(),
1301        ],
1302        &mpl_token_metadata::id(),
1303    );
1304
1305    let (new_edition, _) = Pubkey::find_program_address(
1306        &[
1307            mpl_token_metadata::state::PREFIX.as_bytes(),
1308            mpl_token_metadata::id().as_ref(),
1309            new_mint.as_ref(),
1310            mpl_token_metadata::state::EDITION.as_bytes(),
1311        ],
1312        &mpl_token_metadata::id(),
1313    );
1314
1315    Instruction {
1316        program_id,
1317        accounts: vec![
1318            AccountMeta::new(auction_manager, false),
1319            AccountMeta::new(safety_deposit_token_store, false),
1320            AccountMeta::new(destination, false),
1321            AccountMeta::new(bid_redemption, false),
1322            AccountMeta::new(safety_deposit_box, false),
1323            AccountMeta::new(vault, false),
1324            AccountMeta::new(config, false),
1325            AccountMeta::new_readonly(auction, false),
1326            AccountMeta::new_readonly(bidder_metadata, false),
1327            AccountMeta::new_readonly(bidder, false),
1328            AccountMeta::new(payer, true),
1329            AccountMeta::new_readonly(spl_token::id(), false),
1330            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1331            AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1332            AccountMeta::new_readonly(store, false),
1333            AccountMeta::new_readonly(solana_program::system_program::id(), false),
1334            AccountMeta::new_readonly(sysvar::rent::id(), false),
1335            AccountMeta::new(prize_tracking_ticket, false),
1336            AccountMeta::new(new_metadata, false),
1337            AccountMeta::new(new_edition, false),
1338            AccountMeta::new(master_edition, false),
1339            AccountMeta::new(new_mint, false),
1340            AccountMeta::new(edition_mark_pda, false),
1341            AccountMeta::new_readonly(new_mint_authority, true),
1342            AccountMeta::new_readonly(metadata, false),
1343            AccountMeta::new_readonly(auction_extended, false),
1344        ],
1345        data: MetaplexInstruction::RedeemPrintingV2Bid(RedeemPrintingV2BidArgs {
1346            edition_offset,
1347            win_index,
1348        })
1349        .try_to_vec()
1350        .unwrap(),
1351    }
1352}
1353
1354/// Creates an WithdrawMasterEdition instruction
1355#[allow(clippy::too_many_arguments)]
1356pub fn create_withdraw_master_edition(
1357    program_id: Pubkey,
1358    auction_manager: Pubkey,
1359    safety_deposit_token_store: Pubkey,
1360    destination: Pubkey,
1361    safety_deposit_box: Pubkey,
1362    vault: Pubkey,
1363    fraction_mint: Pubkey,
1364    auction: Pubkey,
1365    store: Pubkey,
1366    mint: Pubkey,
1367) -> Instruction {
1368    let (prize_tracking_ticket, _) = Pubkey::find_program_address(
1369        &[
1370            PREFIX.as_bytes(),
1371            program_id.as_ref(),
1372            auction_manager.as_ref(),
1373            mint.as_ref(),
1374        ],
1375        &program_id,
1376    );
1377
1378    let (vault_authority, _) = Pubkey::find_program_address(
1379        &[
1380            ywpl_token_vault::state::PREFIX.as_bytes(),
1381            ywpl_token_vault::id().as_ref(),
1382            vault.as_ref(),
1383        ],
1384        &ywpl_token_vault::id(),
1385    );
1386
1387    let (auction_data_extended, _) = Pubkey::find_program_address(
1388        &[
1389            ywpl_auction::PREFIX.as_bytes(),
1390            ywpl_auction::id().as_ref(),
1391            vault.as_ref(),
1392            ywpl_auction::EXTENDED.as_bytes(),
1393        ],
1394        &ywpl_auction::id(),
1395    );
1396
1397    Instruction {
1398        program_id,
1399        accounts: vec![
1400            AccountMeta::new(auction_manager, false),
1401            AccountMeta::new(safety_deposit_token_store, false),
1402            AccountMeta::new(destination, false),
1403            AccountMeta::new(safety_deposit_box, false),
1404            AccountMeta::new(vault, false),
1405            AccountMeta::new(fraction_mint, false),
1406            AccountMeta::new_readonly(prize_tracking_ticket, false),
1407            AccountMeta::new_readonly(vault_authority, false),
1408            AccountMeta::new_readonly(auction, false),
1409            AccountMeta::new_readonly(auction_data_extended, false),
1410            AccountMeta::new_readonly(spl_token::id(), false),
1411            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1412            AccountMeta::new_readonly(store, false),
1413            AccountMeta::new_readonly(sysvar::rent::id(), false),
1414        ],
1415        data: MetaplexInstruction::WithdrawMasterEdition
1416            .try_to_vec()
1417            .unwrap(),
1418    }
1419}
1420
1421/// Creates an RedeemParticipationBidV2 instruction
1422#[allow(clippy::too_many_arguments)]
1423pub fn create_redeem_participation_bid_v3_instruction(
1424    program_id: Pubkey,
1425    auction_manager: Pubkey,
1426    safety_deposit_token_store: Pubkey,
1427    destination: Pubkey,
1428    bid_redemption: Pubkey,
1429    safety_deposit_box: Pubkey,
1430    vault: Pubkey,
1431    auction: Pubkey,
1432    auction_extended: Pubkey,
1433    bidder_metadata: Pubkey,
1434    bidder: Pubkey,
1435    payer: Pubkey,
1436    store: Pubkey,
1437    transfer_authority: Pubkey,
1438    accept_payment: Pubkey,
1439    paying_token_account: Pubkey,
1440    new_metadata: Pubkey,
1441    original_mint: Pubkey,
1442    new_mint: Pubkey,
1443    new_mint_authority: Pubkey,
1444    desired_edition: u64,
1445    win_index: Option<u64>,
1446) -> Instruction {
1447    let (config, _) = Pubkey::find_program_address(
1448        &[
1449            PREFIX.as_bytes(),
1450            program_id.as_ref(),
1451            auction_manager.as_ref(),
1452            safety_deposit_box.as_ref(),
1453        ],
1454        &program_id,
1455    );
1456
1457    let (prize_tracking_ticket, _) = Pubkey::find_program_address(
1458        &[
1459            PREFIX.as_bytes(),
1460            program_id.as_ref(),
1461            auction_manager.as_ref(),
1462            original_mint.as_ref(),
1463        ],
1464        &program_id,
1465    );
1466
1467    let edition_number = desired_edition
1468        .checked_div(EDITION_MARKER_BIT_SIZE)
1469        .unwrap();
1470
1471    let (edition_mark_pda, _) = Pubkey::find_program_address(
1472        &[
1473            mpl_token_metadata::state::PREFIX.as_bytes(),
1474            mpl_token_metadata::id().as_ref(),
1475            original_mint.as_ref(),
1476            mpl_token_metadata::state::EDITION.as_bytes(),
1477            edition_number.to_string().as_bytes(),
1478        ],
1479        &mpl_token_metadata::id(),
1480    );
1481
1482    let (metadata, _) = Pubkey::find_program_address(
1483        &[
1484            mpl_token_metadata::state::PREFIX.as_bytes(),
1485            mpl_token_metadata::id().as_ref(),
1486            original_mint.as_ref(),
1487        ],
1488        &mpl_token_metadata::id(),
1489    );
1490
1491    let (master_edition, _) = Pubkey::find_program_address(
1492        &[
1493            mpl_token_metadata::state::PREFIX.as_bytes(),
1494            mpl_token_metadata::id().as_ref(),
1495            original_mint.as_ref(),
1496            mpl_token_metadata::state::EDITION.as_bytes(),
1497        ],
1498        &mpl_token_metadata::id(),
1499    );
1500
1501    let (new_edition, _) = Pubkey::find_program_address(
1502        &[
1503            mpl_token_metadata::state::PREFIX.as_bytes(),
1504            mpl_token_metadata::id().as_ref(),
1505            new_mint.as_ref(),
1506            mpl_token_metadata::state::EDITION.as_bytes(),
1507        ],
1508        &mpl_token_metadata::id(),
1509    );
1510
1511    let (extended, _) = Pubkey::find_program_address(
1512        &[
1513            ywpl_auction::PREFIX.as_bytes(),
1514            ywpl_auction::id().as_ref(),
1515            vault.as_ref(),
1516            ywpl_auction::EXTENDED.as_bytes(),
1517        ],
1518        &ywpl_auction::id(),
1519    );
1520
1521    Instruction {
1522        program_id,
1523        accounts: vec![
1524            AccountMeta::new(auction_manager, false),
1525            AccountMeta::new(safety_deposit_token_store, false),
1526            AccountMeta::new(destination, false),
1527            AccountMeta::new(bid_redemption, false),
1528            AccountMeta::new_readonly(safety_deposit_box, false),
1529            AccountMeta::new_readonly(vault, false),
1530            AccountMeta::new(config, false),
1531            AccountMeta::new_readonly(auction, false),
1532            AccountMeta::new_readonly(bidder_metadata, false),
1533            AccountMeta::new_readonly(bidder, true),
1534            AccountMeta::new(payer, true),
1535            AccountMeta::new_readonly(spl_token::id(), false),
1536            AccountMeta::new_readonly(ywpl_token_vault::id(), false),
1537            AccountMeta::new_readonly(mpl_token_metadata::id(), false),
1538            AccountMeta::new_readonly(store, false),
1539            AccountMeta::new_readonly(solana_program::system_program::id(), false),
1540            AccountMeta::new_readonly(sysvar::rent::id(), false),
1541            AccountMeta::new_readonly(transfer_authority, true),
1542            AccountMeta::new(accept_payment, false),
1543            AccountMeta::new(paying_token_account, false),
1544            AccountMeta::new(prize_tracking_ticket, false),
1545            AccountMeta::new(new_metadata, false),
1546            AccountMeta::new(new_edition, false),
1547            AccountMeta::new(master_edition, false),
1548            AccountMeta::new(new_mint, false),
1549            AccountMeta::new(edition_mark_pda, false),
1550            AccountMeta::new_readonly(new_mint_authority, true),
1551            AccountMeta::new_readonly(metadata, false),
1552            AccountMeta::new_readonly(extended, false),
1553            AccountMeta::new_readonly(auction_extended, false),
1554        ],
1555        data: MetaplexInstruction::RedeemParticipationBidV3(RedeemParticipationBidV3Args {
1556            win_index,
1557        })
1558        .try_to_vec()
1559        .unwrap(),
1560    }
1561}
1562
1563/// Creates an EndAuction instruction
1564#[allow(clippy::too_many_arguments)]
1565pub fn create_end_auction_instruction(
1566    program_id: Pubkey,
1567    auction_manager: Pubkey,
1568    auction: Pubkey,
1569    auction_data_extended: Pubkey,
1570    auction_manager_authority: Pubkey,
1571    store: Pubkey,
1572    end_auction_args: EndAuctionArgs,
1573) -> Instruction {
1574    Instruction {
1575        program_id,
1576        accounts: vec![
1577            AccountMeta::new(auction_manager, false),
1578            AccountMeta::new(auction, false),
1579            AccountMeta::new_readonly(auction_data_extended, false),
1580            AccountMeta::new_readonly(auction_manager_authority, true),
1581            AccountMeta::new_readonly(store, false),
1582            AccountMeta::new_readonly(ywpl_auction::id(), false),
1583            AccountMeta::new_readonly(sysvar::clock::id(), false),
1584        ],
1585        data: MetaplexInstruction::EndAuction(end_auction_args)
1586            .try_to_vec()
1587            .unwrap(),
1588    }
1589}