@@ -37,6 +37,10 @@ export interface MintContext {
3737 cmintDecompressed : boolean ;
3838 /** PDA of the associated SPL mint */
3939 splMint : PublicKey ;
40+ /** Signer pubkey used to derive the mint PDA */
41+ mintSigner : Uint8Array ;
42+ /** Bump seed for the mint PDA */
43+ bump : number ;
4044}
4145
4246/**
@@ -95,6 +99,9 @@ export interface CompressedMint {
9599}
96100
97101/** MintContext as stored by the program */
102+ /**
103+ * Raw mint context for layout encoding (mintSigner and bump are encoded separately)
104+ */
98105export interface RawMintContext {
99106 version : number ;
100107 cmintDecompressed : number ; // bool as u8
@@ -108,9 +115,13 @@ export const MintContextLayout = struct<RawMintContext>([
108115 publicKey ( 'splMint' ) ,
109116] ) ;
110117
111- /** Byte length of MintContext */
118+ /** Byte length of MintContext (excluding mintSigner and bump which are read separately) */
112119export const MINT_CONTEXT_SIZE = MintContextLayout . span ; // 34 bytes
113120
121+ /** Additional bytes for mintSigner (32) + bump (1) */
122+ export const MINT_SIGNER_SIZE = 32 ;
123+ export const BUMP_SIZE = 1 ;
124+
114125/** Reserved bytes for T22 layout compatibility */
115126export const RESERVED_SIZE = 49 ;
116127
@@ -323,6 +334,12 @@ export function deserializeMint(data: Buffer | Uint8Array): CompressedMint {
323334 ) ;
324335 offset += MINT_CONTEXT_SIZE ;
325336
337+ // 2b. Read mintSigner (32 bytes) and bump (1 byte)
338+ const mintSigner = buffer . slice ( offset , offset + MINT_SIGNER_SIZE ) ;
339+ offset += MINT_SIGNER_SIZE ;
340+ const bump = buffer . readUInt8 ( offset ) ;
341+ offset += BUMP_SIZE ;
342+
326343 // 3. Read reserved bytes (49 bytes) for T22 compatibility
327344 const reserved = buffer . slice ( offset , offset + RESERVED_SIZE ) ;
328345 offset += RESERVED_SIZE ;
@@ -386,6 +403,8 @@ export function deserializeMint(data: Buffer | Uint8Array): CompressedMint {
386403 version : rawContext . version ,
387404 cmintDecompressed : rawContext . cmintDecompressed !== 0 ,
388405 splMint : rawContext . splMint ,
406+ mintSigner,
407+ bump,
389408 } ;
390409
391410 const mint : CompressedMint = {
@@ -487,6 +506,10 @@ export function serializeMint(mint: CompressedMint): Buffer {
487506 ) ;
488507 buffers . push ( contextBuffer ) ;
489508
509+ // 2b. Encode mintSigner (32 bytes) and bump (1 byte)
510+ buffers . push ( Buffer . from ( mint . mintContext . mintSigner ) ) ;
511+ buffers . push ( Buffer . from ( [ mint . mintContext . bump ] ) ) ;
512+
490513 // 3. Encode reserved bytes (49 bytes) - default to zeros
491514 const reserved = mint . reserved ?? new Uint8Array ( RESERVED_SIZE ) ;
492515 buffers . push ( Buffer . from ( reserved ) ) ;
@@ -663,6 +686,10 @@ export interface MintInstructionData {
663686 splMint : PublicKey ;
664687 cmintDecompressed : boolean ;
665688 version : number ;
689+ /** Signer pubkey used to derive the mint PDA */
690+ mintSigner : Uint8Array ;
691+ /** Bump seed for the mint PDA */
692+ bump : number ;
666693 metadata ?: MintMetadataField ;
667694}
668695
@@ -705,6 +732,8 @@ export function toMintInstructionData(
705732 splMint : mintContext . splMint ,
706733 cmintDecompressed : mintContext . cmintDecompressed ,
707734 version : mintContext . version ,
735+ mintSigner : mintContext . mintSigner ,
736+ bump : mintContext . bump ,
708737 metadata,
709738 } ;
710739}
0 commit comments