/
mintV2.ts
232 lines (226 loc) · 5.99 KB
/
mintV2.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/
import * as beet from '@metaplex-foundation/beet';
import * as web3 from '@solana/web3.js';
/**
* @category Instructions
* @category MintV2
* @category generated
*/
export const mintV2Struct = new beet.BeetArgsStruct<{
instructionDiscriminator: number[] /* size: 8 */;
}>([['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)]], 'MintV2InstructionArgs');
/**
* Accounts required by the _mintV2_ instruction
*
* @property [_writable_] candyMachine
* @property [_writable_] authorityPda
* @property [**signer**] mintAuthority
* @property [_writable_, **signer**] payer
* @property [] nftOwner
* @property [_writable_] nftMint
* @property [**signer**] nftMintAuthority
* @property [_writable_] nftMetadata
* @property [_writable_] nftMasterEdition
* @property [_writable_] token (optional)
* @property [_writable_] tokenRecord (optional)
* @property [] collectionDelegateRecord
* @property [] collectionMint
* @property [_writable_] collectionMetadata
* @property [] collectionMasterEdition
* @property [] collectionUpdateAuthority
* @property [] tokenMetadataProgram
* @property [] splTokenProgram
* @property [] splAtaProgram (optional)
* @property [] sysvarInstructions
* @property [] recentSlothashes
* @property [] authorizationRulesProgram (optional)
* @property [] authorizationRules (optional)
* @category Instructions
* @category MintV2
* @category generated
*/
export type MintV2InstructionAccounts = {
candyMachine: web3.PublicKey;
authorityPda: web3.PublicKey;
mintAuthority: web3.PublicKey;
payer: web3.PublicKey;
nftOwner: web3.PublicKey;
nftMint: web3.PublicKey;
nftMintAuthority: web3.PublicKey;
nftMetadata: web3.PublicKey;
nftMasterEdition: web3.PublicKey;
token?: web3.PublicKey;
tokenRecord?: web3.PublicKey;
collectionDelegateRecord: web3.PublicKey;
collectionMint: web3.PublicKey;
collectionMetadata: web3.PublicKey;
collectionMasterEdition: web3.PublicKey;
collectionUpdateAuthority: web3.PublicKey;
tokenMetadataProgram: web3.PublicKey;
splTokenProgram: web3.PublicKey;
splAtaProgram?: web3.PublicKey;
systemProgram?: web3.PublicKey;
sysvarInstructions: web3.PublicKey;
recentSlothashes: web3.PublicKey;
authorizationRulesProgram?: web3.PublicKey;
authorizationRules?: web3.PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
};
export const mintV2InstructionDiscriminator = [120, 121, 23, 146, 173, 110, 199, 205];
/**
* Creates a _MintV2_ instruction.
*
* Optional accounts that are not provided default to the program ID since
* this was indicated in the IDL from which this instruction was generated.
*
* @param accounts that will be accessed while the instruction is processed
* @category Instructions
* @category MintV2
* @category generated
*/
export function createMintV2Instruction(
accounts: MintV2InstructionAccounts,
programId = new web3.PublicKey('CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR'),
) {
const [data] = mintV2Struct.serialize({
instructionDiscriminator: mintV2InstructionDiscriminator,
});
const keys: web3.AccountMeta[] = [
{
pubkey: accounts.candyMachine,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.authorityPda,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.mintAuthority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.payer,
isWritable: true,
isSigner: true,
},
{
pubkey: accounts.nftOwner,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.nftMint,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.nftMintAuthority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.nftMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.nftMasterEdition,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.token ?? programId,
isWritable: accounts.token != null,
isSigner: false,
},
{
pubkey: accounts.tokenRecord ?? programId,
isWritable: accounts.tokenRecord != null,
isSigner: false,
},
{
pubkey: accounts.collectionDelegateRecord,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMint,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMetadata,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.collectionMasterEdition,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionUpdateAuthority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.tokenMetadataProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.splTokenProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.splAtaProgram ?? programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.systemProgram ?? web3.SystemProgram.programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.sysvarInstructions,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.recentSlothashes,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.authorizationRulesProgram ?? programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.authorizationRules ?? programId,
isWritable: false,
isSigner: false,
},
];
if (accounts.anchorRemainingAccounts != null) {
for (const acc of accounts.anchorRemainingAccounts) {
keys.push(acc);
}
}
const ix = new web3.TransactionInstruction({
programId,
keys,
data,
});
return ix;
}