/
addConfigLines.ts
99 lines (93 loc) · 2.54 KB
/
addConfigLines.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
/**
* 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';
import { ConfigLine, configLineBeet } from '../types/ConfigLine';
/**
* @category Instructions
* @category AddConfigLines
* @category generated
*/
export type AddConfigLinesInstructionArgs = {
index: number;
configLines: ConfigLine[];
};
/**
* @category Instructions
* @category AddConfigLines
* @category generated
*/
export const addConfigLinesStruct = new beet.FixableBeetArgsStruct<
AddConfigLinesInstructionArgs & {
instructionDiscriminator: number[] /* size: 8 */;
}
>(
[
['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['index', beet.u32],
['configLines', beet.array(configLineBeet)],
],
'AddConfigLinesInstructionArgs',
);
/**
* Accounts required by the _addConfigLines_ instruction
*
* @property [_writable_] candyMachine
* @property [**signer**] authority
* @category Instructions
* @category AddConfigLines
* @category generated
*/
export type AddConfigLinesInstructionAccounts = {
candyMachine: web3.PublicKey;
authority: web3.PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
};
export const addConfigLinesInstructionDiscriminator = [223, 50, 224, 227, 151, 8, 115, 106];
/**
* Creates a _AddConfigLines_ instruction.
*
* @param accounts that will be accessed while the instruction is processed
* @param args to provide as instruction data to the program
*
* @category Instructions
* @category AddConfigLines
* @category generated
*/
export function createAddConfigLinesInstruction(
accounts: AddConfigLinesInstructionAccounts,
args: AddConfigLinesInstructionArgs,
programId = new web3.PublicKey('CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR'),
) {
const [data] = addConfigLinesStruct.serialize({
instructionDiscriminator: addConfigLinesInstructionDiscriminator,
...args,
});
const keys: web3.AccountMeta[] = [
{
pubkey: accounts.candyMachine,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.authority,
isWritable: false,
isSigner: true,
},
];
if (accounts.anchorRemainingAccounts != null) {
for (const acc of accounts.anchorRemainingAccounts) {
keys.push(acc);
}
}
const ix = new web3.TransactionInstruction({
programId,
keys,
data,
});
return ix;
}