@@ -738,25 +738,6 @@ def unwrap_lamports(cls, amount: typing.Optional[int]) -> bytearray:
738738 # 2. sr The source account's owner/delegate.
739739 return pxsol .borsh .Enum .encode (0x2d ) + pxsol .borsh .Option (pxsol .borsh .U64 ).encode (amount )
740740
741- @classmethod
742- def metadata_pointer_extension_initialize (cls , auth : pxsol .core .PubKey , mint : pxsol .core .PubKey ) -> bytearray :
743- # Initialize a new mint with a metadata pointer. Account references:
744- # 0. -w the mint to initialize.
745- return pxsol .borsh .Enum .encode (0x27 ) + pxsol .borsh .Enum .encode (0x00 ) + pxsol .borsh .Struct ([
746- pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
747- pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
748- ]).encode ([auth .p , mint .p ])
749-
750- @classmethod
751- def metadata_pointer_extension_update (cls , mint : pxsol .core .PubKey ) -> bytearray :
752- # Update the metadata pointer address. Only supported for mints that include the metadata pointer extension.
753- # Account references:
754- # 0. -w the mint.
755- # 1. sr the metadata pointer authority.
756- return pxsol .borsh .Enum .encode (0x27 ) + pxsol .borsh .Enum .encode (0x01 ) + pxsol .borsh .Struct ([
757- pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
758- ]).encode ([mint .p ])
759-
760741 @classmethod
761742 def metadata_initialize (cls , name : str , symbol : str , uri : str ) -> bytearray :
762743 # Initializes a tlv entry with the basic token-metadata fields. Account references:
@@ -839,3 +820,27 @@ def metadata_emit(cls) -> bytearray:
839820 pxsol .borsh .Option (pxsol .borsh .U64 ),
840821 pxsol .borsh .Option (pxsol .borsh .U64 ),
841822 ]).encode ([discriminator , None , None ])
823+
824+
825+ class TokenExtensionMetadataPointer :
826+ # Solana spl token metadata pointer extension.
827+ # See: https://github.com/solana-program/token-2022/tree/main/interface/src/extension/metadata_pointer
828+
829+ @classmethod
830+ def initialize (cls , auth : pxsol .core .PubKey , mint : pxsol .core .PubKey ) -> bytearray :
831+ # Initialize a new mint with a metadata pointer. Account references:
832+ # 0. -w the mint to initialize.
833+ return Token .metadata_pointer_extension () + pxsol .borsh .Enum .encode (0x00 ) + pxsol .borsh .Struct ([
834+ pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
835+ pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
836+ ]).encode ([auth .p , mint .p ])
837+
838+ @classmethod
839+ def update (cls , mint : pxsol .core .PubKey ) -> bytearray :
840+ # Update the metadata pointer address. Only supported for mints that include the metadata pointer extension.
841+ # Account references:
842+ # 0. -w the mint.
843+ # 1. sr the metadata pointer authority.
844+ return Token .metadata_pointer_extension () + pxsol .borsh .Enum .encode (0x01 ) + pxsol .borsh .Struct ([
845+ pxsol .borsh .Array (pxsol .borsh .U8 , 32 ),
846+ ]).encode ([mint .p ])
0 commit comments