@@ -33,6 +33,12 @@ import {
3333import { TOKEN_PROGRAM_ADDRESS } from '../programs' ;
3434import { getAccountMetaFactory , type ResolvedAccount } from '../shared' ;
3535
36+ export const BURN_CHECKED_DISCRIMINATOR = 15 ;
37+
38+ export function getBurnCheckedDiscriminatorBytes ( ) {
39+ return getU8Encoder ( ) . encode ( BURN_CHECKED_DISCRIMINATOR ) ;
40+ }
41+
3642export type BurnCheckedInstruction <
3743 TProgram extends string = typeof TOKEN_PROGRAM_ADDRESS ,
3844 TAccountAccount extends string | IAccountMeta < string > = string ,
@@ -78,7 +84,7 @@ export function getBurnCheckedInstructionDataEncoder(): Encoder<BurnCheckedInstr
7884 [ 'amount' , getU64Encoder ( ) ] ,
7985 [ 'decimals' , getU8Encoder ( ) ] ,
8086 ] ) ,
81- ( value ) => ( { ...value , discriminator : 15 } )
87+ ( value ) => ( { ...value , discriminator : BURN_CHECKED_DISCRIMINATOR } )
8288 ) ;
8389}
8490
@@ -120,10 +126,12 @@ export function getBurnCheckedInstruction<
120126 TAccountAccount extends string ,
121127 TAccountMint extends string ,
122128 TAccountAuthority extends string ,
129+ TProgramAddress extends Address = typeof TOKEN_PROGRAM_ADDRESS ,
123130> (
124- input : BurnCheckedInput < TAccountAccount , TAccountMint , TAccountAuthority >
131+ input : BurnCheckedInput < TAccountAccount , TAccountMint , TAccountAuthority > ,
132+ config ?: { programAddress ?: TProgramAddress }
125133) : BurnCheckedInstruction <
126- typeof TOKEN_PROGRAM_ADDRESS ,
134+ TProgramAddress ,
127135 TAccountAccount ,
128136 TAccountMint ,
129137 ( typeof input ) [ 'authority' ] extends TransactionSigner < TAccountAuthority >
@@ -132,7 +140,7 @@ export function getBurnCheckedInstruction<
132140 : TAccountAuthority
133141> {
134142 // Program address.
135- const programAddress = TOKEN_PROGRAM_ADDRESS ;
143+ const programAddress = config ?. programAddress ?? TOKEN_PROGRAM_ADDRESS ;
136144
137145 // Original accounts.
138146 const originalAccounts = {
@@ -170,7 +178,7 @@ export function getBurnCheckedInstruction<
170178 args as BurnCheckedInstructionDataArgs
171179 ) ,
172180 } as BurnCheckedInstruction <
173- typeof TOKEN_PROGRAM_ADDRESS ,
181+ TProgramAddress ,
174182 TAccountAccount ,
175183 TAccountMint ,
176184 ( typeof input ) [ 'authority' ] extends TransactionSigner < TAccountAuthority >
0 commit comments