8
8
9
9
import {
10
10
Context ,
11
+ Option ,
12
+ OptionOrNullable ,
11
13
Pda ,
12
14
PublicKey ,
13
15
Signer ,
@@ -17,6 +19,7 @@ import {
17
19
import {
18
20
Serializer ,
19
21
mapSerializer ,
22
+ option ,
20
23
struct ,
21
24
u8 ,
22
25
} from '@metaplex-foundation/umi/serializers' ;
@@ -25,10 +28,10 @@ import {
25
28
ResolvedAccountsWithIndices ,
26
29
getAccountMetasAndSigners ,
27
30
} from '../shared' ;
28
- import { Attribute , AttributeArgs , getAttributeSerializer } from '../types' ;
31
+ import { Plugin , PluginArgs , getPluginSerializer } from '../types' ;
29
32
30
33
// Accounts.
31
- export type ExtendCollectionAtrributesPluginV1InstructionAccounts = {
34
+ export type UpdateCollectionPluginV2InstructionAccounts = {
32
35
/** The address of the asset */
33
36
collection : PublicKey | Pda ;
34
37
/** The account paying for the storage fees */
@@ -39,50 +42,52 @@ export type ExtendCollectionAtrributesPluginV1InstructionAccounts = {
39
42
systemProgram ?: PublicKey | Pda ;
40
43
/** The SPL Noop Program */
41
44
logWrapper ?: PublicKey | Pda ;
45
+ /** Optional buffer account containing plugin data */
46
+ bufferAccount ?: PublicKey | Pda ;
42
47
} ;
43
48
44
49
// Data.
45
- export type ExtendCollectionAtrributesPluginV1InstructionData = {
50
+ export type UpdateCollectionPluginV2InstructionData = {
46
51
discriminator : number ;
47
- attribute : Attribute ;
52
+ plugin : Option < Plugin > ;
48
53
} ;
49
54
50
- export type ExtendCollectionAtrributesPluginV1InstructionDataArgs = {
51
- attribute : AttributeArgs ;
55
+ export type UpdateCollectionPluginV2InstructionDataArgs = {
56
+ plugin : OptionOrNullable < PluginArgs > ;
52
57
} ;
53
58
54
- export function getExtendCollectionAtrributesPluginV1InstructionDataSerializer ( ) : Serializer <
55
- ExtendCollectionAtrributesPluginV1InstructionDataArgs ,
56
- ExtendCollectionAtrributesPluginV1InstructionData
59
+ export function getUpdateCollectionPluginV2InstructionDataSerializer ( ) : Serializer <
60
+ UpdateCollectionPluginV2InstructionDataArgs ,
61
+ UpdateCollectionPluginV2InstructionData
57
62
> {
58
63
return mapSerializer <
59
- ExtendCollectionAtrributesPluginV1InstructionDataArgs ,
64
+ UpdateCollectionPluginV2InstructionDataArgs ,
60
65
any ,
61
- ExtendCollectionAtrributesPluginV1InstructionData
66
+ UpdateCollectionPluginV2InstructionData
62
67
> (
63
- struct < ExtendCollectionAtrributesPluginV1InstructionData > (
68
+ struct < UpdateCollectionPluginV2InstructionData > (
64
69
[
65
70
[ 'discriminator' , u8 ( ) ] ,
66
- [ 'attribute ' , getAttributeSerializer ( ) ] ,
71
+ [ 'plugin ' , option ( getPluginSerializer ( ) ) ] ,
67
72
] ,
68
- { description : 'ExtendCollectionAtrributesPluginV1InstructionData ' }
73
+ { description : 'UpdateCollectionPluginV2InstructionData ' }
69
74
) ,
70
75
( value ) => ( { ...value , discriminator : 21 } )
71
76
) as Serializer <
72
- ExtendCollectionAtrributesPluginV1InstructionDataArgs ,
73
- ExtendCollectionAtrributesPluginV1InstructionData
77
+ UpdateCollectionPluginV2InstructionDataArgs ,
78
+ UpdateCollectionPluginV2InstructionData
74
79
> ;
75
80
}
76
81
77
82
// Args.
78
- export type ExtendCollectionAtrributesPluginV1InstructionArgs =
79
- ExtendCollectionAtrributesPluginV1InstructionDataArgs ;
83
+ export type UpdateCollectionPluginV2InstructionArgs =
84
+ UpdateCollectionPluginV2InstructionDataArgs ;
80
85
81
86
// Instruction.
82
- export function extendCollectionAtrributesPluginV1 (
87
+ export function updateCollectionPluginV2 (
83
88
context : Pick < Context , 'payer' | 'programs' > ,
84
- input : ExtendCollectionAtrributesPluginV1InstructionAccounts &
85
- ExtendCollectionAtrributesPluginV1InstructionArgs
89
+ input : UpdateCollectionPluginV2InstructionAccounts &
90
+ UpdateCollectionPluginV2InstructionArgs
86
91
) : TransactionBuilder {
87
92
// Program ID.
88
93
const programId = context . programs . getPublicKey (
@@ -117,12 +122,15 @@ export function extendCollectionAtrributesPluginV1(
117
122
isWritable : false as boolean ,
118
123
value : input . logWrapper ?? null ,
119
124
} ,
125
+ bufferAccount : {
126
+ index : 5 ,
127
+ isWritable : false as boolean ,
128
+ value : input . bufferAccount ?? null ,
129
+ } ,
120
130
} satisfies ResolvedAccountsWithIndices ;
121
131
122
132
// Arguments.
123
- const resolvedArgs : ExtendCollectionAtrributesPluginV1InstructionArgs = {
124
- ...input ,
125
- } ;
133
+ const resolvedArgs : UpdateCollectionPluginV2InstructionArgs = { ...input } ;
126
134
127
135
// Default values.
128
136
if ( ! resolvedAccounts . payer . value ) {
@@ -149,10 +157,9 @@ export function extendCollectionAtrributesPluginV1(
149
157
) ;
150
158
151
159
// Data.
152
- const data =
153
- getExtendCollectionAtrributesPluginV1InstructionDataSerializer ( ) . serialize (
154
- resolvedArgs as ExtendCollectionAtrributesPluginV1InstructionDataArgs
155
- ) ;
160
+ const data = getUpdateCollectionPluginV2InstructionDataSerializer ( ) . serialize (
161
+ resolvedArgs as UpdateCollectionPluginV2InstructionDataArgs
162
+ ) ;
156
163
157
164
// Bytes Created On Chain.
158
165
const bytesCreatedOnChain = 0 ;
0 commit comments