File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ The minor version will be incremented upon a breaking change and the patch versi
1414
1515* client: Add ` transaction ` functions to RequestBuilder ([ #1958 ] ( https://github.com/coral-xyz/anchor/pull/1958 ) ).
1616* spl: Add ` create_metadata_accounts_v3 ` and ` set_collection_size ` wrappers ([ #2119 ] ( https://github.com/coral-xyz/anchor/pull/2119 ) )
17+ * spl: Add ` MetadataAccount ` account deserialization. ([ #2014 ] ( https://github.com/coral-xyz/anchor/pull/2014 ) ).
1718
1819## [ 0.25.0] - 2022-07-05
1920
Original file line number Diff line number Diff line change @@ -266,3 +266,32 @@ pub struct SetCollectionSize<'info> {
266266 pub update_authority : AccountInfo < ' info > ,
267267 pub system_program : AccountInfo < ' info > ,
268268}
269+
270+ #[ derive( Clone , Debug , PartialEq ) ]
271+ pub struct MetadataAccount ( mpl_token_metadata:: state:: Metadata ) ;
272+
273+ impl MetadataAccount {
274+ pub const LEN : usize = mpl_token_metadata:: state:: MAX_METADATA_LEN ;
275+ }
276+
277+ impl anchor_lang:: AccountDeserialize for MetadataAccount {
278+ fn try_deserialize_unchecked ( buf : & mut & [ u8 ] ) -> anchor_lang:: Result < Self > {
279+ let result = mpl_token_metadata:: state:: Metadata :: safe_deserialize ( buf) ?;
280+ Ok ( MetadataAccount ( result) )
281+ }
282+ }
283+
284+ impl anchor_lang:: AccountSerialize for MetadataAccount { }
285+
286+ impl anchor_lang:: Owner for MetadataAccount {
287+ fn owner ( ) -> Pubkey {
288+ ID
289+ }
290+ }
291+
292+ impl Deref for MetadataAccount {
293+ type Target = mpl_token_metadata:: state:: Metadata ;
294+ fn deref ( & self ) -> & Self :: Target {
295+ & self . 0
296+ }
297+ }
You can’t perform that action at this time.
0 commit comments