Skip to content

Commit

Permalink
fix option account of verify collection (#168)
Browse files Browse the repository at this point in the history
Co-authored-by: Tristan <[email protected]>
  • Loading branch information
Trisato and Trisato authored May 16, 2024
1 parent b0b5702 commit d16de8d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
8 changes: 8 additions & 0 deletions program/metaplex/token_metadata/instruction.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ type VerifyCollectionParams struct {
CollectionMint common.PublicKey
Collection common.PublicKey
CollectionMasterEditionAccount common.PublicKey
CollectionAuthorityRecord *common.PublicKey
}

func CreateVerifyCollection(param VerifyCollectionParams) types.Instruction {
Expand Down Expand Up @@ -692,6 +693,13 @@ func CreateVerifyCollection(param VerifyCollectionParams) types.Instruction {
IsSigner: false,
},
}
if param.CollectionAuthorityRecord != nil {
accounts = append(accounts, types.AccountMeta{
PubKey: *param.CollectionAuthorityRecord,
IsWritable: false,
IsSigner: false,
})
}
return types.Instruction{
ProgramID: common.MetaplexTokenMetaProgramID,
Accounts: accounts,
Expand Down
29 changes: 29 additions & 0 deletions program/metaplex/token_metadata/instruction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,35 @@ func TestCreateVerifyCollection(t *testing.T) {
Data: []byte{18},
},
},
{
args: args{
param: VerifyCollectionParams{
Metadata: common.PublicKeyFromString("MetaData11111111111111111111111111111111111"),
CollectionUpdateAuthority: common.PublicKeyFromString("CollectionUpdateAuthority111111111111111111"),
Payer: common.PublicKeyFromString("payer11111111111111111111111111111111111111"),
CollectionMint: common.PublicKeyFromString("CollectionMint11111111111111111111111111111"),
Collection: common.PublicKeyFromString("Collection111111111111111111111111111111111"),
CollectionMasterEditionAccount: common.PublicKeyFromString("CollectionMasterEditionAccount1111111111111"),
CollectionAuthorityRecord: func() *common.PublicKey {
r := common.PublicKeyFromString("CollectionAuthorityRecord111111111111111111")
return &r
}(),
},
},
want: types.Instruction{
ProgramID: common.MetaplexTokenMetaProgramID,
Accounts: []types.AccountMeta{
{PubKey: common.PublicKeyFromString("MetaData11111111111111111111111111111111111"), IsSigner: false, IsWritable: true},
{PubKey: common.PublicKeyFromString("CollectionUpdateAuthority111111111111111111"), IsSigner: true, IsWritable: true},
{PubKey: common.PublicKeyFromString("payer11111111111111111111111111111111111111"), IsSigner: true, IsWritable: true},
{PubKey: common.PublicKeyFromString("CollectionMint11111111111111111111111111111"), IsSigner: false, IsWritable: false},
{PubKey: common.PublicKeyFromString("Collection111111111111111111111111111111111"), IsSigner: false, IsWritable: false},
{PubKey: common.PublicKeyFromString("CollectionMasterEditionAccount1111111111111"), IsSigner: false, IsWritable: false},
{PubKey: common.PublicKeyFromString("CollectionAuthorityRecord111111111111111111"), IsSigner: false, IsWritable: false},
},
Data: []byte{18},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit d16de8d

Please sign in to comment.